mirror of
https://github.com/louisrubet/rpn
synced 2025-02-06 08:46:31 +01:00
#3: test string commands
This commit is contained in:
parent
094ce87af1
commit
0520646388
1 changed files with 48 additions and 0 deletions
|
@ -34,3 +34,51 @@ drop
|
||||||
->str
|
->str
|
||||||
-> stack should be "'toto'"
|
-> stack should be "'toto'"
|
||||||
drop
|
drop
|
||||||
|
|
||||||
|
default
|
||||||
|
|
||||||
|
# str-> on real (1)
|
||||||
|
"1"
|
||||||
|
str->
|
||||||
|
-> stack should be 1
|
||||||
|
drop
|
||||||
|
|
||||||
|
# str-> on real (2)
|
||||||
|
"1 2.345 3 4.9"
|
||||||
|
str->
|
||||||
|
-> stack should be 1, 2.345, 3, 4.9
|
||||||
|
erase
|
||||||
|
|
||||||
|
# str-> on real (3)
|
||||||
|
4 fix
|
||||||
|
"1 2.345 3 4.9"
|
||||||
|
str->
|
||||||
|
-> stack should be 1.0000, 2.3450, 3.0000, 4.9000
|
||||||
|
erase
|
||||||
|
default
|
||||||
|
|
||||||
|
# str-> on constant (1)
|
||||||
|
"pi"
|
||||||
|
str->
|
||||||
|
-> stack should be 3.141592653589793238462643
|
||||||
|
erase
|
||||||
|
|
||||||
|
# str-> on constant (2)
|
||||||
|
"'pi' 'e'"
|
||||||
|
str->
|
||||||
|
-> stack should be 'pi', 'e'
|
||||||
|
erase
|
||||||
|
|
||||||
|
# str-> on command (1)
|
||||||
|
"2 dup"
|
||||||
|
str->
|
||||||
|
-> stack should be 2, 2
|
||||||
|
erase
|
||||||
|
|
||||||
|
# str-> on command (2)
|
||||||
|
"3.14 my_pi sto"
|
||||||
|
str->
|
||||||
|
-> stack size should be 0
|
||||||
|
my_pi
|
||||||
|
-> stack should be 3.14
|
||||||
|
erase
|
||||||
|
|
Loading…
Add table
Reference in a new issue