summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test.snt15
-rw-r--r--test/test2.snt8
2 files changed, 23 insertions, 0 deletions
diff --git a/test/test.snt b/test/test.snt
new file mode 100644
index 0000000..32f1eab
--- /dev/null
+++ b/test/test.snt
@@ -0,0 +1,15 @@
+: fact_rec
+ dup 1 != if
+ dup rot * swap 1 - fact_rec
+ then
+;
+
+: fact ( recursive factorial function )
+ 1 swap fact_rec pop
+;
+
+: main
+ 1 begin
+ dup ": strcat 15 fact spacecat notify
+ 1 + dup 1000 > until
+;
diff --git a/test/test2.snt b/test/test2.snt
new file mode 100644
index 0000000..e02d7b5
--- /dev/null
+++ b/test/test2.snt
@@ -0,0 +1,8 @@
+: test
+ begin
+ 1 + dup notify
+ dup 10 > if ; then
+ repeat ;
+
+: main
+ 0 test ;