From 6b2ff65735bb8229af9994db8221303b73a8194b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 8 Mar 2021 00:18:31 +0100 Subject: add tests --- progs/tests/tuples.sy | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 progs/tests/tuples.sy (limited to 'progs/tests/tuples.sy') diff --git a/progs/tests/tuples.sy b/progs/tests/tuples.sy new file mode 100644 index 0000000..74f2701 --- /dev/null +++ b/progs/tests/tuples.sy @@ -0,0 +1,12 @@ +start :: fn { + a := (1,2) + a[0] <=> 1 + a[1] <=> 2 + + b := (1,) + b[0] <=> 1 + + empty := () + c := (empty,) + c[0] <=> () +} -- cgit v1.2.1 From c2eddfeb7f0733b8676ddb22636f1054ae141b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20Th=C3=B6rnros?= Date: Mon, 8 Mar 2021 17:18:58 +0100 Subject: add more tests to tuples --- progs/tests/tuples.sy | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'progs/tests/tuples.sy') diff --git a/progs/tests/tuples.sy b/progs/tests/tuples.sy index 74f2701..51f0b37 100644 --- a/progs/tests/tuples.sy +++ b/progs/tests/tuples.sy @@ -9,4 +9,15 @@ start :: fn { empty := () c := (empty,) c[0] <=> () + + a := (1,2) + a[0] <=> a[1] + + { + q := a[0] + w := a[0] + q + w + q - w + q * w + } } -- cgit v1.2.1 From 39e47cc62ca5372fcac20aceb94a200419281a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20Th=C3=B6rnros?= Date: Mon, 8 Mar 2021 17:46:06 +0100 Subject: fix the tests --- progs/tests/tuples.sy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'progs/tests/tuples.sy') diff --git a/progs/tests/tuples.sy b/progs/tests/tuples.sy index 51f0b37..f2fcfcb 100644 --- a/progs/tests/tuples.sy +++ b/progs/tests/tuples.sy @@ -10,12 +10,12 @@ start :: fn { c := (empty,) c[0] <=> () - a := (1,2) - a[0] <=> a[1] + d := (1,2) + d[0] <=> d[0] { - q := a[0] - w := a[0] + q := d[0] + w := d[0] q + w q - w q * w -- cgit v1.2.1 From 16ba42c52bbf57fa78217327bd9759fec9f09fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 8 Mar 2021 17:58:34 +0100 Subject: parse indexing precedence --- progs/tests/tuples.sy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'progs/tests/tuples.sy') diff --git a/progs/tests/tuples.sy b/progs/tests/tuples.sy index f2fcfcb..642e381 100644 --- a/progs/tests/tuples.sy +++ b/progs/tests/tuples.sy @@ -14,7 +14,8 @@ start :: fn { d[0] <=> d[0] { - q := d[0] + q := d[2-2] + d[d[(5 + 3) * 0]] <=> d[d[(5 + 3) * 0]] w := d[0] q + w q - w -- cgit v1.2.1