From 5d654490bee273bcd6afe612100dafac08199218 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 23 Feb 2024 13:31:35 -0500 Subject: Add first test --- tests/arrays.nl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/arrays.nl (limited to 'tests') diff --git a/tests/arrays.nl b/tests/arrays.nl new file mode 100644 index 00000000..bbe36e42 --- /dev/null +++ b/tests/arrays.nl @@ -0,0 +1,27 @@ +>> arr := [10, 20, 30] += [10, 20, 30] + +>> arr[1] += 10 +>> arr[-1] += 30 + +sum := 0 +for x in arr + sum += x +>> sum += 60 + +str := "" +for i,x in arr + str ++= "({i},{x})" +>> str += "(1,10)(2,20)(3,30)" + +>> arr2 := [10, 20] ++ [30, 40] += [10, 20, 30, 40] + +>> arr2 ++= [50, 60] +>> arr2 += [10, 20, 30, 40, 50, 60] + -- cgit v1.2.3