diff options
author | Damien George <damien.p.george@gmail.com> | 2014-09-29 19:40:20 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-09-29 19:42:06 +0100 |
commit | 44c96b2314f5519643f5c8baa1c05f4f5ce6ff7c (patch) | |
tree | 7b7baa7f1eab35dca0227ace0f1b196a0c13bcbb /tests/micropython/viper_binop_arith.py | |
parent | 3112cde9006809a1ffa7f19e96fa8ee28311f411 (diff) |
tests: Add tests for viper binary operations.
Diffstat (limited to 'tests/micropython/viper_binop_arith.py')
-rw-r--r-- | tests/micropython/viper_binop_arith.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/micropython/viper_binop_arith.py b/tests/micropython/viper_binop_arith.py new file mode 100644 index 000000000..137b8c104 --- /dev/null +++ b/tests/micropython/viper_binop_arith.py @@ -0,0 +1,36 @@ +# test arithmetic operators + +@micropython.viper +def add(x:int, y:int): + print(x + y) + print(y + x) +add(1, 2) +add(42, 3) +add(-1, 2) +add(-42, -3) + +@micropython.viper +def sub(x:int, y:int): + print(x - y) + print(y - x) +sub(1, 2) +sub(42, 3) +sub(-1, 2) +sub(-42, -3) + +@micropython.viper +def shl(x:int, y:int): + print(x << y) +shl(1, 0) +shl(1, 3) +shl(1, 30) +shl(42, 10) +shl(-42, 10) + +@micropython.viper +def shr(x:int, y:int): + print(x >> y) +shr(1, 0) +shr(1, 3) +shr(42, 2) +shr(-42, 2) |