2008-04-03 20:17:58 -04:00
|
|
|
USING: delegate kernel arrays tools.test words math ;
|
2008-03-01 17:00:45 -05:00
|
|
|
IN: delegate.tests
|
2007-11-28 10:49:43 -05:00
|
|
|
|
2008-04-03 20:17:58 -04:00
|
|
|
DEFER: example
|
|
|
|
[ 1 ] [ \ example 1 "prop" set-word-prop \ example "prop" word-prop ] unit-test
|
|
|
|
[ ] [ \ example "prop" [ 1+ ] change-word-prop ] unit-test
|
|
|
|
[ 2 ] [ \ example "prop" word-prop ] unit-test
|
|
|
|
|
|
|
|
|
2007-11-28 10:49:43 -05:00
|
|
|
TUPLE: hello this that ;
|
|
|
|
C: <hello> hello
|
|
|
|
|
|
|
|
TUPLE: goodbye these those ;
|
|
|
|
C: <goodbye> goodbye
|
|
|
|
|
|
|
|
GENERIC: foo ( x -- y )
|
|
|
|
GENERIC: bar ( a -- b )
|
|
|
|
PROTOCOL: baz foo bar ;
|
|
|
|
|
|
|
|
CONSULT: baz goodbye goodbye-these ;
|
|
|
|
M: hello foo hello-this ;
|
|
|
|
M: hello bar dup hello? swap hello-that 2array ;
|
|
|
|
|
|
|
|
GENERIC: bing ( c -- d )
|
|
|
|
CONSULT: hello goodbye goodbye-these ;
|
|
|
|
M: hello bing dup hello? swap hello-that 2array ;
|
|
|
|
MIMIC: bing goodbye hello
|
|
|
|
|
|
|
|
[ 1 { t 0 } ] [ 1 0 <hello> [ foo ] keep bar ] unit-test
|
|
|
|
[ { t 0 } ] [ 1 0 <hello> bing ] unit-test
|
|
|
|
[ 1 ] [ 1 0 <hello> f <goodbye> foo ] unit-test
|
|
|
|
[ { t 0 } ] [ 1 0 <hello> f <goodbye> bar ] unit-test
|
|
|
|
[ { f 0 } ] [ 1 0 <hello> f <goodbye> bing ] unit-test
|