rpn/test/07-string.txt
2017-05-31 18:14:02 +02:00

144 lines
1.7 KiB
Text

## STRING
default
erase
# string entry
"test string"
-> stack size should be 1
-> stack should be "test string"
erase
# string entry (2)
"test string
-> stack size should be 1
-> stack should be "test string"
erase
# string entry (3)
"
-> stack size should be 1
-> stack should be ""
erase
# ->str on real (1)
1
->str
-> stack should be "1"
drop
# ->str on real (2)
1.234
25 std
->str
-> stack should be "1.234"
drop
# ->str on real (3)
1.234
20 fix
->str
-> stack should be "1.23400000000000000000"
drop
# ->str on symbol (1)
toto
->str
-> stack should be "'toto'"
drop
# ->str on symbol (2)
'toto'
->str
-> stack should be "'toto'"
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.1415926535897932385
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
# str-> on program
"<< -> n << n >> >>"
str->
-> stack should be << -> n << n >> >>
erase
# add (1)
12 34 "one" "two" +
-> stack should be 12, 34, "onetwo"
erase
# add (2)
"" "one" + "two" "" +
-> stack should be "one", "two"
erase
# add (3)
"one" +
-> stack size should be 1
-> error should be 2
erase
# chr (1)
"" 33 40 for i i chr + next
-> stack should be "!"#$%&'("
erase
# chr (2)
-223 chr 0 chr
-> stack should be "!", "."
erase
# num (1)
"!wait" num
-> stack should be 33
erase
# num (2)
"" num
-> stack should be 0
erase