summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-06-04 14:00:29 +0000
committerDamien George <damien.p.george@gmail.com>2015-06-04 14:00:29 +0000
commit567b349c2b271c0f04add0f1beb36495835f66f8 (patch)
treeeec69f15a26a3eef7a057c8075f23bb514362d5d /tests
parent4d9cad180dbaf25cdbb9dd0c54a637483db933a7 (diff)
downloadmicropython-567b349c2b271c0f04add0f1beb36495835f66f8.tar.gz
micropython-567b349c2b271c0f04add0f1beb36495835f66f8.zip
py: Implement native multiply operation in viper emitter.
Diffstat (limited to 'tests')
-rw-r--r--tests/micropython/viper_binop_arith.py11
-rw-r--r--tests/micropython/viper_binop_arith.py.exp12
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/micropython/viper_binop_arith.py b/tests/micropython/viper_binop_arith.py
index d37450315f..4d711f1a9f 100644
--- a/tests/micropython/viper_binop_arith.py
+++ b/tests/micropython/viper_binop_arith.py
@@ -19,6 +19,17 @@ sub(-1, 2)
sub(-42, -3)
@micropython.viper
+def mul(x:int, y:int):
+ print(x * y)
+ print(y * x)
+mul(0, 1)
+mul(1, -1)
+mul(1, 2)
+mul(8, 3)
+mul(-3, 4)
+mul(-9, -6)
+
+@micropython.viper
def shl(x:int, y:int):
print(x << y)
shl(1, 0)
diff --git a/tests/micropython/viper_binop_arith.py.exp b/tests/micropython/viper_binop_arith.py.exp
index 15abcc2451..156e3aff5b 100644
--- a/tests/micropython/viper_binop_arith.py.exp
+++ b/tests/micropython/viper_binop_arith.py.exp
@@ -14,6 +14,18 @@
3
-39
39
+0
+0
+-1
+-1
+2
+2
+24
+24
+-12
+-12
+54
+54
1
8
1073741824