rpn/test/04-stack.txt

173 lines
2.4 KiB
Text
Raw Normal View History

2017-04-23 15:50:19 +02:00
## STACK TEST
# entry depth (1)
1 depth
-> stack size should be 2
2017-04-23 15:50:19 +02:00
# entry depth (2)
erase depth
-> stack should be 0
2017-04-23 15:50:19 +02:00
# swap
erase
1 2 swap
-> stack size should be 2
-> stack should be 2, 1
# swap with filled stack
erase
5 6 1 2 swap
-> stack size should be 4
-> stack should be 5, 6, 2, 1
# swap error
erase
5 swap
-> stack size should be 1
-> error should 2
2017-04-29 16:46:46 +02:00
# drop
erase
1 2 3 drop
2017-04-23 15:50:19 +02:00
-> stack size should be 2
-> stack should be 1, 2
2017-04-23 15:50:19 +02:00
2017-04-29 16:46:46 +02:00
# drop2
3
2017-04-23 15:50:19 +02:00
drop2
-> stack size should be 1
-> stack should be 1
erase
2017-04-23 15:50:19 +02:00
2017-04-29 16:46:46 +02:00
# drop error
2017-04-23 15:50:19 +02:00
drop
-> error should be 2
# drop2 error (1)
2017-04-23 15:50:19 +02:00
drop2
-> error should be 2
# drop2 error (2)
2017-04-23 15:50:19 +02:00
1 drop2
-> error should be 2
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
2017-04-29 16:46:46 +02:00
-> stack should be 1, 2, 1, 2
2017-04-23 15:50:19 +02:00
drop2 drop2
# test rot
1 2 3 rot
-> stack size should be 3
2017-05-02 17:06:08 +02:00
-> stack should be 2, 3, 1
erase
2017-04-23 15:50:19 +02:00
# test rot with start
5 6 7 1 2 start rot next
-> stack should be 7, 5, 6
erase
# test rot with next
5 6 7 1 2 for i rot next
-> stack should be 7, 5, 6
erase
# test rot with filled stack
5 6 1 2 3 rot
-> stack size should be 5
-> stack should be 5, 6, 2, 3, 1
erase
2017-04-23 15:50:19 +02:00
# test depth
2017-05-02 17:06:08 +02:00
1 2 3
2017-04-23 15:50:19 +02:00
depth
-> stack size should be 4
2017-05-02 17:06:08 +02:00
-> stack should be 1, 2, 3, 3
erase
2017-04-23 15:50:19 +02:00
# test pick
1 2 3 4 2 pick
-> stack size should be 5
2017-05-02 17:06:08 +02:00
-> stack should be 1, 2, 3, 4, 3
0 pick
-> error should be 4
7 pick
-> error should be 4
2017-04-23 15:50:19 +02:00
# test erase
erase
-> stack size should be 0
# test dropn
erase
1 2 2 dropn
-> stack size should be 0
# test dropn error
erase
1 2 3 dropn
-> stack size should be 3
-> error should be 2
# test dupn
erase
1 2 3 4 3 dupn
-> stack should be 1, 2, 3, 4, 2, 3, 4
# test dupn error
erase
1 2 3 4 5 dupn
-> stack size should be 5
-> error should be 2
# test roll
erase
1 2 3 4 5 4 roll
-> stack should be 1, 3, 4, 5, 2
# test roll with filled stack
erase
10 11 1 2 3 4 5 4 roll
-> stack should be 10, 11, 1, 3, 4, 5, 2
# test roll error
erase
1 2 3 4 5 6 roll
-> stack size should be 6
-> error should be 2
# test rolld
erase
10 20 30 40 50 3 rolld
-> stack should be 10, 20, 50, 30, 40
# test rolld with filled stack
erase
80 90 10 20 30 40 50 3 rolld
-> stack should be 80, 90, 10, 20, 50, 30, 40
# test rolld error
erase
1 2 3 4 5 6 rolld
-> stack size should be 6
-> error should be 2
# test over
erase
3.14 15.16 over
-> stack should be 3.14, 15.16, 3.14
# test over error
erase
2 over
-> stack size should be 1
-> error should be 2
erase