From 128da74038c71ea7305141d6979dadba638b19be Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 2 Sep 2016 18:52:09 +0100 Subject: [PATCH] Add precedence tests for the modulo operator --- .../common/68 number arithmetic/meson.build | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test cases/common/68 number arithmetic/meson.build b/test cases/common/68 number arithmetic/meson.build index 9ecfc19f4..9ca447686 100644 --- a/test cases/common/68 number arithmetic/meson.build +++ b/test cases/common/68 number arithmetic/meson.build @@ -23,8 +23,22 @@ endif assert((5 % 2) == 1, 'Integer modulo (odd) is broken') assert((4 % 2) == 0, 'Integer modulo (even) is broken') -assert(2.is_even() == 1, 'int is_even() broken') -assert(2.is_odd() == 0, 'int is_odd() broken') + +if 2 * 1 % 2 != 0 + error('Modulo precendence with multiplication is broken') +endif +if 2 + 1 % 2 != 3 + error('Modulo precendence with addition is broken') +endif +if 9 / 9 % 2 != 1 + error('Modulo precendence with division is broken') +endif +if 9 - 9 % 2 != 8 + error('Modulo precendence with subtraction is broken') +endif + +assert(2.is_even(), 'int is_even() broken') +assert(not(2.is_odd()), 'int is_odd() broken') assert(3 < 4, 'Lt broken') assert(not(4 < 3), 'Lt broken')