Add and update tests

This commit is contained in:
0x4261756D 2022-12-14 11:46:47 +01:00
parent c2800dfcc7
commit 2a560cfcef
4 changed files with 42 additions and 1 deletions

13
tests/recursion.qbl Normal file
View File

@ -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

7
tests/req_impl.qbl Normal file
View File

@ -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

View File

@ -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
}

12
tests/while.qbl Normal file
View File

@ -0,0 +1,12 @@
//valid,output:10987654321
12 while
{
0
}
10 dup while
{
dup print 1 - dup
}
deq