more test suite work

cvs
Slava Pestov 2004-10-03 20:39:32 +00:00
parent c70b0cecf5
commit b30c92eb6f
5 changed files with 84 additions and 0 deletions

14
library/test/init.factor Normal file
View File

@ -0,0 +1,14 @@
IN: scratchpad
USE: init
USE: namespaces
USE: test
[
[ f ] [ "-no-user-init" cli-arg ] unit-test
[ f ] [ "user-init" get ] unit-test
[ f ] [ "-user-init" cli-arg ] unit-test
[ t ] [ "user-init" get ] unit-test
[ "sdl.factor" ] [ "sdl.factor" cli-arg ] unit-test
] with-scope

View File

@ -0,0 +1,16 @@
IN: scratchpad
USE: interpreter
USE: namespaces
USE: stdio
USE: test
[
init-history
"2 2 +" history+
history.
[ "2 2 +" ] [ 0 get-history ] unit-test
[ 4 ] [ 0 redo ] unit-test
[ 4 ] [ "2 2 +" eval-catch ] unit-test
"The following will print an error; ignore it." print terpri
[ ] [ "clear drop" eval-catch ] unit-test
] with-scope

View File

@ -4,7 +4,9 @@ USE: namespaces
USE: test
[ [ 1 2 3 4 ] ] [ [ 3 4 ] [ 1 2 ] ] [ "x" set "x" append@ "x" get ] test-word
[ [ 1 2 3 4 ] ] [ 4 [ 1 2 3 ] ] [ "x" set "x" add@ "x" get ] test-word
[ [ 1 ] ] [ 1 f ] [ "x" set "x" cons@ "x" get ] test-word
[ [ 1 | 2 ] ] [ 1 2 ] [ "x" set "x" cons@ "x" get ] test-word
[ [ 1 2 ] ] [ 1 [ 2 ] ] [ "x" set "x" cons@ "x" get ] test-word
@ -15,3 +17,30 @@ USE: test
[ [ 2 | 3 ] ] [ "x" uncons@ ] unit-test
[ [ 1 | 2 ] ] [ "x" uncons@ ] unit-test
[ [ 5 4 3 1 ] ] [
[ 5 4 3 2 1 ] "x" set
2 "x" remove@
"x" get
] unit-test
[ [ "hello" f ] ] [
"x" off
f "x" unique@
"hello" "x" unique@
f "x" unique@
5 "x" unique@
f "x" unique@
5 "x" remove@
"hello" "x" unique@
"x" get
] unit-test
[ [ "xyz" #{ 3 2 } 1/5 [ { } ] ] ] [
[, "xyz" , "xyz" unique,
#{ 3 2 } , #{ 3 2 } unique,
1/5 , 1/5 unique,
[, { } unique, ,] , ,]
] unit-test
[ [ 1 2 3 4 ] ] [ [, 1 , [ 2 3 ] list, 4 , ,] ] unit-test

View File

@ -0,0 +1,22 @@
IN: scratchpad
USE: combinators
USE: kernel
USE: math
USE: stack
USE: test
[ 0 1 2 3 4 ] [ 5 [ ] times* ] unit-test
[ ] [ 0 [ ] times* ] unit-test
[ #{ 1 1 } ] [ #{ 2 3 } #{ 1 0 } 2times-succ ] unit-test
[ #{ 1 2 } ] [ #{ 2 3 } #{ 1 1 } 2times-succ ] unit-test
[ #{ 2 0 } ] [ #{ 3 3 } #{ 1 2 } 2times-succ ] unit-test
[ #{ 2 1 } ] [ #{ 3 3 } #{ 2 0 } 2times-succ ] unit-test
[ #{ 2 0 } ] [ #{ 2 2 } #{ 1 1 } 2times-succ ] unit-test
[ #{ 0 0 } #{ 0 1 } #{ 1 0 } #{ 1 1 } ]
[ #{ 2 2 } [ ] 2times* ] unit-test
[ #{ 0 0 } #{ 0 1 } #{ 0 2 } #{ 1 0 } #{ 1 1 } #{ 1 2 }
#{ 2 0 } #{ 2 1 } #{ 2 2 } ]
[ #{ 3 3 } [ ] 2times* ] unit-test

View File

@ -80,12 +80,15 @@ USE: unparser
"parse-number"
"prettyprint"
"image"
"init"
"inspector"
"interpreter"
"io/io"
"vectors"
"words"
"unparser"
"random"
"stream"
"math/bignum"
"math/bitops"
"math/gcd"