mirror of
https://github.com/louisrubet/rpn
synced 2024-12-30 10:23:32 +01:00
175 lines
1.8 KiB
Text
175 lines
1.8 KiB
Text
## TESTS
|
|
# and (1)
|
|
and
|
|
-> error should be 2
|
|
1 and
|
|
-> error should be 2
|
|
drop
|
|
|
|
# and (2)
|
|
0 0 and
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# and (3)
|
|
1 0 and
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# and (4)
|
|
0 1 and
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# and (5)
|
|
1 1 and
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# or (1)
|
|
or
|
|
-> error should be 2
|
|
1 or
|
|
-> error should be 2
|
|
drop
|
|
|
|
# or (2)
|
|
0 0 or
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# or (3)
|
|
0 1 or
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# or (4)
|
|
1 0 or
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# or (5)
|
|
1 1 or
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# xor (1)
|
|
xor
|
|
-> error should be 2
|
|
1 xor
|
|
-> error should be 2
|
|
drop
|
|
|
|
# xor (2)
|
|
0 0 xor
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# xor (3)
|
|
0 1 xor
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# xor (4)
|
|
1 0 xor
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# xor (5)
|
|
1 1 xor
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# not (1)
|
|
not
|
|
-> error should be 2
|
|
1 not
|
|
-> stack size should be 1
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# not (2)
|
|
0 not
|
|
-> stack size should be 1
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# >
|
|
0 0.1 >
|
|
-> stack should be 0
|
|
drop
|
|
0.1 0 >
|
|
-> stack should be 1
|
|
drop
|
|
1 1 >
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# >=
|
|
0 0.1 >=
|
|
-> stack should be 0
|
|
drop
|
|
0.1 0 >=
|
|
-> stack should be 1
|
|
drop
|
|
1 1 >=
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# <
|
|
0 0.1 <
|
|
-> stack should be 1
|
|
drop
|
|
0.1 0 <
|
|
-> stack should be 0
|
|
drop
|
|
1 1 <
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# <=
|
|
0 0.1 <=
|
|
-> stack should be 1
|
|
drop
|
|
0.1 0 <=
|
|
-> stack should be 0
|
|
drop
|
|
1 1 <=
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# !=
|
|
0 0.1 !=
|
|
-> stack should be 1
|
|
drop
|
|
1 1 !=
|
|
-> stack should be 0
|
|
drop
|
|
|
|
# ==
|
|
0 0.1 ==
|
|
-> stack should be 0
|
|
drop
|
|
1 1 ==
|
|
-> stack should be 1
|
|
drop
|
|
|
|
# same
|
|
0 0.1 same
|
|
-> stack should be 0
|
|
drop
|
|
1 1 same
|
|
-> stack should be 1
|
|
drop
|