factor/library/test/interpreter.factor

58 lines
983 B
Factor
Raw Normal View History

2004-11-09 22:22:25 -05:00
IN: scratchpad
USE: interpreter
USE: test
USE: namespaces
2004-11-21 19:27:18 -05:00
USE: stdio
USE: prettyprint
2004-11-09 22:22:25 -05:00
USE: math
USE: math-internals
2004-11-09 22:22:25 -05:00
USE: lists
USE: kernel
2004-11-26 22:23:57 -05:00
: test-interpreter
init-interpreter run meta-d get ;
2004-11-09 22:22:25 -05:00
[ { 1 2 3 } ] [
2004-11-26 22:23:57 -05:00
[ 1 2 3 ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
[ { "Yo" 2 } ] [
2004-11-26 22:23:57 -05:00
[ 2 >r "Yo" r> ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
[ { 2 } ] [
2004-11-26 22:23:57 -05:00
[ t [ 2 ] [ "hi" ] ifte ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
[ { "hi" } ] [
2004-11-26 22:23:57 -05:00
[ f [ 2 ] [ "hi" ] ifte ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
[ { 4 } ] [
2004-11-26 22:23:57 -05:00
[ 2 2 fixnum+ ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
[ { "Hey" "there" } ] [
2004-11-26 22:23:57 -05:00
[ [ "Hey" | "there" ] uncons ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
[ { t } ] [
2004-11-26 22:23:57 -05:00
[ "XYZ" "XYZ" = ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
[ { f } ] [
2004-11-26 22:23:57 -05:00
[ "XYZ" "XuZ" = ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
[ { #{ 1 1.5 } { } #{ 1 1.5 } { } } ] [
2004-11-26 22:23:57 -05:00
[ #{ 1 1.5 } { } 2dup ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
[ { 4 } ] [
2004-11-26 22:23:57 -05:00
[ 2 2 + ] test-interpreter
2004-11-09 22:22:25 -05:00
] unit-test
2004-11-21 19:27:18 -05:00
[ { "4\n" } ] [
2004-11-26 22:23:57 -05:00
[ [ 2 2 + . ] with-string ] test-interpreter
2004-11-21 19:27:18 -05:00
] unit-test