diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2016-09-02 18:52:09 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2016-09-02 18:52:45 +0100 |
commit | 128da74038c71ea7305141d6979dadba638b19be (patch) | |
tree | befd852abb6c5dfdada3c6c2c914c1c9acce9001 | |
parent | 2dd1ec6f8c82dc9a2d97c246664e92246a5af95b (diff) | |
download | meson-128da74038c71ea7305141d6979dadba638b19be.zip meson-128da74038c71ea7305141d6979dadba638b19be.tar.gz meson-128da74038c71ea7305141d6979dadba638b19be.tar.bz2 |
Add precedence tests for the modulo operator
-rw-r--r-- | test cases/common/68 number arithmetic/meson.build | 18 |
1 files 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 9ecfc19..9ca4476 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') |