Objective C test

slava 2006-07-06 20:16:05 +00:00
parent 9f2201fe09
commit 68bf49fca0
2 changed files with 42 additions and 1 deletions

39
library/test/cocoa.factor Normal file
View File

@ -0,0 +1,39 @@
IN: objc-classes
DEFER: Foo
DEFER: Bar
IN: temporary
USING: cocoa compiler kernel objc namespaces objc-classes test memory ;
"NSObject" "Foo"
{ { "foo:" "void" { "id" "SEL" "NSRect" } [ full-gc "x" set 2drop ] } }
{ }
define-objc-class
: test-foo
Foo -> alloc -> init
dup 1 2 101 102 <NSRect> -> foo:
-> release ;
test-foo
[ 1 ] [ "x" get NSRect-x ] unit-test
[ 2 ] [ "x" get NSRect-y ] unit-test
[ 101 ] [ "x" get NSRect-w ] unit-test
[ 102 ] [ "x" get NSRect-h ] unit-test
"NSObject" "Bar"
{ { "bar" "NSRect" { "id" "SEL" } [ 2drop test-foo "x" get ] } }
{ }
define-objc-class
Bar [
-> alloc -> init
dup -> bar "x" set
-> release
] compile-1
[ 1 ] [ "x" get NSRect-x ] unit-test
[ 2 ] [ "x" get NSRect-y ] unit-test
[ 101 ] [ "x" get NSRect-w ] unit-test
[ 102 ] [ "x" get NSRect-h ] unit-test

View File

@ -113,7 +113,9 @@ SYMBOL: failures
"threads" "threads"
"tuple" "tuple"
"words" "words"
} run-tests ; }
macosx? [ "cocoa" add ] when
run-tests ;
: benchmarks : benchmarks
{ {