diff options
| author | Damien George <damien.p.george@gmail.com> | 2014-10-19 19:00:51 +0100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2014-10-19 19:00:51 +0100 |
| commit | 21ca2d76a2c10935826007daec699aba97679240 (patch) | |
| tree | 94b9012c73593c15151a0f3d1fa50d314c0a53c1 /tests/micropython | |
| parent | 9c9db3a7a1c21e575f32c964d7e6260a5a158cdb (diff) | |
py: Partially fix viper multi-comparison; add test for it.
Diffstat (limited to 'tests/micropython')
| -rw-r--r-- | tests/micropython/viper_binop_multi_comp.py | 21 | ||||
| -rw-r--r-- | tests/micropython/viper_binop_multi_comp.py.exp | 9 |
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 |
