summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-06-30 21:37:14 +0100
committerubq323 <ubq323@ubq323.website>2024-06-30 21:37:14 +0100
commit4cf1e1fa0e11307005a724225ea3ae2f80a5c037 (patch)
tree600c6ddc587f011f10a125e6dd31eb07ca8137b7 /tests
parent83382cb1b46eb17f94f16fbbf05b5e471284d797 (diff)
add array index setting syntax
Diffstat (limited to 'tests')
-rw-r--r--tests/arr6.bth4
-rw-r--r--tests/arr6.out2
-rw-r--r--tests/arr7.bth4
-rw-r--r--tests/arr7.out2
-rw-r--r--tests/arr8.bth3
-rw-r--r--tests/arr8.out1
-rw-r--r--tests/sumrec.bth2
-rw-r--r--tests/sumrec.out2
8 files changed, 18 insertions, 2 deletions
diff --git a/tests/arr6.bth b/tests/arr6.bth
new file mode 100644
index 0000000..e814db4
--- /dev/null
+++ b/tests/arr6.bth
@@ -0,0 +1,4 @@
+(let (a [10 20 30])
+ (say a)
+ (set (a 1) 50)
+ (say a))
diff --git a/tests/arr6.out b/tests/arr6.out
new file mode 100644
index 0000000..e80d1c2
--- /dev/null
+++ b/tests/arr6.out
@@ -0,0 +1,2 @@
+[ 10 20 30 ]
+[ 10 50 30 ]
diff --git a/tests/arr7.bth b/tests/arr7.bth
new file mode 100644
index 0000000..7b9a784
--- /dev/null
+++ b/tests/arr7.bth
@@ -0,0 +1,4 @@
+(let (a [10 20 30])
+ (say a)
+ (set (a 3) 40)
+ (say a))
diff --git a/tests/arr7.out b/tests/arr7.out
new file mode 100644
index 0000000..7d6d4b2
--- /dev/null
+++ b/tests/arr7.out
@@ -0,0 +1,2 @@
+[ 10 20 30 ]
+[ 10 20 30 40 ]
diff --git a/tests/arr8.bth b/tests/arr8.bth
new file mode 100644
index 0000000..8f41f0c
--- /dev/null
+++ b/tests/arr8.bth
@@ -0,0 +1,3 @@
+(let (a [10 20 30])
+ (set (a 1) 50)
+ (let (x 100 y 200 z 300) (say y)))
diff --git a/tests/arr8.out b/tests/arr8.out
new file mode 100644
index 0000000..08839f6
--- /dev/null
+++ b/tests/arr8.out
@@ -0,0 +1 @@
+200
diff --git a/tests/sumrec.bth b/tests/sumrec.bth
index 8c8804a..0bbf2b6 100644
--- a/tests/sumrec.bth
+++ b/tests/sumrec.bth
@@ -4,4 +4,4 @@
(f' (- x 1) (+ acc x)))))
(set f (fn (x) (f' x 0)))
(say (f 10))
-(say (f 100))
+(say (f 1000))
diff --git a/tests/sumrec.out b/tests/sumrec.out
index e613215..2a5dbfe 100644
--- a/tests/sumrec.out
+++ b/tests/sumrec.out
@@ -1,2 +1,2 @@
55
-5050
+500500