2005-03-28 23:45:13 -05:00
|
|
|
IN: temporary
|
2006-05-25 23:25:00 -04:00
|
|
|
USING: arrays errors generic hashtables kernel math namespaces
|
2005-11-27 17:45:48 -05:00
|
|
|
sequences test words ;
|
2004-08-19 19:36:28 -04:00
|
|
|
|
|
|
|
|
[ 4 ] [
|
|
|
|
|
"poo" "scratchpad" create [ 2 2 + ] define-compound
|
2005-12-17 19:03:11 -05:00
|
|
|
"poo" "scratchpad" lookup execute
|
2004-08-19 19:36:28 -04:00
|
|
|
] unit-test
|
2004-09-28 00:24:36 -04:00
|
|
|
|
2005-01-28 23:55:22 -05:00
|
|
|
[ t ] [ t vocabs [ words [ word? and ] each ] each ] unit-test
|
2004-09-28 00:24:36 -04:00
|
|
|
|
2004-10-16 21:55:13 -04:00
|
|
|
DEFER: plist-test
|
|
|
|
|
|
|
|
|
|
[ t ] [
|
2005-03-05 14:45:23 -05:00
|
|
|
\ plist-test t "sample-property" set-word-prop
|
|
|
|
|
\ plist-test "sample-property" word-prop
|
2004-10-16 21:55:13 -04:00
|
|
|
] unit-test
|
|
|
|
|
|
|
|
|
|
[ f ] [
|
2005-03-05 14:45:23 -05:00
|
|
|
\ plist-test f "sample-property" set-word-prop
|
|
|
|
|
\ plist-test "sample-property" word-prop
|
2004-10-16 21:55:13 -04:00
|
|
|
] unit-test
|
2004-09-28 00:24:36 -04:00
|
|
|
|
2005-01-28 23:55:22 -05:00
|
|
|
[ f ] [ 5 compound? ] unit-test
|
2004-10-17 16:04:49 -04:00
|
|
|
|
2005-03-05 14:45:23 -05:00
|
|
|
"create-test" "scratchpad" create { 1 2 } "testing" set-word-prop
|
2004-10-17 16:04:49 -04:00
|
|
|
[ { 1 2 } ] [
|
2005-12-17 19:03:11 -05:00
|
|
|
"create-test" "scratchpad" lookup "testing" word-prop
|
2004-10-17 16:04:49 -04:00
|
|
|
] unit-test
|
2004-10-19 12:32:54 -04:00
|
|
|
|
|
|
|
|
[
|
2006-05-15 01:01:47 -04:00
|
|
|
[ t ] [ \ array? "array?" "arrays" lookup = ] unit-test
|
2004-10-19 12:32:54 -04:00
|
|
|
|
|
|
|
|
"test-scope" "scratchpad" create drop
|
|
|
|
|
] with-scope
|
|
|
|
|
|
|
|
|
|
[ "test-scope" ] [
|
2005-12-17 19:03:11 -05:00
|
|
|
"test-scope" "scratchpad" lookup word-name
|
2004-10-19 12:32:54 -04:00
|
|
|
] unit-test
|
2004-11-20 16:57:01 -05:00
|
|
|
|
2005-11-27 17:45:48 -05:00
|
|
|
[ t ] [ vocabs array? ] unit-test
|
2004-11-20 16:57:01 -05:00
|
|
|
[ t ] [ vocabs [ words [ word? ] all? ] all? ] unit-test
|
2004-12-04 15:10:46 -05:00
|
|
|
|
|
|
|
|
[ f ] [ gensym gensym = ] unit-test
|
2004-12-12 23:49:44 -05:00
|
|
|
|
|
|
|
|
[ f ] [ 123 compound? ] unit-test
|
|
|
|
|
|
|
|
|
|
: colon-def ;
|
|
|
|
|
[ t ] [ \ colon-def compound? ] unit-test
|
|
|
|
|
|
|
|
|
|
SYMBOL: a-symbol
|
|
|
|
|
[ f ] [ \ a-symbol compound? ] unit-test
|
|
|
|
|
[ t ] [ \ a-symbol symbol? ] unit-test
|
2004-12-13 15:37:50 -05:00
|
|
|
|
2005-03-05 14:45:23 -05:00
|
|
|
! See if redefining a generic as a colon def clears some
|
|
|
|
|
! word props.
|
|
|
|
|
GENERIC: testing
|
|
|
|
|
: testing ;
|
|
|
|
|
|
|
|
|
|
[ f ] [ \ testing generic? ] unit-test
|
|
|
|
|
|
2005-07-19 04:23:33 -04:00
|
|
|
[ f ] [ gensym interned? ] unit-test
|
|
|
|
|
|
|
|
|
|
: forgotten ;
|
|
|
|
|
: another-forgotten ;
|
|
|
|
|
|
|
|
|
|
[ f ] [ \ forgotten interned? ] unit-test
|
|
|
|
|
|
|
|
|
|
FORGET: forgotten
|
|
|
|
|
|
|
|
|
|
[ f ] [ \ another-forgotten interned? ] unit-test
|
|
|
|
|
|
|
|
|
|
FORGET: another-forgotten
|
|
|
|
|
: another-forgotten ;
|
|
|
|
|
|
2006-05-15 01:01:47 -04:00
|
|
|
[ t ] [ \ + interned? ] unit-test
|
2005-07-19 04:23:33 -04:00
|
|
|
|
2005-10-04 03:16:50 -04:00
|
|
|
! I forgot remove-crossref calls!
|
|
|
|
|
: fee ;
|
|
|
|
|
: foe fee ;
|
|
|
|
|
: fie foe ;
|
|
|
|
|
|
|
|
|
|
[ 0 ] [ \ fee crossref get hash hash-size ] unit-test
|
|
|
|
|
[ t ] [ \ foe crossref get hash not ] unit-test
|
|
|
|
|
|
|
|
|
|
FORGET: foe
|
|
|
|
|
|
2006-03-17 03:21:09 -05:00
|
|
|
! xref should not retain references to gensyms
|
2006-03-17 22:14:59 -05:00
|
|
|
gensym [ * ] define-compound
|
2006-03-17 03:21:09 -05:00
|
|
|
[ t ] [ \ * usage [ interned? not ] subset empty? ] unit-test
|
2006-05-25 01:29:45 -04:00
|
|
|
|
|
|
|
|
DEFER: calls-a-gensym
|
|
|
|
|
\ calls-a-gensym gensym dup "x" set unit define-compound
|
|
|
|
|
[ f ] [ "x" get crossref get hash ] unit-test
|
|
|
|
|
|
|
|
|
|
! regression
|
|
|
|
|
GENERIC: freakish
|
|
|
|
|
: bar freakish ;
|
|
|
|
|
M: array freakish ;
|
|
|
|
|
[ t ] [ \ bar \ freakish usage member? ] unit-test
|
|
|
|
|
|
2006-05-25 23:25:00 -04:00
|
|
|
DEFER: x
|
|
|
|
|
[ t ] [ [ x ] catch third \ x eq? ] unit-test
|
|
|
|
|
|
2006-05-25 01:29:45 -04:00
|
|
|
! This has to be the last test in the file.
|
|
|
|
|
: test-last ( -- ) ;
|
|
|
|
|
|
|
|
|
|
[ "test-last" ] [ word word-name ] unit-test
|