diff --git a/tests/recursion.qbl b/tests/recursion.qbl new file mode 100644 index 0000000..c3ee8a3 --- /dev/null +++ b/tests/recursion.qbl @@ -0,0 +1,13 @@ +function int int int => int fibonacci +{ + dup if + { + req deq deq + } + else + { + 1 dup + - swp fibonacci + } +} + +20 1 0 fibonacci print \ No newline at end of file diff --git a/tests/req_impl.qbl b/tests/req_impl.qbl new file mode 100644 index 0000000..2788564 --- /dev/null +++ b/tests/req_impl.qbl @@ -0,0 +1,7 @@ +function int int => int int req_impl +{ + dup deq +} + +1 2 3 req_impl print print print +1 2 3 req print print print \ No newline at end of file diff --git a/tests/test.qbl b/tests/test.qbl index c2db338..2b46b96 100644 --- a/tests/test.qbl +++ b/tests/test.qbl @@ -27,11 +27,20 @@ function int => str check } } +// 3 +// 3 3 +// 3 +// 3 1 +// 2 +// 2 "test" +// "test" 2 + function int => whileFunction { + dup while { - 1 - "test" req print + 1 - "test" req print dup } deq } diff --git a/tests/while.qbl b/tests/while.qbl new file mode 100644 index 0000000..4644066 --- /dev/null +++ b/tests/while.qbl @@ -0,0 +1,12 @@ +//valid,output:10987654321 + +12 while +{ + 0 +} + +10 dup while +{ + dup print 1 - dup +} +deq \ No newline at end of file