aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordan <[email protected]>2023-05-29 10:54:33 -0400
committerdan <[email protected]>2023-05-29 10:54:33 -0400
commit8151ce5ffec4283a3bc1eeea52b8f9b17cb5d069 (patch)
tree6acc9920cc286346952d5a14a9111722dc8aaee9 /tests
parent1cc9bd9d82f970aba524ff57d9b67e9efac47ce9 (diff)
downloadforth-8151ce5ffec4283a3bc1eeea52b8f9b17cb5d069.tar.gz
forth-8151ce5ffec4283a3bc1eeea52b8f9b17cb5d069.tar.bz2
forth-8151ce5ffec4283a3bc1eeea52b8f9b17cb5d069.zip
tests: add initial tests and test runner script
Diffstat (limited to 'tests')
-rw-r--r--tests/add.forth4
-rw-r--r--tests/define-countdown.forth9
-rw-r--r--tests/define-mult.forth6
-rw-r--r--tests/simple-if.forth5
-rw-r--r--tests/simple-if2.forth4
5 files changed, 28 insertions, 0 deletions
diff --git a/tests/add.forth b/tests/add.forth
new file mode 100644
index 0000000..690bdba
--- /dev/null
+++ b/tests/add.forth
@@ -0,0 +1,4 @@
+INPUT
+1 3 + .
+OUTPUT
+4
diff --git a/tests/define-countdown.forth b/tests/define-countdown.forth
new file mode 100644
index 0000000..539b229
--- /dev/null
+++ b/tests/define-countdown.forth
@@ -0,0 +1,9 @@
+INPUT
+: countdown dup 0 = not if peek 1 - countdown then ;
+5 countdown
+OUTPUT
+5
+4
+3
+2
+1
diff --git a/tests/define-mult.forth b/tests/define-mult.forth
new file mode 100644
index 0000000..5b6f798
--- /dev/null
+++ b/tests/define-mult.forth
@@ -0,0 +1,6 @@
+INPUT
+: multrec over if rot swap over + rot 1 - swap multrec then ;
+: mult 0 multrec ;
+6 8 mult .
+OUTPUT
+48
diff --git a/tests/simple-if.forth b/tests/simple-if.forth
new file mode 100644
index 0000000..668ea0d
--- /dev/null
+++ b/tests/simple-if.forth
@@ -0,0 +1,5 @@
+INPUT
+1 1 = if 5 . then 8 .
+OUTPUT
+5
+8
diff --git a/tests/simple-if2.forth b/tests/simple-if2.forth
new file mode 100644
index 0000000..92bbc6b
--- /dev/null
+++ b/tests/simple-if2.forth
@@ -0,0 +1,4 @@
+INPUT
+0 if 5 . then 8 .
+OUTPUT
+8