From ba32fab374c303a93b69c5f886d765a63782feb0 Mon Sep 17 00:00:00 2001 From: David Mak Date: Wed, 3 Jul 2024 15:19:44 +0800 Subject: [PATCH] standalone: Add demos for list arithmetic operators --- nac3standalone/demo/src/lists.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/nac3standalone/demo/src/lists.py b/nac3standalone/demo/src/lists.py index f05701bf..470c00dc 100644 --- a/nac3standalone/demo/src/lists.py +++ b/nac3standalone/demo/src/lists.py @@ -1,3 +1,7 @@ +@extern +def output_bool(x: bool): + ... + @extern def output_int32_list(x: list[int32]): ... @@ -30,6 +34,32 @@ def run() -> int32: get_list_slice() list_slice_assignment() + + output_int32_list([1, 2, 3] + [4, 5, 6]) + output_int32_list([1, 2, 3] * 3) + output_bool([] == []) + output_bool([0] == []) + output_bool([0] == [0]) + output_bool([0, 1] == [0]) + output_bool([0, 1] == [0, 1]) + output_bool([] != []) + output_bool([0] != []) + output_bool([0] != [0]) + output_bool([0] != [0, 1]) + output_bool([0, 1] != [0, 1]) + output_bool([] == [] == []) + output_bool([0] == [0] == [0]) + output_bool([0, 1] == [0] == [0, 1]) + output_bool([0, 1] == [0, 1] == [0]) + output_bool([0] == [0, 1] == [0, 1]) + output_bool([0, 1] == [0, 1] == [0, 1]) + output_bool([] != [] != []) + output_bool([0] != [0] != [0]) + output_bool([0, 1] != [0] != [0, 1]) + output_bool([0, 1] != [0, 1] != [0]) + output_bool([0] != [0, 1] != [0, 1]) + output_bool([0, 1] != [0, 1] != [0, 1]) + return 0 def get_list_slice():