circuitpython/tests/micropython/viper_binop_comp_uint.py
Damien George 41fa8b5482 py/emitnative: Implement binary operations for viper uint operands.
uint types in viper mode can now be used for all binary operators except
floor-divide and modulo.

Fixes issue #1847 and issue #6177.

Signed-off-by: Damien George <damien@micropython.org>
2020-06-27 00:24:04 +10:00

32 lines
487 B
Python

# test comparison operators with uint type
@micropython.viper
def f(x: uint, y: uint):
if x < y:
print(" <", end="")
if x > y:
print(" >", end="")
if x == y:
print(" ==", end="")
if x <= y:
print(" <=", end="")
if x >= y:
print(" >=", end="")
if x != y:
print(" !=", end="")
def test(a, b):
print(a, b, end="")
f(a, b)
print()
test(1, 1)
test(2, 1)
test(1, 2)
test(2, -1)
test(-2, 1)
test(-2, -1)