rpn/test/04-branch.txt

277 lines
3.8 KiB
Text
Raw Normal View History

2017-05-15 17:18:36 +02:00
## BRANCH
# if then else end (1)
1 if then 'ok' end
-> stack should be 'ok'
erase
# if then else end (2)
1 if 'before' then 'ok' end
-> stack should be 'before', 'ok'
erase
# if then else end (3)
0 if then 'ok' end
-> stack size should be 0
erase
# if then else end (4)
0 if then 'ok' end
-> stack size should be 0
erase
# if then else end (5)
1 if then 'ok' else 'KO' end
-> stack should be 'ok'
erase
# if then else end (6)
1 if then 'ok' 'dokey' else 'KO' end
-> stack should be 'ok', 'dokey'
erase
# if then else end (7)
0 if then 'ok' else 'KO' end
-> stack should be 'KO'
erase
2017-05-20 22:35:19 +02:00
# if then else end - error case (1)
if then end
-> error should be 2
2017-05-20 22:51:10 +02:00
erase
2017-05-20 22:35:19 +02:00
# if then else end - error case (2)
0 if then
-> error should be 11
2017-05-20 22:51:10 +02:00
erase
2017-05-20 22:35:19 +02:00
# if then else end - error case (3)
0 if end
-> error should be 11
2017-05-20 22:51:10 +02:00
erase
2017-05-20 22:35:19 +02:00
# if then else end - error case (4)
0 if end
-> error should be 11
2017-05-20 22:51:10 +02:00
erase
2017-05-20 22:35:19 +02:00
# if then else end - error case (5)
then
-> error should be 11
2017-05-20 22:51:10 +02:00
erase
2017-05-20 22:35:19 +02:00
# if then else end - error case (6)
1 if
-> error should be 11
2017-05-20 22:51:10 +02:00
erase
2017-05-20 22:35:19 +02:00
# if then else end - error case (7)
else
-> error should be 11
2017-05-20 22:51:10 +02:00
erase
2017-05-20 22:35:19 +02:00
# if then else end - error case (8)
end
-> error should be 11
2017-05-20 22:51:10 +02:00
erase
# if then else end - error case (9)
"1" if then end
-> error should be 3
erase
2017-06-01 15:39:21 +02:00
# ift (1)
1 'ok' ift
-> stack should be 'ok'
erase
# ift (2)
0 'ok' ift
-> stack size should be 0
erase
# ift (3)
'ok' ift
-> error should be 2
-> stack size should be 1
erase
# ift (4)
ift
-> error should be 2
-> stack size should be 0
erase
# ifte (1)
1 'ok' 'nok' ifte
-> stack should be 'ok'
erase
# ifte (2)
0 'ok' 'nok' ifte
-> stack should be 'nok'
erase
# ifte (3)
'ok' 'nok' ifte
-> error should be 2
-> stack size should be 2
erase
# ifte (4)
'nok' ifte
-> error should be 2
-> stack size should be 1
erase
# ifte (5)
ifte
-> error should be 2
-> stack size should be 0
erase
2017-05-20 22:35:19 +02:00
2017-05-15 17:18:36 +02:00
# start next (1)
1 2 start 0 next
-> stack should be 0, 0
erase
# start next (2)
2 1 start 0 next
-> stack size should be 0
erase
2017-05-17 18:14:33 +02:00
2017-05-19 14:12:48 +02:00
# start next (3)
-2 -1 start 0 next
-> stack should be 0, 0
erase
# start next (4)
-1 -2 start 0 next
-> stack size should be 0
erase
# start next (5)
1 1 start 0 next
-> stack should be 0
erase
2017-05-20 22:51:10 +02:00
# start next - error case (1)
1 start next
->error should be 2
erase
# start next - error case (2)
start next
->error should be 2
erase
# start next - error case (3)
start
->error should be 11
erase
# start next - error case (4)
next
->error should be 11
erase
# start next - error case (5)
"1" 2 start next
->error should be 3
erase
# start next - error case (5)
1 "2" start next
->error should be 3
erase
2017-05-17 18:14:33 +02:00
# for next (1)
23 27 for i i next
-> stack should be 23, 24, 25, 26, 27
erase
# for next (2)
2017-05-19 14:12:48 +02:00
1 1 for i i next
-> stack should be 1
erase
# for next (3)
2017-05-17 18:14:33 +02:00
27 23 for i i next
-> stack size should be 0
erase
2017-05-19 14:12:48 +02:00
# for next (4)
-2 -1 for i i next
-> stack should be -2, -1
erase
# for next (5)
-1 -2 for i i next
-> stack size should be 0
erase
2017-05-20 22:51:10 +02:00
# for next - error case (1)
1 for i i next
-> error should be 2
erase
# for next - error case (2)
for i i next
-> error should be 2
erase
# for next - error case (3)
"1" 2 for i i next
-> error should be 3
erase
# for next - error case (4)
1 "2" for i i next
-> error should be 3
erase
# for next - error case (5)
1 2 for i i
-> error should be 11
erase
# for next - error case (6)
for
-> error should be 11
erase
2017-05-19 14:12:48 +02:00
# for step (1)
2017-05-20 22:35:19 +02:00
23 27 for i i 1 step
2017-05-19 14:12:48 +02:00
-> stack should be 23, 24, 25, 26, 27
erase
# for step (2)
0 1 for i i 0.25 step
-> stack should be 0, 0.25, 0.5, 0.75, 1
erase
# for step (3)
-1 0 for i i 0.25 step
-> stack should be -1, -0.75, -0.5, -0.25, 0
erase
# for step (4)
0 -1 for i i 0.25 step
-> stack size should be 0
erase
# for step (5)
0 -1 for i i -0.25 step
2017-05-20 22:35:19 +02:00
-> stack size should be 0
2017-05-19 14:12:48 +02:00
erase
2017-05-20 22:51:10 +02:00
# for step - error case (1)
0 1 for i i "0.5" step
-> error should be 3
erase
# for step - error case (2)
step
-> error should be 11
erase