aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordan <[email protected]>2023-06-03 18:31:02 -0400
committerdan <[email protected]>2023-06-03 18:31:02 -0400
commit01f5d30b7931af9c612c58c21264d7d73e5075de (patch)
treee9754076c95aee143fcdecfd8e8e920e5d4da364
parentf59e909a1adaf545dba4c77d83523eeb5063fbcb (diff)
downloadforth-01f5d30b7931af9c612c58c21264d7d73e5075de.tar.gz
forth-01f5d30b7931af9c612c58c21264d7d73e5075de.tar.bz2
forth-01f5d30b7931af9c612c58c21264d7d73e5075de.zip
tests: add do loop tests
-rw-r--r--tests/do-loop-nested.forth20
-rw-r--r--tests/do-loop.forth14
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/do-loop-nested.forth b/tests/do-loop-nested.forth
new file mode 100644
index 0000000..00cf68a
--- /dev/null
+++ b/tests/do-loop-nested.forth
@@ -0,0 +1,20 @@
+INPUT
+: timestables 5 1 do i 5 1 do dup i * . loop loop drop ;
+timestables
+OUTPUT
+1
+2
+3
+4
+2
+4
+6
+8
+3
+6
+9
+12
+4
+8
+12
+16
diff --git a/tests/do-loop.forth b/tests/do-loop.forth
new file mode 100644
index 0000000..4bf49b2
--- /dev/null
+++ b/tests/do-loop.forth
@@ -0,0 +1,14 @@
+INPUT
+: decade 10 0 do i . loop ;
+decade
+OUTPUT
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9