2005-03-28 23:45:13 -05:00
|
|
|
IN: temporary
|
2004-08-27 02:09:24 -04:00
|
|
|
USE: errors
|
2004-08-16 21:11:27 -04:00
|
|
|
USE: kernel
|
2004-08-26 22:21:17 -04:00
|
|
|
USE: math
|
2004-08-16 21:11:27 -04:00
|
|
|
USE: namespaces
|
|
|
|
|
USE: strings
|
|
|
|
|
USE: test
|
2005-04-25 03:33:33 -04:00
|
|
|
USE: sequences
|
2006-01-05 00:33:12 -05:00
|
|
|
USE: vectors
|
2004-08-16 21:11:27 -04:00
|
|
|
|
2006-07-28 03:54:46 -04:00
|
|
|
[ CHAR: b ] [ 1 >bignum "abc" nth ] unit-test
|
|
|
|
|
|
2005-09-20 20:18:01 -04:00
|
|
|
[ ] [ 10 [ [ -1000000 <sbuf> ] catch drop ] times ] unit-test
|
2005-08-12 18:02:03 -04:00
|
|
|
|
2005-08-25 15:27:38 -04:00
|
|
|
[ "abc" ] [ [ "a" "b" "c" ] [ [ % ] each ] "" make ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
2005-05-05 22:30:58 -04:00
|
|
|
[ "abc" ] [ "ab" "c" append ] unit-test
|
|
|
|
|
[ "abc" ] [ "a" "b" "c" append3 ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
2005-05-19 15:16:25 -04:00
|
|
|
[ 3 ] [ "a" "hola" start ] unit-test
|
|
|
|
|
[ -1 ] [ "x" "hola" start ] unit-test
|
|
|
|
|
[ 0 ] [ "" "a" start ] unit-test
|
|
|
|
|
[ 0 ] [ "" "" start ] unit-test
|
|
|
|
|
[ 0 ] [ "hola" "hola" start ] unit-test
|
|
|
|
|
[ 1 ] [ "ol" "hola" start ] unit-test
|
|
|
|
|
[ -1 ] [ "amigo" "hola" start ] unit-test
|
|
|
|
|
[ -1 ] [ "holaa" "hola" start ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
2006-07-29 20:36:25 -04:00
|
|
|
[ "Beginning" ] [ "Beginning and end" 9 head ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
2005-07-16 22:16:18 -04:00
|
|
|
[ f ] [ CHAR: I "team" member? ] unit-test
|
2005-05-18 16:26:22 -04:00
|
|
|
[ t ] [ "ea" "team" subseq? ] unit-test
|
|
|
|
|
[ f ] [ "actore" "Factor" subseq? ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
2006-07-29 20:36:25 -04:00
|
|
|
[ "end" ] [ "Beginning and end" 14 tail ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
|
|
|
|
[ "hello" "world" ] [ "hello world" " " split1 ] unit-test
|
|
|
|
|
[ "goodbye" f ] [ "goodbye" " " split1 ] unit-test
|
|
|
|
|
[ "" "" ] [ "great" "great" split1 ] unit-test
|
|
|
|
|
|
2005-05-18 16:26:22 -04:00
|
|
|
[ "and end" t ] [ "Beginning and end" "Beginning " ?head ] unit-test
|
|
|
|
|
[ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?head ] unit-test
|
|
|
|
|
[ "Beginning and end" f ] [ "Beginning and end" "eginning " ?head ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
2005-05-18 16:26:22 -04:00
|
|
|
[ "Beginning" t ] [ "Beginning and end" " and end" ?tail ] unit-test
|
|
|
|
|
[ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?tail ] unit-test
|
|
|
|
|
[ "Beginning and end" f ] [ "Beginning and end" "eginning " ?tail ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
2005-12-29 19:01:19 -05:00
|
|
|
[ { "This" "is" "a" "split" "sentence" } ]
|
2004-08-16 21:11:27 -04:00
|
|
|
[ "This is a split sentence" " " split ]
|
|
|
|
|
unit-test
|
|
|
|
|
|
2006-01-02 00:51:03 -05:00
|
|
|
[ { "OneWord" } ]
|
2004-08-16 21:11:27 -04:00
|
|
|
[ "OneWord" " " split ]
|
|
|
|
|
unit-test
|
|
|
|
|
|
2006-01-05 00:33:12 -05:00
|
|
|
[ { "a" "b" "c" "d" "e" "f" } ]
|
2006-06-13 16:02:09 -04:00
|
|
|
[ "aXbYcXdYeXf" "XY" split ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
2006-06-14 02:27:57 -04:00
|
|
|
[ { "" "" } ]
|
|
|
|
|
[ " " " " split ] unit-test
|
|
|
|
|
|
|
|
|
|
[ { "hey" } ]
|
|
|
|
|
[ "hey" " " split ] unit-test
|
|
|
|
|
|
2005-05-18 16:26:22 -04:00
|
|
|
[ "Hello world" t ] [ "Hello world\n" "\n" ?tail ] unit-test
|
|
|
|
|
[ "Hello world" f ] [ "Hello world" "\n" ?tail ] unit-test
|
|
|
|
|
[ "" t ] [ "\n" "\n" ?tail ] unit-test
|
|
|
|
|
[ "" f ] [ "" "\n" ?tail ] unit-test
|
2004-08-16 21:11:27 -04:00
|
|
|
|
|
|
|
|
[ t ] [ CHAR: a letter? ] unit-test
|
|
|
|
|
[ f ] [ CHAR: A letter? ] unit-test
|
|
|
|
|
[ f ] [ CHAR: a LETTER? ] unit-test
|
|
|
|
|
[ t ] [ CHAR: A LETTER? ] unit-test
|
|
|
|
|
[ t ] [ CHAR: 0 digit? ] unit-test
|
|
|
|
|
[ f ] [ CHAR: x digit? ] unit-test
|
|
|
|
|
|
2006-01-09 01:34:23 -05:00
|
|
|
[ t ] [ "abc" "abd" <=> 0 < ] unit-test
|
|
|
|
|
[ t ] [ "z" "abd" <=> 0 > ] unit-test
|
2004-08-25 20:51:19 -04:00
|
|
|
|
2005-09-20 20:18:01 -04:00
|
|
|
[ f ] [ [ 0 10 "hello" subseq ] catch not ] unit-test
|
2004-09-04 01:05:50 -04:00
|
|
|
|
2006-07-29 20:36:25 -04:00
|
|
|
[ { "hell" "o wo" "rld" } ] [ "hello world" 4 group ] unit-test
|
2004-10-06 23:34:22 -04:00
|
|
|
|
|
|
|
|
[ 4 ] [
|
|
|
|
|
0 "There are Four Upper Case characters"
|
2005-09-16 22:47:28 -04:00
|
|
|
[ LETTER? [ 1+ ] when ] each
|
2004-10-06 23:34:22 -04:00
|
|
|
] unit-test
|
|
|
|
|
|
|
|
|
|
[ "Replacing+spaces+with+plus" ]
|
|
|
|
|
[
|
|
|
|
|
"Replacing spaces with plus"
|
2005-05-14 17:18:45 -04:00
|
|
|
[ dup CHAR: \s = [ drop CHAR: + ] when ] map
|
2004-10-06 23:34:22 -04:00
|
|
|
]
|
|
|
|
|
unit-test
|
2004-12-19 03:04:03 -05:00
|
|
|
|
2005-06-16 18:50:49 -04:00
|
|
|
[ "05" ] [ "5" 2 CHAR: 0 pad-left ] unit-test
|
|
|
|
|
[ "666" ] [ "666" 2 CHAR: 0 pad-left ] unit-test
|
2005-04-07 18:54:02 -04:00
|
|
|
|
|
|
|
|
[ 1 "" nth ] unit-test-fails
|
2005-05-05 22:30:58 -04:00
|
|
|
[ -6 "hello" nth ] unit-test-fails
|
2005-05-18 16:26:22 -04:00
|
|
|
|
2005-07-22 23:21:50 -04:00
|
|
|
[ t ] [ "hello world" dup >vector >string = ] unit-test
|
2006-06-05 22:04:49 -04:00
|
|
|
|
|
|
|
|
[ "ab" ] [ 2 "abc" resize-string ] unit-test
|
|
|
|
|
[ "abc\0\0\0" ] [ 6 "abc" resize-string ] unit-test
|