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