diff --git a/nac3standalone/demo/src/tuple.py b/nac3standalone/demo/src/tuple.py index 6947171d9..988739f70 100644 --- a/nac3standalone/demo/src/tuple.py +++ b/nac3standalone/demo/src/tuple.py @@ -1,3 +1,7 @@ +@extern +def output_bool(b: bool): + ... + @extern def output_int32_list(x: list[int32]): ... @@ -13,6 +17,41 @@ class A: self.a = a self.b = b + +def test_tuple_eq(): + # 0-len + output_bool(() == ()) + # 1-len + output_bool((1,) == ()) + output_bool(() == (1,)) + output_bool((1,) == (1,)) + output_bool((1,) == (2,)) + # # 2-len + output_bool((1, 2) == ()) + output_bool(() == (1, 2)) + output_bool((1,) == (1, 2)) + output_bool((1, 2) == (1,)) + output_bool((2, 2) == (1, 2)) + output_bool((1, 2) == (2, 2)) + + +def test_tuple_ne(): + # 0-len + output_bool(() != ()) + # 1-len + output_bool((1,) != ()) + output_bool(() != (1,)) + output_bool((1,) != (1,)) + output_bool((1,) != (2,)) + # 2-len + output_bool((1, 2) != ()) + output_bool(() != (1, 2)) + output_bool((1,) != (1, 2)) + output_bool((1, 2) != (1,)) + output_bool((2, 2) != (1, 2)) + output_bool((1, 2) != (2, 2)) + + def run() -> int32: data = [0, 1, 2, 3] @@ -33,4 +72,7 @@ def run() -> int32: output_int32(len((1, 2, 3, 4))) output_int32(len((1, 2, 3, 4, 5))) + test_tuple_eq() + test_tuple_ne() + return 0 \ No newline at end of file