summaryrefslogtreecommitdiff
path: root/tests/micropython/viper_binop_comp.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/micropython/viper_binop_comp.py')
-rw-r--r--tests/micropython/viper_binop_comp.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/micropython/viper_binop_comp.py b/tests/micropython/viper_binop_comp.py
new file mode 100644
index 000000000..dcf91ed89
--- /dev/null
+++ b/tests/micropython/viper_binop_comp.py
@@ -0,0 +1,21 @@
+# test comparison operators
+@micropython.viper
+def f(x:int, y:int):
+ if x < y:
+ print(x, "<", y)
+ if x > y:
+ print(x, ">", y)
+ if x == y:
+ print(x, "==", y)
+ if x <= y:
+ print(x, "<=", y)
+ if x >= y:
+ print(x, ">=", y)
+ if x != y:
+ print(x, "!=", y)
+
+f(1, 1)
+f(2, 1)
+f(1, 2)
+f(2, -1)
+f(-2, 1)