mirror of
https://github.com/louisrubet/rpn
synced 2024-12-30 10:23:32 +01:00
84 lines
1.1 KiB
Text
84 lines
1.1 KiB
Text
|
## STACK TEST
|
||
|
# test entry 1
|
||
|
1
|
||
|
-> stack size should be 1
|
||
|
|
||
|
# test entry 2
|
||
|
2 3
|
||
|
-> stack size should be 3
|
||
|
-> stack should be 3, 2, 1
|
||
|
|
||
|
# test drop
|
||
|
drop
|
||
|
-> stack size should be 2
|
||
|
|
||
|
# test drop2
|
||
|
drop2
|
||
|
-> stack size should be 0
|
||
|
|
||
|
# test drop error
|
||
|
drop
|
||
|
-> error should be 2
|
||
|
|
||
|
# test drop2 error
|
||
|
drop2
|
||
|
-> error should be 2
|
||
|
|
||
|
# test drop2 error
|
||
|
1 drop2
|
||
|
-> error should be 2
|
||
|
drop
|
||
|
|
||
|
# test symbol entry 1
|
||
|
1 '2'
|
||
|
-> stack size should be 2
|
||
|
-> stack should be '2', 1
|
||
|
drop2
|
||
|
|
||
|
# test symbol entry 2
|
||
|
1 '2
|
||
|
-> stack size should be 2
|
||
|
-> stack should be '2', 1
|
||
|
drop2
|
||
|
|
||
|
# test symbol entry 3
|
||
|
''
|
||
|
-> stack should be ''
|
||
|
drop
|
||
|
|
||
|
# test symbol entry 4
|
||
|
'
|
||
|
-> stack should be ''
|
||
|
drop
|
||
|
|
||
|
# test dup
|
||
|
1 dup
|
||
|
-> stack size should be 2
|
||
|
-> stack should be 1, 1
|
||
|
|
||
|
# test dup2
|
||
|
drop 2 dup2
|
||
|
-> stack size should be 4
|
||
|
-> stack should be 2, 1, 2, 1
|
||
|
drop2 drop2
|
||
|
|
||
|
# test rot
|
||
|
1 2 3 rot
|
||
|
-> stack size should be 3
|
||
|
-> stack should be 1, 3, 2
|
||
|
|
||
|
# test depth
|
||
|
depth
|
||
|
-> stack size should be 4
|
||
|
-> stack should be 3, 1, 3, 2
|
||
|
drop2 drop2
|
||
|
|
||
|
# test pick
|
||
|
1 2 3 4 2 pick
|
||
|
-> stack size should be 5
|
||
|
-> stack should be 3, 4, 3, 2, 1
|
||
|
|
||
|
# test erase
|
||
|
erase
|
||
|
-> stack size should be 0
|