mirror of
https://github.com/louisrubet/rpn
synced 2024-12-30 10:23:32 +01:00
225 lines
2.5 KiB
Text
225 lines
2.5 KiB
Text
## STORE
|
|
|
|
# symbol entry
|
|
'test'
|
|
-> stack size should be 1
|
|
-> stack should be 'test'
|
|
erase
|
|
|
|
# symbol entry (2)
|
|
'test
|
|
-> stack size should be 1
|
|
-> stack should be 'test'
|
|
erase
|
|
|
|
# symbol entry (3)
|
|
''
|
|
-> stack size should be 1
|
|
-> stack should be ''
|
|
erase
|
|
|
|
# symbol entry (4)
|
|
'
|
|
-> stack size should be 1
|
|
-> stack should be ''
|
|
erase
|
|
|
|
# sto (1)
|
|
1 'a' sto
|
|
-> stack size should be 0
|
|
'a' a
|
|
-> stack should be 'a', 1
|
|
erase
|
|
|
|
# sto (2)
|
|
2 'a' sto a
|
|
-> stack should be 2
|
|
erase
|
|
|
|
# sto (3)
|
|
3 'b' sto b
|
|
-> stack should be 3
|
|
erase
|
|
|
|
# rcl (1)
|
|
'a' rcl
|
|
-> stack should be 2
|
|
erase
|
|
|
|
# rcl (2)
|
|
'b' rcl
|
|
-> stack should be 3
|
|
erase
|
|
|
|
# rcl (2)
|
|
'var' rcl
|
|
-> error should be 5
|
|
-> stack should be 'var'
|
|
erase
|
|
|
|
# sto in prog then rcl
|
|
3 << 'r' sto >> eval r 'r' rcl
|
|
-> stack should be 3, 3
|
|
erase
|
|
|
|
# purge (1)
|
|
a 'a' purge a
|
|
-> stack should be 2, 'a'
|
|
erase
|
|
|
|
# purge (2)
|
|
'a' purge
|
|
-> error should be 5
|
|
-> stack size should be 0
|
|
erase
|
|
|
|
# purge (3)
|
|
3 'a' sto a 'a' purge
|
|
-> stack should be 3
|
|
erase
|
|
|
|
# sto+ (1)
|
|
8 'a' sto
|
|
2 'a' sto+
|
|
a
|
|
-> stack should be 10
|
|
erase
|
|
|
|
# sto+ (2)
|
|
2 'a' sto
|
|
'a' 2 sto+
|
|
a
|
|
-> stack should be 4
|
|
erase
|
|
|
|
# sto+ (3)
|
|
'a' sto+
|
|
-> stack size should be 1
|
|
-> error should be 2
|
|
erase
|
|
|
|
# sto+ (4)
|
|
3 'zz' sto+
|
|
-> stack should be 3, 'zz'
|
|
-> error should be 5
|
|
erase
|
|
|
|
# sto- (1)
|
|
2 'a' sto
|
|
2 'a' sto-
|
|
a
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# sto- (2)
|
|
2 'a' sto
|
|
'a' 2 sto-
|
|
a
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# sto- (3)
|
|
'a' sto-
|
|
-> stack size should be 1
|
|
-> error should be 2
|
|
erase
|
|
|
|
# sto- (4)
|
|
3 'zz' sto-
|
|
-> stack should be 3, 'zz'
|
|
-> error should be 5
|
|
erase
|
|
|
|
# sto* (1)
|
|
2 'a' sto
|
|
3 'a' sto*
|
|
a
|
|
-> stack should be 6
|
|
erase
|
|
|
|
# sto* (2)
|
|
2 'a' sto
|
|
'a' 3 sto*
|
|
a
|
|
-> stack should be 6
|
|
erase
|
|
|
|
# sto* (3)
|
|
'a' sto*
|
|
-> stack size should be 1
|
|
-> error should be 2
|
|
erase
|
|
|
|
# sto* (4)
|
|
3 'zz' sto*
|
|
-> stack should be 3, 'zz'
|
|
-> error should be 5
|
|
erase
|
|
|
|
# sto/ (1)
|
|
2 'a' sto
|
|
6 'a' sto/
|
|
a
|
|
-> stack should be 3
|
|
erase
|
|
|
|
# sto/ (2)
|
|
6 'a' sto
|
|
'a' 2 sto/
|
|
a
|
|
-> stack should be 3
|
|
erase
|
|
|
|
# sto/ (2)
|
|
'a' sto/
|
|
-> stack size should be 1
|
|
-> error should be 2
|
|
erase
|
|
|
|
# sto/ (4)
|
|
3 'zz' sto/
|
|
-> stack should be 3, 'zz'
|
|
-> error should be 5
|
|
erase
|
|
|
|
# sneg (1)
|
|
7 'a' sto
|
|
'a' sneg
|
|
a
|
|
-> stack should be -7
|
|
erase
|
|
|
|
# sneg (2)
|
|
sneg
|
|
-> error should be 2
|
|
erase
|
|
|
|
# sneg (3)
|
|
'zz' sneg
|
|
-> error should be 5
|
|
-> stack should be 'zz'
|
|
erase
|
|
|
|
# sinv (1)
|
|
4 'a' sto
|
|
'a' sinv
|
|
a
|
|
-> stack should be 0.25
|
|
erase
|
|
|
|
# sinv (2)
|
|
sinv
|
|
-> error should be 2
|
|
erase
|
|
|
|
# sinv (3)
|
|
'zz' sinv
|
|
-> error should be 5
|
|
-> stack should be 'zz'
|
|
erase
|
|
|
|
# clusr
|
|
3.14 'abc' sto clusr 'abc' rcl
|
|
-> error should be 5
|
|
-> stack should be 'abc'
|
|
erase
|