diff options
-rwxr-xr-x | runtests.sh | 5 | ||||
-rw-r--r-- | tests/lxiny-examples/arithmetic.forth | 10 | ||||
-rw-r--r-- | tests/lxiny-examples/arithmetic2.forth | 10 | ||||
-rw-r--r-- | tests/lxiny-examples/printall.forth | 5 | ||||
-rw-r--r-- | tests/lxiny-examples/stack-manipulation.forth | 12 | ||||
-rw-r--r-- | tests/lxiny-examples/stack-manipulation2.forth | 10 |
6 files changed, 52 insertions, 0 deletions
diff --git a/runtests.sh b/runtests.sh index b93a45a..766850d 100755 --- a/runtests.sh +++ b/runtests.sh @@ -37,6 +37,11 @@ for f in $dir/*.forth; do runtest "$f" done +for f in $dir/*/*.forth; do + n="$(expr "$n" + 1)" + runtest "$f" +done + if [ "0" -eq "$failed" ]; then echo "All $n tests passed" >&2 exit 0 diff --git a/tests/lxiny-examples/arithmetic.forth b/tests/lxiny-examples/arithmetic.forth new file mode 100644 index 0000000..95eee8a --- /dev/null +++ b/tests/lxiny-examples/arithmetic.forth @@ -0,0 +1,10 @@ +INPUT +6 7 * . +1360 23 - . +12 12 / . +13 2 mod . +OUTPUT +42 +1337 +1 +1 diff --git a/tests/lxiny-examples/arithmetic2.forth b/tests/lxiny-examples/arithmetic2.forth new file mode 100644 index 0000000..a2212d3 --- /dev/null +++ b/tests/lxiny-examples/arithmetic2.forth @@ -0,0 +1,10 @@ +INPUT +99 negate .k +-99 abs . +52 23 max . +52 23 min . +OUTPUT +-99 +99 +52 +23 diff --git a/tests/lxiny-examples/printall.forth b/tests/lxiny-examples/printall.forth new file mode 100644 index 0000000..578f7e3 --- /dev/null +++ b/tests/lxiny-examples/printall.forth @@ -0,0 +1,5 @@ +INPUT +5 2 3 56 76 23 65 +.s +OUTPUT +<7> 5 2 3 56 76 23 65 diff --git a/tests/lxiny-examples/stack-manipulation.forth b/tests/lxiny-examples/stack-manipulation.forth new file mode 100644 index 0000000..1192bb9 --- /dev/null +++ b/tests/lxiny-examples/stack-manipulation.forth @@ -0,0 +1,12 @@ +INPUT +3 dup .s clearstack +2 5 swap .s clearstack +6 4 5 rot .s clearstack +4 0 drop .s clearstack +1 2 3 nip .s clearstack +OUTPUT +<2> 3 3 +<2> 5 2 +<3> 4 5 6 +<1> 4 +<2> 1 3 diff --git a/tests/lxiny-examples/stack-manipulation2.forth b/tests/lxiny-examples/stack-manipulation2.forth new file mode 100644 index 0000000..a154d40 --- /dev/null +++ b/tests/lxiny-examples/stack-manipulation2.forth @@ -0,0 +1,10 @@ +INPUT +1 2 3 4 tuck .s clearstack +1 2 3 4 over .s clearstack +1 2 3 4 2 roll .s clearstack +1 2 3 4 2 pick .s clearstack +OUTPUT +<5> 1 2 4 3 4 +<5> 1 2 3 4 3 +<4> 1 3 4 2 +<5> 1 2 3 4 2 |