summaryrefslogtreecommitdiff
path: root/tests/micropython/viper_binop_comp_uint.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/micropython/viper_binop_comp_uint.py')
-rw-r--r--tests/micropython/viper_binop_comp_uint.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/micropython/viper_binop_comp_uint.py b/tests/micropython/viper_binop_comp_uint.py
new file mode 100644
index 000000000..85aa32c78
--- /dev/null
+++ b/tests/micropython/viper_binop_comp_uint.py
@@ -0,0 +1,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)