mirror of
https://github.com/louisrubet/rpn
synced 2024-12-28 09:58:52 +01:00
245 lines
2.6 KiB
Text
245 lines
2.6 KiB
Text
## TESTS
|
|
default erase
|
|
|
|
# and (1)
|
|
and
|
|
-> error should be 2
|
|
1 and
|
|
-> error should be 2
|
|
erase
|
|
|
|
# and (2)
|
|
0 0 and
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# and (3)
|
|
1 0 and
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# and (4)
|
|
0 1 and
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# and (5)
|
|
1 1 and
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# or (1)
|
|
or
|
|
-> error should be 2
|
|
1 or
|
|
-> error should be 2
|
|
erase
|
|
|
|
# or (2)
|
|
0 0 or
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# or (3)
|
|
0 1 or
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# or (4)
|
|
1 0 or
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# or (5)
|
|
1 1 or
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# xor (1)
|
|
xor
|
|
-> error should be 2
|
|
1 xor
|
|
-> error should be 2
|
|
erase
|
|
|
|
# xor (2)
|
|
0 0 xor
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# xor (3)
|
|
0 1 xor
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# xor (4)
|
|
1 0 xor
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# xor (5)
|
|
1 1 xor
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# not (1)
|
|
not
|
|
-> error should be 2
|
|
1 not
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# not (2)
|
|
0 not
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# >
|
|
0 0.1 >
|
|
-> stack should be 0
|
|
erase
|
|
0.1 0 >
|
|
-> stack should be 1
|
|
erase
|
|
1 1 >
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# >=
|
|
0 0.1 >=
|
|
-> stack should be 0
|
|
erase
|
|
0.1 0 >=
|
|
-> stack should be 1
|
|
erase
|
|
1 1 >=
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# <
|
|
0 0.1 <
|
|
-> stack should be 1
|
|
erase
|
|
0.1 0 <
|
|
-> stack should be 0
|
|
erase
|
|
1 1 <
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# <=
|
|
0 0.1 <=
|
|
-> stack should be 1
|
|
erase
|
|
0.1 0 <=
|
|
-> stack should be 0
|
|
erase
|
|
1 1 <=
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# !=
|
|
0 0.1 !=
|
|
-> stack should be 1
|
|
erase
|
|
1 1 !=
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# ==
|
|
0 0.1 ==
|
|
-> stack should be 0
|
|
erase
|
|
1 1 ==
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# same
|
|
0 0.1 same
|
|
-> stack should be 0
|
|
erase
|
|
1 1 same
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# string >
|
|
"a" "b" >
|
|
-> stack should be 0
|
|
erase
|
|
"b" "a" >
|
|
-> stack should be 1
|
|
erase
|
|
"a" "a" >
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# string >=
|
|
"a" "b" >=
|
|
-> stack should be 0
|
|
erase
|
|
"b" "a" >=
|
|
-> stack should be 1
|
|
erase
|
|
"a" "a" >=
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# string <
|
|
"a" "b" <
|
|
-> stack should be 1
|
|
erase
|
|
"b" "a" <
|
|
-> stack should be 0
|
|
erase
|
|
"a" "a" <
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# string <=
|
|
"a" "b" <=
|
|
-> stack should be 1
|
|
erase
|
|
"b" "a" <=
|
|
-> stack should be 0
|
|
erase
|
|
"a" "a" <=
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# string !=
|
|
"a" "b" !=
|
|
-> stack should be 1
|
|
erase
|
|
"a" "a" !=
|
|
-> stack should be 0
|
|
erase
|
|
|
|
# string ==
|
|
"a" "b" ==
|
|
-> stack should be 0
|
|
erase
|
|
"a" "a" ==
|
|
-> stack should be 1
|
|
erase
|
|
|
|
# string same
|
|
"a" "b" same
|
|
-> stack should be 0
|
|
erase
|
|
"a" "a" same
|
|
-> stack should be 1
|
|
erase
|