Add precedence tests for the modulo operator

pull/750/head
Emmanuele Bassi 9 years ago
parent 2dd1ec6f8c
commit 128da74038
  1. 18
      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')

Loading…
Cancel
Save