summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-10-12 14:21:06 +0100
committerDamien George <damien.p.george@gmail.com>2014-10-12 14:21:06 +0100
commit1ef2348df0c15f9924d3b5be798fd20805ccd5aa (patch)
tree4289f7e1d42e55318c96ef44e7e6a499c1ea5a3c /tests
parent1606607bd42ce36f7d892c14b29046b7152d0fa6 (diff)
py: Implement and,or,xor native ops for viper.
Diffstat (limited to 'tests')
-rw-r--r--tests/micropython/viper_binop_arith.py22
-rw-r--r--tests/micropython/viper_binop_arith.py.exp10
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/micropython/viper_binop_arith.py b/tests/micropython/viper_binop_arith.py
index 137b8c104..d37450315 100644
--- a/tests/micropython/viper_binop_arith.py
+++ b/tests/micropython/viper_binop_arith.py
@@ -34,3 +34,25 @@ shr(1, 0)
shr(1, 3)
shr(42, 2)
shr(-42, 2)
+
+@micropython.viper
+def and_(x:int, y:int):
+ print(x & y, y & x)
+and_(1, 0)
+and_(1, 3)
+and_(0xf0, 0x3f)
+and_(-42, 6)
+
+@micropython.viper
+def or_(x:int, y:int):
+ print(x | y, y | x)
+or_(1, 0)
+or_(1, 2)
+or_(-42, 5)
+
+@micropython.viper
+def xor(x:int, y:int):
+ print(x ^ y, y ^ x)
+xor(1, 0)
+xor(1, 2)
+xor(-42, 5)
diff --git a/tests/micropython/viper_binop_arith.py.exp b/tests/micropython/viper_binop_arith.py.exp
index f10e998cd..15abcc245 100644
--- a/tests/micropython/viper_binop_arith.py.exp
+++ b/tests/micropython/viper_binop_arith.py.exp
@@ -23,3 +23,13 @@
0
10
-11
+0 0
+1 1
+48 48
+6 6
+1 1
+3 3
+-41 -41
+1 1
+3 3
+-45 -45