summaryrefslogtreecommitdiff
path: root/tests/micropython/viper_binop_comp_uint.py
blob: 85aa32c78c7339c981962955a97baeefdffd8587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 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)