summaryrefslogtreecommitdiff
path: root/tests/micropython/viper_binop_comp.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-09-29 19:40:20 +0100
committerDamien George <damien.p.george@gmail.com>2014-09-29 19:42:06 +0100
commit44c96b2314f5519643f5c8baa1c05f4f5ce6ff7c (patch)
tree7b7baa7f1eab35dca0227ace0f1b196a0c13bcbb /tests/micropython/viper_binop_comp.py
parent3112cde9006809a1ffa7f19e96fa8ee28311f411 (diff)
tests: Add tests for viper binary operations.
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)