41fa8b5482
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>
32 lines
487 B
Python
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)
|