rpn/test/07-test.txt

244 lines
2.6 KiB
Text
Raw Normal View History

2017-05-13 12:46:42 +02:00
## TESTS
# and (1)
2014-09-05 15:45:11 +02:00
and
-> error should be 2
1 and
-> error should be 2
drop
2017-05-13 12:46:42 +02:00
# and (2)
2014-09-05 15:45:11 +02:00
0 0 and
-> stack size should be 1
-> stack should be 0
drop
2017-05-13 12:46:42 +02:00
# and (3)
2014-09-05 15:45:11 +02:00
1 0 and
-> stack size should be 1
-> stack should be 0
drop
2017-05-13 12:46:42 +02:00
# and (4)
2014-09-05 15:45:11 +02:00
0 1 and
-> stack size should be 1
-> stack should be 0
drop
2017-05-13 12:46:42 +02:00
# and (5)
2014-09-05 15:45:11 +02:00
1 1 and
-> stack size should be 1
-> stack should be 1
drop
2017-05-13 12:46:42 +02:00
# or (1)
2014-09-05 15:45:11 +02:00
or
-> error should be 2
1 or
-> error should be 2
drop
2017-05-13 12:46:42 +02:00
# or (2)
2014-09-05 15:45:11 +02:00
0 0 or
-> stack size should be 1
-> stack should be 0
drop
2017-05-13 12:46:42 +02:00
# or (3)
2014-09-05 15:45:11 +02:00
0 1 or
-> stack size should be 1
-> stack should be 1
drop
2017-05-13 12:46:42 +02:00
# or (4)
2014-09-05 15:45:11 +02:00
1 0 or
-> stack size should be 1
-> stack should be 1
drop
2017-05-13 12:46:42 +02:00
# or (5)
2014-09-05 15:45:11 +02:00
1 1 or
-> stack size should be 1
-> stack should be 1
drop
2017-05-13 12:46:42 +02:00
# xor (1)
2014-09-05 15:45:11 +02:00
xor
-> error should be 2
1 xor
-> error should be 2
drop
2017-05-13 12:46:42 +02:00
# xor (2)
2014-09-05 15:45:11 +02:00
0 0 xor
-> stack size should be 1
-> stack should be 0
drop
2017-05-13 12:46:42 +02:00
# xor (3)
2014-09-05 15:45:11 +02:00
0 1 xor
-> stack size should be 1
-> stack should be 1
drop
2017-05-13 12:46:42 +02:00
# xor (4)
2014-09-05 15:45:11 +02:00
1 0 xor
-> stack size should be 1
-> stack should be 1
drop
2017-05-13 12:46:42 +02:00
# xor (5)
2014-09-05 15:45:11 +02:00
1 1 xor
-> stack size should be 1
-> stack should be 0
drop
2017-05-13 12:46:42 +02:00
# not (1)
not
-> error should be 2
1 not
2014-01-03 23:45:07 +01:00
-> stack size should be 1
2017-05-13 12:46:42 +02:00
-> stack should be 0
2014-01-03 23:45:07 +01:00
drop
2017-05-13 12:46:42 +02:00
# not (2)
0 not
2014-01-03 23:45:07 +01:00
-> stack size should be 1
2017-05-13 12:46:42 +02:00
-> stack should be 1
2014-01-03 23:45:07 +01:00
drop
2017-05-13 12:46:42 +02:00
# >
0 0.1 >
2014-01-03 23:45:07 +01:00
-> stack should be 0
drop
2017-05-13 12:46:42 +02:00
0.1 0 >
-> stack should be 1
2014-01-03 23:45:07 +01:00
drop
2017-05-13 12:46:42 +02:00
1 1 >
2014-01-03 23:45:07 +01:00
-> stack should be 0
drop
2017-05-13 12:46:42 +02:00
# >=
0 0.1 >=
-> stack should be 0
2014-01-03 23:45:07 +01:00
drop
2017-05-13 12:46:42 +02:00
0.1 0 >=
-> stack should be 1
2014-01-03 23:45:07 +01:00
drop
2017-05-13 12:46:42 +02:00
1 1 >=
-> stack should be 1
2014-01-03 23:45:07 +01:00
drop
2017-05-13 12:46:42 +02:00
# <
0 0.1 <
2014-01-03 23:45:07 +01:00
-> stack should be 1
drop
2017-05-13 12:46:42 +02:00
0.1 0 <
-> stack should be 0
drop
1 1 <
-> stack should be 0
drop
2014-01-03 23:45:07 +01:00
2017-05-13 12:46:42 +02:00
# <=
0 0.1 <=
-> stack should be 1
drop
0.1 0 <=
-> stack should be 0
drop
1 1 <=
-> stack should be 1
2014-01-03 23:45:07 +01:00
drop
2017-05-13 12:46:42 +02:00
# !=
0 0.1 !=
-> stack should be 1
drop
1 1 !=
-> stack should be 0
2014-01-03 23:45:07 +01:00
drop
2017-05-13 12:46:42 +02:00
# ==
0 0.1 ==
-> stack should be 0
drop
1 1 ==
-> stack should be 1
drop
2014-01-03 23:45:07 +01:00
2017-05-13 12:46:42 +02:00
# same
0 0.1 same
-> stack should be 0
drop
1 1 same
-> stack should be 1
2014-01-03 23:45:07 +01:00
drop
# string >
"a" "b" >
-> stack should be 0
drop
"b" "a" >
-> stack should be 1
drop
"a" "a" >
-> stack should be 0
drop
# string >=
"a" "b" >=
-> stack should be 0
drop
"b" "a" >=
-> stack should be 1
drop
"a" "a" >=
-> stack should be 1
drop
# string <
"a" "b" <
-> stack should be 1
drop
"b" "a" <
-> stack should be 0
drop
"a" "a" <
-> stack should be 0
drop
# string <=
"a" "b" <=
-> stack should be 1
drop
"b" "a" <=
-> stack should be 0
drop
"a" "a" <=
-> stack should be 1
drop
# string !=
"a" "b" !=
-> stack should be 1
drop
"a" "a" !=
-> stack should be 0
drop
# string ==
"a" "b" ==
-> stack should be 0
drop
"a" "a" ==
-> stack should be 1
drop
# string same
"a" "b" same
-> stack should be 0
drop
"a" "a" same
-> stack should be 1
drop