FUNCTION: void* alien-parser-function-effect-test ( int *arg1, float arg2 ) ;
-[ ( arg1 arg2 -- void* ) ] [
+{ ( arg1 arg2 -- void* ) } [
\ alien-parser-function-effect-test "declared-effect" word-prop
] unit-test
-[ t ] [ \ alien-parser-function-effect-test inline? ] unit-test
+{ t } [ \ alien-parser-function-effect-test inline? ] unit-test
FUNCTION-ALIAS: (alien-parser-function-effect-test) void* alien-parser-function-effect-test ( int *arg1, float arg2 ) ;
-[ ( arg1 arg2 -- void* ) ] [
+{ ( arg1 arg2 -- void* ) } [
\ (alien-parser-function-effect-test) "declared-effect" word-prop
] unit-test
-[ t ] [ \ (alien-parser-function-effect-test) inline? ] unit-test
+{ t } [ \ (alien-parser-function-effect-test) inline? ] unit-test
CALLBACK: void* alien-parser-callback-effect-test ( int *arg1 float arg2 ) ;
-[ ( arg1 arg2 -- void* ) ] [
+{ ( arg1 arg2 -- void* ) } [
\ alien-parser-callback-effect-test "callback-effect" word-prop
] unit-test
-[ t ] [ \ alien-parser-callback-effect-test inline? ] unit-test
+{ t } [ \ alien-parser-callback-effect-test inline? ] unit-test
! Reported by mnestic
TYPEDEF: int alien-parser-test-int ! reasonably unique name...
-[ "OK!" ] [
+{ "OK!" } [
[
"USE: specialized-arrays SPECIALIZED-ARRAY: alien-parser-test-int" eval( -- )
! after restart, we end up here
FUNCTION: int function_test ( float x, int[4][FOO] y, char* z, ushort *w ) ;
-[ "USING: alien.c-types alien.syntax ;
+{ "USING: alien.c-types alien.syntax ;
IN: alien.prettyprint.tests
FUNCTION: int function_test
( float x, int[4][FOO] y, char* z, ushort* w ) ; inline
-" ] [
+" } [
[ \ function_test see ] with-string-writer
] unit-test
FUNCTION-ALIAS: function-test int function_test
( float x, int[4][FOO] y, char* z, ushort *w ) ;
-[ "USING: alien.c-types alien.syntax ;
+{ "USING: alien.c-types alien.syntax ;
IN: alien.prettyprint.tests
FUNCTION-ALIAS: function-test int function_test
( float x, int[4][FOO] y, char* z, ushort* w ) ; inline
-" ] [
+" } [
[ \ function-test see ] with-string-writer
] unit-test
TYPEDEF: c-string[ascii] string-typedef
TYPEDEF: char[1][2][3] array-typedef
-[ "USING: alien.c-types alien.syntax ;
+{ "USING: alien.c-types alien.syntax ;
IN: alien.prettyprint.tests
TYPEDEF: c-string[ascii] string-typedef
-" ] [
+" } [
[ \ string-typedef see ] with-string-writer
] unit-test
-[ "USING: alien.c-types alien.syntax ;
+{ "USING: alien.c-types alien.syntax ;
IN: alien.prettyprint.tests
TYPEDEF: char[1][2][3] array-typedef
-" ] [
+" } [
[ \ array-typedef see ] with-string-writer
] unit-test
C-TYPE: opaque-c-type
-[ "USING: alien.syntax ;
+{ "USING: alien.syntax ;
IN: alien.prettyprint.tests
C-TYPE: opaque-c-type
-" ] [
+" } [
[ \ opaque-c-type see ] with-string-writer
] unit-test
TYPEDEF: pointer: int pint
-[ "USING: alien.c-types alien.syntax ;
+{ "USING: alien.c-types alien.syntax ;
IN: alien.prettyprint.tests
TYPEDEF: int* pint
-" ] [
+" } [
[ \ pint see ] with-string-writer
] unit-test
-[ "pointer: int" ] [ pointer: int unparse ] unit-test
+{ "pointer: int" } [ pointer: int unparse ] unit-test
CALLBACK: void callback-test ( int x, float[4] y ) ;
-[ "USING: alien.c-types alien.syntax ;
+{ "USING: alien.c-types alien.syntax ;
IN: alien.prettyprint.tests
CALLBACK: void callback-test ( int x, float[4] y ) ;
-" ] [
+" } [
[ \ callback-test see ] with-string-writer
] unit-test
kernel math ;
IN: bootstrap.image.tests
-[ f ] [ { 1 2 3 } [ 1 2 3 ] eql? ] unit-test
+{ f } [ { 1 2 3 } [ 1 2 3 ] eql? ] unit-test
-[ t ] [ [ 1 2 3 ] [ 1 2 3 ] eql? ] unit-test
+{ t } [ [ 1 2 3 ] [ 1 2 3 ] eql? ] unit-test
-[ f ] [ [ 2drop 0 ] [ 2drop 0.0 ] eql? ] unit-test
+{ f } [ [ 2drop 0 ] [ 2drop 0.0 ] eql? ] unit-test
-[ t ] [ [ 2drop 0 ] [ 2drop 0 ] eql? ] unit-test
+{ t } [ [ 2drop 0 ] [ 2drop 0 ] eql? ] unit-test
-[ f ] [ \ + [ 2drop 0 ] eql? ] unit-test
+{ f } [ \ + [ 2drop 0 ] eql? ] unit-test
-[ f ] [ 3 [ 0 1 2 ] eql? ] unit-test
+{ f } [ 3 [ 0 1 2 ] eql? ] unit-test
-[ f ] [ 3 3.0 eql? ] unit-test
+{ f } [ 3 3.0 eql? ] unit-test
-[ t ] [ 4.0 4.0 eql? ] unit-test
+{ t } [ 4.0 4.0 eql? ] unit-test
USING: tools.test byte-arrays.hex eval ;
IN: byte-arrays.hex.tests
-[ B{ 16 0 8 0 } ] [ HEX{ 10 00 08 00 } ] unit-test
-[ B{ 255 255 15 255 255 255 } ] [ HEX{ ffff 0fff ffff } ] unit-test
+{ B{ 16 0 8 0 } } [ HEX{ 10 00 08 00 } ] unit-test
+{ B{ 255 255 15 255 255 255 } } [ HEX{ ffff 0fff ffff } ] unit-test
[ "HEX{ ffff fff ffff }" parse-string ] must-fail
[ "HEX{ 10 00 08 0 }" parse-string ] must-fail
io.streams.string accessors io math.order sequences ;
IN: calendar.format.tests
-[ 0 ] [
+{ 0 } [
"Z" [ read1 read-rfc3339-gmt-offset ] with-string-reader duration>hours
] unit-test
-[ 1 ] [
+{ 1 } [
"+01" [ read1 read-rfc3339-gmt-offset ] with-string-reader duration>hours
] unit-test
-[ -1 ] [
+{ -1 } [
"-01" [ read1 read-rfc3339-gmt-offset ] with-string-reader duration>hours
] unit-test
-[ -1-1/2 ] [
+{ -1-1/2 } [
"-01:30" [ read1 read-rfc3339-gmt-offset ] with-string-reader duration>hours
] unit-test
-[ 1+1/2 ] [
+{ 1+1/2 } [
"+01:30" [ read1 read-rfc3339-gmt-offset ] with-string-reader duration>hours
] unit-test
-[ ] [ now timestamp>rfc3339 drop ] unit-test
-[ ] [ now timestamp>rfc822 drop ] unit-test
+{ } [ now timestamp>rfc3339 drop ] unit-test
+{ } [ now timestamp>rfc822 drop ] unit-test
-[ 8/1000 -4 ] [
+{ 8/1000 -4 } [
"2008-04-19T04:56:00.008-04:00" rfc3339>timestamp
[ second>> ] [ gmt-offset>> hour>> ] bi
] unit-test
-[ T{ duration f 0 0 0 0 0 0 } ] [
+{ T{ duration f 0 0 0 0 0 0 } } [
"GMT" parse-rfc822-gmt-offset
] unit-test
-[ T{ duration f 0 0 0 -5 0 0 } ] [
+{ T{ duration f 0 0 0 -5 0 0 } } [
"-0500" parse-rfc822-gmt-offset
] unit-test
-[ T{ timestamp f 2008 4 22 14 36 12 T{ duration f 0 0 0 0 0 0 } } ] [
+{ T{ timestamp f 2008 4 22 14 36 12 T{ duration f 0 0 0 0 0 0 } } } [
"Tue, 22 Apr 2008 14:36:12 GMT" rfc822>timestamp
] unit-test
-[ t ] [ now dup timestamp>rfc822 rfc822>timestamp time- 1 seconds before? ] unit-test
+{ t } [ now dup timestamp>rfc822 rfc822>timestamp time- 1 seconds before? ] unit-test
-[ t ] [ now dup timestamp>cookie-string cookie-string>timestamp time- 1 seconds before? ] unit-test
+{ t } [ now dup timestamp>cookie-string cookie-string>timestamp time- 1 seconds before? ] unit-test
-[ "Sun, 4 May 2008 07:00:00" ] [
+{ "Sun, 4 May 2008 07:00:00" } [
"Sun May 04 07:00:00 2008 GMT" cookie-string>timestamp
timestamp>string
] unit-test
-[ "20080504070000" ] [
+{ "20080504070000" } [
"Sun May 04 07:00:00 2008 GMT" cookie-string>timestamp
timestamp>mdtm
] unit-test
-[
+{
T{ timestamp f
2008
5
42+2469/20000
T{ duration f 0 0 0 -5 0 0 }
}
-] [ "2008-05-26T00:37:42.12345-05:00" rfc3339>timestamp ] unit-test
+} [ "2008-05-26T00:37:42.12345-05:00" rfc3339>timestamp ] unit-test
-[
+{
T{ timestamp
{ year 2008 }
{ month 10 }
{ second 59 }
{ gmt-offset T{ duration f 0 0 0 0 0 0 } }
}
-] [ "Thursday, 02-Oct-2008 23:59:59 GMT" cookie-string>timestamp ] unit-test
+} [ "Thursday, 02-Oct-2008 23:59:59 GMT" cookie-string>timestamp ] unit-test
-[ ]
+{ }
[ { 2008 2009 } [ year. ] each ] unit-test
-[
+{
T{ timestamp
{ year 2013 }
{ month 4 }
{ minute 50 }
{ second 24 }
}
-] [ "2013-04-23T13:50:24" rfc3339>timestamp ] unit-test
+} [ "2013-04-23T13:50:24" rfc3339>timestamp ] unit-test
{ "2001-12-14T21:59:43.100000-05:00" } [ "2001-12-14T21:59:43.1-05:00" rfc3339>timestamp timestamp>rfc3339 ] unit-test
-[
+{
T{ timestamp
{ year 2001 }
{ month 12 }
{ minute 59 }
{ second 43+1/10 }
}
-] [ "2001-12-15 02:59:43.1Z" rfc3339>timestamp ] unit-test
+} [ "2001-12-15 02:59:43.1Z" rfc3339>timestamp ] unit-test
-[
+{
T{ timestamp
{ year 2001 }
{ month 12 }
{ minute 59 }
{ second 43+1/10 }
}
-] [ "2001-12-15 02:59:43.1Z" rfc3339>timestamp ] unit-test
+} [ "2001-12-15 02:59:43.1Z" rfc3339>timestamp ] unit-test
USING: tools.test kernel accessors ;
IN: calendar.format.macros
-[ 2 ] [ { [ 2 ] } attempt-all-quots ] unit-test
+{ 2 } [ { [ 2 ] } attempt-all-quots ] unit-test
-[ 2 ] [ { [ 1 throw ] [ 2 ] } attempt-all-quots ] unit-test
+{ 2 } [ { [ 1 throw ] [ 2 ] } attempt-all-quots ] unit-test
[ { [ 1 throw ] } attempt-all-quots ] [ 1 = ] must-fail-with
\ compiled-test-1 def>> must-infer
-[ 2 ] [ compiled-test-1 ] unit-test
+{ 2 } [ compiled-test-1 ] unit-test
USING: checksums.adler-32 checksums strings tools.test ;
IN: checksums.adler-32.tests
-[ 300286872 ] [ "Wikipedia" adler-32 checksum-bytes ] unit-test
-[ 2679885283 ] [ 10000 CHAR: a <string> adler-32 checksum-bytes ] unit-test
+{ 300286872 } [ "Wikipedia" adler-32 checksum-bytes ] unit-test
+{ 2679885283 } [ 10000 CHAR: a <string> adler-32 checksum-bytes ] unit-test
! A few test vectors taken from http://www.isthe.com/chongo/src/fnv/test_fnv.c
-[ 0x811c9dc5 ] [ "" fnv1-32 checksum-bytes ] unit-test
-[ 0x811c9dc5 ] [ "" fnv1a-32 checksum-bytes ] unit-test
-[ 0xcbf29ce484222325 ] [ "" fnv1-64 checksum-bytes ] unit-test
-[ 0xcbf29ce484222325 ] [ "" fnv1a-64 checksum-bytes ] unit-test
+{ 0x811c9dc5 } [ "" fnv1-32 checksum-bytes ] unit-test
+{ 0x811c9dc5 } [ "" fnv1a-32 checksum-bytes ] unit-test
+{ 0xcbf29ce484222325 } [ "" fnv1-64 checksum-bytes ] unit-test
+{ 0xcbf29ce484222325 } [ "" fnv1a-64 checksum-bytes ] unit-test
-[ 0x050c5d7e ] [ "a" fnv1-32 checksum-bytes ] unit-test
-[ 0xe40c292c ] [ "a" fnv1a-32 checksum-bytes ] unit-test
-[ 0xaf63bd4c8601b7be ] [ "a" fnv1-64 checksum-bytes ] unit-test
-[ 0xaf63dc4c8601ec8c ] [ "a" fnv1a-64 checksum-bytes ] unit-test
+{ 0x050c5d7e } [ "a" fnv1-32 checksum-bytes ] unit-test
+{ 0xe40c292c } [ "a" fnv1a-32 checksum-bytes ] unit-test
+{ 0xaf63bd4c8601b7be } [ "a" fnv1-64 checksum-bytes ] unit-test
+{ 0xaf63dc4c8601ec8c } [ "a" fnv1a-64 checksum-bytes ] unit-test
-[ 0x050c5d7d ] [ "b" fnv1-32 checksum-bytes ] unit-test
-[ 0xe70c2de5 ] [ "b" fnv1a-32 checksum-bytes ] unit-test
-[ 0xaf63bd4c8601b7bd ] [ "b" fnv1-64 checksum-bytes ] unit-test
-[ 0xaf63df4c8601f1a5 ] [ "b" fnv1a-64 checksum-bytes ] unit-test
+{ 0x050c5d7d } [ "b" fnv1-32 checksum-bytes ] unit-test
+{ 0xe70c2de5 } [ "b" fnv1a-32 checksum-bytes ] unit-test
+{ 0xaf63bd4c8601b7bd } [ "b" fnv1-64 checksum-bytes ] unit-test
+{ 0xaf63df4c8601f1a5 } [ "b" fnv1a-64 checksum-bytes ] unit-test
-[ 0x31f0b262 ] [ "foobar" fnv1-32 checksum-bytes ] unit-test
-[ 0xbf9cf968 ] [ "foobar" fnv1a-32 checksum-bytes ] unit-test
-[ 0x340d8765a4dda9c2 ] [ "foobar" fnv1-64 checksum-bytes ] unit-test
-[ 0x85944171f73967e8 ] [ "foobar" fnv1a-64 checksum-bytes ] unit-test
+{ 0x31f0b262 } [ "foobar" fnv1-32 checksum-bytes ] unit-test
+{ 0xbf9cf968 } [ "foobar" fnv1a-32 checksum-bytes ] unit-test
+{ 0x340d8765a4dda9c2 } [ "foobar" fnv1-64 checksum-bytes ] unit-test
+{ 0x85944171f73967e8 } [ "foobar" fnv1a-64 checksum-bytes ] unit-test
! I couldn't find any test vectors for 128, 256, 512, or 1024 versions of FNV1 hashes.
! So, just to check that your maths works the same as my maths, here's a few samples computed on my laptop.
! So they may be right or wrong, but either way, them failing is cause for concern somewhere...
-[ 3897470310 ] [ "Hello, world!" fnv1-32 checksum-bytes ] unit-test
-[ 3985698964 ] [ "Hello, world!" fnv1a-32 checksum-bytes ] unit-test
-[ 7285062107457560934 ] [ "Hello, world!" fnv1-64 checksum-bytes ] unit-test
-[ 4094109891673226228 ] [ "Hello, world!" fnv1a-64 checksum-bytes ] unit-test
-[ 281580511747867177735318995358496831158 ] [ "Hello, world!" fnv1-128 checksum-bytes ] unit-test
-[ 303126633380056630368940439484674414572 ] [ "Hello, world!" fnv1a-128 checksum-bytes ] unit-test
-[ 104295939182568077644846978685759236849634734810631820736486253421270219742822 ] [ "Hello, world!" fnv1-256 checksum-bytes ] unit-test
-[ 9495445728692795332446740615588417456874414534608540692485745371050033741380 ] [ "Hello, world!" fnv1a-256 checksum-bytes ] unit-test
-[ 3577308325596719252093726711895047340166329831006673109476042102918876665433235513101496175651226507162015890004121912850661561110326527625579463564626958 ] [ "Hello, world!" fnv1-512 checksum-bytes ] unit-test
-[ 3577308325596719162840652138474318309664256091923081930027929425092517582111473988451078821416039944023089883981242376700859598441397004715365740906054208 ] [ "Hello, world!" fnv1a-512 checksum-bytes ] unit-test
-[ 52692754922840008511959888105094366091401994235075816792707658326855733053286986999719949898492311786648795846192078757217437117165934438286601534984230194601365788544275827382423366672856972872132009691615382991251544423521887009322211754219117294019951276080952271766377222613325328591830596794468813260226 ] [ "Hello, world!" fnv1-1024 checksum-bytes ] unit-test
-[ 52692754922840008511959888105094366091401994235075816792707658326855804920671100511873485674717442819607149127986090276849364757610838433887624184145636764448608707614141109841761957788887305179569455221243999538336208648824673027111352338809582124430199044921035232455717748500524777795242051756321605065326 ] [ "Hello, world!" fnv1a-1024 checksum-bytes ] unit-test
+{ 3897470310 } [ "Hello, world!" fnv1-32 checksum-bytes ] unit-test
+{ 3985698964 } [ "Hello, world!" fnv1a-32 checksum-bytes ] unit-test
+{ 7285062107457560934 } [ "Hello, world!" fnv1-64 checksum-bytes ] unit-test
+{ 4094109891673226228 } [ "Hello, world!" fnv1a-64 checksum-bytes ] unit-test
+{ 281580511747867177735318995358496831158 } [ "Hello, world!" fnv1-128 checksum-bytes ] unit-test
+{ 303126633380056630368940439484674414572 } [ "Hello, world!" fnv1a-128 checksum-bytes ] unit-test
+{ 104295939182568077644846978685759236849634734810631820736486253421270219742822 } [ "Hello, world!" fnv1-256 checksum-bytes ] unit-test
+{ 9495445728692795332446740615588417456874414534608540692485745371050033741380 } [ "Hello, world!" fnv1a-256 checksum-bytes ] unit-test
+{ 3577308325596719252093726711895047340166329831006673109476042102918876665433235513101496175651226507162015890004121912850661561110326527625579463564626958 } [ "Hello, world!" fnv1-512 checksum-bytes ] unit-test
+{ 3577308325596719162840652138474318309664256091923081930027929425092517582111473988451078821416039944023089883981242376700859598441397004715365740906054208 } [ "Hello, world!" fnv1a-512 checksum-bytes ] unit-test
+{ 52692754922840008511959888105094366091401994235075816792707658326855733053286986999719949898492311786648795846192078757217437117165934438286601534984230194601365788544275827382423366672856972872132009691615382991251544423521887009322211754219117294019951276080952271766377222613325328591830596794468813260226 } [ "Hello, world!" fnv1-1024 checksum-bytes ] unit-test
+{ 52692754922840008511959888105094366091401994235075816792707658326855804920671100511873485674717442819607149127986090276849364757610838433887624184145636764448608707614141109841761957788887305179569455221243999538336208648824673027111352338809582124430199044921035232455717748500524777795242051756321605065326 } [ "Hello, world!" fnv1a-1024 checksum-bytes ] unit-test
checksums ;
IN: checksums.hmac.tests
-[
+{
"\u000092\u000094rz68\u0000bb\u00001c\u000013\u0000f4\u00008e\u0000f8\u000015\u00008b\u0000fc\u00009d"
-] [
+} [
"Hi There" 16 11 <string> md5 hmac-bytes >string ] unit-test
-[ "u\u00000cx>j\u0000b0\u0000b5\u000003\u0000ea\u0000a8n1\n]\u0000b78" ]
+{ "u\u00000cx>j\u0000b0\u0000b5\u000003\u0000ea\u0000a8n1\n]\u0000b78" }
[ "what do ya want for nothing?" "Jefe" md5 hmac-bytes >string ] unit-test
-[
+{
"V\u0000be4R\u00001d\u000014L\u000088\u0000db\u0000b8\u0000c73\u0000f0\u0000e8\u0000b3\u0000f6"
-]
+}
[
50 0xdd <repetition>
16 0xaa <string> md5 hmac-bytes >string
] unit-test
-[
+{
"g[\u00000b:\eM\u0000dfN\u000012Hr\u0000dal/c+\u0000fe\u0000d9W\u0000e9"
-] [
+} [
"Hi There" 16 11 <string> sha1 hmac-bytes >string
] unit-test
-[
+{
"\u0000ef\u0000fc\u0000dfj\u0000e5\u0000eb/\u0000a2\u0000d2t\u000016\u0000d5\u0000f1\u000084\u0000df\u00009c%\u00009a|y"
-] [
+} [
"what do ya want for nothing?" "Jefe" sha1 hmac-bytes >string
] unit-test
-[
+{
"\u0000d70YM\u000016~5\u0000d5\u000095o\u0000d8\0=\r\u0000b3\u0000d3\u0000f4m\u0000c7\u0000bb"
-] [
+} [
50 0xdd <repetition>
16 0xaa <string> sha1 hmac-bytes >string
] unit-test
-[ "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7" ]
+{ "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7" }
[ "Hi There" 20 0xb <string> sha-256 hmac-bytes hex-string ] unit-test
-[ "167f928588c5cc2eef8e3093caa0e87c9ff566a14794aa61648d81621a2a40c6" ]
+{ "167f928588c5cc2eef8e3093caa0e87c9ff566a14794aa61648d81621a2a40c6" }
[
"what do ya want for nothing?"
"JefeJefeJefeJefeJefeJefeJefeJefe" sha-256 hmac-bytes hex-string
USING: tools.test checksums.interleave checksums.sha ;
IN: checksums.interleave.tests
-[
+{
B{
59 155 253 205 75 163 94 115 208 42 227 92 181 19 60 232
119 65 178 131 210 48 241 230 204 216 30 156 4 215 80 84 93
206 44 1 18 128 150 153
}
-] [
+} [
B{
102 83 241 12 26 250 181 76 97 200 37 117 168 74 254 48 216
170 26 58 150 150 179 24 153 146 191 225 203 127 166 167
IN: checksums
-[ B{ 255 255 } ] [ { } internet checksum-bytes ] unit-test
-[ B{ 254 255 } ] [ { 1 } internet checksum-bytes ] unit-test
-[ B{ 254 253 } ] [ { 1 2 } internet checksum-bytes ] unit-test
-[ B{ 251 253 } ] [ { 1 2 3 } internet checksum-bytes ] unit-test
+{ B{ 255 255 } } [ { } internet checksum-bytes ] unit-test
+{ B{ 254 255 } } [ { 1 } internet checksum-bytes ] unit-test
+{ B{ 254 253 } } [ { 1 2 } internet checksum-bytes ] unit-test
+{ B{ 251 253 } } [ { 1 2 3 } internet checksum-bytes ] unit-test
: test-data ( -- bytes )
B{
0xf6 0xf7
} ;
-[ B{ 34 13 } ] [ test-data internet checksum-bytes ] unit-test
+{ B{ 34 13 } } [ test-data internet checksum-bytes ] unit-test
sequences ;
IN: checksums.md5.tests
-[ "d41d8cd98f00b204e9800998ecf8427e" ] [ "" >byte-array md5 checksum-bytes hex-string ] unit-test
-[ "0cc175b9c0f1b6a831c399e269772661" ] [ "a" >byte-array md5 checksum-bytes hex-string ] unit-test
-[ "900150983cd24fb0d6963f7d28e17f72" ] [ "abc" >byte-array md5 checksum-bytes hex-string ] unit-test
-[ "f96b697d7cb7938d525a2f31aaf161d0" ] [ "message digest" >byte-array md5 checksum-bytes hex-string ] unit-test
-[ "c3fcd3d76192e4007dfb496cca67e13b" ] [ "abcdefghijklmnopqrstuvwxyz" >byte-array md5 checksum-bytes hex-string ] unit-test
-[ "d174ab98d277d9f5a5611c2c9f419d9f" ] [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" >byte-array md5 checksum-bytes hex-string ] unit-test
-[ "57edf4a22be3c955ac49da2e2107b67a" ] [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" >byte-array md5 checksum-bytes hex-string ] unit-test
+{ "d41d8cd98f00b204e9800998ecf8427e" } [ "" >byte-array md5 checksum-bytes hex-string ] unit-test
+{ "0cc175b9c0f1b6a831c399e269772661" } [ "a" >byte-array md5 checksum-bytes hex-string ] unit-test
+{ "900150983cd24fb0d6963f7d28e17f72" } [ "abc" >byte-array md5 checksum-bytes hex-string ] unit-test
+{ "f96b697d7cb7938d525a2f31aaf161d0" } [ "message digest" >byte-array md5 checksum-bytes hex-string ] unit-test
+{ "c3fcd3d76192e4007dfb496cca67e13b" } [ "abcdefghijklmnopqrstuvwxyz" >byte-array md5 checksum-bytes hex-string ] unit-test
+{ "d174ab98d277d9f5a5611c2c9f419d9f" } [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" >byte-array md5 checksum-bytes hex-string ] unit-test
+{ "57edf4a22be3c955ac49da2e2107b67a" } [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" >byte-array md5 checksum-bytes hex-string ] unit-test
-[
+{
t
-] [
+} [
<md5-state> "asdf" add-checksum-bytes
[ get-checksum ] [ get-checksum ] bi =
] unit-test
-[
+{
t
-] [
+} [
<md5-state> "" add-checksum-bytes
[ get-checksum ] [ get-checksum ] bi =
] unit-test
-[
+{
t
-] [
+} [
<md5-state> "asdf" binary <byte-reader> add-checksum-stream
[ get-checksum ] [ get-checksum ] bi =
] unit-test
-[
+{
t
-] [
+} [
{ "abcd" "efg" } md5 checksum-lines length 16 =
] unit-test
combinators.short-circuit kernel system tools.test ;
IN: checksums.openssl.tests
-[
+{
B{ 201 238 222 100 92 200 182 188 138 255 129 163 115 88 240 136 }
-]
+}
[
"Hello world from the openssl binding" >byte-array
"md5" <openssl-checksum> checksum-bytes
] unit-test
-[
+{
B{ 63 113 237 255 181 5 152 241 136 181 43 95 160 105 44 87 49 82 115 0 }
-]
+}
[
"Hello world from the openssl binding" >byte-array
"sha1" <openssl-checksum> checksum-bytes
] [ { [ unknown-digest? ] [ name>> "no such checksum" = ] } 1&& ]
must-fail-with
-[ ] [ image openssl-sha1 checksum-file drop ] unit-test
+{ } [ image openssl-sha1 checksum-file drop ] unit-test
: test-checksum ( text identifier -- checksum )
checksum-bytes hex-string ;
-[ "a9993e364706816aba3e25717850c26c9cd0d89d" ] [ "abc" sha1 checksum-bytes hex-string ] unit-test
-[ "84983e441c3bd26ebaae4aa1f95129e5e54670f1" ] [ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" sha1 checksum-bytes hex-string ] unit-test
+{ "a9993e364706816aba3e25717850c26c9cd0d89d" } [ "abc" sha1 checksum-bytes hex-string ] unit-test
+{ "84983e441c3bd26ebaae4aa1f95129e5e54670f1" } [ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" sha1 checksum-bytes hex-string ] unit-test
! [ "34aa973cd4c4daa4f61eeb2bdbad27316534016f" ] [ 1000000 CHAR: a fill string>sha1str ] unit-test ! takes a long time...
-[ "dea356a2cddd90c7a7ecedc5ebb563934f460452" ] [ "0123456701234567012345670123456701234567012345670123456701234567"
+{ "dea356a2cddd90c7a7ecedc5ebb563934f460452" } [ "0123456701234567012345670123456701234567012345670123456701234567"
10 swap <array> concat sha1 checksum-bytes hex-string ] unit-test
-[ "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525" ]
+{ "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525" }
[
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
sha-224 test-checksum
] unit-test
-[ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ]
+{ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }
[ "" sha-256 test-checksum ] unit-test
-[ "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ]
+{ "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" }
[ "abc" sha-256 test-checksum ] unit-test
-[ "f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650" ]
+{ "f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650" }
[ "message digest" sha-256 test-checksum ] unit-test
-[ "71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73" ]
+{ "71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73" }
[ "abcdefghijklmnopqrstuvwxyz" sha-256 test-checksum ] unit-test
-[ "db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0" ]
+{ "db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0" }
[
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
sha-256 test-checksum
] unit-test
-[ "f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e" ]
+{ "f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e" }
[
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
sha-256 test-checksum
! [ "8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909" ]
! [ "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" sha-512 test-checksum ] unit-test
-[
+{
t
-] [
+} [
<sha1-state> "asdf" binary <byte-reader> add-checksum-stream
[ get-checksum ] [ get-checksum ] bi =
] unit-test
-[
+{
t
-] [
+} [
<sha-256-state> "asdf" binary <byte-reader> add-checksum-stream
[ get-checksum ] [ get-checksum ] bi =
] unit-test
-[
+{
t
-] [
+} [
<sha-224-state> "asdf" binary <byte-reader> add-checksum-stream
[ get-checksum ] [ get-checksum ] bi =
] unit-test
sequences random stack-checker ;
IN: classes.struct.bit-accessors.test
-[ t ] [ 20 random 20 random bit-reader infer ( alien -- n ) effect= ] unit-test
-[ t ] [ 20 random 20 random bit-writer infer ( n alien -- ) effect= ] unit-test
+{ t } [ 20 random 20 random bit-reader infer ( alien -- n ) effect= ] unit-test
+{ t } [ 20 random 20 random bit-writer infer ( n alien -- ) effect= ] unit-test
{ w ushort initial: 0xffff }
{ foo struct-test-foo } ;
-[ 12 ] [ struct-test-foo heap-size ] unit-test
-[ 12 ] [ struct-test-foo <struct> byte-length ] unit-test
-[ 16 ] [ struct-test-bar heap-size ] unit-test
-[ 123 ] [ struct-test-foo <struct> y>> ] unit-test
-[ 123 ] [ struct-test-bar <struct> foo>> y>> ] unit-test
+{ 12 } [ struct-test-foo heap-size ] unit-test
+{ 12 } [ struct-test-foo <struct> byte-length ] unit-test
+{ 16 } [ struct-test-bar heap-size ] unit-test
+{ 123 } [ struct-test-foo <struct> y>> ] unit-test
+{ 123 } [ struct-test-bar <struct> foo>> y>> ] unit-test
-[ 1 2 3 t ] [
+{ 1 2 3 t } [
1 2 3 t struct-test-foo <struct-boa> struct-test-bar <struct-boa>
{
[ w>> ]
} cleave
] unit-test
-[ 7654 ] [ S{ struct-test-foo f 98 7654 f } y>> ] unit-test
-[ 7654 ] [ S{ struct-test-foo { y 7654 } } y>> ] unit-test
+{ 7654 } [ S{ struct-test-foo f 98 7654 f } y>> ] unit-test
+{ 7654 } [ S{ struct-test-foo { y 7654 } } y>> ] unit-test
-[ {
+{ {
{ "underlying" B{ 98 0 0 98 127 0 0 127 0 0 0 0 } }
{ { "x" char } 98 }
{ { "y" int } 0x7F00007F }
{ { "z" bool } f }
-} ] [
+} } [
B{ 98 0 0 98 127 0 0 127 0 0 0 0 } struct-test-foo memory>struct
make-mirror >alist
] unit-test
-[ { { "underlying" f } } ] [
+{ { { "underlying" f } } } [
f struct-test-foo memory>struct
make-mirror >alist
] unit-test
-[ 55 t ] [ S{ struct-test-foo { x 55 } } make-mirror { "x" "char" } ?of ] unit-test
-[ 55 t ] [ S{ struct-test-foo { y 55 } } make-mirror { "y" "int" } ?of ] unit-test
-[ t t ] [ S{ struct-test-foo { z t } } make-mirror { "z" "bool" } ?of ] unit-test
-[ f t ] [ S{ struct-test-foo { z f } } make-mirror { "z" "bool" } ?of ] unit-test
-[ { "nonexist" "bool" } f ] [ S{ struct-test-foo } make-mirror { "nonexist" "bool" } ?of ] unit-test
-[ "nonexist" f ] [ S{ struct-test-foo } make-mirror "nonexist" ?of ] unit-test
-[ f t ] [ f struct-test-foo memory>struct make-mirror "underlying" ?of ] unit-test
+{ 55 t } [ S{ struct-test-foo { x 55 } } make-mirror { "x" "char" } ?of ] unit-test
+{ 55 t } [ S{ struct-test-foo { y 55 } } make-mirror { "y" "int" } ?of ] unit-test
+{ t t } [ S{ struct-test-foo { z t } } make-mirror { "z" "bool" } ?of ] unit-test
+{ f t } [ S{ struct-test-foo { z f } } make-mirror { "z" "bool" } ?of ] unit-test
+{ { "nonexist" "bool" } f } [ S{ struct-test-foo } make-mirror { "nonexist" "bool" } ?of ] unit-test
+{ "nonexist" f } [ S{ struct-test-foo } make-mirror "nonexist" ?of ] unit-test
+{ f t } [ f struct-test-foo memory>struct make-mirror "underlying" ?of ] unit-test
-[ S{ struct-test-foo { x 3 } { y 2 } { z f } } ] [
+{ S{ struct-test-foo { x 3 } { y 2 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror [ 3 { "x" "char" } ] dip set-at ] keep
] unit-test
-[ S{ struct-test-foo { x 1 } { y 5 } { z f } } ] [
+{ S{ struct-test-foo { x 1 } { y 5 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror [ 5 { "y" "int" } ] dip set-at ] keep
] unit-test
-[ S{ struct-test-foo { x 1 } { y 2 } { z t } } ] [
+{ S{ struct-test-foo { x 1 } { y 2 } { z t } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror [ t { "z" "bool" } ] dip set-at ] keep
] unit-test
-[ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [
+{ S{ struct-test-foo { x 1 } { y 2 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror [ "nonsense" "underlying" ] dip set-at ] keep
] unit-test
-[ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [
+{ S{ struct-test-foo { x 1 } { y 2 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror [ "nonsense" "nonexist" ] dip set-at ] keep
] unit-test
-[ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [
+{ S{ struct-test-foo { x 1 } { y 2 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror [ "nonsense" { "nonexist" "int" } ] dip set-at ] keep
] unit-test
-[ S{ struct-test-foo { x 1 } { y 123 } { z f } } ] [
+{ S{ struct-test-foo { x 1 } { y 123 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror { "y" "int" } swap delete-at ] keep
] unit-test
-[ S{ struct-test-foo { x 0 } { y 2 } { z f } } ] [
+{ S{ struct-test-foo { x 0 } { y 2 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror { "x" "char" } swap delete-at ] keep
] unit-test
-[ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [
+{ S{ struct-test-foo { x 1 } { y 2 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror { "nonexist" "char" } swap delete-at ] keep
] unit-test
-[ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [
+{ S{ struct-test-foo { x 1 } { y 2 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror "underlying" swap delete-at ] keep
] unit-test
-[ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [
+{ S{ struct-test-foo { x 1 } { y 2 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z f } }
[ make-mirror "nonsense" swap delete-at ] keep
] unit-test
-[ S{ struct-test-foo { x 0 } { y 123 } { z f } } ] [
+{ S{ struct-test-foo { x 0 } { y 123 } { z f } } } [
S{ struct-test-foo { x 1 } { y 2 } { z t } }
[ make-mirror clear-assoc ] keep
] unit-test
-[ POSTPONE: STRUCT: ]
+{ POSTPONE: STRUCT: }
[ struct-test-foo struct-definer-word ] unit-test
UNION-STRUCT: struct-test-float-and-bits
{ f c:float }
{ bits uint } ;
-[ 1.0 ] [ struct-test-float-and-bits <struct> 1.0 float>bits >>bits f>> ] unit-test
-[ 4 ] [ struct-test-float-and-bits heap-size ] unit-test
+{ 1.0 } [ struct-test-float-and-bits <struct> 1.0 float>bits >>bits f>> ] unit-test
+{ 4 } [ struct-test-float-and-bits heap-size ] unit-test
-[ 123 ] [ [ struct-test-foo malloc-struct &free y>> ] with-destructors ] unit-test
+{ 123 } [ [ struct-test-foo malloc-struct &free y>> ] with-destructors ] unit-test
-[ POSTPONE: UNION-STRUCT: ]
+{ POSTPONE: UNION-STRUCT: }
[ struct-test-float-and-bits struct-definer-word ] unit-test
STRUCT: struct-test-string-ptr
{ x c-string } ;
-[ "hello world" ] [
+{ "hello world" } [
[
struct-test-string-ptr <struct>
"hello world" utf8 malloc-string &free >>x
] with-destructors
] unit-test
-[ "S{ struct-test-foo { x 0 } { y 7654 } { z f } }" ]
+{ "S{ struct-test-foo { x 0 } { y 7654 } { z f } }" }
[
H{ { boa-tuples? f } { c-object-pointers? f } } [
struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer
] with-variables
] unit-test
-[ "S@ struct-test-foo B{ 0 0 0 0 0 0 0 0 0 0 0 0 }" ]
+{ "S@ struct-test-foo B{ 0 0 0 0 0 0 0 0 0 0 0 0 }" }
[
H{ { c-object-pointers? t } } [
12 <byte-array> struct-test-foo memory>struct [ pprint ] with-string-writer
] with-variables
] unit-test
-[ "S{ struct-test-foo f 0 7654 f }" ]
+{ "S{ struct-test-foo f 0 7654 f }" }
[
H{ { boa-tuples? t } { c-object-pointers? f } } [
struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer
] with-variables
] unit-test
-[ "S@ struct-test-foo f" ]
+{ "S@ struct-test-foo f" }
[
H{ { c-object-pointers? f } } [
f struct-test-foo memory>struct [ pprint ] with-string-writer
] with-variables
] unit-test
-[ "USING: alien.c-types classes.struct ;
+{ "USING: alien.c-types classes.struct ;
IN: classes.struct.tests
STRUCT: struct-test-foo
{ x char initial: 0 } { y int initial: 123 } { z bool } ;
-" ]
+" }
[ [ struct-test-foo see ] with-string-writer ] unit-test
-[ "USING: alien.c-types classes.struct ;
+{ "USING: alien.c-types classes.struct ;
IN: classes.struct.tests
UNION-STRUCT: struct-test-float-and-bits
{ f float initial: 0.0 } { bits uint initial: 0 } ;
-" ]
+" }
[ [ struct-test-float-and-bits see ] with-string-writer ] unit-test
-[ {
+{ {
T{ struct-slot-spec
{ name "x" }
{ offset 0 }
{ type bool }
{ class object }
}
-} ] [ struct-test-foo lookup-c-type fields>> ] unit-test
+} } [ struct-test-foo lookup-c-type fields>> ] unit-test
-[ {
+{ {
T{ struct-slot-spec
{ name "f" }
{ offset 0 }
{ class $[ cell 4 = integer fixnum ? ] }
{ initial 0 }
}
-} ] [ struct-test-float-and-bits lookup-c-type fields>> ] unit-test
+} } [ struct-test-float-and-bits lookup-c-type fields>> ] unit-test
STRUCT: struct-test-equality-1
{ x int } ;
STRUCT: struct-test-equality-2
{ y int } ;
-[ 0 ] [ struct-test-equality-1 new hashcode ] unit-test
+{ 0 } [ struct-test-equality-1 new hashcode ] unit-test
-[ t ] [
+{ t } [
[
struct-test-equality-1 <struct> 5 >>x
struct-test-equality-1 malloc-struct &free 5 >>x =
] with-destructors
] unit-test
-[ f ] [
+{ f } [
[
struct-test-equality-1 <struct> 5 >>x
struct-test-equality-2 malloc-struct &free 5 >>y =
] with-destructors
] unit-test
-[ t ] [
+{ t } [
[
struct-test-equality-1 <struct> 5 >>x
struct-test-equality-1 malloc-struct &free 5 >>x
{ y ushort[6] initial: ushort-array{ 2 3 5 7 11 13 } }
{ z int } ;
-[ 11 ] [ struct-test-array-slots <struct> y>> 4 swap nth ] unit-test
+{ 11 } [ struct-test-array-slots <struct> y>> 4 swap nth ] unit-test
-[ t ] [
+{ t } [
struct-test-array-slots <struct>
[ y>> [ 8 3 ] dip set-nth ]
[ y>> ushort-array{ 2 3 5 8 11 13 } sequence= ] bi
SPECIALIZED-ARRAY: struct-test-optimization
-[ t ] [ [ struct-test-optimization memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test
-[ t ] [
+{ t } [ [ struct-test-optimization memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test
+{ t } [
[ 3 struct-test-optimization <c-direct-array> third y>> ]
{ <tuple> <tuple-boa> memory>struct y>> } inlined?
] unit-test
-[ t ] [ [ struct-test-optimization memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test
+{ t } [ [ struct-test-optimization memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test
-[ t ] [
+{ t } [
[ struct-test-optimization memory>struct x>> second ]
{ memory>struct x>> int <c-direct-array> <tuple> <tuple-boa> } inlined?
] unit-test
-[ f ] [ [ memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test
+{ f } [ [ memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test
-[ t ] [
+{ t } [
[ struct-test-optimization <struct> struct-test-optimization <struct> [ x>> ] bi@ ]
{ x>> } inlined?
] unit-test
-[ ] [
+{ } [
[
struct-test-optimization specialized-array-vocab forget-vocab
] with-compilation-unit
! Test cloning structs
STRUCT: clone-test-struct { x int } { y char[3] } ;
-[ 1 char-array{ 9 1 1 } ] [
+{ 1 char-array{ 9 1 1 } } [
clone-test-struct <struct>
1 >>x char-array{ 9 1 1 } >>y
clone
[ x>> ] [ y>> char >c-array ] bi
] unit-test
-[ t 1 char-array{ 9 1 1 } ] [
+{ t 1 char-array{ 9 1 1 } } [
[
clone-test-struct malloc-struct &free
1 >>x char-array{ 9 1 1 } >>y
: struct-that's-a-word ( -- ) "OOPS" throw ;
-[ -77 ] [ S{ struct-that's-a-word { x -77 } } clone x>> ] unit-test
+{ -77 } [ S{ struct-that's-a-word { x -77 } } clone x>> ] unit-test
! Interactive parsing of struct slot definitions
[
TUPLE: a-subclass < will-become-struct ;
-[ f ] [ will-become-struct struct-class? ] unit-test
+{ f } [ will-become-struct struct-class? ] unit-test
-[ will-become-struct ] [ a-subclass superclass ] unit-test
+{ will-become-struct } [ a-subclass superclass ] unit-test
-[ ] [ "IN: classes.struct.tests USING: classes.struct alien.c-types ; STRUCT: will-become-struct { x int } ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.struct.tests USING: classes.struct alien.c-types ; STRUCT: will-become-struct { x int } ;" eval( -- ) ] unit-test
-[ t ] [ will-become-struct struct-class? ] unit-test
+{ t } [ will-become-struct struct-class? ] unit-test
-[ tuple ] [ a-subclass superclass ] unit-test
+{ tuple } [ a-subclass superclass ] unit-test
STRUCT: bit-field-test
{ a uint bits: 12 }
{ b int bits: 2 }
{ c char } ;
-[ S{ bit-field-test f 0 0 0 } ] [ bit-field-test <struct> ] unit-test
-[ S{ bit-field-test f 1 -2 3 } ] [ bit-field-test <struct> 1 >>a 2 >>b 3 >>c ] unit-test
-[ 4095 ] [ bit-field-test <struct> 8191 >>a a>> ] unit-test
-[ 1 ] [ bit-field-test <struct> 1 >>b b>> ] unit-test
-[ -2 ] [ bit-field-test <struct> 2 >>b b>> ] unit-test
-[ 1 ] [ bit-field-test <struct> 257 >>c c>> ] unit-test
-[ 3 ] [ bit-field-test heap-size ] unit-test
+{ S{ bit-field-test f 0 0 0 } } [ bit-field-test <struct> ] unit-test
+{ S{ bit-field-test f 1 -2 3 } } [ bit-field-test <struct> 1 >>a 2 >>b 3 >>c ] unit-test
+{ 4095 } [ bit-field-test <struct> 8191 >>a a>> ] unit-test
+{ 1 } [ bit-field-test <struct> 1 >>b b>> ] unit-test
+{ -2 } [ bit-field-test <struct> 2 >>b b>> ] unit-test
+{ 1 } [ bit-field-test <struct> 257 >>c c>> ] unit-test
+{ 3 } [ bit-field-test heap-size ] unit-test
STRUCT: referent
{ y int } ;
STRUCT: referrer
{ x referent* } ;
-[ 57 ] [
+{ 57 } [
[
referrer <struct>
referent malloc-struct &free
{ x self-referent* }
{ y int } ;
-[ 75 ] [
+{ 75 } [
[
self-referent <struct>
self-referent malloc-struct &free
{ x backward-referent* }
{ y int } ;
-[ 41 ] [
+{ 41 } [
[
forward-referent <struct>
backward-referent malloc-struct &free
] with-destructors
] unit-test
-[ 14 ] [
+{ 14 } [
[
backward-referent <struct>
forward-referent malloc-struct &free
{ b int } ;
CONSULT: struct-test-delegate struct-test-delegator del>> ;
-[ S{ struct-test-delegator f S{ struct-test-delegate f 7 } 8 } ] [
+{ S{ struct-test-delegator f S{ struct-test-delegate f 7 } 8 } } [
struct-test-delegator <struct>
7 >>a
8 >>b
STRUCT: silly-array-field-test { x int*[3] } ;
-[ t ] [ silly-array-field-test <struct> x>> void*-array? ] unit-test
+{ t } [ silly-array-field-test <struct> x>> void*-array? ] unit-test
! Packed structs
PACKED-STRUCT: packed-struct-test
{ g c:char }
{ h c:int } ;
-[ 15 ] [ packed-struct-test heap-size ] unit-test
+{ 15 } [ packed-struct-test heap-size ] unit-test
-[ 0 ] [ "d" packed-struct-test offset-of ] unit-test
-[ 4 ] [ "e" packed-struct-test offset-of ] unit-test
-[ 6 ] [ "f" packed-struct-test offset-of ] unit-test
-[ 10 ] [ "g" packed-struct-test offset-of ] unit-test
-[ 11 ] [ "h" packed-struct-test offset-of ] unit-test
+{ 0 } [ "d" packed-struct-test offset-of ] unit-test
+{ 4 } [ "e" packed-struct-test offset-of ] unit-test
+{ 6 } [ "f" packed-struct-test offset-of ] unit-test
+{ 10 } [ "g" packed-struct-test offset-of ] unit-test
+{ 11 } [ "h" packed-struct-test offset-of ] unit-test
-[ POSTPONE: PACKED-STRUCT: ]
+{ POSTPONE: PACKED-STRUCT: }
[ packed-struct-test struct-definer-word ] unit-test
STRUCT: struct-1 { a c:int } ;
PACKED-STRUCT: struct-1-packed { a c:int } ;
UNION-STRUCT: struct-1-union { a c:int } ;
-[ "USING: alien.c-types classes.struct ;
+{ "USING: alien.c-types classes.struct ;
IN: classes.struct.tests
STRUCT: struct-1 { a int initial: 0 } ;
-" ]
+" }
[ \ struct-1 [ see ] with-string-writer ] unit-test
-[ "USING: alien.c-types classes.struct ;
+{ "USING: alien.c-types classes.struct ;
IN: classes.struct.tests
PACKED-STRUCT: struct-1-packed { a int initial: 0 } ;
-" ]
+" }
[ \ struct-1-packed [ see ] with-string-writer ] unit-test
-[ "USING: alien.c-types classes.struct ;
+{ "USING: alien.c-types classes.struct ;
IN: classes.struct.tests
STRUCT: struct-1-union { a int initial: 0 } ;
-" ]
+" }
[ \ struct-1-union [ see ] with-string-writer ] unit-test
! Bug #206
STRUCT: going-to-redefine { a uint } ;
-[ ] [
+{ } [
"IN: classes.struct.tests TUPLE: going-to-redefine b ;" eval( -- )
] unit-test
-[ f ] [ \ going-to-redefine \ clone ?lookup-method ] unit-test
-[ f ] [ \ going-to-redefine \ struct-slot-values ?lookup-method ] unit-test
+{ f } [ \ going-to-redefine \ clone ?lookup-method ] unit-test
+{ f } [ \ going-to-redefine \ struct-slot-values ?lookup-method ] unit-test
! Test reset-class on structs, which should forget all the accessors, clone, and struct-slot-values
STRUCT: some-accessors { aaa uint } { bbb int } ;
-[ ] [ [ \ some-accessors reset-class ] with-compilation-unit ] unit-test
-[ f ] [ \ some-accessors \ a>> ?lookup-method ] unit-test
-[ f ] [ \ some-accessors \ a<< ?lookup-method ] unit-test
-[ f ] [ \ some-accessors \ b>> ?lookup-method ] unit-test
-[ f ] [ \ some-accessors \ b<< ?lookup-method ] unit-test
-[ f ] [ \ some-accessors \ clone ?lookup-method ] unit-test
-[ f ] [ \ some-accessors \ struct-slot-values ?lookup-method ] unit-test
+{ } [ [ \ some-accessors reset-class ] with-compilation-unit ] unit-test
+{ f } [ \ some-accessors \ a>> ?lookup-method ] unit-test
+{ f } [ \ some-accessors \ a<< ?lookup-method ] unit-test
+{ f } [ \ some-accessors \ b>> ?lookup-method ] unit-test
+{ f } [ \ some-accessors \ b<< ?lookup-method ] unit-test
+{ f } [ \ some-accessors \ clone ?lookup-method ] unit-test
+{ f } [ \ some-accessors \ struct-slot-values ?lookup-method ] unit-test
<< \ some-accessors forget >>
USING: tools.test colors.constants colors ;
IN: colors.constants.tests
-[ t ] [ COLOR: light-green rgba? ] unit-test
+{ t } [ COLOR: light-green rgba? ] unit-test
IN: colors.hex.test
-[ HEXCOLOR: 000000 ] [ 0.0 0.0 0.0 1.0 <rgba> ] unit-test
-[ HEXCOLOR: FFFFFF ] [ 1.0 1.0 1.0 1.0 <rgba> ] unit-test
-[ HEXCOLOR: abcdef ] [ "abcdef" hex>rgba ] unit-test
-[ HEXCOLOR: abcdef ] [ "ABCDEF" hex>rgba ] unit-test
-[ "ABCDEF" ] [ HEXCOLOR: abcdef rgba>hex ] unit-test
+{ HEXCOLOR: 000000 } [ 0.0 0.0 0.0 1.0 <rgba> ] unit-test
+{ HEXCOLOR: FFFFFF } [ 1.0 1.0 1.0 1.0 <rgba> ] unit-test
+{ HEXCOLOR: abcdef } [ "abcdef" hex>rgba ] unit-test
+{ HEXCOLOR: abcdef } [ "ABCDEF" hex>rgba ] unit-test
+{ "ABCDEF" } [ HEXCOLOR: abcdef rgba>hex ] unit-test
[ 360 * ] 2dip
1 <hsva> >rgba [ red>> ] [ green>> ] [ blue>> ] tri ;
-[ 1/2 1/2 1/2 ] [ 0 0 1/2 hsv>rgb ] unit-test
+{ 1/2 1/2 1/2 } [ 0 0 1/2 hsv>rgb ] unit-test
-[ 1/2 1/4 1/4 ] [ 0 1/2 1/2 hsv>rgb ] unit-test
-[ 1/3 2/9 2/9 ] [ 0 1/3 1/3 hsv>rgb ] unit-test
+{ 1/2 1/4 1/4 } [ 0 1/2 1/2 hsv>rgb ] unit-test
+{ 1/3 2/9 2/9 } [ 0 1/3 1/3 hsv>rgb ] unit-test
-[ 24/125 1/5 4/25 ] [ 1/5 1/5 1/5 hsv>rgb ] unit-test
-[ 29/180 1/6 5/36 ] [ 1/5 1/6 1/6 hsv>rgb ] unit-test
+{ 24/125 1/5 4/25 } [ 1/5 1/5 1/5 hsv>rgb ] unit-test
+{ 29/180 1/6 5/36 } [ 1/5 1/6 1/6 hsv>rgb ] unit-test
-[ 6/25 2/5 38/125 ] [ 2/5 2/5 2/5 hsv>rgb ] unit-test
-[ 8/25 4/5 64/125 ] [ 2/5 3/5 4/5 hsv>rgb ] unit-test
+{ 6/25 2/5 38/125 } [ 2/5 2/5 2/5 hsv>rgb ] unit-test
+{ 8/25 4/5 64/125 } [ 2/5 3/5 4/5 hsv>rgb ] unit-test
-[ 6/25 48/125 3/5 ] [ 3/5 3/5 3/5 hsv>rgb ] unit-test
-[ 0 0 0 ] [ 3/5 1/5 0 hsv>rgb ] unit-test
+{ 6/25 48/125 3/5 } [ 3/5 3/5 3/5 hsv>rgb ] unit-test
+{ 0 0 0 } [ 3/5 1/5 0 hsv>rgb ] unit-test
-[ 84/125 4/25 4/5 ] [ 4/5 4/5 4/5 hsv>rgb ] unit-test
-[ 7/15 1/3 1/2 ] [ 4/5 1/3 1/2 hsv>rgb ] unit-test
+{ 84/125 4/25 4/5 } [ 4/5 4/5 4/5 hsv>rgb ] unit-test
+{ 7/15 1/3 1/2 } [ 4/5 1/3 1/2 hsv>rgb ] unit-test
-[ 5/6 5/36 5/6 ] [ 5/6 5/6 5/6 hsv>rgb ] unit-test
-[ 1/6 0 1/6 ] [ 5/6 1 1/6 hsv>rgb ] unit-test
+{ 5/6 5/36 5/6 } [ 5/6 5/6 5/6 hsv>rgb ] unit-test
+{ 1/6 0 1/6 } [ 5/6 1 1/6 hsv>rgb ] unit-test
-[ 0.5 ] [ 180 0.1 0.2 0.5 <hsva> alpha>> ] unit-test
+{ 0.5 } [ 180 0.1 0.2 0.5 <hsva> alpha>> ] unit-test
USING: tools.test combinators.random combinators.random.private ;
IN: combinators.random.tests
-[ 1 ] [ 1 [ 1 ] [ 2 ] ifp ] unit-test
-[ 2 ] [ 0 [ 1 ] [ 2 ] ifp ] unit-test
+{ 1 } [ 1 [ 1 ] [ 2 ] ifp ] unit-test
+{ 2 } [ 0 [ 1 ] [ 2 ] ifp ] unit-test
-[ 3 ]
+{ 3 }
[ { { 0 [ 1 ] }
{ 0 [ 2 ] }
{ 1 [ 3 ] }
[ 4 ]
} casep ] unit-test
-[ 4 ]
+{ 4 }
[ { { 0 [ 1 ] }
{ 0 [ 2 ] }
{ 0 [ 3 ] }
[ 4 ]
} casep ] unit-test
-[ 1 1 ] [ 1 {
+{ 1 1 } [ 1 {
{ 1 [ 1 ] }
{ 0 [ 2 ] }
{ 0 [ 3 ] }
[ 4 ]
} casep ] unit-test
-[ 1 4 ] [ 1 {
+{ 1 4 } [ 1 {
{ 0 [ 1 ] }
{ 0 [ 2 ] }
{ 0 [ 3 ] }
[ 4 ]
} casep ] unit-test
-[ 2 ] [ 0.7 {
+{ 2 } [ 0.7 {
{ 0.3 [ 1 ] }
{ 0.5 [ 2 ] }
[ 2 ] } (casep) ] unit-test
-[ { { 1/3 [ 1 ] }
+{ { { 1/3 [ 1 ] }
{ 1/3 [ 2 ] }
- { 1/3 [ 3 ] } } ]
+ { 1/3 [ 3 ] } } }
[ { [ 1 ] [ 2 ] [ 3 ] } call-random>casep ] unit-test
-[ { { 1/2 [ 1 ] }
+{ { { 1/2 [ 1 ] }
{ 1/4 [ 2 ] }
- { 1/4 [ 3 ] } } ]
+ { 1/4 [ 3 ] } } }
[ { { 1/2 [ 1 ] }
{ 1/2 [ 2 ] }
{ 1 [ 3 ] } } direct>conditional ] unit-test
-[ { { 1/2 [ 1 ] }
+{ { { 1/2 [ 1 ] }
{ 1/4 [ 2 ] }
- { [ 3 ] } } ]
+ { [ 3 ] } } }
[ { { 1/2 [ 1 ] }
{ 1/2 [ 2 ] }
{ [ 3 ] } } direct>conditional ] unit-test
-[ f ] [ { { 0.6 [ 1 ] }
+{ f } [ { { 0.6 [ 1 ] }
{ 0.6 [ 2 ] } } good-probabilities? ] unit-test
-[ f ] [ { { 0.3 [ 1 ] }
+{ f } [ { { 0.3 [ 1 ] }
{ 0.6 [ 2 ] } } good-probabilities? ] unit-test
-[ f ] [ { { -0.6 [ 1 ] }
+{ f } [ { { -0.6 [ 1 ] }
{ 1.4 [ 2 ] } } good-probabilities? ] unit-test
-[ f ] [ { { -0.6 [ 1 ] }
+{ f } [ { { -0.6 [ 1 ] }
[ 2 ] } good-probabilities? ] unit-test
-[ t ] [ { { 0.6 [ 1 ] }
+{ t } [ { { 0.6 [ 1 ] }
[ 2 ] } good-probabilities? ] unit-test
-[ t ] [ { { 0.6 [ 1 ] }
+{ t } [ { { 0.6 [ 1 ] }
{ 0.4 [ 2 ] } } good-probabilities? ] unit-test
USING: kernel math tools.test combinators.short-circuit accessors ;
IN: combinators.short-circuit.tests
-[ 3 ] [ { [ 1 ] [ 2 ] [ 3 ] } 0&& ] unit-test
-[ 5 ] [ 3 { [ 0 > ] [ odd? ] [ 2 + ] } 1&& ] unit-test
-[ 30 ] [ 10 20 { [ + 0 > ] [ - even? ] [ + ] } 2&& ] unit-test
+{ 3 } [ { [ 1 ] [ 2 ] [ 3 ] } 0&& ] unit-test
+{ 5 } [ 3 { [ 0 > ] [ odd? ] [ 2 + ] } 1&& ] unit-test
+{ 30 } [ 10 20 { [ + 0 > ] [ - even? ] [ + ] } 2&& ] unit-test
-[ f ] [ { [ 1 ] [ f ] [ 3 ] } 0&& ] unit-test
-[ f ] [ 3 { [ 0 > ] [ even? ] [ 2 + ] } 1&& ] unit-test
-[ f ] [ 10 20 { [ + 0 > ] [ - odd? ] [ + ] } 2&& ] unit-test
+{ f } [ { [ 1 ] [ f ] [ 3 ] } 0&& ] unit-test
+{ f } [ 3 { [ 0 > ] [ even? ] [ 2 + ] } 1&& ] unit-test
+{ f } [ 10 20 { [ + 0 > ] [ - odd? ] [ + ] } 2&& ] unit-test
-[ "factor" ] [ { [ 10 0 < ] [ f ] [ "factor" ] } 0|| ] unit-test
-[ 11 ] [ 10 { [ odd? ] [ 100 > ] [ 1 + ] } 1|| ] unit-test
-[ 30 ] [ 10 20 { [ + odd? ] [ + 100 > ] [ + ] } 2|| ] unit-test
-[ f ] [ { [ 10 0 < ] [ f ] [ 0 1 = ] } 0|| ] unit-test
+{ "factor" } [ { [ 10 0 < ] [ f ] [ "factor" ] } 0|| ] unit-test
+{ 11 } [ 10 { [ odd? ] [ 100 > ] [ 1 + ] } 1|| ] unit-test
+{ 30 } [ 10 20 { [ + odd? ] [ + 100 > ] [ + ] } 2|| ] unit-test
+{ f } [ { [ 10 0 < ] [ f ] [ 0 1 = ] } 0|| ] unit-test
: compiled-&& ( a -- ? ) { [ 0 > ] [ even? ] [ 2 + ] } 1&& ;
-[ f ] [ 3 compiled-&& ] unit-test
-[ 4 ] [ 2 compiled-&& ] unit-test
+{ f } [ 3 compiled-&& ] unit-test
+{ 4 } [ 2 compiled-&& ] unit-test
: compiled-|| ( a b -- ? ) { [ + odd? ] [ + 100 > ] [ + ] } 2|| ;
-[ 30 ] [ 10 20 compiled-|| ] unit-test
-[ 2 ] [ 1 1 compiled-|| ] unit-test
+{ 30 } [ 10 20 compiled-|| ] unit-test
+{ 2 } [ 1 1 compiled-|| ] unit-test
! && and || should be row-polymorphic both when compiled and when interpreted
: row-&& ( -- ? )
f t { [ drop dup ] } 1&& nip ;
-[ f ] [ row-&& ] unit-test
-[ f ] [ \ row-&& def>> call ] unit-test
+{ f } [ row-&& ] unit-test
+{ f } [ \ row-&& def>> call ] unit-test
: row-|| ( -- ? )
f t { [ drop dup ] } 1|| nip ;
-[ f ] [ row-|| ] unit-test
-[ f ] [ \ row-|| def>> call ] unit-test
+{ f } [ row-|| ] unit-test
+{ f } [ \ row-|| def>> call ] unit-test
USING: kernel math tools.test combinators.short-circuit.smart ;
IN: combinators.short-circuit.smart.tests
-[ t ] [ { [ 1 ] [ 2 ] [ 3 ] } && 3 = ] unit-test
-[ t ] [ 3 { [ 0 > ] [ odd? ] [ 2 + ] } && 5 = ] unit-test
-[ t ] [ 10 20 { [ + 0 > ] [ - even? ] [ + ] } && 30 = ] unit-test
+{ t } [ { [ 1 ] [ 2 ] [ 3 ] } && 3 = ] unit-test
+{ t } [ 3 { [ 0 > ] [ odd? ] [ 2 + ] } && 5 = ] unit-test
+{ t } [ 10 20 { [ + 0 > ] [ - even? ] [ + ] } && 30 = ] unit-test
-[ f ] [ { [ 1 ] [ f ] [ 3 ] } && 3 = ] unit-test
-[ f ] [ 3 { [ 0 > ] [ even? ] [ 2 + ] } && ] unit-test
-[ f ] [ 10 20 { [ + 0 > ] [ - odd? ] [ + ] } && 30 = ] unit-test
+{ f } [ { [ 1 ] [ f ] [ 3 ] } && 3 = ] unit-test
+{ f } [ 3 { [ 0 > ] [ even? ] [ 2 + ] } && ] unit-test
+{ f } [ 10 20 { [ + 0 > ] [ - odd? ] [ + ] } && 30 = ] unit-test
-[ t ] [ { [ 10 0 < ] [ f ] [ "factor" ] } || "factor" = ] unit-test
+{ t } [ { [ 10 0 < ] [ f ] [ "factor" ] } || "factor" = ] unit-test
-[ t ] [ 10 { [ odd? ] [ 100 > ] [ 1 + ] } || 11 = ] unit-test
+{ t } [ 10 { [ odd? ] [ 100 > ] [ 1 + ] } || 11 = ] unit-test
-[ t ] [ 10 20 { [ + odd? ] [ + 100 > ] [ + ] } || 30 = ] unit-test
+{ t } [ 10 20 { [ + odd? ] [ + 100 > ] [ + ] } || 30 = ] unit-test
-[ f ] [ { [ 10 0 < ] [ f ] [ 0 1 = ] } || ] unit-test
+{ f } [ { [ 10 0 < ] [ f ] [ 0 1 = ] } || ] unit-test
10 [ 1 - ] [ 1 + ] bi ;
[ [ test-bi ] output>array ] must-infer
-[ { 9 11 } ] [ [ test-bi ] output>array ] unit-test
+{ { 9 11 } } [ [ test-bi ] output>array ] unit-test
[ { 9 11 } [ + ] input<sequence ] must-infer
-[ 20 ] [ { 9 11 } [ + ] input<sequence ] unit-test
+{ 20 } [ { 9 11 } [ + ] input<sequence ] unit-test
-[ 6 ] [ [ 1 2 3 ] [ + ] reduce-outputs ] unit-test
+{ 6 } [ [ 1 2 3 ] [ + ] reduce-outputs ] unit-test
[ [ 1 2 3 ] [ + ] reduce-outputs ] must-infer
-[ 6 ] [ [ 1 2 3 ] sum-outputs ] unit-test
+{ 6 } [ [ 1 2 3 ] sum-outputs ] unit-test
-[ "ab" ]
+{ "ab" }
[
[ "a" "b" ] "" append-outputs-as
] unit-test
-[ "" ]
+{ "" }
[
[ ] "" append-outputs-as
] unit-test
-[ { } ]
+{ { } }
[
[ ] append-outputs
] unit-test
-[ B{ 1 2 3 } ]
+{ B{ 1 2 3 } }
[
[ { 1 } { 2 } { 3 } ] B{ } append-outputs-as
] unit-test
\ nested-smart-combo-test def>> must-infer
-[ { { 1 2 } { 3 4 } } ] [ nested-smart-combo-test ] unit-test
+{ { { 1 2 } { 3 4 } } } [ nested-smart-combo-test ] unit-test
-[ 14 ] [ [ 1 2 3 ] [ sq ] [ + ] map-reduce-outputs ] unit-test
+{ 14 } [ [ 1 2 3 ] [ sq ] [ + ] map-reduce-outputs ] unit-test
{ 2 3 } [ [ + ] preserving ] must-infer-as
: smart-if-test ( a b -- b )
[ < ] [ swap - ] [ - ] smart-if ;
-[ 7 ] [ 10 3 smart-if-test ] unit-test
-[ 16 ] [ 25 41 smart-if-test ] unit-test
+{ 7 } [ 10 3 smart-if-test ] unit-test
+{ 16 } [ 25 41 smart-if-test ] unit-test
-[ { 1 2 } { 3 4 } { 5 6 } ] [ 1 2 3 4 5 6 [ 2array ] 3 smart-apply ] unit-test
-[ { 1 2 3 } { 4 5 6 } ] [ 1 2 3 4 5 6 [ 3array ] 2 smart-apply ] unit-test
+{ { 1 2 } { 3 4 } { 5 6 } } [ 1 2 3 4 5 6 [ 2array ] 3 smart-apply ] unit-test
+{ { 1 2 3 } { 4 5 6 } } [ 1 2 3 4 5 6 [ 3array ] 2 smart-apply ] unit-test
-[ 4 ] [ 2 [ even? ] [ 2 + ] smart-when ] unit-test
-[ 3 ] [ 3 [ even? ] [ 2 + ] smart-when ] unit-test
-[ 4 ] [ 2 [ odd? ] [ 2 + ] smart-unless ] unit-test
-[ 3 ] [ 3 [ odd? ] [ 2 + ] smart-unless ] unit-test
+{ 4 } [ 2 [ even? ] [ 2 + ] smart-when ] unit-test
+{ 3 } [ 3 [ even? ] [ 2 + ] smart-when ] unit-test
+{ 4 } [ 2 [ odd? ] [ 2 + ] smart-unless ] unit-test
+{ 3 } [ 3 [ odd? ] [ 2 + ] smart-unless ] unit-test
-[ 4 ] [ 2 [ even? ] [ 2 + ] smart-when* ] unit-test
-[ ] [ 3 [ even? ] [ 2 + ] smart-when* ] unit-test
-[ 3 ] [ 2 [ odd? ] [ 3 ] smart-unless* ] unit-test
-[ 3 ] [ 3 [ odd? ] [ 5 ] smart-unless* ] unit-test
+{ 4 } [ 2 [ even? ] [ 2 + ] smart-when* ] unit-test
+{ } [ 3 [ even? ] [ 2 + ] smart-when* ] unit-test
+{ 3 } [ 2 [ odd? ] [ 3 ] smart-unless* ] unit-test
+{ 3 } [ 3 [ odd? ] [ 5 ] smart-unless* ] unit-test
-[ -1 ] [ 1 2 [ + odd? ] [ - ] smart-when* ] unit-test
-[ ] [ 2 2 [ + odd? ] [ ] smart-unless* ] unit-test
+{ -1 } [ 1 2 [ + odd? ] [ - ] smart-when* ] unit-test
+{ } [ 2 2 [ + odd? ] [ ] smart-unless* ] unit-test
-[ ( -- x ) ] [ [ [ ] [ call ] curry output>array ] infer ] unit-test
+{ ( -- x ) } [ [ [ ] [ call ] curry output>array ] infer ] unit-test
:: map-reduce-test ( a b c -- d ) [ a b c ] [ a - ] [ b * + ] map-reduce-outputs ;
-[ 10 ] [ 1 2 3 map-reduce-test ] unit-test
+{ 10 } [ 1 2 3 map-reduce-test ] unit-test
-[ ( x x -- x ) ] [ [ curry inputs ] infer ] unit-test
+{ ( x x -- x ) } [ [ curry inputs ] infer ] unit-test
-[ ( x -- x ) ] [ [ [ curry ] curry inputs ] infer ] unit-test
+{ ( x -- x ) } [ [ [ curry ] curry inputs ] infer ] unit-test
{ 1 1 1 } [ 1 3 [ ] smart-with times ] unit-test
{ "BCD" } [ 1 "ABC" [ + ] smart-with map ] unit-test
[ f >>insn# ] map ;
! Redundant load elimination
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
T{ ##copy f 2 1 any-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
] unit-test
! Store-load forwarding
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##set-slot-imm f 1 0 1 0 }
T{ ##copy f 2 1 any-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! Dead store elimination
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
T{ ##set-slot-imm f 2 0 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} test-alias-analysis
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##peek f 3 D 3 }
T{ ##set-slot-imm f 3 0 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! Redundant store elimination
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
} test-alias-analysis
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
T{ ##copy f 2 1 any-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
] unit-test
! Not a redundant load
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##set-slot-imm f 0 1 1 0 }
T{ ##slot-imm f 2 0 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! Not a redundant store
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##slot-imm f 4 0 1 0 }
T{ ##set-slot-imm f 3 1 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! There's a redundant load, but not a redundant store
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##set-slot-imm f 3 0 1 0 }
T{ ##copy f 6 3 any-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
! Fresh allocations don't alias existing values
! Redundant load elimination
-[
+{
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
T{ ##set-slot-imm f 2 1 1 0 }
T{ ##copy f 5 3 any-rep }
}
-] [
+} [
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
] unit-test
! Redundant store elimination
-[
+{
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
T{ ##slot-imm f 5 1 1 0 }
T{ ##set-slot-imm f 3 4 1 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
! Storing a new alias class into another object means that heap-ac
! can now alias the new ac
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##set-slot-imm f 1 5 1 0 }
T{ ##slot-imm f 6 4 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! Compares between objects which cannot alias are eliminated
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##allot f 1 16 array }
T{ ##load-reference f 2 f }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##allot f 1 16 array }
] unit-test
! Make sure that input to ##box-displaced-alien becomes heap-ac
-[
+{
V{
T{ ##allot f 1 16 byte-array }
T{ ##load-reference f 2 10 }
T{ ##slot-imm f 5 3 1 $[ alien type-number ] }
T{ ##compare f 6 5 1 cc= }
}
-] [
+} [
V{
T{ ##allot f 1 16 byte-array }
T{ ##load-reference f 2 10 }
! We can't make any assumptions about heap-ac between
! instructions which can call back into Factor code
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
T{ ##alien-invoke f { } { } { } { } 0 0 "free" }
T{ ##slot-imm f 2 0 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
} test-alias-analysis
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##alien-invoke f { } { } { } { } 0 0 "free" }
T{ ##slot-imm f 2 0 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} test-alias-analysis
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##alien-invoke f { } { } { } { } 0 0 "free" }
T{ ##set-slot-imm f 2 0 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} test-alias-analysis
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
T{ ##alien-invoke f { } { } { } { } 0 0 "free" }
T{ ##set-slot-imm f 1 0 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##slot-imm f 1 0 1 0 }
! We can't eliminate stores on any alias class across a GC-ing
! instruction
-[
+{
V{
T{ ##allot f 0 }
T{ ##slot-imm f 1 0 1 0 }
T{ ##alien-invoke f { } { } { } { } 0 0 "free" }
T{ ##copy f 2 1 any-rep }
}
-] [
+} [
V{
T{ ##allot f 0 }
T{ ##slot-imm f 1 0 1 0 }
} test-alias-analysis
] unit-test
-[
+{
V{
T{ ##allot f 0 }
T{ ##peek f 1 D 1 }
T{ ##alien-invoke f { } { } { } { } 0 0 "free" }
T{ ##copy f 2 1 any-rep }
}
-] [
+} [
V{
T{ ##allot f 0 }
T{ ##peek f 1 D 1 }
} test-alias-analysis
] unit-test
-[
+{
V{
T{ ##allot f 0 }
T{ ##peek f 1 D 1 }
T{ ##alien-invoke f { } { } { } { } 0 0 "free" }
T{ ##set-slot-imm f 2 0 1 0 }
}
-] [
+} [
V{
T{ ##allot f 0 }
T{ ##peek f 1 D 1 }
} test-alias-analysis
] unit-test
-[
+{
V{
T{ ##allot f 0 }
T{ ##slot-imm f 1 0 1 0 }
T{ ##alien-invoke f { } { } { } { } 0 0 "free" }
}
-] [
+} [
V{
T{ ##allot f 0 }
T{ ##slot-imm f 1 0 1 0 }
! Make sure that gc-map-insns which are also vreg-insns are
! handled properly
-[
+{
V{
T{ ##allot f 0 }
T{ ##alien-indirect f { } { } { { 2 double-rep 0 } } { } 0 0 "free" }
T{ ##set-slot-imm f 2 0 1 0 }
}
-] [
+} [
V{
T{ ##allot f 0 }
T{ ##alien-indirect f { } { } { { 2 double-rep 0 } } { } 0 0 "free" }
test-diamond
-[ ] [ test-branch-splitting ] unit-test
+{ } [ test-branch-splitting ] unit-test
V{ T{ ##branch } } 0 test-bb
2 { 3 4 } edges
-[ ] [ test-branch-splitting ] unit-test
+{ } [ test-branch-splitting ] unit-test
V{ T{ ##branch } } 0 test-bb
2 4 edge
-[ ] [ test-branch-splitting ] unit-test
+{ } [ test-branch-splitting ] unit-test
V{ T{ ##branch } } 0 test-bb
1 2 edge
-[ ] [ test-branch-splitting ] unit-test
+{ } [ test-branch-splitting ] unit-test
{ pinned-c-ptr class fixnum } \ set-alien-cell '[ _ declare _ execute ] unit-test-builder
] each
-[ t ] [ [ swap ] [ ##replace? ] contains-insn? ] unit-test
+{ t } [ [ swap ] [ ##replace? ] contains-insn? ] unit-test
-[ f ] [ [ swap swap ] [ ##replace? ] contains-insn? ] unit-test
+{ f } [ [ swap swap ] [ ##replace? ] contains-insn? ] unit-test
-[ t ] [
+{ t } [
[ { fixnum byte-array fixnum } declare set-alien-unsigned-1 ]
[ [ ##store-memory? ] [ ##store-memory-imm? ] bi or ] contains-insn?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum byte-array fixnum } declare [ dup * dup * ] 2dip set-alien-unsigned-1 ]
[ [ ##store-memory? ] [ ##store-memory-imm? ] bi or ] contains-insn?
] unit-test
-[ f ] [
+{ f } [
[ { byte-array fixnum } declare set-alien-unsigned-1 ]
[ [ ##store-memory? ] [ ##store-memory-imm? ] bi or ] contains-insn?
] unit-test
-[ t t ] [
+{ t t } [
[ { byte-array fixnum } declare alien-cell ]
[ [ [ ##load-memory? ] [ ##load-memory-imm? ] bi or ] contains-insn? ]
[ [ ##box-alien? ] contains-insn? ]
bi
] unit-test
-[ f ] [
+{ f } [
[ { byte-array integer } declare alien-cell ]
[ [ ##load-memory? ] [ ##load-memory-imm? ] bi or ] contains-insn?
] unit-test
-[ f ] [
+{ f } [
[ 1000 [ ] times ] [ ##peek? ] contains-insn?
] unit-test
-[ f t ] [
+{ f t } [
[ { fixnum alien } declare <displaced-alien> 0 alien-cell ]
[ [ ##unbox-any-c-ptr? ] contains-insn? ]
[ [ ##unbox-alien? ] contains-insn? ] bi
] when
! Regression. Make sure everything is inlined correctly
-[ f ] [ M\ hashtable set-at [ { [ ##call? ] [ word>> \ set-slot eq? ] } 1&& ] contains-insn? ] unit-test
+{ f } [ M\ hashtable set-at [ { [ ##call? ] [ word>> \ set-slot eq? ] } 1&& ] contains-insn? ] unit-test
! Regression. Make sure branch splitting works.
-[ 2 ] [ [ 1 2 ? ] [ ##return? ] count-insns ] unit-test
+{ 2 } [ [ 1 2 ? ] [ ##return? ] count-insns ] unit-test
! Make sure fast union predicates don't have conditionals.
-[ f ] [
+{ f } [
[ tag 1 swap fixnum-shift-fast ]
[ ##compare-integer-imm-branch? ] contains-insn?
] unit-test
3 4 edge
4 5 edge
-[ ] [ test-copy-propagation ] unit-test
+{ } [ test-copy-propagation ] unit-test
-[
+{
V{
T{ ##replace f 0 D 0 }
T{ ##replace f 4 D 1 }
T{ ##replace f 4 D 2 }
T{ ##branch }
}
-] [ 5 get instructions>> ] unit-test
+} [ 5 get instructions>> ] unit-test
! Test optimistic assumption
V{
2 { 2 3 } edges
3 4 edge
-[ ] [ test-copy-propagation ] unit-test
+{ } [ test-copy-propagation ] unit-test
-[
+{
V{
T{ ##replace f 0 D 1 }
T{ ##branch }
}
-] [ 3 get instructions>> ] unit-test
+} [ 3 get instructions>> ] unit-test
: test-dce ( insns -- insns' )
insns>cfg dup eliminate-dead-code entry>> instructions>> ;
-[ V{
+{ V{
T{ ##load-integer { dst 1 } { val 8 } }
T{ ##load-integer { dst 2 } { val 16 } }
T{ ##add { dst 3 } { src1 1 } { src2 2 } }
T{ ##replace { src 3 } { loc D 0 } }
-} ] [ V{
+} } [ V{
T{ ##load-integer { dst 1 } { val 8 } }
T{ ##load-integer { dst 2 } { val 16 } }
T{ ##add { dst 3 } { src1 1 } { src2 2 } }
T{ ##replace { src 3 } { loc D 0 } }
} test-dce ] unit-test
-[ V{ } ] [ V{
+{ V{ } } [ V{
T{ ##load-integer { dst 1 } { val 8 } }
T{ ##load-integer { dst 2 } { val 16 } }
T{ ##add { dst 3 } { src1 1 } { src2 2 } }
} test-dce ] unit-test
-[ V{ } ] [ V{
+{ V{ } } [ V{
T{ ##load-integer { dst 3 } { val 8 } }
T{ ##allot { dst 1 } { temp 2 } }
} test-dce ] unit-test
-[ V{ } ] [ V{
+{ V{ } } [ V{
T{ ##load-integer { dst 3 } { val 8 } }
T{ ##allot { dst 1 } { temp 2 } }
T{ ##set-slot-imm { obj 1 } { src 3 } }
} test-dce ] unit-test
-[ V{
+{ V{
T{ ##load-integer { dst 3 } { val 8 } }
T{ ##allot { dst 1 } { temp 2 } }
T{ ##set-slot-imm { obj 1 } { src 3 } }
T{ ##replace { src 1 } { loc D 0 } }
-} ] [ V{
+} } [ V{
T{ ##load-integer { dst 3 } { val 8 } }
T{ ##allot { dst 1 } { temp 2 } }
T{ ##set-slot-imm { obj 1 } { src 3 } }
T{ ##replace { src 1 } { loc D 0 } }
} test-dce ] unit-test
-[ V{
+{ V{
T{ ##allot { dst 1 } { temp 2 } }
T{ ##replace { src 1 } { loc D 0 } }
-} ] [ V{
+} } [ V{
T{ ##allot { dst 1 } { temp 2 } }
T{ ##replace { src 1 } { loc D 0 } }
} test-dce ] unit-test
-[ V{
+{ V{
T{ ##allot { dst 1 } { temp 2 } }
T{ ##replace { src 1 } { loc D 0 } }
T{ ##load-integer { dst 3 } { val 8 } }
T{ ##set-slot-imm { obj 1 } { src 3 } }
-} ] [ V{
+} } [ V{
T{ ##allot { dst 1 } { temp 2 } }
T{ ##replace { src 1 } { loc D 0 } }
T{ ##load-integer { dst 3 } { val 8 } }
5 6 edge
1 get block>cfg 0 set
-[ ] [ 0 get compute-defs ] unit-test
+{ } [ 0 get compute-defs ] unit-test
3 4 edge
4 5 edge
-[ ] [ test-dominance ] unit-test
+{ } [ test-dominance ] unit-test
-[ t ] [ 0 get dom-parent 0 get eq? ] unit-test
-[ t ] [ 1 get dom-parent 0 get eq? ] unit-test
-[ t ] [ 2 get dom-parent 0 get eq? ] unit-test
-[ t ] [ 4 get dom-parent 0 get eq? ] unit-test
-[ t ] [ 3 get dom-parent 1 get eq? ] unit-test
-[ t ] [ 5 get dom-parent 4 get eq? ] unit-test
+{ t } [ 0 get dom-parent 0 get eq? ] unit-test
+{ t } [ 1 get dom-parent 0 get eq? ] unit-test
+{ t } [ 2 get dom-parent 0 get eq? ] unit-test
+{ t } [ 4 get dom-parent 0 get eq? ] unit-test
+{ t } [ 3 get dom-parent 1 get eq? ] unit-test
+{ t } [ 5 get dom-parent 4 get eq? ] unit-test
-[ t ] [ 0 get dom-children 1 get 2 get 4 get 3array set= ] unit-test
+{ t } [ 0 get dom-children 1 get 2 get 4 get 3array set= ] unit-test
-[ t ] [ 0 get 3 get dominates? ] unit-test
-[ f ] [ 3 get 4 get dominates? ] unit-test
-[ f ] [ 1 get 4 get dominates? ] unit-test
-[ t ] [ 4 get 5 get dominates? ] unit-test
-[ f ] [ 1 get 5 get dominates? ] unit-test
+{ t } [ 0 get 3 get dominates? ] unit-test
+{ f } [ 3 get 4 get dominates? ] unit-test
+{ f } [ 1 get 4 get dominates? ] unit-test
+{ t } [ 4 get 5 get dominates? ] unit-test
+{ f } [ 1 get 5 get dominates? ] unit-test
! Example from the paper
V{ } 0 test-bb
3 4 edge
4 3 edge
-[ ] [ test-dominance ] unit-test
+{ } [ test-dominance ] unit-test
-[ t ] [ 0 4 [a,b] [ get dom-parent 0 get eq? ] all? ] unit-test
+{ t } [ 0 4 [a,b] [ get dom-parent 0 get eq? ] all? ] unit-test
! The other example from the paper
V{ } 0 test-bb
4 { 5 3 } edges
3 4 edge
-[ ] [ test-dominance ] unit-test
+{ } [ test-dominance ] unit-test
-[ t ] [ 0 5 [a,b] [ get dom-parent 0 get eq? ] all? ] unit-test
+{ t } [ 0 5 [a,b] [ get dom-parent 0 get eq? ] all? ] unit-test
: non-det-test ( -- cfg )
9 iota [ V{ } clone over insns>block ] { } map>assoc dup
] cfg-unit-test
! gc-check-offsets
-[ { } ] [
+{ { } } [
V{
T{ ##inc }
T{ ##peek }
} gc-check-offsets
] unit-test
-[ { } ] [
+{ { } } [
V{
T{ ##inc }
T{ ##peek }
} gc-check-offsets
] unit-test
-[ { 0 } ] [
+{ { 0 } } [
V{
T{ ##inc }
T{ ##peek }
} gc-check-offsets
] unit-test
-[ { 0 } ] [
+{ { 0 } } [
V{
T{ ##inc }
T{ ##peek }
} gc-check-offsets
] unit-test
-[ { 0 4 } ] [
+{ { 0 4 } } [
V{
T{ ##inc }
T{ ##peek }
} gc-check-offsets
] unit-test
-[ { 3 } ] [
+{ { 3 } } [
V{
T{ ##inc }
T{ ##peek }
} gc-check-offsets
] unit-test
-[ { { "a" } } ] [ { "a" } { } split-instructions ] unit-test
+{ { { "a" } } } [ { "a" } { } split-instructions ] unit-test
-[ { { } { "a" } } ] [ { "a" } { 0 } split-instructions ] unit-test
+{ { { } { "a" } } } [ { "a" } { 0 } split-instructions ] unit-test
-[ { { "a" } { } } ] [ { "a" } { 1 } split-instructions ] unit-test
+{ { { "a" } { } } } [ { "a" } { 1 } split-instructions ] unit-test
-[ { { "a" } { "b" } } ] [ { "a" "b" } { 1 } split-instructions ] unit-test
+{ { { "a" } { "b" } } } [ { "a" "b" } { 1 } split-instructions ] unit-test
-[ { { } { "a" } { "b" "c" } } ] [ { "a" "b" "c" } { 0 1 } split-instructions ] unit-test
+{ { { } { "a" } { "b" "c" } } } [ { "a" "b" "c" } { 0 1 } split-instructions ] unit-test
: test-gc-checks ( -- )
H{ } clone representations set
0 1 edge
-[ ] [ test-gc-checks ] unit-test
+{ } [ test-gc-checks ] unit-test
-[ t ] [ cfg get blocks-with-gc 1 get 1array sequence= ] unit-test
+{ t } [ cfg get blocks-with-gc 1 get 1array sequence= ] unit-test
: gc-check? ( bb -- ? )
instructions>>
T{ ##branch }
} = ;
-[ t ] [ <gc-call> gc-call? ] unit-test
+{ t } [ <gc-call> gc-call? ] unit-test
reset-vreg-counter
3 4 edge
4 5 edge
-[ ] [ test-gc-checks ] unit-test
+{ } [ test-gc-checks ] unit-test
H{
{ 2 tagged-rep }
} representations set
-[ ] [ cfg get insert-gc-checks ] unit-test
+{ } [ cfg get insert-gc-checks ] unit-test
-[ ] [ 1 get successors>> first successors>> first 2 set ] unit-test
+{ } [ 1 get successors>> first successors>> first 2 set ] unit-test
-[ 2 ] [ 2 get predecessors>> length ] unit-test
+{ 2 } [ 2 get predecessors>> length ] unit-test
-[ t ] [ 1 get successors>> first gc-check? ] unit-test
+{ t } [ 1 get successors>> first gc-check? ] unit-test
-[ 64 ] [ 1 get successors>> first instructions>> first size>> ] unit-test
+{ 64 } [ 1 get successors>> first instructions>> first size>> ] unit-test
-[ t ] [ 2 get predecessors>> first gc-check? ] unit-test
+{ t } [ 2 get predecessors>> first gc-check? ] unit-test
-[
+{
V{
T{ ##call-gc f T{ gc-map } }
T{ ##branch }
}
-] [ 2 get predecessors>> second instructions>> ] unit-test
+} [ 2 get predecessors>> second instructions>> ] unit-test
! Don't forget to invalidate RPO after inserting basic blocks!
-[ 8 ] [ cfg get reverse-post-order length ] unit-test
+{ 8 } [ cfg get reverse-post-order length ] unit-test
! Do the right thing with ##phi instructions
V{
1 3 edge
2 3 edge
-[ ] [ test-gc-checks ] unit-test
+{ } [ test-gc-checks ] unit-test
H{
{ 1 tagged-rep }
{ 3 tagged-rep }
} representations set
-[ ] [ cfg get insert-gc-checks ] unit-test
-[ ] [ 1 get successors>> first successors>> first 3 set ] unit-test
-[ t ] [ 2 get successors>> first instructions>> first ##phi? ] unit-test
-[ 2 ] [ 3 get instructions>> length ] unit-test
+{ } [ cfg get insert-gc-checks ] unit-test
+{ } [ 1 get successors>> first successors>> first 3 set ] unit-test
+{ t } [ 2 get successors>> first instructions>> first ##phi? ] unit-test
+{ 2 } [ 3 get instructions>> length ] unit-test
! GC check in a block that is its own successor
V{
0 1 edge
1 { 1 2 } edges
-[ ] [ test-gc-checks ] unit-test
+{ } [ test-gc-checks ] unit-test
-[ ] [ cfg get insert-gc-checks ] unit-test
+{ } [ cfg get insert-gc-checks ] unit-test
-[ ] [
+{ } [
0 get successors>> first predecessors>>
[ first 0 get assert= ]
[ second 1 get [ instructions>> ] bi@ assert= ] bi
] unit-test
-[ ] [
+{ } [
0 get successors>> first successors>>
[ first 1 get [ instructions>> ] bi@ assert= ]
[ second gc-call? t assert= ] bi
] unit-test
-[ ] [
+{ } [
2 get predecessors>> first predecessors>>
[ first gc-check? t assert= ]
[ second gc-call? t assert= ] bi
2 vreg-counter set-global
-[ ] [ test-gc-checks ] unit-test
+{ } [ test-gc-checks ] unit-test
-[ ] [ cfg get insert-gc-checks ] unit-test
+{ } [ cfg get insert-gc-checks ] unit-test
! The GC check should come after the alien-invoke
-[
+{
V{
T{ ##alien-invoke f "malloc" f f f f f T{ gc-map } }
T{ ##check-nursery-branch f 64 cc<= 3 4 }
}
-] [ 0 get successors>> first instructions>> ] unit-test
+} [ 0 get successors>> first instructions>> ] unit-test
! call then allot then call then allot
V{
2 vreg-counter set-global
-[ ] [ test-gc-checks ] unit-test
+{ } [ test-gc-checks ] unit-test
-[ ] [ cfg get insert-gc-checks ] unit-test
+{ } [ cfg get insert-gc-checks ] unit-test
-[
+{
V{
T{ ##alien-invoke f "malloc" f f f f f T{ gc-map } }
T{ ##check-nursery-branch f 64 cc<= 3 4 }
}
-] [
+} [
0 get
successors>> first
instructions>>
] unit-test
-[
+{
V{
T{ ##allot f 1 64 byte-array }
T{ ##alien-invoke f "malloc" f f f f f T{ gc-map } }
T{ ##check-nursery-branch f 64 cc<= 5 6 }
}
-] [
+} [
0 get
successors>> first
successors>> first
instructions>>
] unit-test
-[
+{
V{
T{ ##allot f 2 64 byte-array }
T{ ##branch }
}
-] [
+} [
0 get
successors>> first
successors>> first
M: simple-ops-cpu %alien-vector-reps all-reps ;
! v+
-[ { ##add-vector } ]
+{ { ##add-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-v+ ] test-emit ]
unit-test
! v-
-[ { ##sub-vector } ]
+{ { ##sub-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-v- ] test-emit ]
unit-test
! vneg
-[ { ##load-reference ##sub-vector } ]
+{ { ##load-reference ##sub-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vneg ] test-emit ]
unit-test
-[ { ##zero-vector ##sub-vector } ]
+{ { ##zero-vector ##sub-vector } }
[ simple-ops-cpu int-4-rep [ emit-simd-vneg ] test-emit ]
unit-test
! v*
-[ { ##mul-vector } ]
+{ { ##mul-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-v* ] test-emit ]
unit-test
! v/
-[ { ##div-vector } ]
+{ { ##div-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-v/ ] test-emit ]
unit-test
M: addsub-cpu %add-sub-vector-reps { int-4-rep float-4-rep } ;
! v+-
-[ { ##add-sub-vector } ]
+{ { ##add-sub-vector } }
[ addsub-cpu float-4-rep [ emit-simd-v+- ] test-emit ]
unit-test
-[ { ##load-reference ##xor-vector ##add-vector } ]
+{ { ##load-reference ##xor-vector ##add-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-v+- ] test-emit ]
unit-test
-[ { ##load-reference ##xor-vector ##sub-vector ##add-vector } ]
+{ { ##load-reference ##xor-vector ##sub-vector ##add-vector } }
[ simple-ops-cpu int-4-rep [ emit-simd-v+- ] test-emit ]
unit-test
M: saturating-cpu %saturated-mul-vector-reps { int-4-rep } ;
! vs+
-[ { ##add-vector } ]
+{ { ##add-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vs+ ] test-emit ]
unit-test
-[ { ##add-vector } ]
+{ { ##add-vector } }
[ saturating-cpu float-4-rep [ emit-simd-vs+ ] test-emit ]
unit-test
-[ { ##saturated-add-vector } ]
+{ { ##saturated-add-vector } }
[ saturating-cpu int-4-rep [ emit-simd-vs+ ] test-emit ]
unit-test
! vs-
-[ { ##sub-vector } ]
+{ { ##sub-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vs- ] test-emit ]
unit-test
-[ { ##sub-vector } ]
+{ { ##sub-vector } }
[ saturating-cpu float-4-rep [ emit-simd-vs- ] test-emit ]
unit-test
-[ { ##saturated-sub-vector } ]
+{ { ##saturated-sub-vector } }
[ saturating-cpu int-4-rep [ emit-simd-vs- ] test-emit ]
unit-test
! vs*
-[ { ##mul-vector } ]
+{ { ##mul-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vs* ] test-emit ]
unit-test
-[ { ##mul-vector } ]
+{ { ##mul-vector } }
[ saturating-cpu float-4-rep [ emit-simd-vs* ] test-emit ]
unit-test
-[ { ##saturated-mul-vector } ]
+{ { ##saturated-mul-vector } }
[ saturating-cpu int-4-rep [ emit-simd-vs* ] test-emit ]
unit-test
M: compare-cpu %compare-vector-ccs nip f 2array 1array f ;
! vmin
-[ { ##min-vector } ]
+{ { ##min-vector } }
[ minmax-cpu float-4-rep [ emit-simd-vmin ] test-emit ]
unit-test
-[ { ##compare-vector ##and-vector ##andn-vector ##or-vector } ]
+{ { ##compare-vector ##and-vector ##andn-vector ##or-vector } }
[ compare-cpu float-4-rep [ emit-simd-vmin ] test-emit ]
unit-test
! vmax
-[ { ##max-vector } ]
+{ { ##max-vector } }
[ minmax-cpu float-4-rep [ emit-simd-vmax ] test-emit ]
unit-test
-[ { ##compare-vector ##and-vector ##andn-vector ##or-vector } ]
+{ { ##compare-vector ##and-vector ##andn-vector ##or-vector } }
[ compare-cpu float-4-rep [ emit-simd-vmax ] test-emit ]
unit-test
M: horizontal-cpu %unpack-vector-tail-reps signed-reps ;
! v.
-[ { ##dot-vector } ]
+{ { ##dot-vector } }
[ dot-cpu float-4-rep [ emit-simd-v. ] test-emit ]
unit-test
-[ { ##mul-vector ##horizontal-add-vector ##horizontal-add-vector ##vector>scalar } ]
+{ { ##mul-vector ##horizontal-add-vector ##horizontal-add-vector ##vector>scalar } }
[ horizontal-cpu float-4-rep [ emit-simd-v. ] test-emit ]
unit-test
-[ {
+{ {
##mul-vector
##merge-vector-head ##merge-vector-tail ##add-vector
##merge-vector-head ##merge-vector-tail ##add-vector
##vector>scalar
-} ]
+} }
[ simple-ops-cpu float-4-rep [ emit-simd-v. ] test-emit ]
unit-test
! vsqrt
-[ { ##sqrt-vector } ]
+{ { ##sqrt-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vsqrt ] test-emit ]
unit-test
! sum
-[ { ##horizontal-add-vector ##vector>scalar } ]
+{ { ##horizontal-add-vector ##vector>scalar } }
[ horizontal-cpu double-2-rep [ emit-simd-sum ] test-emit ]
unit-test
-[ { ##horizontal-add-vector ##horizontal-add-vector ##vector>scalar } ]
+{ { ##horizontal-add-vector ##horizontal-add-vector ##vector>scalar } }
[ horizontal-cpu float-4-rep [ emit-simd-sum ] test-emit ]
unit-test
-[ {
+{ {
##unpack-vector-head ##unpack-vector-tail ##add-vector
##horizontal-add-vector ##horizontal-add-vector
##vector>scalar
-} ]
+} }
[ horizontal-cpu short-8-rep [ emit-simd-sum ] test-emit ]
unit-test
-[ {
+{ {
##unpack-vector-head ##unpack-vector-tail ##add-vector
##horizontal-add-vector ##horizontal-add-vector ##horizontal-add-vector
##vector>scalar
-} ]
+} }
[ horizontal-cpu char-16-rep [ emit-simd-sum ] test-emit ]
unit-test
M: abs-cpu %abs-vector-reps signed-reps ;
! vabs
-[ { } ]
+{ { } }
[ simple-ops-cpu uint-4-rep [ emit-simd-vabs ] test-emit ]
unit-test
-[ { ##abs-vector } ]
+{ { ##abs-vector } }
[ abs-cpu float-4-rep [ emit-simd-vabs ] test-emit ]
unit-test
-[ { ##load-reference ##andn-vector } ]
+{ { ##load-reference ##andn-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vabs ] test-emit ]
unit-test
-[ { ##zero-vector ##sub-vector ##compare-vector ##and-vector ##andn-vector ##or-vector } ]
+{ { ##zero-vector ##sub-vector ##compare-vector ##and-vector ##andn-vector ##or-vector } }
[ compare-cpu int-4-rep [ emit-simd-vabs ] test-emit ]
unit-test
! vand
-[ { ##and-vector } ]
+{ { ##and-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vand ] test-emit ]
unit-test
! vandn
-[ { ##andn-vector } ]
+{ { ##andn-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vandn ] test-emit ]
unit-test
! vor
-[ { ##or-vector } ]
+{ { ##or-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vor ] test-emit ]
unit-test
! vxor
-[ { ##xor-vector } ]
+{ { ##xor-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vxor ] test-emit ]
unit-test
M: not-cpu %not-vector-reps signed-reps ;
! vnot
-[ { ##not-vector } ]
+{ { ##not-vector } }
[ not-cpu float-4-rep [ emit-simd-vnot ] test-emit ]
unit-test
-[ { ##fill-vector ##xor-vector } ]
+{ { ##fill-vector ##xor-vector } }
[ simple-ops-cpu float-4-rep [ emit-simd-vnot ] test-emit ]
unit-test
M: horizontal-shift-cpu %horizontal-shr-vector-imm-reps signed-reps ;
! vlshift
-[ { ##shl-vector-imm } ]
+{ { ##shl-vector-imm } }
[ shift-imm-cpu 2 int-4-rep [ emit-simd-vlshift ] test-emit-literal ]
unit-test
-[ { ##shl-vector } ]
+{ { ##shl-vector } }
[ shift-cpu int-4-rep [ emit-simd-vlshift ] test-emit ]
unit-test
! vrshift
-[ { ##shr-vector-imm } ]
+{ { ##shr-vector-imm } }
[ shift-imm-cpu 2 int-4-rep [ emit-simd-vrshift ] test-emit-literal ]
unit-test
-[ { ##shr-vector } ]
+{ { ##shr-vector } }
[ shift-cpu int-4-rep [ emit-simd-vrshift ] test-emit ]
unit-test
! hlshift
-[ { ##horizontal-shl-vector-imm } ]
+{ { ##horizontal-shl-vector-imm } }
[ horizontal-shift-cpu 2 int-4-rep [ emit-simd-hlshift ] test-emit-literal ]
unit-test
! hrshift
-[ { ##horizontal-shr-vector-imm } ]
+{ { ##horizontal-shr-vector-imm } }
[ horizontal-shift-cpu 2 int-4-rep [ emit-simd-hrshift ] test-emit-literal ]
unit-test
M: shuffle-cpu %shuffle-vector-reps signed-reps ;
! vshuffle-elements
-[ { ##load-reference ##shuffle-vector } ]
+{ { ##load-reference ##shuffle-vector } }
[ shuffle-cpu { 0 1 2 3 } int-4-rep [ emit-simd-vshuffle-elements ] test-emit-literal ]
unit-test
-[ { ##shuffle-vector-imm } ]
+{ { ##shuffle-vector-imm } }
[ shuffle-imm-cpu { 0 1 2 3 } int-4-rep [ emit-simd-vshuffle-elements ] test-emit-literal ]
unit-test
! vshuffle-bytes
-[ { ##shuffle-vector } ]
+{ { ##shuffle-vector } }
[ shuffle-cpu int-4-rep [ emit-simd-vshuffle-bytes ] test-emit ]
unit-test
! vmerge-head
-[ { ##merge-vector-head } ]
+{ { ##merge-vector-head } }
[ simple-ops-cpu float-4-rep [ emit-simd-vmerge-head ] test-emit ]
unit-test
! vmerge-tail
-[ { ##merge-vector-tail } ]
+{ { ##merge-vector-tail } }
[ simple-ops-cpu float-4-rep [ emit-simd-vmerge-tail ] test-emit ]
unit-test
! v<= etc.
-[ { ##compare-vector } ]
+{ { ##compare-vector } }
[ compare-cpu int-4-rep [ emit-simd-v<= ] test-emit ]
unit-test
-[ { ##min-vector ##compare-vector } ]
+{ { ##min-vector ##compare-vector } }
[ minmax-cpu int-4-rep [ emit-simd-v<= ] test-emit ]
unit-test
-[ { ##load-reference ##xor-vector ##xor-vector ##compare-vector } ]
+{ { ##load-reference ##xor-vector ##xor-vector ##compare-vector } }
[ compare-cpu uint-4-rep [ emit-simd-v<= ] test-emit ]
unit-test
! vany? etc.
-[ { ##test-vector } ]
+{ { ##test-vector } }
[ simple-ops-cpu int-4-rep [ emit-simd-vany? ] test-emit ]
unit-test
M: convert-cpu %float>integer-vector-reps { float-4-rep } ;
! v>float
-[ { } ]
+{ { } }
[ convert-cpu float-4-rep [ emit-simd-v>float ] test-emit ]
unit-test
-[ { ##integer>float-vector } ]
+{ { ##integer>float-vector } }
[ convert-cpu int-4-rep [ emit-simd-v>float ] test-emit ]
unit-test
! v>integer
-[ { } ]
+{ { } }
[ convert-cpu int-4-rep [ emit-simd-v>integer ] test-emit ]
unit-test
-[ { ##float>integer-vector } ]
+{ { ##float>integer-vector } }
[ convert-cpu float-4-rep [ emit-simd-v>integer ] test-emit ]
unit-test
! vpack-signed
-[ { ##signed-pack-vector } ]
+{ { ##signed-pack-vector } }
[ simple-ops-cpu int-4-rep [ emit-simd-vpack-signed ] test-emit ]
unit-test
! vpack-unsigned
-[ { ##unsigned-pack-vector } ]
+{ { ##unsigned-pack-vector } }
[ simple-ops-cpu int-4-rep [ emit-simd-vpack-unsigned ] test-emit ]
unit-test
M: unpack-cpu %unpack-vector-tail-reps all-reps ;
! vunpack-head
-[ { ##unpack-vector-head } ]
+{ { ##unpack-vector-head } }
[ unpack-head-cpu int-4-rep [ emit-simd-vunpack-head ] test-emit ]
unit-test
-[ { ##zero-vector ##merge-vector-head } ]
+{ { ##zero-vector ##merge-vector-head } }
[ simple-ops-cpu uint-4-rep [ emit-simd-vunpack-head ] test-emit ]
unit-test
-[ { ##merge-vector-head ##shr-vector-imm } ]
+{ { ##merge-vector-head ##shr-vector-imm } }
[ shift-imm-cpu int-4-rep [ emit-simd-vunpack-head ] test-emit ]
unit-test
-[ { ##zero-vector ##compare-vector ##merge-vector-head } ]
+{ { ##zero-vector ##compare-vector ##merge-vector-head } }
[ compare-cpu int-4-rep [ emit-simd-vunpack-head ] test-emit ]
unit-test
! vunpack-tail
-[ { ##unpack-vector-tail } ]
+{ { ##unpack-vector-tail } }
[ unpack-cpu int-4-rep [ emit-simd-vunpack-tail ] test-emit ]
unit-test
-[ { ##tail>head-vector ##unpack-vector-head } ]
+{ { ##tail>head-vector ##unpack-vector-head } }
[ unpack-head-cpu int-4-rep [ emit-simd-vunpack-tail ] test-emit ]
unit-test
-[ { ##zero-vector ##merge-vector-tail } ]
+{ { ##zero-vector ##merge-vector-tail } }
[ simple-ops-cpu uint-4-rep [ emit-simd-vunpack-tail ] test-emit ]
unit-test
-[ { ##merge-vector-tail ##shr-vector-imm } ]
+{ { ##merge-vector-tail ##shr-vector-imm } }
[ shift-imm-cpu int-4-rep [ emit-simd-vunpack-tail ] test-emit ]
unit-test
-[ { ##zero-vector ##compare-vector ##merge-vector-tail } ]
+{ { ##zero-vector ##compare-vector ##merge-vector-tail } }
[ compare-cpu int-4-rep [ emit-simd-vunpack-tail ] test-emit ]
unit-test
! with
-[ { ##scalar>vector ##shuffle-vector-imm } ]
+{ { ##scalar>vector ##shuffle-vector-imm } }
[ shuffle-imm-cpu float-4-rep [ emit-simd-with ] test-emit ]
unit-test
! gather-2
-[ { ##gather-vector-2 } ]
+{ { ##gather-vector-2 } }
[ simple-ops-cpu double-2-rep [ emit-simd-gather-2 ] test-emit ]
unit-test
! gather-4
-[ { ##gather-vector-4 } ]
+{ { ##gather-vector-4 } }
[ simple-ops-cpu float-4-rep [ emit-simd-gather-4 ] test-emit ]
unit-test
! select
-[ { ##shuffle-vector-imm ##vector>scalar } ]
+{ { ##shuffle-vector-imm ##vector>scalar } }
[ shuffle-imm-cpu 1 float-4-rep [ emit-simd-select ] test-emit-literal ]
unit-test
[ cfg set ] [ number-instructions ] [ compute-live-intervals ] tri
drop ;
-[ ] [
+{ } [
H{
{ 1 int-rep }
} representations set
test-live-intervals
] unit-test
-[ 0 0 ] [
+{ 0 0 } [
1 live-intervals get at [ start>> ] [ end>> ] bi
] unit-test
! Live range and interval splitting
-[
+{
{ T{ live-range f 1 10 } T{ live-range f 15 15 } }
{ T{ live-range f 16 20 } }
-] [
+} [
{
T{ live-range f 1 10 }
T{ live-range f 15 20 }
} 15 split-ranges
] unit-test
-[
+{
{ T{ live-range f 1 10 } T{ live-range f 15 16 } }
{ T{ live-range f 17 20 } }
-] [
+} [
{
T{ live-range f 1 10 }
T{ live-range f 15 20 }
} 16 split-ranges
] unit-test
-[
+{
{ T{ live-range f 1 10 } }
{ T{ live-range f 15 20 } }
-] [
+} [
{
T{ live-range f 1 10 }
T{ live-range f 15 20 }
} 12 split-ranges
] unit-test
-[
+{
{ T{ live-range f 1 10 } T{ live-range f 15 17 } }
{ T{ live-range f 18 20 } }
-] [
+} [
{
T{ live-range f 1 10 }
T{ live-range f 15 20 }
{ T{ live-range f 1 10 } } 0 split-ranges
] must-fail
-[
+{
{ T{ live-range f 0 0 } }
{ T{ live-range f 1 5 } }
-] [
+} [
{ T{ live-range f 0 5 } } 0 split-ranges
] unit-test
: clean-up-split ( a b -- a b )
[ dup [ [ >vector ] change-uses [ >vector ] change-ranges ] when ] bi@ ;
-[
+{
T{ live-interval-state
{ vreg 1 }
{ reg-class float-regs }
{ reload-from T{ spill-slot f 0 } }
{ reload-rep float-rep }
}
-] [
+} [
T{ live-interval-state
{ vreg 1 }
{ reg-class float-regs }
clean-up-split
] unit-test
-[
+{
f
T{ live-interval-state
{ vreg 2 }
{ reload-from T{ spill-slot f 4 } }
{ reload-rep float-rep }
}
-] [
+} [
T{ live-interval-state
{ vreg 2 }
{ reg-class float-regs }
clean-up-split
] unit-test
-[
+{
T{ live-interval-state
{ vreg 3 }
{ reg-class float-regs }
{ spill-rep float-rep }
}
f
-] [
+} [
T{ live-interval-state
{ vreg 3 }
{ reg-class float-regs }
clean-up-split
] unit-test
-[
+{
T{ live-interval-state
{ vreg 4 }
{ reg-class float-regs }
{ reload-from T{ spill-slot f 12 } }
{ reload-rep float-rep }
}
-] [
+} [
T{ live-interval-state
{ vreg 4 }
{ reg-class float-regs }
] unit-test
! Don't insert reload if first usage is a def
-[
+{
T{ live-interval-state
{ vreg 5 }
{ reg-class float-regs }
{ uses V{ T{ vreg-use f 20 float-rep f } T{ vreg-use f 30 f float-rep } } }
{ ranges V{ T{ live-range f 20 30 } } }
}
-] [
+} [
T{ live-interval-state
{ vreg 5 }
{ reg-class float-regs }
] unit-test
! Multiple representations
-[
+{
T{ live-interval-state
{ vreg 6 }
{ reg-class float-regs }
{ reload-from T{ spill-slot f 24 } }
{ reload-rep double-rep }
}
-] [
+} [
T{ live-interval-state
{ vreg 6 }
{ reg-class float-regs }
clean-up-split
] unit-test
-[
+{
f
T{ live-interval-state
{ vreg 7 }
{ uses V{ T{ vreg-use f 8 int-rep } } }
{ reg-class int-regs }
}
-] [
+} [
T{ live-interval-state
{ vreg 7 }
{ start 4 }
] unit-test
! trim-before-ranges, trim-after-ranges
-[
+{
T{ live-interval-state
{ vreg 8 }
{ start 0 }
{ reload-from T{ spill-slot f 32 } }
{ reload-rep int-rep }
}
-] [
+} [
T{ live-interval-state
{ vreg 8 }
{ start 0 }
{ 3 int-rep }
} representations set
-[
+{
{
3
10
}
-] [
+} [
H{
{ int-regs
V{
spill-status
] unit-test
-[
+{
{
1
1/0.
}
-] [
+} [
H{
{ int-regs
V{
H{ { 1 int-rep } { 2 int-rep } } representations set
-[ ] [
+{ } [
{
T{ live-interval-state
{ vreg 1 }
check-linear-scan
] unit-test
-[ ] [
+{ } [
{
T{ live-interval-state
{ vreg 1 }
check-linear-scan
] unit-test
-[ ] [
+{ } [
{
T{ live-interval-state
{ vreg 1 }
check-linear-scan
] unit-test
-[ ] [
+{ } [
{
T{ live-interval-state
{ vreg 1 }
{ 5 int-rep }
} representations set
-[ ] [
+{ } [
{
T{ live-interval-state
{ vreg 1 }
! Test spill-new code path
-[ ] [
+{ } [
{
T{ live-interval-state
{ vreg 1 }
check-linear-scan
] unit-test
-[ f ] [
+{ f } [
T{ live-range f 0 10 }
T{ live-range f 20 30 }
intersect-live-range
] unit-test
-[ 10 ] [
+{ 10 } [
T{ live-range f 0 10 }
T{ live-range f 10 30 }
intersect-live-range
] unit-test
-[ 5 ] [
+{ 5 } [
T{ live-range f 0 10 }
T{ live-range f 5 30 }
intersect-live-range
] unit-test
-[ 5 ] [
+{ 5 } [
T{ live-range f 5 30 }
T{ live-range f 0 10 }
intersect-live-range
] unit-test
-[ 5 ] [
+{ 5 } [
T{ live-range f 5 10 }
T{ live-range f 0 15 }
intersect-live-range
] unit-test
-[ 50 ] [
+{ 50 } [
{
T{ live-range f 0 10 }
T{ live-range f 20 30 }
intersect-live-ranges
] unit-test
-[ f ] [
+{ f } [
{
T{ live-range f 0 10 }
T{ live-range f 20 30 }
intersect-live-ranges
] unit-test
-[ 5 ] [
+{ 5 } [
T{ live-interval-state
{ start 0 }
{ reg-class int-regs }
{ 4 int-rep }
} representations set
-[ { 0 10 } ] [
+{ { 0 10 } } [
H{
{ int-regs
{
compiler.cfg.linear-scan.allocation.state ;
IN: compiler.cfg.linear-scan.resolve.tests
-[
+{
{
{
T{ location f T{ spill-slot f 0 } int-rep int-regs }
T{ location f 1 int-rep int-regs }
}
}
-] [
+} [
[
0 <spill-slot> 1 int-rep add-mapping
] { } make
] unit-test
-[
+{
{
T{ ##reload { dst 1 } { rep int-rep } { src T{ spill-slot f 0 } } }
}
-] [
+} [
[
T{ location f T{ spill-slot f 0 } int-rep int-regs }
T{ location f 1 int-rep int-regs }
] { } make
] unit-test
-[
+{
{
T{ ##spill { src 1 } { rep int-rep } { dst T{ spill-slot f 0 } } }
}
-] [
+} [
[
T{ location f 1 int-rep int-regs }
T{ location f T{ spill-slot f 0 } int-rep int-regs }
] { } make
] unit-test
-[
+{
{
T{ ##copy { src 1 } { dst 2 } { rep int-rep } }
}
-] [
+} [
[
T{ location f 1 int-rep int-regs }
T{ location f 2 int-rep int-regs }
] { } make
] unit-test
-[
+{
{
T{ ##copy { src 1 } { dst 2 } { rep int-rep } }
T{ ##branch }
}
-] [
+} [
{ { T{ location f 1 int-rep int-regs } T{ location f 2 int-rep int-regs } } }
mapping-instructions
] unit-test
-[
+{
{
T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 0 } } }
T{ ##reload { dst 0 } { rep tagged-rep } { src T{ spill-slot f 1 } } }
T{ ##branch }
}
-] [
+} [
{
{ T{ location f T{ spill-slot f 1 } tagged-rep int-regs } T{ location f 0 tagged-rep int-regs } }
{ T{ location f 0 int-rep int-regs } T{ location f T{ spill-slot f 0 } int-rep int-regs } }
mapping-instructions
] unit-test
-[
+{
{
T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 1 } } }
T{ ##reload { dst 0 } { rep tagged-rep } { src T{ spill-slot f 0 } } }
T{ ##branch }
}
-] [
+} [
{
{ T{ location f T{ spill-slot f 0 } tagged-rep int-regs } T{ location f 0 tagged-rep int-regs } }
{ T{ location f 0 int-rep int-regs } T{ location f T{ spill-slot f 1 } int-rep int-regs } }
mapping-instructions
] unit-test
-[
+{
{
T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 1 } } }
T{ ##reload { dst 0 } { rep tagged-rep } { src T{ spill-slot f 0 } } }
T{ ##branch }
}
-] [
+} [
{
{ T{ location f 0 int-rep int-regs } T{ location f T{ spill-slot f 1 } int-rep int-regs } }
{ T{ location f T{ spill-slot f 0 } tagged-rep int-regs } T{ location f 0 tagged-rep int-regs } }
cfg new 8 >>spill-area-size cfg set
init-resolve
-[ t ] [
+{ t } [
{
{ T{ location f 0 int-rep int-regs } T{ location f 1 int-rep int-regs } }
{ T{ location f 1 int-rep int-regs } T{ location f 0 int-rep int-regs } }
1 { 2 3 } edges
-[ ] [ test-liveness ] unit-test
+{ } [ test-liveness ] unit-test
-[
+{
H{
{ 1 1 }
{ 2 2 }
{ 3 3 }
}
-]
+}
[ 1 get live-in ]
unit-test
1 2 edge
-[ ] [ test-liveness ] unit-test
+{ } [ test-liveness ] unit-test
-[ H{ { 0 0 } } ] [ 2 get live-in ] unit-test
+{ H{ { 0 0 } } } [ 2 get live-in ] unit-test
! Regression
V{
7 8 edge
8 9 edge
-[ ] [ test-liveness ] unit-test
+{ } [ test-liveness ] unit-test
-[ H{ { 28 28 } { 29 29 } { 30 30 } { 31 31 } } ] [ 5 get live-out ] unit-test
-[ H{ { 28 28 } { 29 29 } { 30 30 } } ] [ 6 get live-in ] unit-test
-[ H{ { 28 28 } { 29 29 } { 31 31 } } ] [ 7 get live-in ] unit-test
-[ H{ { 30 30 } } ] [ 6 get 8 get edge-live-in ] unit-test
+{ H{ { 28 28 } { 29 29 } { 30 30 } { 31 31 } } } [ 5 get live-out ] unit-test
+{ H{ { 28 28 } { 29 29 } { 30 30 } } } [ 6 get live-in ] unit-test
+{ H{ { 28 28 } { 29 29 } { 31 31 } } } [ 7 get live-in ] unit-test
+{ H{ { 30 30 } } } [ 6 get 8 get edge-live-in ] unit-test
V{
T{ ##prologue }
5 6 edge
6 7 edge
-[ ] [ 0 get block>cfg dup cfg set compute-live-sets ] unit-test
+{ } [ 0 get block>cfg dup cfg set compute-live-sets ] unit-test
-[ t ] [ 0 get live-in assoc-empty? ] unit-test
+{ t } [ 0 get live-in assoc-empty? ] unit-test
-[ H{ { 2 2 } } ] [ 4 get live-out ] unit-test
+{ H{ { 2 2 } } } [ 4 get live-out ] unit-test
-[ H{ { 0 0 } } ] [ 2 get 4 get edge-live-in ] unit-test
+{ H{ { 0 0 } } } [ 2 get 4 get edge-live-in ] unit-test
-[ H{ { 1 1 } } ] [ 3 get 4 get edge-live-in ] unit-test
+{ H{ { 1 1 } } } [ 3 get 4 get edge-live-in ] unit-test
V{
{ 1 int-rep }
} representations set
-[ ] [ 0 get block>cfg dup cfg set compute-live-sets ] unit-test
+{ } [ 0 get block>cfg dup cfg set compute-live-sets ] unit-test
-[ V{ { 1 0 } } ] [ 1 get instructions>> 2 swap nth gc-map>> derived-roots>> ] unit-test
+{ V{ { 1 0 } } } [ 1 get instructions>> 2 swap nth gc-map>> derived-roots>> ] unit-test
-[ { 0 } ] [ 1 get instructions>> 2 swap nth gc-map>> gc-roots>> ] unit-test
+{ { 0 } } [ 1 get instructions>> 2 swap nth gc-map>> gc-roots>> ] unit-test
-[ V{ { 1 0 } } ] [ 1 get instructions>> 4 swap nth gc-map>> derived-roots>> ] unit-test
+{ V{ { 1 0 } } } [ 1 get instructions>> 4 swap nth gc-map>> derived-roots>> ] unit-test
-[ { 0 } ] [ 1 get instructions>> 4 swap nth gc-map>> gc-roots>> ] unit-test
+{ { 0 } } [ 1 get instructions>> 4 swap nth gc-map>> gc-roots>> ] unit-test
: test-loop-detection ( -- )
0 get block>cfg needs-loops ;
-[ ] [ test-loop-detection ] unit-test
+{ } [ test-loop-detection ] unit-test
-[ 1 ] [ 0 get loop-nesting-at ] unit-test
-[ 0 ] [ 1 get loop-nesting-at ] unit-test
-[ 1 ] [ 2 get loop-nesting-at ] unit-test
+{ 1 } [ 0 get loop-nesting-at ] unit-test
+{ 0 } [ 1 get loop-nesting-at ] unit-test
+{ 1 } [ 2 get loop-nesting-at ] unit-test
H{ } test-parallel-copy
] unit-test
-[
+{
{
T{ ##copy f 4 2 any-rep }
T{ ##copy f 2 1 any-rep }
T{ ##copy f 1 4 any-rep }
}
-] [
+} [
H{
{ 1 2 }
{ 2 1 }
} test-parallel-copy
] unit-test
-[
+{
{
T{ ##copy f 1 2 any-rep }
T{ ##copy f 3 4 any-rep }
}
-] [
+} [
H{
{ 1 2 }
{ 3 4 }
} test-parallel-copy
] unit-test
-[
+{
{
T{ ##copy f 1 3 any-rep }
T{ ##copy f 2 1 any-rep }
}
-] [
+} [
H{
{ 1 3 }
{ 2 3 }
} test-parallel-copy
] unit-test
-[
+{
{
T{ ##copy f 4 3 any-rep }
T{ ##copy f 3 2 any-rep }
T{ ##copy f 2 1 any-rep }
T{ ##copy f 1 4 any-rep }
}
-] [
+} [
{
{ 2 1 }
{ 3 2 }
1 3 edge
2 3 edge
-[ ] [ test-scc ] unit-test
+{ } [ test-scc ] unit-test
-[ t ] [ 0 vreg>scc 1 vreg>scc = ] unit-test
-[ t ] [ 0 vreg>scc 3 vreg>scc = ] unit-test
-[ f ] [ 2 vreg>scc 3 vreg>scc = ] unit-test
+{ t } [ 0 vreg>scc 1 vreg>scc = ] unit-test
+{ t } [ 0 vreg>scc 3 vreg>scc = ] unit-test
+{ f } [ 2 vreg>scc 3 vreg>scc = ] unit-test
FROM: alien.c-types => char ;
IN: compiler.cfg.representations
-[ { double-rep double-rep } ] [
+{ { double-rep double-rep } } [
T{ ##add-float
{ dst 5 }
{ src1 3 }
} uses-vreg-reps
] unit-test
-[ { double-rep } ] [
+{ { double-rep } } [
T{ ##load-memory-imm
{ dst 5 }
{ base 3 }
3 vreg-counter set-global
-[
+{
{
T{ ##allot f 2 16 float 4 }
T{ ##store-memory-imm f 1 2 $[ float-offset ] double-rep f }
}
-] [
+} [
[
2 1 tagged-rep double-rep emit-conversion
] { } make
] unit-test
-[
+{
{
T{ ##load-memory-imm f 2 1 $[ float-offset ] double-rep f }
}
-] [
+} [
[
2 1 double-rep tagged-rep emit-conversion
] { } make
0 1 edge
1 2 edge
-[ ] [ test-representations ] unit-test
+{ } [ test-representations ] unit-test
-[ 1 ] [ 1 get instructions>> [ ##allot? ] count ] unit-test
+{ 1 } [ 1 get instructions>> [ ##allot? ] count ] unit-test
! Don't dereference the result of a peek
V{
0 1 edge
1 { 2 3 } edges
-[ ] [ test-representations ] unit-test
+{ } [ test-representations ] unit-test
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##branch }
}
-] [ 1 get instructions>> ] unit-test
+} [ 1 get instructions>> ] unit-test
! We cannot untag-fixnum the result of a peek if there are usages
! of it as a tagged-rep
3 { 3 4 } edges
2 4 edge
-[ ] [ test-representations ] unit-test
+{ } [ test-representations ] unit-test
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##branch }
}
-] [ 1 get instructions>> ] unit-test
+} [ 1 get instructions>> ] unit-test
! But its ok to untag-fixnum the result of a peek if all usages use
! it as int-rep
3 vreg-counter set-global
-[ ] [ test-representations ] unit-test
+{ } [ test-representations ] unit-test
-[
+{
V{
T{ ##peek f 4 D 0 }
T{ ##sar-imm f 1 4 $[ tag-bits get ] }
T{ ##branch }
}
-] [ 1 get instructions>> ] unit-test
+} [ 1 get instructions>> ] unit-test
! scalar-rep => int-rep conversion
V{
0 1 edge
1 2 edge
-[ ] [ test-representations ] unit-test
+{ } [ test-representations ] unit-test
-[ t ] [ 1 get instructions>> 4 swap nth ##scalar>integer? ] unit-test
+{ t } [ 1 get instructions>> 4 swap nth ##scalar>integer? ] unit-test
! Test phi node behavior
V{
2 3 edge
3 4 edge
-[ ] [ test-representations ] unit-test
+{ } [ test-representations ] unit-test
-[ T{ ##load-tagged f 1 $[ 1 tag-fixnum ] } ]
+{ T{ ##load-tagged f 1 $[ 1 tag-fixnum ] } }
[ 1 get instructions>> first ]
unit-test
-[ T{ ##load-tagged f 2 $[ 2 tag-fixnum ] } ]
+{ T{ ##load-tagged f 2 $[ 2 tag-fixnum ] } }
[ 2 get instructions>> first ]
unit-test
2 3 edge
3 4 edge
-[ ] [ test-representations ] unit-test
+{ } [ test-representations ] unit-test
! Don't untag the f!
-[ 2 ] [ 2 get instructions>> length ] unit-test
+{ 2 } [ 2 get instructions>> length ] unit-test
cpu x86.32? [
! we might lose precision
5 vreg-counter set-global
-[ f ] [
+{ f } [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! Converting a ##load-integer into a ##load-tagged
-[
+{
V{
T{ ##load-tagged f 1 $[ 100 tag-fixnum ] }
T{ ##replace f 1 D 0 }
}
-] [
+} [
V{
T{ ##load-integer f 1 100 }
T{ ##replace f 1 D 0 }
! Peephole optimization if input to ##shl-imm is tagged
3 vreg-counter set-global
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##sar-imm f 2 1 1 }
T{ ##shl-imm f 3 4 $[ tag-bits get ] }
T{ ##replace f 3 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 0 }
T{ ##shl-imm f 2 1 3 }
3 vreg-counter set-global
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##shl-imm f 2 1 $[ 10 tag-bits get - ] }
T{ ##shl-imm f 3 4 $[ tag-bits get ] }
T{ ##replace f 3 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 0 }
T{ ##shl-imm f 2 1 10 }
} test-peephole
] unit-test
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##copy f 2 1 int-rep }
T{ ##shl-imm f 3 5 $[ tag-bits get ] }
T{ ##replace f 3 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 0 }
T{ ##shl-imm f 2 1 $[ tag-bits get ] }
] unit-test
! Peephole optimization if output of ##shl-imm needs to be tagged
-[
+{
V{
T{ ##load-integer f 1 100 }
T{ ##shl-imm f 2 1 $[ 3 tag-bits get + ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##load-integer f 1 100 }
T{ ##shl-imm f 2 1 3 }
! Peephole optimization if both input and output of ##shl-imm
! need to be tagged
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 3 }
T{ ##replace f 1 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 3 }
] unit-test
! Peephole optimization if neither input nor output of ##shl-imm need to be tagged
-[
+{
V{
T{ ##load-integer f 1 100 }
T{ ##shl-imm f 2 1 3 }
T{ ##load-integer f 4 100 }
T{ ##store-memory f 2 3 4 0 0 int-rep char }
}
-] [
+} [
V{
T{ ##load-integer f 1 100 }
T{ ##shl-imm f 2 1 3 }
6 vreg-counter set-global
! Peephole optimization if input to ##sar-imm is tagged
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##sar-imm f 7 1 $[ 3 tag-bits get + ] }
T{ ##shl-imm f 2 7 $[ tag-bits get ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 0 }
T{ ##sar-imm f 2 1 3 }
6 vreg-counter set-global
! (Lack of) peephole optimization if output of ##sar-imm needs to be tagged
-[
+{
V{
T{ ##load-integer f 1 100 }
T{ ##sar-imm f 7 1 3 }
T{ ##shl-imm f 2 7 $[ tag-bits get ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##load-integer f 1 100 }
T{ ##sar-imm f 2 1 3 }
! Peephole optimization if input of ##sar-imm is tagged but output is untagged
! need to be tagged
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 $[ 3 tag-bits get + ] }
T{ ##load-integer f 4 100 }
T{ ##store-memory f 1 3 4 0 0 int-rep char }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 3 }
] unit-test
! Peephole optimization if neither input nor output of ##sar-imm need to be tagged
-[
+{
V{
T{ ##load-integer f 1 100 }
T{ ##sar-imm f 2 1 3 }
T{ ##load-integer f 4 100 }
T{ ##store-memory f 2 3 4 0 0 int-rep char }
}
-] [
+} [
V{
T{ ##load-integer f 1 100 }
T{ ##sar-imm f 2 1 3 }
} test-peephole
] unit-test
-[
+{
V{
T{ ##load-vector f 0 B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } short-8-rep }
T{ ##select-vector f 1 0 0 short-8-rep }
T{ ##load-integer f 6 100 }
T{ ##store-memory f 4 5 6 0 0 int-rep char }
}
-] [
+} [
V{
T{ ##load-vector f 0 B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } short-8-rep }
T{ ##select-vector f 1 0 0 short-8-rep }
6 vreg-counter set-global
-[
+{
V{
T{ ##load-vector f 0 B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } int-4-rep }
T{ ##select-vector f 1 0 0 int-4-rep }
T{ ##shl-imm f 4 7 $[ tag-bits get ] }
T{ ##replace f 4 D 0 }
}
-] [
+} [
V{
T{ ##load-vector f 0 B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } int-4-rep }
T{ ##select-vector f 1 0 0 int-4-rep }
] unit-test
! Tag/untag elimination
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##add-imm f 2 1 $[ 100 tag-fixnum ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 0 }
T{ ##add-imm f 2 1 100 }
} test-peephole
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##add f 2 0 1 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] when
! Tag/untag elimination for ##mul-imm
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##mul-imm f 1 0 100 }
T{ ##replace f 1 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##mul-imm f 1 0 100 }
4 vreg-counter set-global
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##mul-imm f 3 2 $[ 100 tag-fixnum ] }
T{ ##replace f 3 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! Tag/untag elimination for ##compare-integer and ##test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##test f 2 0 1 cc= }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} test-peephole
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##compare-integer f 2 0 1 cc= }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} test-peephole
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##compare-integer-branch f 0 1 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} test-peephole
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##test-branch f 0 1 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} test-peephole
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##compare-integer-imm-branch f 0 $[ 10 tag-fixnum ] cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} test-peephole
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##test-imm-branch f 0 $[ 10 tag-fixnum ] cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! Tag/untag elimination for ##neg
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##neg f 1 0 }
T{ ##replace f 1 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##neg f 1 0 }
4 vreg-counter set-global
-[
+{
V{
T{ ##peek { dst 0 } { loc D 0 } }
T{ ##peek { dst 1 } { loc D 1 } }
T{ ##mul-imm { dst 3 } { src1 2 } { src2 -16 } }
T{ ##replace { src 3 } { loc D 0 } }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
! Tag/untag elimination for ##not
2 vreg-counter set-global
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##not f 3 0 }
T{ ##xor-imm f 1 3 $[ tag-mask get ] }
T{ ##replace f 1 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##not f 1 0 }
0 get [ insert-save-context ] change-instructions drop
-[
+{
V{
T{ ##add f 1 2 3 }
T{ ##branch }
}
-] [
+} [
0 get instructions>>
] unit-test
0 get [ insert-save-context ] change-instructions drop
-[
+{
V{
T{ ##inc f D 3 }
T{ ##save-context f 5 6 }
T{ gc-map { scrub-d B{ 0 0 0 } } { scrub-r B{ } } { gc-roots { } } }
}
}
-] [
+} [
0 get instructions>>
] unit-test
0 get [ insert-save-context ] change-instructions drop
-[
+{
V{
T{ ##phi }
T{ ##save-context f 7 8 }
T{ ##box }
}
-] [
+} [
0 get instructions>>
] unit-test
1 3 edge
2 3 edge
-[ ] [ test-ssa ] unit-test
+{ } [ test-ssa ] unit-test
-[
+{
V{
T{ ##load-integer f 1 100 }
T{ ##add-imm f 2 1 50 }
T{ ##add-imm f 3 2 10 }
T{ ##branch }
}
-] [ 0 get instructions>> ] unit-test
+} [ 0 get instructions>> ] unit-test
-[
+{
V{
T{ ##load-integer f 4 3 }
T{ ##branch }
}
-] [ 1 get instructions>> ] unit-test
+} [ 1 get instructions>> ] unit-test
-[
+{
V{
T{ ##load-integer f 5 4 }
T{ ##branch }
}
-] [ 2 get instructions>> ] unit-test
+} [ 2 get instructions>> ] unit-test
-[
+{
V{
T{ ##phi f 6 H{ { 1 4 } { 2 5 } } }
T{ ##replace f 6 D 0 }
T{ ##return }
}
-] [
+} [
3 get instructions>>
clean-up-phis
] unit-test
4 6 edge
5 6 edge
-[ ] [ test-ssa ] unit-test
+{ } [ test-ssa ] unit-test
-[
+{
V{
T{ ##phi f 3 H{ { 2 1 } { 3 2 } } }
T{ ##replace f 3 D 0 }
}
-] [
+} [
4 get instructions>>
clean-up-phis
] unit-test
2 4 edge
3 4 edge
-[ ] [ test-ssa ] unit-test
+{ } [ test-ssa ] unit-test
-[ V{ } ] [ 4 get instructions>> [ ##phi? ] filter ] unit-test
+{ V{ } } [ 4 get instructions>> [ ##phi? ] filter ] unit-test
! Test 4
reset-counters
5 7 edge
6 7 edge
-[ ] [ test-ssa ] unit-test
+{ } [ test-ssa ] unit-test
-[ V{ } ] [ 5 get instructions>> [ ##phi? ] filter ] unit-test
+{ V{ } } [ 5 get instructions>> [ ##phi? ] filter ] unit-test
-[ V{ } ] [ 7 get instructions>> [ ##phi? ] filter ] unit-test
+{ V{ } } [ 7 get instructions>> [ ##phi? ] filter ] unit-test
3 4 edge
4 5 edge
-[ ] [ test-tdmsc ] unit-test
+{ } [ test-tdmsc ] unit-test
-[ { 4 } ] [ 1 get 1array merge-set [ number>> ] map ] unit-test
-[ { 4 } ] [ 2 get 1array merge-set [ number>> ] map ] unit-test
-[ { } ] [ 0 get 1array merge-set ] unit-test
-[ { } ] [ 4 get 1array merge-set ] unit-test
+{ { 4 } } [ 1 get 1array merge-set [ number>> ] map ] unit-test
+{ { 4 } } [ 2 get 1array merge-set [ number>> ] map ] unit-test
+{ { } } [ 0 get 1array merge-set ] unit-test
+{ { } } [ 4 get 1array merge-set ] unit-test
V{ } 0 test-bb
V{ } 1 test-bb
4 6 edge
5 6 edge
-[ ] [ test-tdmsc ] unit-test
+{ } [ test-tdmsc ] unit-test
-[ t ] [
+{ t } [
2 get 3 get 2array merge-set
4 get 6 get 2array set=
] unit-test
4 5 edge
5 2 edge
-[ ] [ test-tdmsc ] unit-test
+{ } [ test-tdmsc ] unit-test
-[ { 2 } ] [ { 2 3 4 5 } [ get ] map merge-set [ number>> ] map ] unit-test
-[ { } ] [ { 0 1 6 7 } [ get ] map merge-set ] unit-test
+{ { 2 } } [ { 2 3 4 5 } [ get ] map merge-set [ number>> ] map ] unit-test
+{ { } } [ { 0 1 6 7 } [ get ] map merge-set ] unit-test
0 1 edge
-[ ] [ test-interference ] unit-test
-
-[ f ] [ 0 1 test-vregs-intersect? ] unit-test
-[ f ] [ 1 0 test-vregs-intersect? ] unit-test
-[ f ] [ 2 3 test-vregs-intersect? ] unit-test
-[ f ] [ 3 2 test-vregs-intersect? ] unit-test
-[ t ] [ 0 2 test-vregs-intersect? ] unit-test
-[ t ] [ 2 0 test-vregs-intersect? ] unit-test
-[ f ] [ 1 3 test-vregs-intersect? ] unit-test
-[ f ] [ 3 1 test-vregs-intersect? ] unit-test
-[ t ] [ 3 4 test-vregs-intersect? ] unit-test
-[ t ] [ 4 3 test-vregs-intersect? ] unit-test
-[ t ] [ 3 5 test-vregs-intersect? ] unit-test
-[ t ] [ 5 3 test-vregs-intersect? ] unit-test
-[ f ] [ 3 6 test-vregs-intersect? ] unit-test
-[ f ] [ 6 3 test-vregs-intersect? ] unit-test
+{ } [ test-interference ] unit-test
+
+{ f } [ 0 1 test-vregs-intersect? ] unit-test
+{ f } [ 1 0 test-vregs-intersect? ] unit-test
+{ f } [ 2 3 test-vregs-intersect? ] unit-test
+{ f } [ 3 2 test-vregs-intersect? ] unit-test
+{ t } [ 0 2 test-vregs-intersect? ] unit-test
+{ t } [ 2 0 test-vregs-intersect? ] unit-test
+{ f } [ 1 3 test-vregs-intersect? ] unit-test
+{ f } [ 3 1 test-vregs-intersect? ] unit-test
+{ t } [ 3 4 test-vregs-intersect? ] unit-test
+{ t } [ 4 3 test-vregs-intersect? ] unit-test
+{ t } [ 3 5 test-vregs-intersect? ] unit-test
+{ t } [ 5 3 test-vregs-intersect? ] unit-test
+{ f } [ 3 6 test-vregs-intersect? ] unit-test
+{ f } [ 6 3 test-vregs-intersect? ] unit-test
V{
T{ ##prologue }
0 1 edge
1 2 edge
-[ ] [ test-interference ] unit-test
+{ } [ test-interference ] unit-test
-[ t ] [ { 15 } { 23 13 } test-sets-interfere? nip ] unit-test
+{ t } [ { 15 } { 23 13 } test-sets-interfere? nip ] unit-test
V{
T{ ##prologue f }
5 6 edge
7 8 edge
-[ ] [ test-interference ] unit-test
+{ } [ test-interference ] unit-test
-[ f ] [ { 48 } { 32 35 } test-sets-interfere? nip ] unit-test
+{ f } [ { 48 } { 32 35 } test-sets-interfere? nip ] unit-test
TUPLE: bab ;
TUPLE: gfg { x bab } ;
14 15 edge
15 16 edge
-[ ] [ test-interference ] unit-test
+{ } [ test-interference ] unit-test
-[ t ] [ 43 45 test-vregs-intersect? ] unit-test
-[ f ] [ 43 45 test-vregs-interfere? ] unit-test
+{ t } [ 43 45 test-vregs-intersect? ] unit-test
+{ f } [ 43 45 test-vregs-interfere? ] unit-test
-[ t ] [ 43 46 test-vregs-intersect? ] unit-test
-[ t ] [ 43 46 test-vregs-interfere? ] unit-test
+{ t } [ 43 46 test-vregs-intersect? ] unit-test
+{ t } [ 43 46 test-vregs-interfere? ] unit-test
-[ f ] [ 45 46 test-vregs-intersect? ] unit-test
-[ f ] [ 45 46 test-vregs-interfere? ] unit-test
+{ f } [ 45 46 test-vregs-intersect? ] unit-test
+{ f } [ 45 46 test-vregs-interfere? ] unit-test
-[ f ] [ { 43 } { 45 } test-sets-interfere? nip ] unit-test
+{ f } [ { 43 } { 45 } test-sets-interfere? nip ] unit-test
-[ t f ] [
+{ t f } [
{ 46 } { 43 } { 45 }
[ [ <test-vreg-info> ] map ] tri@
sets-interfere? [ sets-interfere? nip ] dip
3 2 edge
4 5 edge
-[ ] [ test-interference ] unit-test
+{ } [ test-interference ] unit-test
-[ f f ] [
+{ f f } [
{ 33 } { 21 } { 32 }
[ [ <test-vreg-info> ] map ] tri@
sets-interfere? [ sets-interfere? nip ] dip
] unit-test
-[ f ] [ 33 21 test-vregs-intersect? ] unit-test
-[ f ] [ 32 21 test-vregs-intersect? ] unit-test
-[ f ] [ 32 33 test-vregs-intersect? ] unit-test
+{ f } [ 33 21 test-vregs-intersect? ] unit-test
+{ f } [ 32 21 test-vregs-intersect? ] unit-test
+{ f } [ 32 33 test-vregs-intersect? ] unit-test
] map ;
! Folding constants together
-[
+{
{
T{ ##load-reference f 0 0.0 }
T{ ##load-reference f 1 -0.0 }
}
-] [
+} [
{
T{ ##load-reference f 0 0.0 }
T{ ##load-reference f 1 -0.0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-reference f 0 0.0 }
T{ ##copy f 1 0 any-rep }
}
-] [
+} [
{
T{ ##load-reference f 0 0.0 }
T{ ##load-reference f 1 0.0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-reference f 0 t }
T{ ##copy f 1 0 any-rep }
}
-] [
+} [
{
T{ ##load-reference f 0 t }
T{ ##load-reference f 1 t }
] when
! Double compare elimination
-[
+{
{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
T{ ##copy f 6 4 any-rep }
T{ ##replace f 6 D 0 }
}
-] [
+} [
{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 1 D 1 }
T{ ##compare-imm f 2 1 16 cc= }
T{ ##copy f 3 2 any-rep }
T{ ##replace f 3 D 0 }
}
-] [
+} [
{
T{ ##peek f 1 D 1 }
T{ ##compare-imm f 2 1 16 cc= }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
T{ ##copy f 6 4 any-rep }
T{ ##replace f 6 D 0 }
}
-] [
+} [
{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
T{ ##compare-integer f 6 2 1 cc/<= }
T{ ##replace f 6 D 0 }
}
-] [
+} [
{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 1 D 1 }
T{ ##compare-integer-imm f 2 1 100 cc<= }
T{ ##compare-integer-imm f 3 1 100 cc/<= }
T{ ##replace f 3 D 0 }
}
-] [
+} [
{
T{ ##peek f 1 D 1 }
T{ ##compare-integer-imm f 2 1 100 cc<= }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 8 D 0 }
T{ ##peek f 9 D -1 }
T{ ##compare-float-unordered f 14 8 9 cc/< }
T{ ##replace f 14 D 0 }
}
-] [
+} [
{
T{ ##peek f 8 D 0 }
T{ ##peek f 9 D -1 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
T{ ##compare f 33 29 30 cc= }
T{ ##compare-branch f 29 30 cc= }
}
-] [
+} [
{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
T{ ##compare-integer f 33 29 30 cc<= }
T{ ##compare-integer-branch f 29 30 cc<= }
}
-] [
+} [
{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
T{ ##test f 33 29 30 cc= }
T{ ##test-branch f 29 30 cc= }
}
-] [
+} [
{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 29 D -1 }
T{ ##test-imm f 33 29 30 cc= }
T{ ##test-imm-branch f 29 30 cc= }
}
-] [
+} [
{
T{ ##peek f 29 D -1 }
T{ ##test-imm f 33 29 30 cc= }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 1 D -1 }
T{ ##test-vector f 2 1 f float-4-rep vcc-any }
T{ ##test-vector-branch f 1 f float-4-rep vcc-any }
}
-] [
+} [
{
T{ ##peek f 1 D -1 }
T{ ##test-vector f 2 1 f float-4-rep vcc-any }
] when
! Immediate operand fusion
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##add-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##add-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##add-imm f 2 0 -100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##sub f 1 0 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##mul-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##mul-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 1 D 0 }
T{ ##shl-imm f 2 1 3 }
}
-] [
+} [
{
T{ ##peek f 1 D 0 }
T{ ##mul-imm f 2 1 8 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
T{ ##neg f 2 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
T{ ##neg f 2 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
T{ ##neg f 2 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
T{ ##neg f 2 0 }
T{ ##copy f 3 0 any-rep }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##neg f 1 0 }
T{ ##copy f 2 0 any-rep }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##neg f 1 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##not f 1 0 }
T{ ##copy f 2 0 any-rep }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##not f 1 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##and-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##and-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##or-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##or-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##xor-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##xor-imm f 2 0 100 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-imm f 2 0 100 cc= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm f 2 0 100 cc<= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
] unit-test
] unless
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm f 2 0 100 cc>= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm-branch f 0 100 cc<= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm-branch f 0 100 cc>= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
] unit-test
! Compare folding
-[
+{
{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 200 }
T{ ##load-reference f 3 t }
}
-] [
+} [
{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 200 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 200 }
T{ ##load-reference f 3 f }
}
-] [
+} [
{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 200 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##load-integer f 1 100 }
T{ ##load-reference f 2 f }
}
-] [
+} [
{
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm f 2 1 123 cc= }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##load-integer f 1 10 }
T{ ##load-integer f 2 20 }
T{ ##load-reference f 3 f }
}
-] [
+} [
{
T{ ##load-integer f 1 10 }
T{ ##load-integer f 2 20 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##load-reference f 3 t }
}
-] [
+} [
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##load-reference f 3 t }
}
-] [
+} [
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 10 }
T{ ##load-integer f 2 20 }
T{ ##load-reference f 3 f }
}
-] [
+} [
{
T{ ##load-integer f 1 10 }
T{ ##load-integer f 2 20 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 f }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc< }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##load-reference f 2 f }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc<= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 f }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc> }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc>= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 f }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc/= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 10 }
T{ ##load-reference f 2 t }
}
-] [
+} [
{
T{ ##load-integer f 1 10 }
T{ ##compare-imm f 2 1 10 cc= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 10 }
T{ ##load-reference f 2 f }
}
-] [
+} [
{
T{ ##load-integer f 1 10 }
T{ ##compare-imm f 2 1 20 cc= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 10 }
T{ ##load-reference f 2 t }
}
-] [
+} [
{
T{ ##load-integer f 1 10 }
T{ ##compare-imm f 2 1 100 cc/= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 10 }
T{ ##load-reference f 2 f }
}
-] [
+} [
{
T{ ##load-integer f 1 10 }
T{ ##compare-imm f 2 1 10 cc/= }
] unit-test
] when
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare f 1 0 0 cc= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 f }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare f 1 0 0 cc/= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 12 }
T{ ##load-reference f 3 t }
}
-] [
+} [
{
T{ ##load-integer f 1 12 }
T{ ##test-imm f 3 1 13 cc/= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 15 }
T{ ##load-reference f 3 f }
}
-] [
+} [
{
T{ ##load-integer f 1 15 }
T{ ##test-imm f 3 1 16 cc/= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 12 }
T{ ##load-reference f 3 f }
}
-] [
+} [
{
T{ ##load-integer f 1 12 }
T{ ##test-imm f 3 1 13 cc= }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 15 }
T{ ##load-reference f 3 t }
}
-] [
+} [
{
T{ ##load-integer f 1 15 }
T{ ##test-imm f 3 1 16 cc= }
] unit-test
! Rewriting a ##test of an ##and into a ##test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##and f 2 0 1 }
T{ ##test f 3 0 1 cc= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##and-imm f 2 0 12 }
T{ ##test-imm f 3 0 12 cc= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##and-imm f 2 0 12 }
] unit-test
! Rewriting ##test into ##test-imm
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm f 2 0 10 cc= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm f 2 0 10 cc= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
} value-numbering-step trim-temps
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm-branch f 0 10 cc= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm-branch f 0 10 cc= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm-branch f 0 10 cc= }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
] when
! Reassociation
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##add-imm f 4 0 150 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##add-imm f 4 0 150 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##add-imm f 4 0 50 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##add-imm f 4 0 -150 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##mul-imm f 4 0 5000 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##mul-imm f 4 0 5000 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##and-imm f 4 0 32 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##and-imm f 4 0 32 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##or-imm f 4 0 118 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##or-imm f 4 0 118 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##xor-imm f 4 0 86 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##xor-imm f 4 0 86 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 10 }
T{ ##shl-imm f 2 0 21 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 10 }
T{ ##shl-imm f 2 1 $[ cell-bits 1 - ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 10 }
T{ ##sar-imm f 2 0 21 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 10 }
T{ ##sar-imm f 2 1 $[ cell-bits 1 - ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
T{ ##shr-imm f 2 0 21 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
T{ ##shr-imm f 2 1 $[ cell-bits 1 - ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
T{ ##sar-imm f 2 1 11 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
! Distributive law
2 vreg-counter set-global
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 10 }
T{ ##add-imm f 2 3 40 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 10 }
T{ ##add-imm f 2 4 30 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 -10 }
T{ ##add-imm f 2 5 -40 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##sub-imm f 1 0 10 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 -10 }
T{ ##add-imm f 2 6 -30 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##sub-imm f 1 0 10 }
] unit-test
! Simplification
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##copy f 3 0 any-rep }
T{ ##replace f 3 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##copy f 3 0 any-rep }
T{ ##replace f 3 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##copy f 3 0 any-rep }
T{ ##replace f 3 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##and-imm f 1 0 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 1 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##and-imm f 1 0 -1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 1 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##and f 1 0 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 1 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##or-imm f 1 0 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##or-imm f 1 0 -1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 1 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##or f 1 0 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 1 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##xor-imm f 1 0 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##not f 1 0 }
T{ ##replace f 1 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##xor-imm f 1 0 -1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##xor f 1 0 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##mul-imm f 2 0 1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 2 0 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 2 0 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 2 0 0 }
] unit-test
! Constant folding
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 3 }
T{ ##load-integer f 3 4 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 3 }
T{ ##load-integer f 3 -2 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
T{ ##load-integer f 2 3 }
T{ ##load-integer f 3 6 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
T{ ##load-integer f 2 1 }
T{ ##load-integer f 3 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
T{ ##load-integer f 2 1 }
T{ ##load-integer f 3 3 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
T{ ##load-integer f 2 3 }
T{ ##load-integer f 3 1 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 3 8 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
] unit-test
] when
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -8 }
T{ ##load-integer f 3 -4 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -8 }
] unless
] when
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 -1 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 -2 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
] unit-test
! ##tagged>integer constant folding
-[
+{
{
T{ ##load-reference f 1 f }
T{ ##load-integer f 2 $[ \ f type-number ] }
T{ ##copy f 3 2 any-rep }
}
-] [
+} [
{
T{ ##load-reference f 1 f }
T{ ##tagged>integer f 2 1 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 $[ 100 tag-fixnum ] }
T{ ##load-integer f 3 $[ 100 tag-fixnum 1 + ] }
}
-] [
+} [
{
T{ ##load-integer f 1 100 }
T{ ##tagged>integer f 2 1 }
] unit-test
! Alien boxing and unboxing
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##box-alien f 1 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##box-alien f 1 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##box-alien f 1 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 2 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##box-alien f 1 0 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 1 D 0 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 0 }
3 vreg-counter set-global
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 16 }
T{ ##unbox-any-c-ptr f 4 0 }
T{ ##add-imm f 3 4 16 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 16 }
4 vreg-counter set-global
-[
+{
{
T{ ##box-alien f 0 1 }
T{ ##load-integer f 2 16 }
T{ ##copy f 5 1 any-rep }
T{ ##add-imm f 4 5 16 }
}
-] [
+} [
{
T{ ##box-alien f 0 1 }
T{ ##load-integer f 2 16 }
3 vreg-counter set-global
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 0 }
T{ ##copy f 3 0 any-rep }
T{ ##replace f 3 D 1 }
}
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 0 }
] unit-test
! Various SIMD simplifications
-[
+{
{
T{ ##vector>scalar f 1 0 float-4-rep }
T{ ##copy f 2 0 any-rep }
}
-] [
+} [
{
T{ ##vector>scalar f 1 0 float-4-rep }
T{ ##scalar>vector f 2 1 float-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##copy f 1 0 any-rep }
}
-] [
+} [
{
T{ ##shuffle-vector-imm f 1 0 { 0 1 2 3 } float-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
T{ ##shuffle-vector-imm f 2 0 { 0 2 3 1 } float-4-rep }
}
-] [
+} [
{
T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
T{ ##shuffle-vector-imm f 2 1 { 3 1 2 0 } float-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
T{ ##shuffle-vector-imm f 2 1 { 1 0 } double-2-rep }
}
-] [
+} [
{
T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
T{ ##shuffle-vector-imm f 2 1 { 1 0 } double-2-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 0 55 }
T{ ##load-reference f 1 B{ 55 0 0 0 55 0 0 0 55 0 0 0 55 0 0 0 } }
T{ ##load-reference f 2 B{ 55 0 0 0 55 0 0 0 55 0 0 0 55 0 0 0 } }
}
-] [
+} [
{
T{ ##load-integer f 0 55 }
T{ ##scalar>vector f 1 0 int-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 1 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
T{ ##load-reference f 2 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
}
-] [
+} [
{
T{ ##load-reference f 0 1.25 }
T{ ##scalar>vector f 1 0 float-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 1 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
T{ ##load-reference f 2 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
}
-] [
+} [
{
T{ ##load-reference f 0 1.25 }
T{ ##scalar>vector f 1 0 float-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 0 55 }
T{ ##load-reference f 1 B{ 55 0 55 0 55 0 55 0 55 0 55 0 55 0 55 0 } }
T{ ##load-reference f 2 B{ 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 } }
T{ ##load-reference f 3 B{ 0 55 0 55 0 55 0 55 0 55 0 55 0 55 0 55 } }
}
-] [
+} [
{
T{ ##load-integer f 0 55 }
T{ ##scalar>vector f 1 0 short-8-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 2 3.75 }
T{ ##load-reference f 4 B{ 0 0 0 0 0 0 244 63 0 0 0 0 0 0 14 64 } }
}
-] [
+} [
{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 2 3.75 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 0 125 }
T{ ##load-integer f 2 375 }
T{ ##load-reference f 4 B{ 125 0 0 0 0 0 0 0 119 1 0 0 0 0 0 0 } }
}
-] [
+} [
{
T{ ##load-integer f 0 125 }
T{ ##load-integer f 2 375 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 1 2.50 }
T{ ##load-reference f 3 5.00 }
T{ ##load-reference f 4 B{ 0 0 160 63 0 0 32 64 0 0 112 64 0 0 160 64 } }
}
-] [
+} [
{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 1 2.50 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##load-integer f 0 125 }
T{ ##load-integer f 1 250 }
T{ ##load-integer f 3 500 }
T{ ##load-reference f 4 B{ 125 0 0 0 250 0 0 0 119 1 0 0 244 1 0 0 } }
}
-] [
+} [
{
T{ ##load-integer f 0 125 }
T{ ##load-integer f 1 250 }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##zero-vector f 2 float-4-rep }
}
-] [
+} [
{
T{ ##xor-vector f 2 1 1 float-4-rep }
} value-numbering-step
! NOT x AND y => x ANDN y
-[
+{
{
T{ ##fill-vector f 3 float-4-rep }
T{ ##xor-vector f 4 0 3 float-4-rep }
T{ ##andn-vector f 5 0 1 float-4-rep }
}
-] [
+} [
{
T{ ##fill-vector f 3 float-4-rep }
T{ ##xor-vector f 4 0 3 float-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##not-vector f 4 0 float-4-rep }
T{ ##andn-vector f 5 0 1 float-4-rep }
}
-] [
+} [
{
T{ ##not-vector f 4 0 float-4-rep }
T{ ##and-vector f 5 4 1 float-4-rep }
! x AND NOT y => y ANDN x
-[
+{
{
T{ ##fill-vector f 3 float-4-rep }
T{ ##xor-vector f 4 0 3 float-4-rep }
T{ ##andn-vector f 5 0 1 float-4-rep }
}
-] [
+} [
{
T{ ##fill-vector f 3 float-4-rep }
T{ ##xor-vector f 4 0 3 float-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##not-vector f 4 0 float-4-rep }
T{ ##andn-vector f 5 0 1 float-4-rep }
}
-] [
+} [
{
T{ ##not-vector f 4 0 float-4-rep }
T{ ##and-vector f 5 1 4 float-4-rep }
! NOT x ANDN y => x AND y
-[
+{
{
T{ ##fill-vector f 3 float-4-rep }
T{ ##xor-vector f 4 0 3 float-4-rep }
T{ ##and-vector f 5 0 1 float-4-rep }
}
-] [
+} [
{
T{ ##fill-vector f 3 float-4-rep }
T{ ##xor-vector f 4 0 3 float-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##not-vector f 4 0 float-4-rep }
T{ ##and-vector f 5 0 1 float-4-rep }
}
-] [
+} [
{
T{ ##not-vector f 4 0 float-4-rep }
T{ ##andn-vector f 5 4 1 float-4-rep }
! AND <=> ANDN
-[
+{
{
T{ ##fill-vector f 3 float-4-rep }
T{ ##xor-vector f 4 0 3 float-4-rep }
T{ ##and-vector f 6 0 2 float-4-rep }
T{ ##or-vector f 7 5 6 float-4-rep }
}
-] [
+} [
{
T{ ##fill-vector f 3 float-4-rep }
T{ ##xor-vector f 4 0 3 float-4-rep }
} value-numbering-step
] unit-test
-[
+{
{
T{ ##not-vector f 4 0 float-4-rep }
T{ ##andn-vector f 5 0 1 float-4-rep }
T{ ##and-vector f 6 0 2 float-4-rep }
T{ ##or-vector f 7 5 6 float-4-rep }
}
-] [
+} [
{
T{ ##not-vector f 4 0 float-4-rep }
T{ ##and-vector f 5 4 1 float-4-rep }
[ V{ 0 1 } clone >>successors basic-block set value-numbering-step ] keep
successors>> first ;
-[
+{
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##branch }
}
1
-] [
+} [
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##branch }
}
0
-] [
+} [
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##branch }
}
0
-] [
+} [
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##branch }
}
1
-] [
+} [
{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
1
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc< }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
0
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc<= }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
1
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc> }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
0
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc>= }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
0
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc= }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
1
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc/= }
} test-branch-folding
] unit-test
-[
+{
{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
T{ ##branch }
}
0
-] [
+} [
{
T{ ##peek f 0 D 0 }
T{ ##compare f 1 0 0 cc<= }
test-diamond
-[ ] [
+{ } [
0 get block>cfg dup cfg set
[ value-numbering ]
[ select-representations ]
[ destruct-ssa ] tri
] unit-test
-[ 1 ] [ 1 get successors>> length ] unit-test
+{ 1 } [ 1 get successors>> length ] unit-test
-[ t ] [ 1 get successors>> first 3 get eq? ] unit-test
+{ t } [ 1 get successors>> first 3 get eq? ] unit-test
-[ 2 ] [ 4 get instructions>> length ] unit-test
+{ 2 } [ 4 get instructions>> length ] unit-test
V{
T{ ##peek f 0 D 0 }
test-diamond
-[ ] [
+{ } [
0 get block>cfg
{ value-numbering eliminate-dead-code } apply-passes
] unit-test
-[ t ] [ 1 get successors>> first 3 get eq? ] unit-test
+{ t } [ 1 get successors>> first 3 get eq? ] unit-test
-[ 1 ] [ 3 get instructions>> first inputs>> assoc-size ] unit-test
+{ 1 } [ 3 get instructions>> first inputs>> assoc-size ] unit-test
V{ T{ ##prologue } T{ ##branch } } 0 test-bb
2 3 edge
4 5 edge
-[ ] [
+{ } [
0 get block>cfg
{ value-numbering eliminate-dead-code } apply-passes
] unit-test
-[ f ] [ 1 get instructions>> [ ##peek? ] any? ] unit-test
+{ f } [ 1 get instructions>> [ ##peek? ] any? ] unit-test
! Slot addressing optimization
cpu x86? [
! Alien addressing optimization
! Base offset fusion on ##load/store-memory-imm
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##tagged>integer f 2 1 }
T{ ##add-imm f 3 2 10 }
T{ ##load-memory-imm f 4 2 10 int-rep c:uchar }
}
-] [
+} [
V{
T{ ##peek f 1 D 0 }
T{ ##tagged>integer f 2 1 }
} value-numbering-step
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##add-imm f 4 3 10 }
T{ ##store-memory-imm f 2 3 10 int-rep c:uchar }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! Displacement fusion on ##load/store-memory-imm
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##add f 4 2 3 }
T{ ##load-memory f 5 2 3 0 0 int-rep c:uchar }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-numbering-step
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##add f 4 2 3 }
T{ ##store-memory f 5 2 3 0 0 int-rep c:uchar }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
! Displacement offset fusion should not occur on
! ##load/store-memory with non-zero scale
-[ ] [
+{ } [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
IN: compiler.cfg.write-barrier.tests
! Do need a write barrier on a random store.
-[
+{
V{
T{ ##peek f 1 }
T{ ##set-slot f 2 1 3 }
T{ ##write-barrier f 1 3 }
}
-] [
+} [
V{
T{ ##peek f 1 }
T{ ##set-slot f 2 1 3 }
} write-barriers-step
] unit-test
-[
+{
V{
T{ ##peek f 1 }
T{ ##set-slot-imm f 2 1 }
T{ ##write-barrier-imm f 1 }
}
-] [
+} [
V{
T{ ##peek f 1 }
T{ ##set-slot-imm f 2 1 }
] unit-test
! Don't need a write barrier on freshly allocated objects.
-[
+{
V{
T{ ##allot f 1 }
T{ ##set-slot f 2 1 3 }
}
-] [
+} [
V{
T{ ##allot f 1 }
T{ ##set-slot f 2 1 3 }
} write-barriers-step
] unit-test
-[
+{
V{
T{ ##allot f 1 }
T{ ##set-slot-imm f 2 1 }
}
-] [
+} [
V{
T{ ##allot f 1 }
T{ ##set-slot-imm f 2 1 }
! Do need a write barrier if there's a subroutine call between
! the allocation and the store.
-[
+{
V{
T{ ##allot f 1 }
T{ ##box }
T{ ##set-slot f 2 1 3 }
T{ ##write-barrier f 1 3 }
}
-] [
+} [
V{
T{ ##allot f 1 }
T{ ##box }
} write-barriers-step
] unit-test
-[
+{
V{
T{ ##allot f 1 }
T{ ##box }
T{ ##set-slot-imm f 2 1 }
T{ ##write-barrier-imm f 1 }
}
-] [
+} [
V{
T{ ##allot f 1 }
T{ ##box }
] unit-test
! ##copy instructions
-[
+{
V{
T{ ##copy f 2 1 }
T{ ##set-slot-imm f 3 1 }
T{ ##write-barrier-imm f 2 }
}
-] [
+} [
V{
T{ ##copy f 2 1 }
T{ ##set-slot-imm f 3 1 }
} write-barriers-step
] unit-test
-[
+{
V{
T{ ##copy f 2 1 }
T{ ##set-slot-imm f 3 2 }
T{ ##write-barrier-imm f 1 }
}
-] [
+} [
V{
T{ ##copy f 2 1 }
T{ ##set-slot-imm f 3 2 }
} write-barriers-step
] unit-test
-[
+{
V{
T{ ##copy f 2 1 }
T{ ##copy f 3 2 }
T{ ##set-slot-imm f 3 1 }
T{ ##write-barrier-imm f 2 }
}
-] [
+} [
V{
T{ ##copy f 2 1 }
T{ ##copy f 3 2 }
} write-barriers-step
] unit-test
-[
+{
V{
T{ ##copy f 2 1 }
T{ ##copy f 3 2 }
T{ ##set-slot-imm f 4 1 }
T{ ##write-barrier-imm f 3 }
}
-] [
+} [
V{
T{ ##copy f 2 1 }
T{ ##copy f 3 2 }
kernel make compiler.constants words ;
IN: compiler.codegen.tests
-[ ] [ [ ] with-fixup drop ] unit-test
-[ ] [ [ \ + %call ] with-fixup drop ] unit-test
+{ } [ [ ] with-fixup drop ] unit-test
+{ } [ [ \ + %call ] with-fixup drop ] unit-test
-[ ] [ [ <label> dup define-label dup resolve-label %jump-label ] with-fixup drop ] unit-test
-[ ] [ [ <label> dup define-label dup resolve-label B{ 0 0 0 0 } % rc-absolute-cell label-fixup ] with-fixup drop ] unit-test
+{ } [ [ <label> dup define-label dup resolve-label %jump-label ] with-fixup drop ] unit-test
+{ } [ [ <label> dup define-label dup resolve-label B{ 0 0 0 0 } % rc-absolute-cell label-fixup ] with-fixup drop ] unit-test
! Error checking
[ [ <label> dup define-label %jump-label ] with-fixup ] must-fail
] B{ } make
"result" set
-[ 0 ] [ "result" get length 16 mod ] unit-test
+{ 0 } [ "result" get length 16 mod ] unit-test
[
100 <byte-array> %
] B{ } make
"expect" set
-[ t ] [ "result" get length "expect" get length = ] unit-test
-[ t ] [ "result" get "expect" get = ] unit-test
+{ t } [ "result" get length "expect" get length = ] unit-test
+{ t } [ "result" get "expect" get = ] unit-test
! Fix the gc root offset calculations
SINGLETON: linux-x86.64
! Dependencies of all words should always be satisfied unless we're
! in the middle of recompiling something
-[ { } ] [
+{ { } } [
all-words dup [ subwords ] map concat append
H{ } clone '[ _ dependencies-satisfied? ] reject
] unit-test
: inline-recursive ( -- ) inline-recursive ; inline recursive
-[ t ] [ \ inline-recursive build-tree [ #recursive? ] any? ] unit-test
+{ t } [ \ inline-recursive build-tree [ #recursive? ] any? ] unit-test
: bad-recursion-1 ( a -- b )
dup [ drop bad-recursion-1 5 ] [ ] if ;
QUALIFIED-WITH: alien.c-types c
IN: compiler.tree.cleanup.tests
-[ t ] [ [ [ 1 ] [ 2 ] if ] cleaned-up-tree [ #if? ] contains-node? ] unit-test
+{ t } [ [ [ 1 ] [ 2 ] if ] cleaned-up-tree [ #if? ] contains-node? ] unit-test
-[ f ] [ [ f [ 1 ] [ 2 ] if ] cleaned-up-tree [ #if? ] contains-node? ] unit-test
+{ f } [ [ f [ 1 ] [ 2 ] if ] cleaned-up-tree [ #if? ] contains-node? ] unit-test
-[ f ] [ [ { array } declare [ 1 ] [ 2 ] if ] cleaned-up-tree [ #if? ] contains-node? ] unit-test
+{ f } [ [ { array } declare [ 1 ] [ 2 ] if ] cleaned-up-tree [ #if? ] contains-node? ] unit-test
-[ t ] [ [ { sequence } declare [ 1 ] [ 2 ] if ] cleaned-up-tree [ #if? ] contains-node? ] unit-test
+{ t } [ [ { sequence } declare [ 1 ] [ 2 ] if ] cleaned-up-tree [ #if? ] contains-node? ] unit-test
: recursive-test ( a -- b ) dup [ not recursive-test ] when ; inline recursive
-[ t ] [ [ recursive-test ] cleaned-up-tree [ #recursive? ] contains-node? ] unit-test
+{ t } [ [ recursive-test ] cleaned-up-tree [ #recursive? ] contains-node? ] unit-test
-[ f ] [ [ f recursive-test ] cleaned-up-tree [ #recursive? ] contains-node? ] unit-test
+{ f } [ [ f recursive-test ] cleaned-up-tree [ #recursive? ] contains-node? ] unit-test
-[ t ] [ [ t recursive-test ] cleaned-up-tree [ #recursive? ] contains-node? ] unit-test
+{ t } [ [ t recursive-test ] cleaned-up-tree [ #recursive? ] contains-node? ] unit-test
-[ f ] [
+{ f } [
[ { integer } declare >fixnum ]
\ >fixnum inlined?
] unit-test
M: f detect-f ; inline
-[ t ] [
+{ t } [
[ dup [ mynot ] [ ] if detect-f ] \ detect-f inlined?
] unit-test
M: object xyz ; inline
-[ t ] [
+{ t } [
[ { integer } declare xyz ] \ xyz inlined?
] unit-test
-[ t ] [
+{ t } [
[ dup fixnum? [ xyz ] [ drop "hi" ] if ]
\ xyz inlined?
] unit-test
! The + should be optimized into fixnum+, if it was not, then
! the type of the loop index was not inferred correctly
-[ t ] [
+{ t } [
[ [ dup 2 + drop ] fx-repeat ] \ + inlined?
] unit-test
: i-repeat ( n quot -- ) [ { integer } declare ] dip 0 -rot (i-repeat) ; inline
-[ t ] [
+{ t } [
[ [ dup xyz drop ] i-repeat ] \ xyz inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum } declare dup 100 >= [ 1 + ] unless ] \ fixnum+ inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum fixnum } declare dupd < [ 1 + 1 + ] when ]
\ + inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum fixnum } declare dupd < [ 1 + 1 + ] when ]
\ + inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum } declare [ ] times ] \ >= inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum } declare [ ] times ] \ + inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum } declare [ ] times ] \ fixnum+ inlined?
] unit-test
-[ t ] [
+{ t } [
[ { integer fixnum } declare dupd < [ 1 + ] when ]
\ + inlined?
] unit-test
-[ f ] [
+{ f } [
[ { integer fixnum } declare dupd < [ 1 + ] when ]
\ +-integer-fixnum inlined?
] unit-test
-[ t ] [
+{ t } [
[
[ no-cond ] 1
[ 1array dup quotation? [ >quotation ] unless ] times
] \ quotation? inlined?
] unit-test
-[ t ] [
+{ t } [
[
1000000000000000000000000000000000 [ ] times
] \ + inlined?
] unit-test
-[ f ] [
+{ f } [
[
1000000000000000000000000000000000 [ ] times
] \ +-integer-fixnum inlined?
] unit-test
-[ f ] [
+{ f } [
[ { bignum } declare [ ] times ]
\ +-integer-fixnum inlined?
] unit-test
-[ t ] [
+{ t } [
[ { array-capacity } declare 0 < ] \ < inlined?
] unit-test
-[ t ] [
+{ t } [
[ { array-capacity } declare 0 < ] \ fixnum< inlined?
] unit-test
-[ t ] [
+{ t } [
[ { array-capacity } declare 1 fixnum- ] \ fixnum- inlined?
] unit-test
: annotate-entry-test-2 ( from to -- obj ) 0 -rot (annotate-entry-test-2) ; inline
-[ f ] [
+{ f } [
[ { bignum } declare annotate-entry-test-2 ]
\ annotate-entry-test-1 inlined?
] unit-test
-[ t ] [
+{ t } [
[ { float } declare 10 [ 2.3 * ] times >float ]
\ >float inlined?
] unit-test
M: float detect-float ;
-[ t ] [
+{ t } [
[ { real float } declare + detect-float ]
\ detect-float inlined?
] unit-test
-[ t ] [
+{ t } [
[ { float real } declare + detect-float ]
\ detect-float inlined?
] unit-test
-[ f ] [
+{ f } [
[ { fixnum fixnum } declare 7 bitand neg shift ]
\ fixnum-shift-fast inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum fixnum } declare 7 bitand neg shift ]
{ shift fixnum-shift } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum fixnum } declare 1 swap 7 bitand shift ]
{ shift fixnum-shift } inlined?
] unit-test
-[ f ] [
+{ f } [
[ { fixnum fixnum } declare 1 swap 7 bitand shift ]
{ fixnum-shift-fast } inlined?
] unit-test
-[ t ] [
+{ t } [
[ 1 swap 7 bitand shift ]
{ shift fixnum-shift } inlined?
] unit-test
] unit-test
] when
-[ t ] [
+{ t } [
[ B{ 1 0 } c:short deref 0 number= ]
\ number= inlined?
] unit-test
-[ t ] [
+{ t } [
[ B{ 1 0 } c:short deref 0 { number number } declare number= ]
\ number= inlined?
] unit-test
-[ t ] [
+{ t } [
[ B{ 1 0 } c:short deref 0 = ]
\ number= inlined?
] unit-test
-[ t ] [
+{ t } [
[ B{ 1 0 } c:short deref dup number? [ 0 number= ] [ drop f ] if ]
\ number= inlined?
] unit-test
-[ t ] [
+{ t } [
[ 0xff bitand 0 0xff between? ]
\ >= inlined?
] unit-test
-[ t ] [
+{ t } [
[ 0xff swap 0xff bitand >= ]
\ >= inlined?
] unit-test
-[ t ] [
+{ t } [
[ { vector } declare nth-unsafe ] \ nth-unsafe inlined?
] unit-test
-[ t ] [
+{ t } [
[
dup integer? [
dup fixnum? [
: rec ( a -- b )
dup 0 > [ 1 - rec ] when ; inline recursive
-[ t ] [
+{ t } [
[ { fixnum } declare rec 1 + ]
{ > - + } inlined?
] unit-test
: fib ( m -- n )
dup 2 < [ drop 1 ] [ dup 1 - fib swap 2 - fib + ] if ; inline recursive
-[ t ] [
+{ t } [
[ 27.0 fib ] { < - + } inlined?
] unit-test
-[ f ] [
+{ f } [
[ 27.0 fib ] { +-integer-integer } inlined?
] unit-test
-[ t ] [
+{ t } [
[ 27 fib ] { < - + } inlined?
] unit-test
-[ t ] [
+{ t } [
[ 27 >bignum fib ] { < - + } inlined?
] unit-test
-[ f ] [
+{ f } [
[ 27/2 fib ] { < - } inlined?
] unit-test
-[ t ] [
+{ t } [
[ 10 [ -1 shift ] times ] \ shift inlined?
] unit-test
-[ f ] [
+{ f } [
[ { fixnum } declare 1048575 fixnum-bitand 524288 fixnum- ]
\ fixnum-bitand inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum } declare [ drop ] each-integer ]
{ < <-integer-fixnum +-integer-fixnum + } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum } declare iota [ drop ] each ]
{ < <-integer-fixnum +-integer-fixnum + } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum } declare iota 0 [ + ] reduce ]
{ < <-integer-fixnum nth-unsafe } inlined?
] unit-test
-[ f ] [
+{ f } [
[ { fixnum } declare iota 0 [ + ] reduce ]
\ +-integer-fixnum inlined?
] unit-test
-[ f ] [
+{ f } [
[
{ integer } declare iota [ ] map
] \ integer>fixnum inlined?
] unit-test
-[ f ] [
+{ f } [
[
{ integer } declare { } set-nth-unsafe
] \ integer>fixnum inlined?
] unit-test
-[ f ] [
+{ f } [
[
{ integer } declare 1 + { } set-nth-unsafe
] \ >fixnum inlined?
] unit-test
-[ t ] [
+{ t } [
[
{ array } declare length
1 + dup 100 fixnum> [ 1 fixnum+ ] when
] \ fixnum+ inlined?
] unit-test
-[ t ] [
+{ t } [
[ [ resize-array ] keep length ] \ length inlined?
] unit-test
-[ t ] [
+{ t } [
[ dup 0 > [ sqrt ] when ] \ sqrt inlined?
] unit-test
-[ t ] [
+{ t } [
[ { utf8 } declare decode-char ] \ decode-char inlined?
] unit-test
-[ t ] [
+{ t } [
[ { ascii } declare decode-char ] \ decode-char inlined?
] unit-test
-[ t ] [ [ { 1 2 } length ] { length length>> slot } inlined? ] unit-test
+{ t } [ [ { 1 2 } length ] { length length>> slot } inlined? ] unit-test
-[ t ] [
+{ t } [
[
{ integer } declare iota [ 0 >= ] map
] { >= fixnum>= } inlined?
] unit-test
-[ ] [
+{ } [
[
4 pick array-capacity?
[ set-slot ] [ \ array-capacity 2nip bad-slot-value ] if
] cleaned-up-tree drop
] unit-test
-[ ] [
+{ } [
[ { merge-state } declare accum>> 0 >>length ] cleaned-up-tree drop
] unit-test
-[ ] [
+{ } [
[
[ "X" throw ]
[ dupd dup -1 < [ 0 >= [ ] [ "X" throw ] if ] [ drop ] if ]
] cleaned-up-tree drop
] unit-test
-[ t ] [
+{ t } [
[ [ 2array ] [ 0 3array ] if first ]
{ nth-unsafe < <= > >= } inlined?
] unit-test
-[ ] [
+{ } [
[ [ [ "A" throw ] dip ] [ "B" throw ] if ]
cleaned-up-tree drop
] unit-test
2drop
] if ; inline recursive
-[ t ] [
+{ t } [
[ 2 swap >fixnum buffalo-wings ]
{ <-integer-fixnum +-integer-fixnum } inlined?
] unit-test
2drop
] if ; inline recursive
-[ t ] [
+{ t } [
[ 2 swap >fixnum ribs ]
{ <-integer-fixnum +-integer-fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ hashtable new ] \ new inlined?
] unit-test
-[ t ] [
+{ t } [
[ { array-capacity } declare 1 fixnum+ ] cleaned-up-tree
[ { [ #call? ] [ node-input-infos second literal>> 1 = ] } 1&& ] any?
] unit-test
-[ ] [
+{ } [
[ { null } declare [ 1 ] [ 2 ] if ]
build-tree normalize propagate cleanup-tree check-nodes
] unit-test
-[ t ] [
+{ t } [
[ { array } declare 2 <groups> [ . . ] assoc-each ]
\ nth-unsafe inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum fixnum } declare = ]
\ both-fixnums? inlined?
] unit-test
-[ t ] [
+{ t } [
[ { integer integer } declare + drop ]
{ + +-integer-integer } inlined?
] unit-test
-[ [ ] ] [
+{ [ ] } [
[
20 f <array>
[ 0 swap nth ] keep
] cleaned-up-tree nodes>quot
] unit-test
-[ t ] [
+{ t } [
[ int { } cdecl [ 2 2 + ] alien-callback ]
{ + } inlined?
] unit-test
-[ t ] [
+{ t } [
[ double { double double } cdecl [ + ] alien-callback ]
\ + inlined?
] unit-test
-[ f ] [
+{ f } [
[ double { double double } cdecl [ + ] alien-callback ]
\ float+ inlined?
] unit-test
-[ f ] [
+{ f } [
[ char { char char } cdecl [ + ] alien-callback ]
\ fixnum+fast inlined?
] unit-test
-[ t ] [
+{ t } [
[ void { } cdecl [ ] alien-callback void { } cdecl alien-indirect ]
\ >c-ptr inlined?
] unit-test
[ out-d>> length + ] [ drop ] if
] each-node ;
-[ 3 ] [ [ 1 2 3 ] count-live-values ] unit-test
+{ 3 } [ [ 1 2 3 ] count-live-values ] unit-test
-[ 1 ] [ [ drop ] count-live-values ] unit-test
+{ 1 } [ [ drop ] count-live-values ] unit-test
-[ 0 ] [ [ 1 drop ] count-live-values ] unit-test
+{ 0 } [ [ 1 drop ] count-live-values ] unit-test
-[ 1 ] [ [ 1 2 drop ] count-live-values ] unit-test
+{ 1 } [ [ 1 2 drop ] count-live-values ] unit-test
-[ 3 ] [ [ [ 1 ] [ 2 ] if ] count-live-values ] unit-test
+{ 3 } [ [ [ 1 ] [ 2 ] if ] count-live-values ] unit-test
-[ 1 ] [ [ [ 1 ] [ 2 ] if drop ] count-live-values ] unit-test
+{ 1 } [ [ [ 1 ] [ 2 ] if drop ] count-live-values ] unit-test
-[ 2 ] [ [ [ 1 ] [ dup ] if drop ] count-live-values ] unit-test
+{ 2 } [ [ [ 1 ] [ dup ] if drop ] count-live-values ] unit-test
-[ 2 ] [ [ 1 + ] count-live-values ] unit-test
+{ 2 } [ [ 1 + ] count-live-values ] unit-test
-[ 0 ] [ [ 1 2 + drop ] count-live-values ] unit-test
+{ 0 } [ [ 1 2 + drop ] count-live-values ] unit-test
-[ 3 ] [ [ 1 + 3 + ] count-live-values ] unit-test
+{ 3 } [ [ 1 + 3 + ] count-live-values ] unit-test
-[ 0 ] [ [ 1 2 + 3 + drop ] count-live-values ] unit-test
+{ 0 } [ [ 1 2 + 3 + drop ] count-live-values ] unit-test
-[ 4 ] [ [ [ 1 ] [ 2 ] if 3 + ] count-live-values ] unit-test
+{ 4 } [ [ [ 1 ] [ 2 ] if 3 + ] count-live-values ] unit-test
-[ 1 ] [ [ [ 1 ] [ 2 ] if 3 + drop ] count-live-values ] unit-test
+{ 1 } [ [ [ 1 ] [ 2 ] if 3 + drop ] count-live-values ] unit-test
-[ 0 ] [ [ [ ] call ] count-live-values ] unit-test
+{ 0 } [ [ [ ] call ] count-live-values ] unit-test
-[ 1 ] [ [ [ 1 ] call ] count-live-values ] unit-test
+{ 1 } [ [ [ 1 ] call ] count-live-values ] unit-test
-[ 2 ] [ [ [ 1 ] [ 2 ] compose call ] count-live-values ] unit-test
+{ 2 } [ [ [ 1 ] [ 2 ] compose call ] count-live-values ] unit-test
-[ 0 ] [ [ [ 1 ] [ 2 ] compose call + drop ] count-live-values ] unit-test
+{ 0 } [ [ [ 1 ] [ 2 ] compose call + drop ] count-live-values ] unit-test
-[ 3 ] [ [ 10 [ ] times ] count-live-values ] unit-test
+{ 3 } [ [ 10 [ ] times ] count-live-values ] unit-test
: optimize-quot ( quot -- quot' )
build-tree
remove-dead-code
"no-check" get [ dup check-nodes ] unless nodes>quot ;
-[ [ drop 1 ] ] [ [ [ 1 ] dip drop ] optimize-quot ] unit-test
+{ [ drop 1 ] } [ [ [ 1 ] dip drop ] optimize-quot ] unit-test
-[ [ stream-read1 drop 1 2 ] ] [ [ stream-read1 [ 1 2 ] dip drop ] optimize-quot ] unit-test
+{ [ stream-read1 drop 1 2 ] } [ [ stream-read1 [ 1 2 ] dip drop ] optimize-quot ] unit-test
-[ [ over >R + R> ] ] [ [ [ + ] [ drop ] 2bi ] optimize-quot ] unit-test
+{ [ over >R + R> ] } [ [ [ + ] [ drop ] 2bi ] optimize-quot ] unit-test
-[ [ [ ] [ ] if ] ] [ [ [ 1 ] [ 2 ] if drop ] optimize-quot ] unit-test
+{ [ [ ] [ ] if ] } [ [ [ 1 ] [ 2 ] if drop ] optimize-quot ] unit-test
: flushable-1 ( a b -- c ) 2drop f ; flushable
: flushable-2 ( a b -- c ) 2drop f ; flushable
-[ [ 2nip [ ] [ ] if ] ] [
+{ [ 2nip [ ] [ ] if ] } [
[ [ flushable-1 ] [ flushable-2 ] if drop ] optimize-quot
] unit-test
: non-flushable-3 ( a b -- c ) 2drop f ;
-[ [ [ 2drop ] [ non-flushable-3 drop ] if ] ] [
+{ [ [ 2drop ] [ non-flushable-3 drop ] if ] } [
[ [ flushable-1 ] [ non-flushable-3 ] if drop ] optimize-quot
] unit-test
-[ [ [ f ] [ f ] if ] ] [ [ [ f ] [ f ] if ] optimize-quot ] unit-test
+{ [ [ f ] [ f ] if ] } [ [ [ f ] [ f ] if ] optimize-quot ] unit-test
-[ ] [ [ dup [ 3 throw ] [ ] if ] optimize-quot drop ] unit-test
+{ } [ [ dup [ 3 throw ] [ ] if ] optimize-quot drop ] unit-test
-[ [ [ . ] [ drop ] if ] ] [ [ [ dup . ] [ ] if drop ] optimize-quot ] unit-test
+{ [ [ . ] [ drop ] if ] } [ [ [ dup . ] [ ] if drop ] optimize-quot ] unit-test
-[ [ f ] ] [ [ f dup [ ] [ ] if ] optimize-quot ] unit-test
+{ [ f ] } [ [ f dup [ ] [ ] if ] optimize-quot ] unit-test
-[ ] [ [ over [ ] [ dup [ "X" throw ] [ "X" throw ] if ] if ] optimize-quot drop ] unit-test
+{ } [ [ over [ ] [ dup [ "X" throw ] [ "X" throw ] if ] if ] optimize-quot drop ] unit-test
: boo ( a b -- c ) 2drop f ;
-[ [ dup 4 eq? [ nip ] [ boo ] if ] ] [ [ dup dup 4 eq? [ drop nip ] [ drop boo ] if ] optimize-quot ] unit-test
+{ [ dup 4 eq? [ nip ] [ boo ] if ] } [ [ dup dup 4 eq? [ drop nip ] [ drop boo ] if ] optimize-quot ] unit-test
: squish ( quot -- quot' )
[
: call-recursive-dce-1 ( a -- b )
[ call-recursive-dce-1 drop ] [ call-recursive-dce-1 ] bi ; inline recursive
-[ [ drop "WRAP" [ "REC" drop "REC" ] label ] ] [
+{ [ drop "WRAP" [ "REC" drop "REC" ] label ] } [
[ call-recursive-dce-1 ] optimize-quot squish
] unit-test
drop
produce-a-value dup . call-recursive-dce-2 ; inline recursive
-[ [ "WRAP" [ produce-a-value . "REC" ] label ] ] [
+{ [ "WRAP" [ produce-a-value . "REC" ] label ] } [
[ f call-recursive-dce-2 drop ] optimize-quot squish
] unit-test
-[ [ "WRAP" [ produce-a-value . "REC" ] label ] ] [
+{ [ "WRAP" [ produce-a-value . "REC" ] label ] } [
[ f call-recursive-dce-2 ] optimize-quot squish
] unit-test
: call-recursive-dce-3 ( a -- )
call-recursive-dce-3 ; inline recursive
-[ [ [ drop "WRAP" [ "REC" ] label ] [ . ] if ] ] [
+{ [ [ drop "WRAP" [ "REC" ] label ] [ . ] if ] } [
[ [ call-recursive-dce-3 ] [ . ] if ] optimize-quot squish
] unit-test
-[ [ drop "WRAP" [ "REC" ] label ] ] [
+{ [ drop "WRAP" [ "REC" ] label ] } [
[ call-recursive-dce-3 ] optimize-quot squish
] unit-test
: call-recursive-dce-4 ( a -- b )
call-recursive-dce-4 ; inline recursive
-[ [ drop "WRAP" [ "REC" ] label ] ] [
+{ [ drop "WRAP" [ "REC" ] label ] } [
[ call-recursive-dce-4 ] optimize-quot squish
] unit-test
-[ [ drop "WRAP" [ "REC" ] label ] ] [
+{ [ drop "WRAP" [ "REC" ] label ] } [
[ call-recursive-dce-4 drop ] optimize-quot squish
] unit-test
-[ ] [ [ f call-recursive-dce-3 swap ] optimize-quot drop ] unit-test
+{ } [ [ f call-recursive-dce-3 swap ] optimize-quot drop ] unit-test
: call-recursive-dce-5 ( -- ) call-recursive-dce-5 ; inline recursive
-[ ] [ [ call-recursive-dce-5 swap ] optimize-quot drop ] unit-test
+{ } [ [ call-recursive-dce-5 swap ] optimize-quot drop ] unit-test
-[ ] [ [ [ 0 -rot set-nth-unsafe ] curry (each-integer) ] optimize-quot drop ] unit-test
+{ } [ [ [ 0 -rot set-nth-unsafe ] curry (each-integer) ] optimize-quot drop ] unit-test
: call-recursive-dce-6 ( i quot: ( ..a -- ..b ) -- i )
dup call [ drop ] [ call-recursive-dce-6 ] if ; inline recursive
-[ ] [ [ [ ] curry [ ] swap compose call-recursive-dce-6 ] optimize-quot drop ] unit-test
+{ } [ [ [ ] curry [ ] swap compose call-recursive-dce-6 ] optimize-quot drop ] unit-test
-[ ] [ [ [ ] rot [ . ] curry pick [ roll 2drop call ] [ 2nip call ] if ] optimize-quot drop ] unit-test
+{ } [ [ [ ] rot [ . ] curry pick [ roll 2drop call ] [ 2nip call ] if ] optimize-quot drop ] unit-test
-[ [ drop ] ] [ [ array? drop ] optimize-quot ] unit-test
+{ [ drop ] } [ [ array? drop ] optimize-quot ] unit-test
-[ [ drop ] ] [ [ array instance? drop ] optimize-quot ] unit-test
+{ [ drop ] } [ [ array instance? drop ] optimize-quot ] unit-test
-[ [ drop ] ] [ [ { integer } declare f <array> drop ] optimize-quot ] unit-test
+{ [ drop ] } [ [ { integer } declare f <array> drop ] optimize-quot ] unit-test
-[ [ f <array> drop ] ] [ [ f <array> drop ] optimize-quot ] unit-test
+{ [ f <array> drop ] } [ [ f <array> drop ] optimize-quot ] unit-test
: call-recursive-dce-7 ( obj -- elt ? )
dup 5 = [ t ] [ dup [ call-recursive-dce-7 ] [ drop f f ] if ] if ; inline recursive
-[ ] [ [ call-recursive-dce-7 ] optimize-quot drop ] unit-test
+{ } [ [ call-recursive-dce-7 ] optimize-quot drop ] unit-test
-[ [ /i ] ] [ [ /mod drop ] optimize-quot ] unit-test
+{ [ /i ] } [ [ /mod drop ] optimize-quot ] unit-test
-[ [ mod ] ] [ [ /mod nip ] optimize-quot ] unit-test
+{ [ mod ] } [ [ /mod nip ] optimize-quot ] unit-test
-[ [ fixnum/i ] ] [ [ { fixnum fixnum } declare /mod drop ] optimize-quot ] unit-test
+{ [ fixnum/i ] } [ [ { fixnum fixnum } declare /mod drop ] optimize-quot ] unit-test
-[ [ fixnum-mod ] ] [ [ { fixnum fixnum } declare /mod nip ] optimize-quot ] unit-test
+{ [ fixnum-mod ] } [ [ { fixnum fixnum } declare /mod nip ] optimize-quot ] unit-test
-[ [ bignum/i ] ] [ [ { bignum bignum } declare /mod drop ] optimize-quot ] unit-test
+{ [ bignum/i ] } [ [ { bignum bignum } declare /mod drop ] optimize-quot ] unit-test
-[ [ bignum-mod ] ] [ [ { bignum bignum } declare /mod nip ] optimize-quot ] unit-test
+{ [ bignum-mod ] } [ [ { bignum bignum } declare /mod nip ] optimize-quot ] unit-test
-[ [ /i ] ] [ [ /mod drop ] optimize-quot ] unit-test
+{ [ /i ] } [ [ /mod drop ] optimize-quot ] unit-test
-[ [ mod ] ] [ [ /mod nip ] optimize-quot ] unit-test
+{ [ mod ] } [ [ /mod nip ] optimize-quot ] unit-test
binary-search compiler.tree.checker ;
IN: compiler.tree.def-use.tests
-[ t ] [
+{ t } [
[ 1 2 3 ] build-tree compute-def-use drop
def-use get {
[ assoc-size 3 = ]
: too-deep ( a b -- c )
dup [ drop ] [ 2dup too-deep too-deep drop ] if ; inline recursive
-[ ] [
+{ } [
[ too-deep ]
build-tree
analyze-recursive
compiler.tree.def-use.simplified accessors sequences sorting classes ;
IN: compiler.tree.def-use.simplified
-[ { #call #return } ] [
+{ { #call #return } } [
[ 1 dup reverse ] build-tree compute-def-use
first out-d>> first actually-used-by
[ node>> class-of ] map natural-sort
: word-1 ( a -- b ) dup [ word-1 ] when ; inline recursive
-[ { #introduce } ] [
+{ { #introduce } } [
[ word-1 ] build-tree analyze-recursive compute-def-use
last in-d>> first actually-defined-by
[ node>> class-of ] map natural-sort
] unit-test
-[ { #if #return } ] [
+{ { #if #return } } [
[ word-1 ] build-tree analyze-recursive compute-def-use
first out-d>> first actually-used-by
[ node>> class-of ] map natural-sort
: test-checker ( quot -- ? )
build-tree normalize propagate cleanup-tree run-escape-analysis? ;
-[ t ] [
+{ t } [
[ { complex } declare [ real>> ] [ imaginary>> ] bi ]
test-checker
] unit-test
-[ t ] [
+{ t } [
[ complex boa [ real>> ] [ imaginary>> ] bi ]
test-checker
] unit-test
-[ t ] [
+{ t } [
[ [ complex boa [ real>> ] [ imaginary>> ] bi ] when ]
test-checker
] unit-test
-[ f ] [
+{ f } [
[ swap 1 2 ? ]
test-checker
] unit-test
remove-dead-code
0 swap [ count-unboxed-allocations* ] each-node ;
-[ 0 ] [ [ [ + ] curry ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ [ + ] curry ] count-unboxed-allocations ] unit-test
-[ 1 ] [ [ [ + ] curry drop ] count-unboxed-allocations ] unit-test
+{ 1 } [ [ [ + ] curry drop ] count-unboxed-allocations ] unit-test
-[ 1 ] [ [ [ + ] curry 3 slot ] count-unboxed-allocations ] unit-test
+{ 1 } [ [ [ + ] curry 3 slot ] count-unboxed-allocations ] unit-test
-[ 1 ] [ [ [ + ] curry 3 slot drop ] count-unboxed-allocations ] unit-test
+{ 1 } [ [ [ + ] curry 3 slot drop ] count-unboxed-allocations ] unit-test
-[ 1 ] [ [ [ + ] curry uncurry ] count-unboxed-allocations ] unit-test
+{ 1 } [ [ [ + ] curry uncurry ] count-unboxed-allocations ] unit-test
-[ 1 ] [ [ [ + ] curry call ] count-unboxed-allocations ] unit-test
+{ 1 } [ [ [ + ] curry call ] count-unboxed-allocations ] unit-test
-[ 1 ] [ [ [ + ] curry call ] count-unboxed-allocations ] unit-test
+{ 1 } [ [ [ + ] curry call ] count-unboxed-allocations ] unit-test
-[ 0 ] [ [ [ [ + ] curry ] [ drop [ ] ] if ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ [ [ + ] curry ] [ drop [ ] ] if ] count-unboxed-allocations ] unit-test
-[ 2 ] [
+{ 2 } [
[ [ [ + ] curry ] [ [ * ] curry ] if uncurry ] count-unboxed-allocations
] unit-test
-[ 0 ] [
+{ 0 } [
[ [ [ + ] curry ] [ [ * ] curry ] if ] count-unboxed-allocations
] unit-test
-[ 3 ] [
+{ 3 } [
[ [ [ + ] curry ] [ dup [ [ * ] curry ] [ [ / ] curry ] if ] if uncurry ] count-unboxed-allocations
] unit-test
-[ 2 ] [
+{ 2 } [
[ [ [ + ] curry 4 ] [ dup [ [ * ] curry ] [ [ / ] curry ] if uncurry ] if ] count-unboxed-allocations
] unit-test
-[ 0 ] [
+{ 0 } [
[ [ [ + ] curry ] [ dup [ [ * ] curry ] [ [ / ] curry ] if ] if ] count-unboxed-allocations
] unit-test
TUPLE: cons { car read-only } { cdr read-only } ;
-[ 0 ] [
+{ 0 } [
[
dup 0 = [
2 cons boa
] count-unboxed-allocations
] unit-test
-[ 3 ] [
+{ 3 } [
[
dup 0 = [
2 cons boa
] count-unboxed-allocations
] unit-test
-[ 0 ] [
+{ 0 } [
[
dup 0 = [
dup 1 = [
] count-unboxed-allocations
] unit-test
-[ 2 ] [
+{ 2 } [
[
dup 0 = [
2 cons boa
] count-unboxed-allocations
] unit-test
-[ 0 ] [
+{ 0 } [
[
dup 0 = [
2 cons boa
] count-unboxed-allocations
] unit-test
-[ 2 ] [
+{ 2 } [
[
[ dup cons boa ] [ drop 1 2 cons boa ] if car>>
] count-unboxed-allocations
] unit-test
-[ 2 ] [
+{ 2 } [
[
3dup
[ cons boa ] [ cons boa 3 cons boa ] if
] count-unboxed-allocations
] unit-test
-[ 2 ] [
+{ 2 } [
[
3dup [ cons boa ] [ cons boa . 1 2 cons boa ] if
[ car>> ] [ cdr>> ] bi
] count-unboxed-allocations
] unit-test
-[ 1 ] [
+{ 1 } [
[ [ 3 cons boa ] [ "A" throw ] if car>> ]
count-unboxed-allocations
] unit-test
-[ 0 ] [
+{ 0 } [
[ 10 [ drop ] each-integer ] count-unboxed-allocations
] unit-test
-[ 0 ] [
+{ 0 } [
[
1 2 cons boa 10 [ drop 2 cons boa ] each-integer car>>
] count-unboxed-allocations
: infinite-cons-loop ( a -- b ) 2 cons boa infinite-cons-loop ; inline recursive
-[ 0 ] [
+{ 0 } [
[
1 2 cons boa infinite-cons-loop
] count-unboxed-allocations
C: <rw-box> rw-box
-[ 0 ] [ [ <rw-box> i>> ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ <rw-box> i>> ] count-unboxed-allocations ] unit-test
: fake-fib ( m -- n )
dup i>> 1 <= [ drop 1 <rw-box> ] when ; inline recursive
-[ 0 ] [ [ <rw-box> fake-fib i>> ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ <rw-box> fake-fib i>> ] count-unboxed-allocations ] unit-test
TUPLE: ro-box { i read-only } ;
swap i>> swap i>> + <ro-box>
] if ; inline recursive
-[ 5 ] [ [ <ro-box> tuple-fib i>> ] count-unboxed-allocations ] unit-test
+{ 5 } [ [ <ro-box> tuple-fib i>> ] count-unboxed-allocations ] unit-test
-[ 3 ] [ [ <ro-box> tuple-fib ] count-unboxed-allocations ] unit-test
+{ 3 } [ [ <ro-box> tuple-fib ] count-unboxed-allocations ] unit-test
: tuple-fib' ( m -- n )
dup 1 <= [ 1 - tuple-fib' i>> ] when <ro-box> ; inline recursive
-[ 0 ] [ [ tuple-fib' ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ tuple-fib' ] count-unboxed-allocations ] unit-test
: bad-tuple-fib-1 ( m -- n )
dup i>> 1 <= [
swap i>> swap i>> + <ro-box>
] if ; inline recursive
-[ 3 ] [ [ <ro-box> bad-tuple-fib-1 i>> ] count-unboxed-allocations ] unit-test
+{ 3 } [ [ <ro-box> bad-tuple-fib-1 i>> ] count-unboxed-allocations ] unit-test
: bad-tuple-fib-2 ( m -- n )
dup .
swap i>> swap i>> + <ro-box>
] if ; inline recursive
-[ 2 ] [ [ <ro-box> bad-tuple-fib-2 i>> ] count-unboxed-allocations ] unit-test
+{ 2 } [ [ <ro-box> bad-tuple-fib-2 i>> ] count-unboxed-allocations ] unit-test
: tuple-fib-2 ( m -- n )
dup 1 <= [
swap i>> swap i>> + <ro-box>
] if ; inline recursive
-[ 2 ] [ [ tuple-fib-2 i>> ] count-unboxed-allocations ] unit-test
+{ 2 } [ [ tuple-fib-2 i>> ] count-unboxed-allocations ] unit-test
: tuple-fib-3 ( m -- n )
dup 1 <= [
swap i>> swap i>> + <ro-box>
] if ; inline recursive
-[ 0 ] [ [ tuple-fib-3 i>> ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ tuple-fib-3 i>> ] count-unboxed-allocations ] unit-test
: bad-tuple-fib-3 ( m -- n )
dup 1 <= [
2drop f
] if ; inline recursive
-[ 0 ] [ [ bad-tuple-fib-3 i>> ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ bad-tuple-fib-3 i>> ] count-unboxed-allocations ] unit-test
-[ 1 ] [ [ complex boa >rect ] count-unboxed-allocations ] unit-test
+{ 1 } [ [ complex boa >rect ] count-unboxed-allocations ] unit-test
-[ 0 ] [ [ 1 cons boa 2 cons boa ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ 1 cons boa 2 cons boa ] count-unboxed-allocations ] unit-test
-[ 1 ] [ [ 1 cons boa 2 cons boa car>> ] count-unboxed-allocations ] unit-test
+{ 1 } [ [ 1 cons boa 2 cons boa car>> ] count-unboxed-allocations ] unit-test
-[ 0 ] [ [ 1 cons boa 2 cons boa dup . car>> ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ 1 cons boa 2 cons boa dup . car>> ] count-unboxed-allocations ] unit-test
-[ 0 ] [ [ 1 cons boa "x" get slot ] count-unboxed-allocations ] unit-test
+{ 0 } [ [ 1 cons boa "x" get slot ] count-unboxed-allocations ] unit-test
-[ 0 ] [
+{ 0 } [
[ dup -1 over >= [ 0 >= [ "A" throw ] unless ] [ drop ] if ]
count-unboxed-allocations
] unit-test
-[ 0 ] [
+{ 0 } [
[ \ too-many->r boa f f \ inference-error boa ]
count-unboxed-allocations
] unit-test
TUPLE: empty-tuple ;
-[ ] [ [ empty-tuple boa layout-of ] count-unboxed-allocations drop ] unit-test
+{ } [ [ empty-tuple boa layout-of ] count-unboxed-allocations drop ] unit-test
! New feature!
-[ 1 ] [ [ { complex } declare real>> ] count-unboxed-allocations ] unit-test
+{ 1 } [ [ { complex } declare real>> ] count-unboxed-allocations ] unit-test
-[ 1 ] [
+{ 1 } [
[ { complex } declare [ real>> ] [ imaginary>> ] bi ]
count-unboxed-allocations
] unit-test
-[ 0 ] [
+{ 0 } [
[ { vector } declare length>> ]
count-unboxed-allocations
] unit-test
TUPLE: point-2d { x read-only } { y read-only } ;
TUPLE: point-3d < point-2d { z read-only } ;
-[ 0 ] [
+{ 0 } [
[ { point-2d } declare dup point-3d? [ z>> ] [ x>> ] if ]
count-unboxed-allocations
] unit-test
-[ 0 ] [
+{ 0 } [
[ point-2d boa dup point-3d? [ z>> ] [ x>> ] if ]
count-unboxed-allocations
] unit-test
H{ } clone allocations set
<escaping-values> escaping-values set
-[ ] [ 8 [ introduce-value ] each-integer ] unit-test
+{ } [ 8 [ introduce-value ] each-integer ] unit-test
-[ ] [ { 1 2 } 3 record-allocation ] unit-test
+{ } [ { 1 2 } 3 record-allocation ] unit-test
-[ t ] [ { 1 2 } { 6 7 } congruent? ] unit-test
-[ f ] [ { 3 4 } { 6 7 } congruent? ] unit-test
-[ f ] [ { 3 4 5 } { 6 7 } congruent? ] unit-test
+{ t } [ { 1 2 } { 6 7 } congruent? ] unit-test
+{ f } [ { 3 4 } { 6 7 } congruent? ] unit-test
+{ f } [ { 3 4 5 } { 6 7 } congruent? ] unit-test
: test-modular-arithmetic ( quot -- quot' )
cleaned-up-tree nodes>quot ;
-[ [ >R >fixnum R> >fixnum fixnum+fast ] ]
+{ [ >R >fixnum R> >fixnum fixnum+fast ] }
[ [ { integer integer } declare + >fixnum ] test-modular-arithmetic ] unit-test
-[ [ +-integer-integer dup >fixnum ] ]
+{ [ +-integer-integer dup >fixnum ] }
[ [ { integer integer } declare + dup >fixnum ] test-modular-arithmetic ] unit-test
-[ [ >R >fixnum R> >fixnum fixnum+fast 4 fixnum*fast ] ]
+{ [ >R >fixnum R> >fixnum fixnum+fast 4 fixnum*fast ] }
[ [ { integer integer } declare + 4 * >fixnum ] test-modular-arithmetic ] unit-test
TUPLE: declared-fixnum { x fixnum } ;
-[ t ] [
+{ t } [
[ { declared-fixnum } declare [ 1 + ] change-x ]
{ + } inlined?
! XXX: As of .97, we do a bounds check and throw an error on
! { + fixnum+ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { declared-fixnum } declare x>> drop ]
{ slot } inlined?
] unit-test
-[ f ] [
+{ f } [
[ { integer } declare -63 shift 4095 bitand ]
\ shift inlined?
] unit-test
-[ t ] [
+{ t } [
[ { integer } declare 127 bitand 3 + ]
{ + +-integer-fixnum bitand } inlined?
] unit-test
-[ f ] [
+{ f } [
[ { integer } declare 127 bitand 3 + ]
{ integer>fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[
{ integer } declare
dup 0 >= [
] { * + shift mod fixnum-mod fixnum* fixnum+ fixnum- } inlined?
] unit-test
-[ t ] [
+{ t } [
[
{ fixnum } declare
615949 * 797807 + 20 2^ mod dup 19 2^ -
] { >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[
{ integer } declare 0 swap
[
] { * + shift rem mod fixnum-mod fixnum* fixnum+ fixnum- } inlined?
] unit-test
-[ t ] [
+{ t } [
[
{ fixnum } declare iota 0 swap
[
] { * + shift rem mod fixnum-mod fixnum* fixnum+ fixnum- >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { string sbuf } declare ] \ push-all def>> append \ + inlined?
] unit-test
-[ t ] [
+{ t } [
[ { string sbuf } declare ] \ push-all def>> append \ fixnum+ inlined?
] unit-test
-[ t ] [
+{ t } [
[ { string sbuf } declare ] \ push-all def>> append \ >fixnum inlined?
] unit-test
-[ t ] [
+{ t } [
[
{ integer } declare iota [ 256 mod ] map
] { mod fixnum-mod } inlined?
] unit-test
-[ f ] [
+{ f } [
[
256 mod
] { mod fixnum-mod } inlined?
] unit-test
-[ f ] [
+{ f } [
[
>fixnum 256 mod
] { mod fixnum-mod } inlined?
] unit-test
-[ f ] [
+{ f } [
[
dup 0 >= [ 256 mod ] when
] { mod fixnum-mod } inlined?
] unit-test
-[ t ] [
+{ t } [
[
{ integer } declare dup 0 >= [ 256 mod ] when
] { mod fixnum-mod } inlined?
] unit-test
-[ t ] [
+{ t } [
[
{ integer } declare 256 rem
] { mod fixnum-mod } inlined?
] unit-test
-[ t ] [
+{ t } [
[
{ iota-tuple } declare [ 256 rem ] map
] { mod fixnum-mod rem } inlined?
] unit-test
-[ [ drop 0 ] ]
+{ [ drop 0 ] }
[ [ >integer 1 rem ] test-modular-arithmetic ] unit-test
-[ [ drop 0 ] ]
+{ [ drop 0 ] }
[ [ >integer 1 mod ] test-modular-arithmetic ] unit-test
-[ [ >fixnum 255 >R R> fixnum-bitand ] ]
+{ [ >fixnum 255 >R R> fixnum-bitand ] }
[ [ >integer 256 rem ] test-modular-arithmetic ] unit-test
-[ t ] [
+{ t } [
[ { fixnum fixnum } declare + [ 1 + >fixnum ] [ 2 + >fixnum ] bi ]
{ >fixnum } inlined?
] unit-test
-[ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-unsigned-1 ] ]
+{ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-unsigned-1 ] }
[ [ [ { fixnum fixnum } declare + ] 2dip set-alien-unsigned-1 ] test-modular-arithmetic ] unit-test
-[ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-unsigned-2 ] ]
+{ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-unsigned-2 ] }
[ [ [ { fixnum fixnum } declare + ] 2dip set-alien-unsigned-2 ] test-modular-arithmetic ] unit-test
cell {
} case
[ [ [ { fixnum fixnum } declare + ] 2dip set-alien-unsigned-4 ] test-modular-arithmetic ] unit-test
-[ [ "COMPLEX SHUFFLE" fixnum+ "COMPLEX SHUFFLE" set-alien-unsigned-8 ] ]
+{ [ "COMPLEX SHUFFLE" fixnum+ "COMPLEX SHUFFLE" set-alien-unsigned-8 ] }
[ [ [ { fixnum fixnum } declare + ] 2dip set-alien-unsigned-8 ] test-modular-arithmetic ] unit-test
-[ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-signed-1 ] ]
+{ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-signed-1 ] }
[ [ [ { fixnum fixnum } declare + ] 2dip set-alien-signed-1 ] test-modular-arithmetic ] unit-test
-[ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-signed-2 ] ]
+{ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-signed-2 ] }
[ [ [ { fixnum fixnum } declare + ] 2dip set-alien-signed-2 ] test-modular-arithmetic ] unit-test
cell {
} case
[ [ [ { fixnum fixnum } declare + ] 2dip set-alien-signed-4 ] test-modular-arithmetic ] unit-test
-[ [ "COMPLEX SHUFFLE" fixnum+ "COMPLEX SHUFFLE" set-alien-signed-8 ] ]
+{ [ "COMPLEX SHUFFLE" fixnum+ "COMPLEX SHUFFLE" set-alien-signed-8 ] }
[ [ [ { fixnum fixnum } declare + ] 2dip set-alien-signed-8 ] test-modular-arithmetic ] unit-test
-[ t ] [ [ { fixnum byte-array } declare [ + ] with map ] { + fixnum+ >fixnum } inlined? ] unit-test
+{ t } [ [ { fixnum byte-array } declare [ + ] with map ] { + fixnum+ >fixnum } inlined? ] unit-test
-[ t ] [
+{ t } [
[ 0 10 <byte-array> 10 [ 1 pick 0 + >fixnum pick set-nth-unsafe [ 1 + >fixnum ] dip ] times ]
{ >fixnum } inlined?
] unit-test
-[ f ] [ [ + >fixnum ] { >fixnum } inlined? ] unit-test
+{ f } [ [ + >fixnum ] { >fixnum } inlined? ] unit-test
-[ t ] [
+{ t } [
[ >integer [ >fixnum ] [ >fixnum ] bi ]
{ >integer } inlined?
] unit-test
-[ f ] [
+{ f } [
[ >integer [ >fixnum ] [ >fixnum ] bi ]
{ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ >integer [ 2 + >fixnum ] [ 3 + >fixnum ] bi ]
{ >integer } inlined?
] unit-test
-[ f ] [
+{ f } [
[ >integer [ 2 + >fixnum ] [ 3 + >fixnum ] bi ]
{ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ >integer [ >fixnum ] [ >fixnum ] bi ]
{ >integer } inlined?
] unit-test
-[ f ] [
+{ f } [
[ >bignum [ >fixnum ] [ >fixnum ] bi ]
{ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ >bignum [ >fixnum ] [ >fixnum ] bi ]
{ >bignum } inlined?
] unit-test
-[ f ] [
+{ f } [
[ [ { fixnum } declare 2 fixnum+ ] dip [ >fixnum 2 - ] [ ] if ]
{ fixnum+ } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum boolean } declare [ 1 + ] [ "HI" throw ] if >fixnum ]
{ fixnum+ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum boolean } declare [ 1 + ] [ drop 5 ] if >fixnum ]
{ fixnum+ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum boolean } declare [ 1 + ] [ 2 + ] if >fixnum ]
{ fixnum+ >fixnum } inlined?
] unit-test
-[ [ [ 1 ] [ 4 ] if ] ] [
+{ [ [ 1 ] [ 4 ] if ] } [
[ [ 1.5 ] [ 4 ] if >fixnum ] test-modular-arithmetic
] unit-test
-[ [ [ 1 ] [ 2 ] if ] ] [
+{ [ [ 1 ] [ 2 ] if ] } [
[ [ 1.5 ] [ 2.3 ] if >fixnum ] test-modular-arithmetic
] unit-test
-[ f ] [
+{ f } [
[ { fixnum fixnum boolean } declare [ [ 3 * ] [ 1 + ] dip ] [ [ 4 - ] [ 2 + ] dip ] if >fixnum ]
{ fixnum+ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ 0 1000 [ 1 + dup >fixnum . ] times drop ]
{ fixnum+ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum } declare 3 + [ 1000 ] dip [ >fixnum . ] curry times ]
{ fixnum+ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ 0 1000 [ 1 + ] times >fixnum ]
{ fixnum+ >fixnum } inlined?
] unit-test
-[ f ] [
+{ f } [
[ f >fixnum ]
{ >fixnum } inlined?
] unit-test
-[ f ] [
+{ f } [
[ [ >fixnum ] 2dip set-alien-unsigned-1 ]
{ >fixnum } inlined?
] unit-test
-[ t ] [
+{ t } [
[ { fixnum } declare 123 >bignum bitand >fixnum ]
{ >bignum fixnum>bignum bignum-bitand } inlined?
] unit-test
! Shifts
-[ t ] [
+{ t } [
[
[ 0 ] 2dip { array } declare [
hashcode* >fixnum swap [
sequences accessors tools.test kernel math ;
IN: compiler.tree.normalization.tests
-[ 3 ] [ [ 3drop 1 2 3 ] build-tree count-introductions ] unit-test
+{ 3 } [ [ 3drop 1 2 3 ] build-tree count-introductions ] unit-test
-[ 4 ] [ [ 3drop 1 2 3 3drop drop ] build-tree count-introductions ] unit-test
+{ 4 } [ [ 3drop 1 2 3 3drop drop ] build-tree count-introductions ] unit-test
-[ 3 ] [ [ [ drop ] [ 2drop 3 ] if ] build-tree count-introductions ] unit-test
+{ 3 } [ [ [ drop ] [ 2drop 3 ] if ] build-tree count-introductions ] unit-test
-[ 2 ] [ [ 3 [ drop ] [ 2drop 3 ] if ] build-tree count-introductions ] unit-test
+{ 2 } [ [ 3 [ drop ] [ 2drop 3 ] if ] build-tree count-introductions ] unit-test
: foo ( ..a quot: ( ..a -- ..b ) -- ..b ) call ; inline recursive
: recursive-inputs ( nodes -- n )
[ #recursive? ] find nip child>> first in-d>> length ;
-[ 1 3 ] [
+{ 1 3 } [
[ [ swap ] foo ] build-tree
[ recursive-inputs ]
[ analyze-recursive normalize recursive-inputs ] bi
: test-normalization ( quot -- )
build-tree analyze-recursive normalize check-nodes ;
-[ ] [ [ [ 1 ] [ 2 ] if + * ] test-normalization ] unit-test
+{ } [ [ [ 1 ] [ 2 ] if + * ] test-normalization ] unit-test
DEFER: bbb
: aaa ( obj x -- obj ) dup [ dup [ bbb ] dip aaa ] [ drop ] if ; inline recursive
: bbb ( obj x -- obj ) [ drop 0 ] dip aaa ; inline recursive
-[ ] [ [ bbb ] test-normalization ] unit-test
+{ } [ [ bbb ] test-normalization ] unit-test
: ccc ( obj -- 1 ) ccc drop 1 ; inline recursive
-[ ] [ [ ccc ] test-normalization ] unit-test
+{ } [ [ ccc ] test-normalization ] unit-test
DEFER: eee
: ddd ( a b -- a b ) eee ; inline recursive
: eee ( a b -- a b ) swap ddd ; inline recursive
-[ ] [ [ eee ] test-normalization ] unit-test
+{ } [ [ eee ] test-normalization ] unit-test
: call-recursive-5 ( -- ) call-recursive-5 ; inline recursive
-[ ] [ [ call-recursive-5 swap ] test-normalization ] unit-test
+{ } [ [ call-recursive-5 swap ] test-normalization ] unit-test
] unit-test
! execute-effect-unsafe?
-[ t ] [ \ + ( a b -- c ) execute-effect-unsafe? ] unit-test
-[ t ] [ \ + ( a b c -- d e ) execute-effect-unsafe? ] unit-test
-[ f ] [ \ + ( a b c -- d ) execute-effect-unsafe? ] unit-test
-[ f ] [ \ call ( x -- ) execute-effect-unsafe? ] unit-test
+{ t } [ \ + ( a b -- c ) execute-effect-unsafe? ] unit-test
+{ t } [ \ + ( a b c -- d e ) execute-effect-unsafe? ] unit-test
+{ f } [ \ + ( a b c -- d ) execute-effect-unsafe? ] unit-test
+{ f } [ \ call ( x -- ) execute-effect-unsafe? ] unit-test
! update-inline-cache
{ t } [
: compiled-execute2 ( a b word: ( a b -- c ) -- c )
execute( a b -- c ) ;
-[ [ 3 ] ] [ [ 1 2 \ + execute( a b -- c ) ] optimized-quot ] unit-test
-[ [ 3 ] ] [ [ 1 2 [ + ] call( a b -- c ) ] optimized-quot ] unit-test
-[ [ 3 ] ] [ [ 1 2 '[ _ + ] call( a -- b ) ] optimized-quot ] unit-test
-[ [ 3 ] ] [ [ 1 2 '[ _ ] [ + ] compose call( a -- b ) ] optimized-quot ] unit-test
+{ [ 3 ] } [ [ 1 2 \ + execute( a b -- c ) ] optimized-quot ] unit-test
+{ [ 3 ] } [ [ 1 2 [ + ] call( a b -- c ) ] optimized-quot ] unit-test
+{ [ 3 ] } [ [ 1 2 '[ _ + ] call( a -- b ) ] optimized-quot ] unit-test
+{ [ 3 ] } [ [ 1 2 '[ _ ] [ + ] compose call( a -- b ) ] optimized-quot ] unit-test
[ 1 2 { [ + ] } first compiled-call2 ] must-fail
-[ 3 ] [ 1 2 { + } first compiled-execute2 ] unit-test
-[ 3 ] [ 1 2 '[ _ + ] compiled-call2 ] unit-test
-[ 3 ] [ 1 2 '[ _ ] [ + ] compose compiled-call2 ] unit-test
-[ 3 ] [ 1 2 \ + compiled-execute2 ] unit-test
-
-[ 3 ] [ 1 2 { [ + ] } first call( a b -- c ) ] unit-test
-[ 3 ] [ 1 2 { + } first execute( a b -- c ) ] unit-test
-[ 3 ] [ 1 2 '[ _ + ] call( a -- b ) ] unit-test
-[ 3 ] [ 1 2 '[ _ ] [ + ] compose call( a -- b ) ] unit-test
-
-[ t ] [ [ 2 '[ _ ] [ + ] compose ] final-info first infer-value ( object -- object ) effect= ] unit-test
-[ t ] [ [ 2 '[ _ ] 1 '[ _ + ] compose ] final-info first infer-value ( -- object ) effect= ] unit-test
-[ t ] [ [ 2 '[ _ + ] ] final-info first infer-value ( object -- object ) effect= ] unit-test
-[ f ] [ [ [ [ ] [ 1 ] if ] ] final-info first infer-value ] unit-test
-[ t ] [ [ [ 1 ] '[ @ ] ] final-info first infer-value ( -- object ) effect= ] unit-test
-[ f ] [ [ dup drop ] final-info first infer-value ] unit-test
+{ 3 } [ 1 2 { + } first compiled-execute2 ] unit-test
+{ 3 } [ 1 2 '[ _ + ] compiled-call2 ] unit-test
+{ 3 } [ 1 2 '[ _ ] [ + ] compose compiled-call2 ] unit-test
+{ 3 } [ 1 2 \ + compiled-execute2 ] unit-test
+
+{ 3 } [ 1 2 { [ + ] } first call( a b -- c ) ] unit-test
+{ 3 } [ 1 2 { + } first execute( a b -- c ) ] unit-test
+{ 3 } [ 1 2 '[ _ + ] call( a -- b ) ] unit-test
+{ 3 } [ 1 2 '[ _ ] [ + ] compose call( a -- b ) ] unit-test
+
+{ t } [ [ 2 '[ _ ] [ + ] compose ] final-info first infer-value ( object -- object ) effect= ] unit-test
+{ t } [ [ 2 '[ _ ] 1 '[ _ + ] compose ] final-info first infer-value ( -- object ) effect= ] unit-test
+{ t } [ [ 2 '[ _ + ] ] final-info first infer-value ( object -- object ) effect= ] unit-test
+{ f } [ [ [ [ ] [ 1 ] if ] ] final-info first infer-value ] unit-test
+{ t } [ [ [ 1 ] '[ @ ] ] final-info first infer-value ( -- object ) effect= ] unit-test
+{ f } [ [ dup drop ] final-info first infer-value ] unit-test
! This should not hang
-[ ] [ [ [ dup call( quot -- ) ] dup call( quot -- ) ] final-info drop ] unit-test
-[ ] [ [ [ dup curry call( quot -- ) ] dup curry call( quot -- ) ] final-info drop ] unit-test
+{ } [ [ [ dup call( quot -- ) ] dup call( quot -- ) ] final-info drop ] unit-test
+{ } [ [ [ dup curry call( quot -- ) ] dup curry call( quot -- ) ] final-info drop ] unit-test
! This should get inlined, because the parameter to the curry is literal even though
! [ boa ] by itself doesn't infer
TUPLE: a-tuple x ;
-[ V{ a-tuple } ] [ [ a-tuple '[ _ boa ] call( x -- tuple ) ] final-classes ] unit-test
+{ V{ a-tuple } } [ [ a-tuple '[ _ boa ] call( x -- tuple ) ] final-classes ] unit-test
! See if redefinitions are handled correctly
: call(-redefine-test ( a -- b ) 1 + ;
: test-quotatation ( -- quot ) [ call(-redefine-test ] ;
-[ t ] [ test-quotatation cached-effect ( a -- b ) effect<= ] unit-test
+{ t } [ test-quotatation cached-effect ( a -- b ) effect<= ] unit-test
-[ ] [ "IN: compiler.tree.propagation.call-effect.tests USE: math : call(-redefine-test ( a b -- c ) + ;" eval( -- ) ] unit-test
+{ } [ "IN: compiler.tree.propagation.call-effect.tests USE: math : call(-redefine-test ( a b -- c ) + ;" eval( -- ) ] unit-test
-[ t ] [ test-quotatation cached-effect ( a b -- c ) effect<= ] unit-test
+{ t } [ test-quotatation cached-effect ( a b -- c ) effect<= ] unit-test
: inline-cache-invalidation-test ( a b c -- c ) call( a b -- c ) ;
-[ 4 ] [ 1 3 test-quotatation inline-cache-invalidation-test ] unit-test
+{ 4 } [ 1 3 test-quotatation inline-cache-invalidation-test ] unit-test
-[ ] [ "IN: compiler.tree.propagation.call-effect.tests USE: math : call(-redefine-test ( a -- c ) 1 + ;" eval( -- ) ] unit-test
+{ } [ "IN: compiler.tree.propagation.call-effect.tests USE: math : call(-redefine-test ( a -- c ) 1 + ;" eval( -- ) ] unit-test
[ 1 3 test-quotatation inline-cache-invalidation-test ] [ T{ wrong-values f [ call(-redefine-test ] ( a b -- c ) } = ] must-fail-with
: my-word ( a b c q -- result ) call( a b c -- result ) ;
-[ T{ my-tuple f 1 2 3 } ] [ 1 2 3 my-quot my-word ] unit-test
+{ T{ my-tuple f 1 2 3 } } [ 1 2 3 my-quot my-word ] unit-test
-[ ] [ "IN: compiler.tree.propagation.call-effect.tests TUPLE: my-tuple a b ;" eval( -- ) ] unit-test
+{ } [ "IN: compiler.tree.propagation.call-effect.tests TUPLE: my-tuple a b ;" eval( -- ) ] unit-test
[ 1 2 3 my-quot my-word ] [ wrong-values? ] must-fail-with
H{ } clone copies set
-[ ] [ 0 introduce-value ] unit-test
-[ ] [ 1 introduce-value ] unit-test
-[ ] [ 1 2 is-copy-of ] unit-test
-[ ] [ 2 3 is-copy-of ] unit-test
-[ ] [ 2 4 is-copy-of ] unit-test
-[ ] [ 4 5 is-copy-of ] unit-test
-[ ] [ 0 6 is-copy-of ] unit-test
+{ } [ 0 introduce-value ] unit-test
+{ } [ 1 introduce-value ] unit-test
+{ } [ 1 2 is-copy-of ] unit-test
+{ } [ 2 3 is-copy-of ] unit-test
+{ } [ 2 4 is-copy-of ] unit-test
+{ } [ 4 5 is-copy-of ] unit-test
+{ } [ 0 6 is-copy-of ] unit-test
-[ 0 ] [ 0 resolve-copy ] unit-test
-[ 1 ] [ 5 resolve-copy ] unit-test
+{ 0 } [ 0 resolve-copy ] unit-test
+{ 1 } [ 5 resolve-copy ] unit-test
! Make sure that we did path compression
-[ 1 ] [ 5 copies get at ] unit-test
+{ 1 } [ 5 copies get at ] unit-test
-[ 1 ] [ 1 resolve-copy ] unit-test
-[ 1 ] [ 2 resolve-copy ] unit-test
-[ 1 ] [ 3 resolve-copy ] unit-test
-[ 1 ] [ 4 resolve-copy ] unit-test
-[ 0 ] [ 6 resolve-copy ] unit-test
+{ 1 } [ 1 resolve-copy ] unit-test
+{ 1 } [ 2 resolve-copy ] unit-test
+{ 1 } [ 3 resolve-copy ] unit-test
+{ 1 } [ 4 resolve-copy ] unit-test
+{ 0 } [ 6 resolve-copy ] unit-test
kernel tools.test compiler.tree.propagation.info arrays ;
IN: compiler.tree.propagation.info.tests
-[ f ] [ 0.0 -0.0 eql? ] unit-test
+{ f } [ 0.0 -0.0 eql? ] unit-test
-[ t t ] [
+{ t t } [
0 10 [a,b] <interval-info>
5 20 [a,b] <interval-info>
value-info-intersect
bi
] unit-test
-[ float 10.0 t ] [
+{ float 10.0 t } [
10.0 <literal-info>
10.0 <literal-info>
value-info-intersect
[ class>> ] [ >literal< ] bi
] unit-test
-[ null ] [
+{ null } [
10 <literal-info>
10.0 <literal-info>
value-info-intersect
class>>
] unit-test
-[ fixnum 10 t ] [
+{ fixnum 10 t } [
10 <literal-info>
10 <literal-info>
value-info-union
[ class>> ] [ >literal< ] bi
] unit-test
-[ 3.0 t ] [
+{ 3.0 t } [
3 3 [a,b] <interval-info> float <class-info>
value-info-intersect >literal<
] unit-test
-[ 3 t ] [
+{ 3 t } [
2 3 (a,b] <interval-info> fixnum <class-info>
value-info-intersect >literal<
] unit-test
-[ T{ value-info-state f null empty-interval f f } ] [
+{ T{ value-info-state f null empty-interval f f } } [
fixnum -10 0 [a,b] <class/interval-info>
fixnum 19 29 [a,b] <class/interval-info>
value-info-intersect
] unit-test
-[ 3 t ] [
+{ 3 t } [
3 <literal-info>
null-info value-info-union >literal<
] unit-test
-[ ] [ { } value-infos-union drop ] unit-test
+{ } [ { } value-infos-union drop ] unit-test
TUPLE: test-tuple { x read-only } ;
-[ t ] [
+{ t } [
f f 3 <literal-info> 3array test-tuple <tuple-info> dup
object-info value-info-intersect =
] unit-test
-[ t ] [
+{ t } [
null-info 3 <literal-info> value-info<=
] unit-test
-[ t t ] [
+{ t t } [
f <literal-info>
fixnum 0 40 [a,b] <class/interval-info>
value-info-union
SPECIALIZED-ARRAY: void*
IN: compiler.tree.propagation.tests
-[ { } ] [
+{ { } } [
all-words [
"input-classes" word-prop [ class? ] all? not
] filter
[ fixnum>float ] final-info first interval>> fixnum-interval =
] unit-test
-[ V{ } ] [ [ ] final-classes ] unit-test
+{ V{ } } [ [ ] final-classes ] unit-test
-[ V{ fixnum } ] [ [ 1 ] final-classes ] unit-test
+{ V{ fixnum } } [ [ 1 ] final-classes ] unit-test
-[ V{ fixnum } ] [ [ 1 [ ] dip ] final-classes ] unit-test
+{ V{ fixnum } } [ [ 1 [ ] dip ] final-classes ] unit-test
-[ V{ fixnum object } ] [ [ 1 swap ] final-classes ] unit-test
+{ V{ fixnum object } } [ [ 1 swap ] final-classes ] unit-test
-[ V{ array } ] [ [ 10 f <array> ] final-classes ] unit-test
+{ V{ array } } [ [ 10 f <array> ] final-classes ] unit-test
-[ V{ array } ] [ [ { array } declare ] final-classes ] unit-test
+{ V{ array } } [ [ { array } declare ] final-classes ] unit-test
-[ V{ array } ] [ [ 10 f <array> swap [ ] [ ] if ] final-classes ] unit-test
+{ V{ array } } [ [ 10 f <array> swap [ ] [ ] if ] final-classes ] unit-test
-[ V{ fixnum } ] [ [ dup fixnum? [ ] [ drop 3 ] if ] final-classes ] unit-test
+{ V{ fixnum } } [ [ dup fixnum? [ ] [ drop 3 ] if ] final-classes ] unit-test
-[ V{ 69 } ] [ [ [ 69 ] [ 69 ] if ] final-literals ] unit-test
+{ V{ 69 } } [ [ [ 69 ] [ 69 ] if ] final-literals ] unit-test
-[ V{ integer } ] [ [ bitnot ] final-classes ] unit-test
+{ V{ integer } } [ [ bitnot ] final-classes ] unit-test
-[ V{ fixnum } ] [ [ { fixnum } declare bitnot ] final-classes ] unit-test
+{ V{ fixnum } } [ [ { fixnum } declare bitnot ] final-classes ] unit-test
! Test type propagation for math ops
: cleanup-math-class ( obj -- class )
: final-math-class ( quot -- class )
final-classes first cleanup-math-class ;
-[ number ] [ [ + ] final-math-class ] unit-test
+{ number } [ [ + ] final-math-class ] unit-test
-[ bignum ] [ [ { fixnum bignum } declare + ] final-math-class ] unit-test
+{ bignum } [ [ { fixnum bignum } declare + ] final-math-class ] unit-test
-[ integer ] [ [ { fixnum integer } declare + ] final-math-class ] unit-test
+{ integer } [ [ { fixnum integer } declare + ] final-math-class ] unit-test
-[ bignum ] [ [ { integer bignum } declare + ] final-math-class ] unit-test
+{ bignum } [ [ { integer bignum } declare + ] final-math-class ] unit-test
-[ integer ] [ [ { fixnum fixnum } declare + ] final-math-class ] unit-test
+{ integer } [ [ { fixnum fixnum } declare + ] final-math-class ] unit-test
-[ float ] [ [ { float integer } declare + ] final-math-class ] unit-test
+{ float } [ [ { float integer } declare + ] final-math-class ] unit-test
-[ float ] [ [ { real float } declare + ] final-math-class ] unit-test
+{ float } [ [ { real float } declare + ] final-math-class ] unit-test
-[ float ] [ [ { float real } declare + ] final-math-class ] unit-test
+{ float } [ [ { float real } declare + ] final-math-class ] unit-test
-[ rational ] [ [ { ratio ratio } declare + ] final-math-class ] unit-test
+{ rational } [ [ { ratio ratio } declare + ] final-math-class ] unit-test
-[ rational ] [ [ { rational ratio } declare + ] final-math-class ] unit-test
+{ rational } [ [ { rational ratio } declare + ] final-math-class ] unit-test
-[ number ] [ [ { complex complex } declare + ] final-math-class ] unit-test
+{ number } [ [ { complex complex } declare + ] final-math-class ] unit-test
-[ float ] [ [ /f ] final-math-class ] unit-test
+{ float } [ [ /f ] final-math-class ] unit-test
-[ float ] [ [ { real real } declare /f ] final-math-class ] unit-test
+{ float } [ [ { real real } declare /f ] final-math-class ] unit-test
-[ integer ] [ [ /i ] final-math-class ] unit-test
+{ integer } [ [ /i ] final-math-class ] unit-test
-[ integer ] [ [ { integer float } declare /i ] final-math-class ] unit-test
+{ integer } [ [ { integer float } declare /i ] final-math-class ] unit-test
-[ integer ] [ [ { float float } declare /i ] final-math-class ] unit-test
+{ integer } [ [ { float float } declare /i ] final-math-class ] unit-test
-[ integer ] [ [ { integer } declare bitnot ] final-math-class ] unit-test
+{ integer } [ [ { integer } declare bitnot ] final-math-class ] unit-test
-[ null ] [ [ { null null } declare + ] final-math-class ] unit-test
+{ null } [ [ { null null } declare + ] final-math-class ] unit-test
-[ null ] [ [ { null fixnum } declare + ] final-math-class ] unit-test
+{ null } [ [ { null fixnum } declare + ] final-math-class ] unit-test
-[ float ] [ [ { float fixnum } declare + ] final-math-class ] unit-test
+{ float } [ [ { float fixnum } declare + ] final-math-class ] unit-test
-[ bignum ] [ [ { bignum bignum } declare bitxor ] final-math-class ] unit-test
+{ bignum } [ [ { bignum bignum } declare bitxor ] final-math-class ] unit-test
-[ bignum ] [ [ { integer } declare 123 >bignum bitand ] final-math-class ] unit-test
+{ bignum } [ [ { integer } declare 123 >bignum bitand ] final-math-class ] unit-test
-[ float ] [ [ { float float } declare mod ] final-math-class ] unit-test
+{ float } [ [ { float float } declare mod ] final-math-class ] unit-test
-[ V{ integer float } ] [ [ { float float } declare [ /i ] keep ] final-classes ] unit-test
+{ V{ integer float } } [ [ { float float } declare [ /i ] keep ] final-classes ] unit-test
-[ V{ fixnum } ] [ [ 255 bitand ] final-classes ] unit-test
+{ V{ fixnum } } [ [ 255 bitand ] final-classes ] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ [ 255 bitand ] [ 65535 bitand ] bi + ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[
{ fixnum } declare [ 255 bitand ] [ 65535 bitand ] bi +
] final-classes
] unit-test
-[ V{ integer } ] [
+{ V{ integer } } [
[ { fixnum } declare [ 255 bitand ] keep + ] final-classes
] unit-test
-[ V{ integer } ] [
+{ V{ integer } } [
[ { fixnum } declare 615949 * ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ 255 bitand >fixnum 3 bitor ] final-classes
] unit-test
-[ V{ 0 } ] [
+{ V{ 0 } } [
[ >fixnum 1 mod ] final-literals
] unit-test
-[ V{ 69 } ] [
+{ V{ 69 } } [
[ >fixnum swap [ 1 mod 69 + ] [ drop 69 ] if ] final-literals
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ >fixnum dup 10 > [ 1 - ] when ] final-classes
] unit-test
-[ V{ integer } ] [ [ >fixnum 2 * ] final-classes ] unit-test
+{ V{ integer } } [ [ >fixnum 2 * ] final-classes ] unit-test
-[ V{ integer } ] [
+{ V{ integer } } [
[ >fixnum dup 10 < drop 2 * ] final-classes
] unit-test
-[ V{ integer } ] [
+{ V{ integer } } [
[ >fixnum dup 10 < [ 2 * ] when ] final-classes
] unit-test
-[ V{ integer } ] [
+{ V{ integer } } [
[ >fixnum dup 10 < [ 2 * ] [ 2 * ] if ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ >fixnum dup 10 < [ dup -10 > [ 2 * ] when ] when ] final-classes
] unit-test
-[ V{ f } ] [
+{ V{ f } } [
[ dup 10 < [ dup 8 > [ drop 9 ] unless ] [ drop 9 ] if ] final-literals
] unit-test
-[ V{ 9 } ] [
+{ V{ 9 } } [
[
123 bitand
dup 10 < [ dup 8 > [ drop 9 ] unless ] [ drop 9 ] if
] final-literals
] unit-test
-[ V{ t } ] [ [ 40 mod 40 < ] final-literals ] unit-test
+{ V{ t } } [ [ 40 mod 40 < ] final-literals ] unit-test
-[ V{ f } ] [ [ 40 mod 0 >= ] final-literals ] unit-test
+{ V{ f } } [ [ 40 mod 0 >= ] final-literals ] unit-test
-[ V{ t } ] [ [ 40 rem 0 >= ] final-literals ] unit-test
+{ V{ t } } [ [ 40 rem 0 >= ] final-literals ] unit-test
-[ V{ t } ] [ [ abs 40 mod 0 >= ] final-literals ] unit-test
+{ V{ t } } [ [ abs 40 mod 0 >= ] final-literals ] unit-test
-[ t ] [ [ abs ] final-info first interval>> [0,inf] = ] unit-test
+{ t } [ [ abs ] final-info first interval>> [0,inf] = ] unit-test
-[ t ] [ [ absq ] final-info first interval>> [0,inf] = ] unit-test
+{ t } [ [ absq ] final-info first interval>> [0,inf] = ] unit-test
-[ t ] [ [ { fixnum } declare abs ] final-info first interval>> [0,inf] interval-subset? ] unit-test
+{ t } [ [ { fixnum } declare abs ] final-info first interval>> [0,inf] interval-subset? ] unit-test
-[ t ] [ [ { fixnum } declare absq ] final-info first interval>> [0,inf] interval-subset? ] unit-test
+{ t } [ [ { fixnum } declare absq ] final-info first interval>> [0,inf] interval-subset? ] unit-test
-[ V{ integer } ] [ [ { fixnum } declare abs ] final-classes ] unit-test
+{ V{ integer } } [ [ { fixnum } declare abs ] final-classes ] unit-test
-[ V{ integer } ] [ [ { fixnum } declare absq ] final-classes ] unit-test
+{ V{ integer } } [ [ { fixnum } declare absq ] final-classes ] unit-test
-[ t ] [ [ { bignum } declare abs ] final-info first interval>> [0,inf] interval-subset? ] unit-test
+{ t } [ [ { bignum } declare abs ] final-info first interval>> [0,inf] interval-subset? ] unit-test
-[ t ] [ [ { bignum } declare absq ] final-info first interval>> [0,inf] interval-subset? ] unit-test
+{ t } [ [ { bignum } declare absq ] final-info first interval>> [0,inf] interval-subset? ] unit-test
-[ t ] [ [ { float } declare abs ] final-info first interval>> [0,inf] = ] unit-test
+{ t } [ [ { float } declare abs ] final-info first interval>> [0,inf] = ] unit-test
-[ t ] [ [ { float } declare absq ] final-info first interval>> [0,inf] = ] unit-test
+{ t } [ [ { float } declare absq ] final-info first interval>> [0,inf] = ] unit-test
-[ t ] [ [ { complex } declare abs ] final-info first interval>> [0,inf] = ] unit-test
+{ t } [ [ { complex } declare abs ] final-info first interval>> [0,inf] = ] unit-test
-[ t ] [ [ { complex } declare absq ] final-info first interval>> [0,inf] = ] unit-test
+{ t } [ [ { complex } declare absq ] final-info first interval>> [0,inf] = ] unit-test
-[ t ] [ [ { float float } declare rect> C{ 0.0 0.0 } + absq ] final-info first interval>> [0,inf] = ] unit-test
+{ t } [ [ { float float } declare rect> C{ 0.0 0.0 } + absq ] final-info first interval>> [0,inf] = ] unit-test
-[ V{ float } ] [ [ { float float } declare rect> C{ 0.0 0.0 } + absq ] final-classes ] unit-test
+{ V{ float } } [ [ { float float } declare rect> C{ 0.0 0.0 } + absq ] final-classes ] unit-test
-[ t ] [ [ [ - absq ] [ + ] 2map-reduce ] final-info first interval>> [0,inf] = ] unit-test
+{ t } [ [ [ - absq ] [ + ] 2map-reduce ] final-info first interval>> [0,inf] = ] unit-test
-[ t ] [ [ { double-array double-array } declare [ - absq ] [ + ] 2map-reduce ] final-info first interval>> [0,inf] = ] unit-test
+{ t } [ [ { double-array double-array } declare [ - absq ] [ + ] 2map-reduce ] final-info first interval>> [0,inf] = ] unit-test
-[ V{ string } ] [
+{ V{ string } } [
[ dup string? not [ "Oops" throw ] [ ] if ] final-classes
] unit-test
-[ V{ string } ] [
+{ V{ string } } [
[ dup string? not not >boolean [ ] [ "Oops" throw ] if ] final-classes
] unit-test
-[ f ] [ [ t xor ] final-classes first null-class? ] unit-test
+{ f } [ [ t xor ] final-classes first null-class? ] unit-test
-[ t ] [ [ t or ] final-classes first true-class? ] unit-test
+{ t } [ [ t or ] final-classes first true-class? ] unit-test
-[ t ] [ [ t swap or ] final-classes first true-class? ] unit-test
+{ t } [ [ t swap or ] final-classes first true-class? ] unit-test
-[ t ] [ [ f and ] final-classes first false-class? ] unit-test
+{ t } [ [ f and ] final-classes first false-class? ] unit-test
-[ t ] [ [ f swap and ] final-classes first false-class? ] unit-test
+{ t } [ [ f swap and ] final-classes first false-class? ] unit-test
-[ t ] [ [ dup not or ] final-classes first true-class? ] unit-test
+{ t } [ [ dup not or ] final-classes first true-class? ] unit-test
-[ t ] [ [ dup not swap or ] final-classes first true-class? ] unit-test
+{ t } [ [ dup not swap or ] final-classes first true-class? ] unit-test
-[ t ] [ [ dup not and ] final-classes first false-class? ] unit-test
+{ t } [ [ dup not and ] final-classes first false-class? ] unit-test
-[ t ] [ [ dup not swap and ] final-classes first false-class? ] unit-test
+{ t } [ [ dup not swap and ] final-classes first false-class? ] unit-test
-[ t ] [ [ over [ drop f ] when [ "A" throw ] unless ] final-classes first false-class? ] unit-test
+{ t } [ [ over [ drop f ] when [ "A" throw ] unless ] final-classes first false-class? ] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[
[ { fixnum } declare ] [ drop f ] if
dup [ dup 13 eq? [ t ] [ f ] if ] [ t ] if
] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[
>fixnum
dup [ 10 < ] [ -10 > ] bi and not [ 2 * ] unless
] final-classes
] unit-test
-[ ] [
+{ } [
[
dup dup dup [ 100 < ] [ drop f ] if dup
[ 2drop f ] [ 2drop f ] if
] final-info drop
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ { fixnum } declare (clone) ] final-classes
] unit-test
-[ V{ vector } ] [
+{ V{ vector } } [
[ vector new ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[
{ fixnum byte-array } declare
[ nth-unsafe ] 2keep [ nth-unsafe ] 2keep nth-unsafe
] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ 0 dup 10 > [ 2 * ] when ] final-classes
] unit-test
-[ V{ f } ] [
+{ V{ f } } [
[ [ 0.0 ] [ -0.0 ] if ] final-literals
] unit-test
-[ V{ 1.5 } ] [
+{ V{ 1.5 } } [
[ /f 1.5 1.5 clamp ] final-literals
] unit-test
-[ V{ 1.5 } ] [
+{ V{ 1.5 } } [
[
/f
dup 1.5 <= [ dup 1.5 >= [ ] [ drop 1.5 ] if ] [ drop 1.5 ] if
] final-literals
] unit-test
-[ V{ 1.5 } ] [
+{ V{ 1.5 } } [
[
/f
dup 1.5 u<= [ dup 1.5 u>= [ ] [ drop 1.5 ] if ] [ drop 1.5 ] if
] final-literals
] unit-test
-[ V{ 1.5 } ] [
+{ V{ 1.5 } } [
[
/f
dup 1.5 <= [ dup 10 >= [ ] [ drop 1.5 ] if ] [ drop 1.5 ] if
] final-literals
] unit-test
-[ V{ 1.5 } ] [
+{ V{ 1.5 } } [
[
/f
dup 1.5 u<= [ dup 10 u>= [ ] [ drop 1.5 ] if ] [ drop 1.5 ] if
] final-literals
] unit-test
-[ V{ f } ] [
+{ V{ f } } [
[
/f
dup 0.0 <= [ dup 0.0 >= [ drop 0.0 ] unless ] [ drop 0.0 ] if
] final-literals
] unit-test
-[ V{ f } ] [
+{ V{ f } } [
[
/f
dup 0.0 u<= [ dup 0.0 u>= [ drop 0.0 ] unless ] [ drop 0.0 ] if
] final-literals
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ 0 dup 10 > [ 100 * ] when ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ 0 dup 10 > [ drop "foo" ] when ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ 0 dup 10 u> [ 100 * ] when ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ 0 dup 10 u> [ drop "foo" ] when ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ { fixnum } declare 3 3 - + ] final-classes
] unit-test
-[ V{ t } ] [
+{ V{ t } } [
[ dup 10 < [ 3 * 30 < ] [ drop t ] if ] final-literals
] unit-test
-[ V{ t } ] [
+{ V{ t } } [
[ dup 10 u< [ 3 * 30 u< ] [ drop t ] if ] final-literals
] unit-test
-[ V{ "d" } ] [
+{ V{ "d" } } [
[
3 {
[ "a" ]
] final-literals
] unit-test
-[ V{ "hi" } ] [
+{ V{ "hi" } } [
[ [ "hi" ] [ 123 3 throw ] if ] final-literals
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ >fixnum dup 100 < [ 1 + ] [ "Oops" throw ] if ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ >fixnum dup 100 u< [ 1 + ] [ "Oops" throw ] if ] final-classes
] unit-test
-[ V{ -1 } ] [
+{ V{ -1 } } [
[ 0 dup 100 < not [ 1 + ] [ 1 - ] if ] final-literals
] unit-test
-[ V{ -1 } ] [
+{ V{ -1 } } [
[ 0 dup 100 u< not [ 1 + ] [ 1 - ] if ] final-literals
] unit-test
-[ V{ 2 } ] [
+{ V{ 2 } } [
[ [ 1 ] [ 1 ] if 1 + ] final-literals
] unit-test
-[ V{ object } ] [
+{ V{ object } } [
[ 0 * 10 < ] final-classes
] unit-test
-[ V{ object } ] [
+{ V{ object } } [
[ 0 * 10 u< ] final-classes
] unit-test
-[ V{ 27 } ] [
+{ V{ 27 } } [
[
123 bitand dup 10 < over 8 > and [ 3 * ] [ "B" throw ] if
] final-literals
] unit-test
-[ V{ 27 } ] [
+{ V{ 27 } } [
[
123 bitand dup 10 u< over 8 u> and [ 3 * ] [ "B" throw ] if
] final-literals
] unit-test
-[ V{ string string } ] [
+{ V{ string string } } [
[
2dup [ dup string? [ "Oops" throw ] unless ] bi@ 2drop
] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ { fixnum fixnum } declare 7 bitand neg shift ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ { fixnum fixnum } declare 7 bitand neg >bignum shift ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ { fixnum } declare 1 swap 7 bitand shift ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ { fixnum } declare 1 swap 7 bitand >bignum shift ] final-classes
] unit-test
] when
! Array length propagation
-[ V{ t } ] [ [ 10 f <array> length 10 = ] final-literals ] unit-test
+{ V{ t } } [ [ 10 f <array> length 10 = ] final-literals ] unit-test
-[ V{ t } ] [ [ [ 10 f <array> length ] [ 10 <byte-array> length ] if 10 = ] final-literals ] unit-test
+{ V{ t } } [ [ [ 10 f <array> length ] [ 10 <byte-array> length ] if 10 = ] final-literals ] unit-test
-[ V{ t } ] [ [ [ 1 f <array> ] [ 2 f <array> ] if length 3 < ] final-literals ] unit-test
+{ V{ t } } [ [ [ 1 f <array> ] [ 2 f <array> ] if length 3 < ] final-literals ] unit-test
-[ V{ 10 } ] [
+{ V{ 10 } } [
[ { fixnum } declare dup 10 eq? [ "A" throw ] unless ] final-literals
] unit-test
-[ V{ 3 } ] [ [ [ { 1 2 3 } ] [ { 4 5 6 } ] if length ] final-literals ] unit-test
+{ V{ 3 } } [ [ [ { 1 2 3 } ] [ { 4 5 6 } ] if length ] final-literals ] unit-test
-[ V{ 3 } ] [ [ [ B{ 1 2 3 } ] [ B{ 4 5 6 } ] if length ] final-literals ] unit-test
+{ V{ 3 } } [ [ [ B{ 1 2 3 } ] [ B{ 4 5 6 } ] if length ] final-literals ] unit-test
-[ V{ 3 } ] [ [ [ "yay" ] [ "hah" ] if length ] final-literals ] unit-test
+{ V{ 3 } } [ [ [ "yay" ] [ "hah" ] if length ] final-literals ] unit-test
-[ V{ 3 } ] [ [ 3 <byte-array> length ] final-literals ] unit-test
+{ V{ 3 } } [ [ 3 <byte-array> length ] final-literals ] unit-test
-[ V{ 3 } ] [ [ 3 f <string> length ] final-literals ] unit-test
+{ V{ 3 } } [ [ 3 f <string> length ] final-literals ] unit-test
! Slot propagation
TUPLE: prop-test-tuple { x integer } ;
-[ V{ integer } ] [ [ { prop-test-tuple } declare x>> ] final-classes ] unit-test
+{ V{ integer } } [ [ { prop-test-tuple } declare x>> ] final-classes ] unit-test
TUPLE: fold-boa-test-tuple { x read-only } { y read-only } { z read-only } ;
-[ V{ T{ fold-boa-test-tuple f 1 2 3 } } ]
+{ V{ T{ fold-boa-test-tuple f 1 2 3 } } }
[ [ 1 2 3 fold-boa-test-tuple boa ] final-literals ]
unit-test
TUPLE: don't-fold-boa-test-tuple < identity-tuple ;
-[ V{ f } ]
+{ V{ f } }
[ [ don't-fold-boa-test-tuple boa ] final-literals ]
unit-test
TUPLE: immutable-prop-test-tuple { x sequence read-only } ;
-[ V{ T{ immutable-prop-test-tuple f "hey" } } ] [
+{ V{ T{ immutable-prop-test-tuple f "hey" } } } [
[ "hey" immutable-prop-test-tuple boa ] final-literals
] unit-test
-[ V{ { 1 2 } } ] [
+{ V{ { 1 2 } } } [
[ { 1 2 } immutable-prop-test-tuple boa x>> ] final-literals
] unit-test
-[ V{ array } ] [
+{ V{ array } } [
[ { array } declare immutable-prop-test-tuple boa x>> ] final-classes
] unit-test
-[ V{ complex } ] [
+{ V{ complex } } [
[ complex boa ] final-classes
] unit-test
-[ V{ complex } ] [
+{ V{ complex } } [
[ { float float } declare dup 0.0 <= [ "Oops" throw ] [ rect> ] if ] final-classes
] unit-test
-[ V{ float float } ] [
+{ V{ float float } } [
[
{ float float } declare
dup 0.0 <= [ "Oops" throw ] when rect>
] final-classes
] unit-test
-[ V{ complex } ] [
+{ V{ complex } } [
[
{ float float object } declare
[ "Oops" throw ] [ complex boa ] if
] final-classes
] unit-test
-[ ] [ [ dup 3 slot swap 4 slot dup 3 slot swap 4 slot ] final-info drop ] unit-test
+{ } [ [ dup 3 slot swap 4 slot dup 3 slot swap 4 slot ] final-info drop ] unit-test
-[ V{ number } ] [ [ [ "Oops" throw ] [ 2 + ] if ] final-classes ] unit-test
-[ V{ number } ] [ [ [ 2 + ] [ "Oops" throw ] if ] final-classes ] unit-test
+{ V{ number } } [ [ [ "Oops" throw ] [ 2 + ] if ] final-classes ] unit-test
+{ V{ number } } [ [ [ 2 + ] [ "Oops" throw ] if ] final-classes ] unit-test
-[ V{ POSTPONE: f } ] [
+{ V{ POSTPONE: f } } [
[ dup 1.0 <= [ drop f ] [ 0 number= ] if ] final-classes
] unit-test
! Don't fold this
TUPLE: mutable-tuple-test { x sequence } ;
-[ V{ sequence } ] [
+{ V{ sequence } } [
[ "hey" mutable-tuple-test boa x>> ] final-classes
] unit-test
-[ V{ sequence } ] [
+{ V{ sequence } } [
[ T{ mutable-tuple-test f "hey" } x>> ] final-classes
] unit-test
-[ V{ array } ] [
+{ V{ array } } [
[ T{ mutable-tuple-test f "hey" } layout-of ] final-classes
] unit-test
! Mixed mutable and immutable slots
TUPLE: mixed-mutable-immutable { x integer } { y sequence read-only } ;
-[ V{ integer array } ] [
+{ V{ integer array } } [
[
3 { 2 1 } mixed-mutable-immutable boa [ x>> ] [ y>> ] bi
] final-classes
] unit-test
-[ V{ array integer } ] [
+{ V{ array integer } } [
[
3 { 2 1 } mixed-mutable-immutable boa [ y>> ] [ x>> ] bi
] final-classes
] unit-test
-[ V{ integer array } ] [
+{ V{ integer array } } [
[
[ 2drop T{ mixed-mutable-immutable f 3 { } } ]
[ { array } declare mixed-mutable-immutable boa ] if
] final-classes
] unit-test
-[ V{ f { } } ] [
+{ V{ f { } } } [
[
T{ mixed-mutable-immutable f 3 { } }
[ x>> ] [ y>> ] bi
! Recursive propagation
: recursive-test-1 ( a -- b ) recursive-test-1 ; inline recursive
-[ V{ null } ] [ [ recursive-test-1 ] final-classes ] unit-test
+{ V{ null } } [ [ recursive-test-1 ] final-classes ] unit-test
: recursive-test-2 ( a -- b ) dup 10 < [ recursive-test-2 ] when ; inline recursive
-[ V{ real } ] [ [ recursive-test-2 ] final-classes ] unit-test
+{ V{ real } } [ [ recursive-test-2 ] final-classes ] unit-test
: recursive-test-3 ( a -- b ) dup 10 < drop ; inline recursive
-[ V{ real } ] [ [ recursive-test-3 ] final-classes ] unit-test
+{ V{ real } } [ [ recursive-test-3 ] final-classes ] unit-test
-[ V{ real } ] [ [ [ dup 10 < ] [ ] while ] final-classes ] unit-test
+{ V{ real } } [ [ [ dup 10 < ] [ ] while ] final-classes ] unit-test
-[ V{ float } ] [
+{ V{ float } } [
[ { float } declare 10 [ 2.3 * ] times ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ 0 10 [ nip ] each-integer ] final-classes
] unit-test
-[ V{ t } ] [
+{ V{ t } } [
[ t 10 [ nip 0 >= ] each-integer ] final-literals
] unit-test
: recursive-test-4 ( i n -- )
2dup < [ [ 1 + ] dip recursive-test-4 ] [ 2drop ] if ; inline recursive
-[ ] [ [ recursive-test-4 ] final-info drop ] unit-test
+{ } [ [ recursive-test-4 ] final-info drop ] unit-test
: recursive-test-5 ( a -- b )
dup 1 <= [ drop 1 ] [ dup 1 - recursive-test-5 * ] if ; inline recursive
-[ V{ integer } ] [ [ { integer } declare recursive-test-5 ] final-classes ] unit-test
+{ V{ integer } } [ [ { integer } declare recursive-test-5 ] final-classes ] unit-test
: recursive-test-6 ( a -- b )
dup 1 <= [ drop 1 ] [ dup 1 - recursive-test-6 swap 2 - recursive-test-6 + ] if ; inline recursive
-[ V{ integer } ] [ [ { fixnum } declare recursive-test-6 ] final-classes ] unit-test
+{ V{ integer } } [ [ { fixnum } declare recursive-test-6 ] final-classes ] unit-test
: recursive-test-7 ( a -- b )
dup 10 < [ 1 + recursive-test-7 ] when ; inline recursive
-[ V{ fixnum } ] [ [ 0 recursive-test-7 ] final-classes ] unit-test
+{ V{ fixnum } } [ [ 0 recursive-test-7 ] final-classes ] unit-test
-[ V{ fixnum } ] [ [ 1 10 [ dup 10 < [ 2 * ] when ] times ] final-classes ] unit-test
+{ V{ fixnum } } [ [ 1 10 [ dup 10 < [ 2 * ] when ] times ] final-classes ] unit-test
-[ V{ integer } ] [ [ 0 2 100 ^ [ nip ] each-integer ] final-classes ] unit-test
+{ V{ integer } } [ [ 0 2 100 ^ [ nip ] each-integer ] final-classes ] unit-test
-[ ] [ [ [ ] [ ] compose curry call ] final-info drop ] unit-test
+{ } [ [ [ ] [ ] compose curry call ] final-info drop ] unit-test
-[ V{ } ] [
+{ V{ } } [
[ [ drop ] [ drop ] compose curry (each-integer) ] final-classes
] unit-test
: dead-loop ( obj -- final-obj )
iterate [ dead-loop ] when ; inline recursive
-[ V{ fixnum } ] [ [ { fixnum } declare dead-loop ] final-classes ] unit-test
+{ V{ fixnum } } [ [ { fixnum } declare dead-loop ] final-classes ] unit-test
: hang-1 ( m -- x )
dup 0 number= [ hang-1 ] unless ; inline recursive
-[ ] [ [ 3 hang-1 ] final-info drop ] unit-test
+{ } [ [ 3 hang-1 ] final-info drop ] unit-test
: hang-2 ( m n -- x )
over 0 number= [
] if
] if ; inline recursive
-[ ] [ [ 3 over hang-2 ] final-info drop ] unit-test
+{ } [ [ 3 over hang-2 ] final-info drop ] unit-test
-[ ] [
+{ } [
[
dup fixnum? [ 3 over hang-2 ] [ 3 over hang-2 ] if
] final-info drop
] unit-test
-[ V{ t } ] [
+{ V{ t } } [
[ { hashtable } declare hashtable instance? ] final-classes
] unit-test
-[ V{ POSTPONE: f } ] [
+{ V{ POSTPONE: f } } [
[ { vector } declare hashtable instance? ] final-classes
] unit-test
-[ V{ object } ] [
+{ V{ object } } [
[ { assoc } declare hashtable instance? ] final-classes
] unit-test
-[ V{ t } ] [
+{ V{ t } } [
[ { string } declare string? ] final-classes
] unit-test
-[ V{ POSTPONE: f } ] [
+{ V{ POSTPONE: f } } [
[ 3 string? ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ { fixnum } declare [ ] curry obj>> ] final-classes
] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ { fixnum fixnum } declare iota [ nth-unsafe ] curry call ] final-classes
] unit-test
-[ V{ f } ] [
+{ V{ f } } [
[ 10 eq? [ drop 3 ] unless ] final-literals
] unit-test
M: fixnum bad-generic 1 fixnum+fast ; inline
: bad-behavior ( -- b ) 4 bad-generic ; inline recursive
-[ V{ fixnum } ] [ [ bad-behavior ] final-classes ] unit-test
+{ V{ fixnum } } [ [ bad-behavior ] final-classes ] unit-test
-[ V{ number } ] [
+{ V{ number } } [
[
0 10 [ bad-generic dup 123 bitand drop bad-generic 1 + ] times
] final-classes
GENERIC: infinite-loop ( a -- b )
M: integer infinite-loop infinite-loop ;
-[ ] [ [ { integer } declare infinite-loop ] final-classes drop ] unit-test
+{ } [ [ { integer } declare infinite-loop ] final-classes drop ] unit-test
-[ V{ tuple } ] [ [ tuple-layout <tuple> ] final-classes ] unit-test
+{ V{ tuple } } [ [ tuple-layout <tuple> ] final-classes ] unit-test
-[ ] [ [ instance? ] final-classes drop ] unit-test
+{ } [ [ instance? ] final-classes drop ] unit-test
-[ f ] [ [ V{ } clone ] final-info first literal?>> ] unit-test
+{ f } [ [ V{ } clone ] final-info first literal?>> ] unit-test
: fold-throw-test ( a -- b ) "A" throw ; foldable
-[ ] [ [ 0 fold-throw-test ] final-info drop ] unit-test
+{ } [ [ 0 fold-throw-test ] final-info drop ] unit-test
: too-deep ( a b -- c )
dup [ drop ] [ 2dup too-deep too-deep * ] if ; inline recursive
-[ ] [ [ too-deep ] final-info drop ] unit-test
+{ } [ [ too-deep ] final-info drop ] unit-test
-[ ] [ [ reversed boa slice boa nth-unsafe * ] final-info drop ] unit-test
+{ } [ [ reversed boa slice boa nth-unsafe * ] final-info drop ] unit-test
MIXIN: empty-mixin
-[ ] [ [ { empty-mixin } declare empty-mixin? ] final-info drop ] unit-test
+{ } [ [ { empty-mixin } declare empty-mixin? ] final-info drop ] unit-test
-[ V{ fixnum } ] [ [ [ bignum-shift drop ] keep ] final-classes ] unit-test
+{ V{ fixnum } } [ [ [ bignum-shift drop ] keep ] final-classes ] unit-test
-[ V{ float } ] [
+{ V{ float } } [
[
[ { float float } declare complex boa ]
[ 2drop C{ 0.0 0.0 } ]
] final-classes
] unit-test
-[ V{ POSTPONE: f } ] [
+{ V{ POSTPONE: f } } [
[ { float } declare 0 eq? ] final-classes
] unit-test
[ fixnum-mod ] final-classes
] unit-test
-[ V{ integer } ] [
+{ V{ integer } } [
[ { fixnum integer } declare bitand ] final-classes
] unit-test
-[ V{ double-array } ] [ [| | double-array{ } ] final-classes ] unit-test
+{ V{ double-array } } [ [| | double-array{ } ] final-classes ] unit-test
-[ V{ t } ] [ [ macosx unix? ] final-literals ] unit-test
+{ V{ t } } [ [ macosx unix? ] final-literals ] unit-test
-[ V{ array } ] [ [ [ <=> ] sort [ <=> ] sort ] final-classes ] unit-test
+{ V{ array } } [ [ [ <=> ] sort [ <=> ] sort ] final-classes ] unit-test
-[ V{ float } ] [ [ fsqrt ] final-classes ] unit-test
+{ V{ float } } [ [ fsqrt ] final-classes ] unit-test
-[ V{ t } ] [ [ { fixnum } declare 10 mod >float -20 > ] final-literals ] unit-test
+{ V{ t } } [ [ { fixnum } declare 10 mod >float -20 > ] final-literals ] unit-test
-[ T{ interval f { 0 t } { 127 t } } ] [
+{ T{ interval f { 0 t } { 127 t } } } [
[ { integer } declare 127 bitand ] final-info first interval>>
] unit-test
-[ V{ t } ] [
+{ V{ t } } [
[ [ 123 bitand ] [ drop f ] if dup [ 0 >= ] [ not ] if ] final-literals
] unit-test
-[ V{ bignum } ] [
+{ V{ bignum } } [
[ { bignum } declare dup 1 - bitxor ] final-classes
] unit-test
-[ V{ bignum integer } ] [
+{ V{ bignum integer } } [
[ { bignum integer } declare [ shift ] keep ] final-classes
] unit-test
-[ V{ fixnum } ] [ [ >fixnum 15 bitand 1 swap shift ] final-classes ] unit-test
+{ V{ fixnum } } [ [ >fixnum 15 bitand 1 swap shift ] final-classes ] unit-test
-[ V{ fixnum } ] [ [ 15 bitand 1 swap shift ] final-classes ] unit-test
+{ V{ fixnum } } [ [ 15 bitand 1 swap shift ] final-classes ] unit-test
-[ V{ fixnum } ] [
+{ V{ fixnum } } [
[ { fixnum } declare log2 ] final-classes
] unit-test
-[ V{ t } ] [
+{ V{ t } } [
[ { fixnum } declare log2 0 >= ] final-classes
] unit-test
-[ V{ POSTPONE: f } ] [
+{ V{ POSTPONE: f } } [
[ { word object } declare equal? ] final-classes
] unit-test
-[ V{ string } ] [
+{ V{ string } } [
[ dup string? t xor [ "A" throw ] [ ] if ] final-classes
] unit-test
-[ t ] [ [ dup t xor or ] final-classes first true-class? ] unit-test
+{ t } [ [ dup t xor or ] final-classes first true-class? ] unit-test
-[ t ] [ [ dup t xor swap or ] final-classes first true-class? ] unit-test
+{ t } [ [ dup t xor swap or ] final-classes first true-class? ] unit-test
-[ t ] [ [ dup t xor and ] final-classes first false-class? ] unit-test
+{ t } [ [ dup t xor and ] final-classes first false-class? ] unit-test
-[ t ] [ [ dup t xor swap and ] final-classes first false-class? ] unit-test
+{ t } [ [ dup t xor swap and ] final-classes first false-class? ] unit-test
! generalize-counter-interval wasn't being called in all the right places.
! bug found by littledan
: littledan-1-test ( -- ) 0 littledan-1 boa (littledan-1-test) ; inline
-[ ] [ [ littledan-1-test ] final-classes drop ] unit-test
+{ } [ [ littledan-1-test ] final-classes drop ] unit-test
TUPLE: littledan-2 { from read-only } { to read-only } ;
: littledan-2-test ( x -- i elt )
[ 0 ] dip { array-capacity } declare littledan-2 boa (littledan-2-test) ; inline
-[ ] [ [ littledan-2-test ] final-classes drop ] unit-test
+{ } [ [ littledan-2-test ] final-classes drop ] unit-test
: (littledan-3-test) ( x -- )
length 1 + f <array> (littledan-3-test) ; inline recursive
: littledan-3-test ( -- )
0 f <array> (littledan-3-test) ; inline
-[ ] [ [ littledan-3-test ] final-classes drop ] unit-test
+{ } [ [ littledan-3-test ] final-classes drop ] unit-test
-[ V{ 0 } ] [ [ { } length ] final-literals ] unit-test
+{ V{ 0 } } [ [ { } length ] final-literals ] unit-test
-[ V{ 1 } ] [ [ { } length 1 + f <array> length ] final-literals ] unit-test
+{ V{ 1 } } [ [ { } length 1 + f <array> length ] final-literals ] unit-test
! generalize-counter is not tight enough
-[ V{ fixnum } ] [ [ 0 10 [ 1 + >fixnum ] times ] final-classes ] unit-test
+{ V{ fixnum } } [ [ 0 10 [ 1 + >fixnum ] times ] final-classes ] unit-test
-[ V{ fixnum } ] [ [ 0 10 [ 1 + >fixnum ] times 0 + ] final-classes ] unit-test
+{ V{ fixnum } } [ [ 0 10 [ 1 + >fixnum ] times 0 + ] final-classes ] unit-test
! Coercions need to update intervals
-[ V{ f } ] [ [ 1 2 ? 100 shift >fixnum 1 = ] final-literals ] unit-test
+{ V{ f } } [ [ 1 2 ? 100 shift >fixnum 1 = ] final-literals ] unit-test
-[ V{ t } ] [ [ >fixnum 1 + >fixnum most-positive-fixnum <= ] final-literals ] unit-test
+{ V{ t } } [ [ >fixnum 1 + >fixnum most-positive-fixnum <= ] final-literals ] unit-test
-[ V{ t } ] [ [ >fixnum 1 + >fixnum most-negative-fixnum >= ] final-literals ] unit-test
+{ V{ t } } [ [ >fixnum 1 + >fixnum most-negative-fixnum >= ] final-literals ] unit-test
-[ V{ f } ] [ [ >fixnum 1 + >fixnum most-negative-fixnum > ] final-literals ] unit-test
+{ V{ f } } [ [ >fixnum 1 + >fixnum most-negative-fixnum > ] final-literals ] unit-test
! Mutable tuples with circularity should not cause problems
TUPLE: circle me ;
-[ ] [ circle new dup >>me 1quotation final-info drop ] unit-test
+{ } [ circle new dup >>me 1quotation final-info drop ] unit-test
! Joe found an oversight
-[ V{ integer } ] [ [ >integer ] final-classes ] unit-test
+{ V{ integer } } [ [ >integer ] final-classes ] unit-test
TUPLE: foo bar ;
-[ t ] [ [ foo new ] { new } inlined? ] unit-test
+{ t } [ [ foo new ] { new } inlined? ] unit-test
GENERIC: whatever ( x -- y )
M: number whatever drop foo ; inline
-[ t ] [ [ 1 whatever new ] { new } inlined? ] unit-test
+{ t } [ [ 1 whatever new ] { new } inlined? ] unit-test
: that-thing ( -- class ) foo ;
-[ f ] [ [ that-thing new ] { new } inlined? ] unit-test
+{ f } [ [ that-thing new ] { new } inlined? ] unit-test
GENERIC: whatever2 ( x -- y )
M: number whatever2 drop H{ { 1 1 } { 2 2 } { 3 3 } { 4 4 } { 5 6 } } ; inline
M: f whatever2 ; inline
-[ t ] [ [ 1 whatever2 at ] { at* hashcode* } inlined? ] unit-test
-[ f ] [ [ whatever2 at ] { at* hashcode* } inlined? ] unit-test
+{ t } [ [ 1 whatever2 at ] { at* hashcode* } inlined? ] unit-test
+{ f } [ [ whatever2 at ] { at* hashcode* } inlined? ] unit-test
SYMBOL: not-an-assoc
-[ f ] [ [ not-an-assoc at ] { at* } inlined? ] unit-test
+{ f } [ [ not-an-assoc at ] { at* } inlined? ] unit-test
-[ t ] [ [ { 1 2 3 } member? ] { member? } inlined? ] unit-test
-[ f ] [ [ { 1 2 3 } swap member? ] { member? } inlined? ] unit-test
+{ t } [ [ { 1 2 3 } member? ] { member? } inlined? ] unit-test
+{ f } [ [ { 1 2 3 } swap member? ] { member? } inlined? ] unit-test
-[ t ] [ [ { 1 2 3 } member-eq? ] { member-eq? } inlined? ] unit-test
-[ f ] [ [ { 1 2 3 } swap member-eq? ] { member-eq? } inlined? ] unit-test
+{ t } [ [ { 1 2 3 } member-eq? ] { member-eq? } inlined? ] unit-test
+{ f } [ [ { 1 2 3 } swap member-eq? ] { member-eq? } inlined? ] unit-test
-[ t ] [ [ V{ } clone ] { clone (clone) } inlined? ] unit-test
-[ f ] [ [ { } clone ] { clone (clone) } inlined? ] unit-test
+{ t } [ [ V{ } clone ] { clone (clone) } inlined? ] unit-test
+{ f } [ [ { } clone ] { clone (clone) } inlined? ] unit-test
-[ f ] [ [ instance? ] { instance? } inlined? ] unit-test
-[ f ] [ [ 5 instance? ] { instance? } inlined? ] unit-test
-[ t ] [ [ array instance? ] { instance? } inlined? ] unit-test
+{ f } [ [ instance? ] { instance? } inlined? ] unit-test
+{ f } [ [ 5 instance? ] { instance? } inlined? ] unit-test
+{ t } [ [ array instance? ] { instance? } inlined? ] unit-test
-[ t ] [ [ ( a b c -- c b a ) shuffle ] { shuffle } inlined? ] unit-test
-[ f ] [ [ { 1 2 3 } swap shuffle ] { shuffle } inlined? ] unit-test
+{ t } [ [ ( a b c -- c b a ) shuffle ] { shuffle } inlined? ] unit-test
+{ f } [ [ { 1 2 3 } swap shuffle ] { shuffle } inlined? ] unit-test
! Type function for 'clone' had a subtle issue
TUPLE: tuple-with-read-only-slot { x read-only } ;
M: tuple-with-read-only-slot clone
x>> clone tuple-with-read-only-slot boa ; inline
-[ V{ object } ] [
+{ V{ object } } [
[ { 1 2 3 } dup tuple-with-read-only-slot boa clone x>> eq? ] final-classes
] unit-test
! alien-cell outputs a alien or f
-[ t ] [
+{ t } [
[ { byte-array fixnum } declare alien-cell dup [ "OOPS" throw ] unless ] final-classes
first alien class=
] unit-test
! Don't crash if bad literal inputs are passed to unsafe words
-[ f ] [ [ { } 1 fixnum+fast ] final-info first literal?>> ] unit-test
+{ f } [ [ { } 1 fixnum+fast ] final-info first literal?>> ] unit-test
! Converting /i to shift
-[ t ] [ [ >fixnum dup 0 >= [ 16 /i ] when ] { /i fixnum/i fixnum/i-fast } inlined? ] unit-test
-[ f ] [ [ >fixnum dup 0 >= [ 16 /i ] when ] { fixnum-shift-fast } inlined? ] unit-test
-[ f ] [ [ >float dup 0 >= [ 16 /i ] when ] { /i float/f } inlined? ] unit-test
+{ t } [ [ >fixnum dup 0 >= [ 16 /i ] when ] { /i fixnum/i fixnum/i-fast } inlined? ] unit-test
+{ f } [ [ >fixnum dup 0 >= [ 16 /i ] when ] { fixnum-shift-fast } inlined? ] unit-test
+{ f } [ [ >float dup 0 >= [ 16 /i ] when ] { /i float/f } inlined? ] unit-test
! We want this to inline
-[ t ] [ [ void* <c-direct-array> ] { <c-direct-array> } inlined? ] unit-test
-[ V{ void*-array } ] [ [ void* <c-direct-array> ] final-classes ] unit-test
+{ t } [ [ void* <c-direct-array> ] { <c-direct-array> } inlined? ] unit-test
+{ V{ void*-array } } [ [ void* <c-direct-array> ] final-classes ] unit-test
! bitand identities
-[ t ] [ [ alien-unsigned-1 255 bitand ] { bitand fixnum-bitand } inlined? ] unit-test
-[ t ] [ [ alien-unsigned-1 255 swap bitand ] { bitand fixnum-bitand } inlined? ] unit-test
+{ t } [ [ alien-unsigned-1 255 bitand ] { bitand fixnum-bitand } inlined? ] unit-test
+{ t } [ [ alien-unsigned-1 255 swap bitand ] { bitand fixnum-bitand } inlined? ] unit-test
-[ t ] [ [ { fixnum } declare 256 rem -256 bitand ] { fixnum-bitand } inlined? ] unit-test
-[ t ] [ [ { fixnum } declare 250 rem -256 bitand ] { fixnum-bitand } inlined? ] unit-test
-[ f ] [ [ { fixnum } declare 257 rem -256 bitand ] { fixnum-bitand } inlined? ] unit-test
+{ t } [ [ { fixnum } declare 256 rem -256 bitand ] { fixnum-bitand } inlined? ] unit-test
+{ t } [ [ { fixnum } declare 250 rem -256 bitand ] { fixnum-bitand } inlined? ] unit-test
+{ f } [ [ { fixnum } declare 257 rem -256 bitand ] { fixnum-bitand } inlined? ] unit-test
-[ V{ fixnum } ] [ [ >bignum 10 mod 2^ ] final-classes ] unit-test
-[ V{ bignum } ] [ [ >bignum 10 bitand ] final-classes ] unit-test
-[ V{ bignum } ] [ [ >bignum 10 >bignum bitand ] final-classes ] unit-test
-[ V{ fixnum } ] [ [ >bignum 10 mod ] final-classes ] unit-test
-[ V{ bignum } ] [ [ { fixnum } declare -1 >bignum bitand ] final-classes ] unit-test
-[ V{ bignum } ] [ [ { fixnum } declare -1 >bignum swap bitand ] final-classes ] unit-test
+{ V{ fixnum } } [ [ >bignum 10 mod 2^ ] final-classes ] unit-test
+{ V{ bignum } } [ [ >bignum 10 bitand ] final-classes ] unit-test
+{ V{ bignum } } [ [ >bignum 10 >bignum bitand ] final-classes ] unit-test
+{ V{ fixnum } } [ [ >bignum 10 mod ] final-classes ] unit-test
+{ V{ bignum } } [ [ { fixnum } declare -1 >bignum bitand ] final-classes ] unit-test
+{ V{ bignum } } [ [ { fixnum } declare -1 >bignum swap bitand ] final-classes ] unit-test
! Could be bignum not integer but who cares
-[ V{ integer } ] [ [ 10 >bignum bitand ] final-classes ] unit-test
+{ V{ integer } } [ [ 10 >bignum bitand ] final-classes ] unit-test
-[ t ] [ [ { fixnum fixnum } declare min ] { min } inlined? ] unit-test
-[ f ] [ [ { fixnum fixnum } declare min ] { fixnum-min } inlined? ] unit-test
+{ t } [ [ { fixnum fixnum } declare min ] { min } inlined? ] unit-test
+{ f } [ [ { fixnum fixnum } declare min ] { fixnum-min } inlined? ] unit-test
-[ t ] [ [ { float float } declare min ] { min } inlined? ] unit-test
-[ f ] [ [ { float float } declare min ] { float-min } inlined? ] unit-test
+{ t } [ [ { float float } declare min ] { min } inlined? ] unit-test
+{ f } [ [ { float float } declare min ] { float-min } inlined? ] unit-test
-[ t ] [ [ { fixnum fixnum } declare max ] { max } inlined? ] unit-test
-[ f ] [ [ { fixnum fixnum } declare max ] { fixnum-max } inlined? ] unit-test
+{ t } [ [ { fixnum fixnum } declare max ] { max } inlined? ] unit-test
+{ f } [ [ { fixnum fixnum } declare max ] { fixnum-max } inlined? ] unit-test
-[ t ] [ [ { float float } declare max ] { max } inlined? ] unit-test
-[ f ] [ [ { float float } declare max ] { float-max } inlined? ] unit-test
+{ t } [ [ { float float } declare max ] { max } inlined? ] unit-test
+{ f } [ [ { float float } declare max ] { float-max } inlined? ] unit-test
! Propagation should not call equal?, hashcode, etc on literals in user code
-[ V{ } ] [ [ 4 <reversed> [ 2drop ] with each ] final-info ] unit-test
+{ V{ } } [ [ 4 <reversed> [ 2drop ] with each ] final-info ] unit-test
! Reduction
-[ 1 ] [ [ 4 <reversed> [ nth-unsafe ] [ ] unless ] final-info length ] unit-test
+{ 1 } [ [ 4 <reversed> [ nth-unsafe ] [ ] unless ] final-info length ] unit-test
! Optimization on bit?
-[ t ] [ [ 3 bit? ] { bit? } inlined? ] unit-test
-[ f ] [ [ 500 bit? ] { bit? } inlined? ] unit-test
+{ t } [ [ 3 bit? ] { bit? } inlined? ] unit-test
+{ f } [ [ 500 bit? ] { bit? } inlined? ] unit-test
-[ t ] [ [ { 1 } intersect ] { intersect } inlined? ] unit-test
-[ f ] [ [ { 1 } swap intersect ] { intersect } inlined? ] unit-test ! We could do this
+{ t } [ [ { 1 } intersect ] { intersect } inlined? ] unit-test
+{ f } [ [ { 1 } swap intersect ] { intersect } inlined? ] unit-test ! We could do this
-[ t ] [ [ { 1 } intersects? ] { intersects? } inlined? ] unit-test
-[ f ] [ [ { 1 } swap intersects? ] { intersects? } inlined? ] unit-test ! We could do this
+{ t } [ [ { 1 } intersects? ] { intersects? } inlined? ] unit-test
+{ f } [ [ { 1 } swap intersects? ] { intersects? } inlined? ] unit-test ! We could do this
-[ t ] [ [ { 1 } diff ] { diff } inlined? ] unit-test
-[ f ] [ [ { 1 } swap diff ] { diff } inlined? ] unit-test ! We could do this
+{ t } [ [ { 1 } diff ] { diff } inlined? ] unit-test
+{ f } [ [ { 1 } swap diff ] { diff } inlined? ] unit-test ! We could do this
! Output range for string-nth now that string-nth is a library word and
! not a primitive
-[ t ] [
+{ t } [
! Should actually be 0 23 2^ 1 - [a,b]
[ string-nth ] final-info first interval>> 0 23 2^ [a,b] =
] unit-test
! Non-zero displacement for <displaced-alien> restricts the output type
-[ t ] [
+{ t } [
[ { byte-array } declare <displaced-alien> ] final-classes
first byte-array alien class-or class=
] unit-test
-[ V{ alien } ] [
+{ V{ alien } } [
[ { alien } declare <displaced-alien> ] final-classes
] unit-test
-[ t ] [
+{ t } [
[ { POSTPONE: f } declare <displaced-alien> ] final-classes
first \ f alien class-or class=
] unit-test
-[ V{ alien } ] [
+{ V{ alien } } [
[ { byte-array } declare [ 10 bitand 2 + ] dip <displaced-alien> ] final-classes
] unit-test
! 'tag' should have a declared output interval
-[ V{ t } ] [
+{ V{ t } } [
[ tag 0 15 between? ] final-literals
] unit-test
-[ t ] [
+{ t } [
[ maybe{ integer } instance? ] { instance? } inlined?
] unit-test
TUPLE: inline-please a ;
-[ t ] [
+{ t } [
[ maybe{ inline-please } instance? ] { instance? } inlined?
] unit-test
M: integer derp 5 + ;
M: f derp drop t ;
-[ t ]
+{ t }
[
[ dup maybe{ integer } instance? [ derp ] when ] { instance? } inlined?
] unit-test
math.intervals kernel math literals layouts ;
IN: compiler.tree.propagation.recursive.tests
-[ T{ interval f { 0 t } { 1/0. t } } ] [
+{ T{ interval f { 0 t } { 1/0. t } } } [
T{ interval f { 1 t } { 1 t } }
T{ interval f { 0 t } { 0 t } }
integer generalize-counter-interval
] unit-test
-[ T{ interval f { 0 t } { $[ max-array-capacity ] t } } ] [
+{ T{ interval f { 0 t } { $[ max-array-capacity ] t } } } [
T{ interval f { 1 t } { 1 t } }
T{ interval f { 0 t } { 0 t } }
fixnum generalize-counter-interval
] unit-test
-[ T{ interval f { -1/0. t } { 10 t } } ] [
+{ T{ interval f { -1/0. t } { 10 t } } } [
T{ interval f { -1 t } { -1 t } }
T{ interval f { 10 t } { 10 t } }
integer generalize-counter-interval
] unit-test
-[ T{ interval f { $[ most-negative-fixnum ] t } { 10 t } } ] [
+{ T{ interval f { $[ most-negative-fixnum ] t } { 10 t } } } [
T{ interval f { -1 t } { -1 t } }
T{ interval f { 10 t } { 10 t } }
fixnum generalize-counter-interval
] unit-test
-[ t ] [
+{ t } [
T{ interval f { -268435456 t } { 268435455 t } }
T{ interval f { 1 t } { 268435455 t } }
over
integer generalize-counter-interval =
] unit-test
-[ t ] [
+{ t } [
T{ interval f { -268435456 t } { 268435455 t } }
T{ interval f { 1 t } { 268435455 t } }
over
fixnum generalize-counter-interval =
] unit-test
-[ full-interval ] [
+{ full-interval } [
T{ interval f { -5 t } { 3 t } }
T{ interval f { 2 t } { 11 t } }
integer generalize-counter-interval
] unit-test
-[ $[ fixnum-interval ] ] [
+{ $[ fixnum-interval ] } [
T{ interval f { -5 t } { 3 t } }
T{ interval f { 2 t } { 11 t } }
fixnum generalize-counter-interval
compiler.tree.recursive.private ;
IN: compiler.tree.recursive.tests
-[ { f f f f } ] [ f { f t f f } (tail-calls) ] unit-test
-[ { f f f t } ] [ t { f t f f } (tail-calls) ] unit-test
-[ { f t t t } ] [ t { f f t t } (tail-calls) ] unit-test
-[ { f f f t } ] [ t { f f t f } (tail-calls) ] unit-test
+{ { f f f f } } [ f { f t f f } (tail-calls) ] unit-test
+{ { f f f t } } [ t { f t f f } (tail-calls) ] unit-test
+{ { f t t t } } [ t { f f t t } (tail-calls) ] unit-test
+{ { f f f t } } [ t { f f t f } (tail-calls) ] unit-test
: label-is-loop? ( nodes word -- ? )
swap [
: loop-test-1 ( a -- )
dup [ 1 + loop-test-1 ] [ drop ] if ; inline recursive
-[ t ] [
+{ t } [
[ loop-test-1 ] build-tree analyze-recursive
\ loop-test-1 label-is-loop?
] unit-test
-[ t ] [
+{ t } [
[ loop-test-1 1 2 3 ] build-tree analyze-recursive
\ loop-test-1 label-is-loop?
] unit-test
-[ t ] [
+{ t } [
[ [ loop-test-1 ] each ] build-tree analyze-recursive
\ loop-test-1 label-is-loop?
] unit-test
-[ t ] [
+{ t } [
[ [ loop-test-1 ] each ] build-tree analyze-recursive
\ (each-integer) label-is-loop?
] unit-test
: loop-test-2 ( a b -- a' )
dup [ 1 + loop-test-2 1 - ] [ drop ] if ; inline recursive
-[ t ] [
+{ t } [
[ loop-test-2 ] build-tree analyze-recursive
\ loop-test-2 label-is-not-loop?
] unit-test
: loop-test-3 ( a -- )
dup [ [ loop-test-3 ] each ] [ drop ] if ; inline recursive
-[ t ] [
+{ t } [
[ loop-test-3 ] build-tree analyze-recursive
\ loop-test-3 label-is-not-loop?
] unit-test
-[ f ] [
+{ f } [
[ [ [ ] map ] map ] build-tree analyze-recursive
[
dup #recursive? [ label>> loop?>> not ] [ drop f ] if
: a ( -- )
blah [ b ] [ a ] if ; inline recursive
-[ t ] [
+{ t } [
[ a ] build-tree analyze-recursive
\ a label-is-loop?
] unit-test
-[ t ] [
+{ t } [
[ a ] build-tree analyze-recursive
\ b label-is-loop?
] unit-test
-[ t ] [
+{ t } [
[ b ] build-tree analyze-recursive
\ a label-is-loop?
] unit-test
-[ t ] [
+{ t } [
[ a ] build-tree analyze-recursive
\ b label-is-loop?
] unit-test
: a' ( -- )
blah [ b' ] [ a' ] if ; inline recursive
-[ f ] [
+{ f } [
[ a' ] build-tree analyze-recursive
\ a' label-is-loop?
] unit-test
-[ f ] [
+{ f } [
[ b' ] build-tree analyze-recursive
\ b' label-is-loop?
] unit-test
! paper almost convinced me that a loop conversion here is
! sound.
-[ t ] [
+{ t } [
[ b' ] build-tree analyze-recursive
\ a' label-is-loop?
] unit-test
-[ f ] [
+{ f } [
[ a' ] build-tree analyze-recursive
\ b' label-is-loop?
] unit-test
: a'' ( a -- b )
dup [ b'' a'' ] when ; inline recursive
-[ t ] [
+{ t } [
[ a'' ] build-tree analyze-recursive
\ a'' label-is-not-loop?
] unit-test
-[ t ] [
+{ t } [
[ a'' ] build-tree analyze-recursive
\ b'' label-is-loop?
] unit-test
-[ t ] [
+{ t } [
[ b'' ] build-tree analyze-recursive
\ a'' label-is-loop?
] unit-test
-[ t ] [
+{ t } [
[ b'' ] build-tree analyze-recursive
\ b'' label-is-not-loop?
] unit-test
[ [ 1 - ] dip loop-in-non-loop ] [ call ] 2bi
] [ 2drop ] if ; inline recursive
-[ t ] [
+{ t } [
[ 10 [ [ drop ] each-integer ] loop-in-non-loop ]
build-tree analyze-recursive
\ (each-integer) label-is-loop?
: a''' ( -- )
blah [ b''' ] [ a''' ] if ; inline recursive
-[ t ] [
+{ t } [
[ b''' ] build-tree analyze-recursive
\ a''' label-is-loop?
] unit-test
: b4 ( a -- b ) dup [ a4 reverse ] when ; inline recursive
-[ t ] [ [ b4 ] build-tree analyze-recursive \ a4 label-is-loop? ] unit-test
-[ t ] [ [ b4 ] build-tree analyze-recursive \ b4 label-is-not-loop? ] unit-test
-[ t ] [ [ a4 ] build-tree analyze-recursive \ a4 label-is-not-loop? ] unit-test
-[ t ] [ [ a4 ] build-tree analyze-recursive \ b4 label-is-loop? ] unit-test
+{ t } [ [ b4 ] build-tree analyze-recursive \ a4 label-is-loop? ] unit-test
+{ t } [ [ b4 ] build-tree analyze-recursive \ b4 label-is-not-loop? ] unit-test
+{ t } [ [ a4 ] build-tree analyze-recursive \ a4 label-is-not-loop? ] unit-test
+{ t } [ [ a4 ] build-tree analyze-recursive \ b4 label-is-loop? ] unit-test
: bleach-node ( quot: ( ..a -- ..b ) -- )
[ bleach-node ] curry [ ] compose impeach-node ; inline recursive
-[ ] [ [ [ ] bleach-node ] test-unboxing ] unit-test
+{ } [ [ [ ] bleach-node ] test-unboxing ] unit-test
TUPLE: box { i read-only } ;
: box-test ( m -- n )
dup box-test i>> swap box-test drop box boa ; inline recursive
-[ ] [ [ T{ box f 34 } box-test i>> ] test-unboxing ] unit-test
+{ } [ [ T{ box f 34 } box-test i>> ] test-unboxing ] unit-test
USING: tools.test compression.inflate ;
IN: compression.inflate.tests
-[
+{
B{
1 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 122 121 94 119
255 255 255 0 255 255 255 0 255 255 255 0 255 255 255 0 255
255 255 0
}
-] [
+} [
B{
56 141 99 252 255 255 63 3 41 160 170 50 174 252 253 219
199 17 2 2 92 172 2 130 82 107 152 69 132 191 138 153 153
USING: arrays byte-arrays compression.snappy kernel tools.test ;
IN: compression.snappy.tests
-[ t ] [
+{ t } [
1000 2 <array> >byte-array [ snappy-compress snappy-uncompress ] keep =
] unit-test
-[ t ] [
+{ t } [
B{ } [ snappy-compress snappy-uncompress ] keep =
] unit-test
-[ t ] [
+{ t } [
B{ 1 } [ snappy-compress snappy-uncompress ] keep =
] unit-test
-[ t ] [
+{ t } [
B{ 1 2 } [ snappy-compress snappy-uncompress ] keep =
] unit-test
-[ t ] [
+{ t } [
B{ 1 2 3 } [ snappy-compress snappy-uncompress ] keep =
] unit-test
: compress-me ( -- byte-array ) B{ 1 2 3 4 5 } ;
-[ t ] [ compress-me [ compress uncompress ] keep = ] unit-test
+{ t } [ compress-me [ compress uncompress ] keep = ] unit-test
[ ffi:Z_DATA_ERROR zlib-error-message ] [ string>> "data error" = ] must-fail-with
{ 2 1 } [ [ 2array ] 2parallel-map ] must-infer-as
[ [ ] parallel-filter ] must-infer
-[ { 1 4 9 } ] [ { 1 2 3 } [ sq ] parallel-map ] unit-test
+{ { 1 4 9 } } [ { 1 2 3 } [ sq ] parallel-map ] unit-test
-[ { 1 4 9 } ] [ { 1 2 3 } [ 1000000 random sleep sq ] parallel-map ] unit-test
+{ { 1 4 9 } } [ { 1 2 3 } [ 1000000 random sleep sq ] parallel-map ] unit-test
[ { 1 2 3 } [ dup 2 mod 0 = [ "Even" throw ] when ] parallel-map ]
[ error>> "Even" = ] must-fail-with
-[ V{ 0 3 6 9 } ]
+{ V{ 0 3 6 9 } }
[ 10 iota [ 3 mod zero? ] parallel-filter ] unit-test
-[ 10 ]
+{ 10 }
[
V{ } clone
10 iota over [ push ] curry parallel-each
length
] unit-test
-[ { 10 20 30 } ] [
+{ { 10 20 30 } } [
{ 1 4 3 } { 10 5 10 } [ * ] 2parallel-map
] unit-test
-[ { -9 -1 -7 } ] [
+{ { -9 -1 -7 } } [
{ 1 4 3 } { 10 5 10 } [ - ] 2parallel-map
] unit-test
{ 1 4 3 } { 1 0 1 } [ / drop ] 2parallel-each
] must-fail
-[ 20 ]
+{ 20 }
[
V{ } clone
10 iota 10 iota pick [ [ push ] [ push ] bi ] curry 2parallel-each
[ { f } [ "OOPS" throw ] parallel-each ] must-fail
-[ "1a" "4b" "3c" ] [
+{ "1a" "4b" "3c" } [
2
{ [ 1 - ] [ sq ] [ 1 + ] } parallel-cleave
[ number>string ] 3 parallel-napply
USING: concurrency.count-downs threads kernel tools.test ;
IN: concurrency.count-downs.tests`
-[ ] [ 0 <count-down> await ] unit-test
+{ } [ 0 <count-down> await ] unit-test
[ 1 <count-down> dup count-down count-down ] must-fail
-[ ] [
+{ } [
1 <count-down>
3 <count-down>
2dup [ await count-down ] 2curry "Master" spawn drop
} cond ;
-[ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test
+{ } [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test
test-node-server [
[ ] [
pr ?promise ;
-[ "Hello world, Goodbye world" ] [ exchanger-test ] unit-test
+{ "Hello world, Goodbye world" } [ exchanger-test ] unit-test
f lower-flag
f value>> ;
-[ f ] [ flag-test-1 ] unit-test
+{ f } [ flag-test-1 ] unit-test
:: flag-test-2 ( -- ? )
<flag> :> f
f lower-flag
f value>> ;
-[ f ] [ flag-test-2 ] unit-test
+{ f } [ flag-test-2 ] unit-test
:: flag-test-3 ( -- val )
<flag> :> f
f raise-flag
f value>> ;
-[ t ] [ flag-test-3 ] unit-test
+{ t } [ flag-test-3 ] unit-test
:: flag-test-4 ( -- val )
<flag> :> f
f wait-for-flag
f value>> ;
-[ t ] [ flag-test-4 ] unit-test
+{ t } [ flag-test-4 ] unit-test
:: flag-test-5 ( -- val )
<flag> :> f
f wait-for-flag
f value>> ;
-[ t ] [ flag-test-5 ] unit-test
+{ t } [ flag-test-5 ] unit-test
-[ ] [
+{ } [
{ 1 2 } <flag>
[ [ 1 seconds sleep raise-flag ] curry "Flag test" spawn drop ]
[ [ wait-for-flag drop ] curry parallel-each ] bi
USING: concurrency.futures kernel tools.test threads ;
IN: concurrency.futures.tests
-[ 50 ] [
+{ 50 } [
[ 50 ] future ?future
] unit-test
[ "this should propogate" throw ] future ?future
] must-fail
-[ ] [
+{ } [
[ "this should not propogate" throw ] future drop
] unit-test
! Race condition with futures
-[ 3 3 ] [
+{ 3 3 } [
[ 3 ] future
dup ?future swap ?future
] unit-test
! Another race
-[ 3 ] [
+{ 3 } [
[ 3 yield ] future ?future
] unit-test
c await
v ;
-[ V{ 1 3 2 4 } ] [ lock-test-0 ] unit-test
-[ V{ 1 2 3 4 } ] [ lock-test-1 ] unit-test
+{ V{ 1 3 2 4 } } [ lock-test-0 ] unit-test
+{ V{ 1 2 3 4 } } [ lock-test-1 ] unit-test
-[ 3 ] [
+{ 3 } [
<reentrant-lock> dup [
[
3
] with-lock
] unit-test
-[ ] [ <rw-lock> drop ] unit-test
+{ } [ <rw-lock> drop ] unit-test
-[ ] [ <rw-lock> [ ] with-read-lock ] unit-test
+{ } [ <rw-lock> [ ] with-read-lock ] unit-test
-[ ] [ <rw-lock> dup [ [ ] with-read-lock ] with-read-lock ] unit-test
+{ } [ <rw-lock> dup [ [ ] with-read-lock ] with-read-lock ] unit-test
-[ ] [ <rw-lock> [ ] with-write-lock ] unit-test
+{ } [ <rw-lock> [ ] with-write-lock ] unit-test
-[ ] [ <rw-lock> dup [ [ ] with-write-lock ] with-write-lock ] unit-test
+{ } [ <rw-lock> dup [ [ ] with-write-lock ] with-write-lock ] unit-test
-[ ] [ <rw-lock> dup [ [ ] with-read-lock ] with-write-lock ] unit-test
+{ } [ <rw-lock> dup [ [ ] with-read-lock ] with-write-lock ] unit-test
:: rw-lock-test-1 ( -- v )
<rw-lock> :> l
c'' await
v ;
-[ V{ 1 2 3 4 5 6 } ] [ rw-lock-test-1 ] unit-test
+{ V{ 1 2 3 4 5 6 } } [ rw-lock-test-1 ] unit-test
:: rw-lock-test-2 ( -- v )
<rw-lock> :> l
c' await
v ;
-[ V{ 1 2 3 } ] [ rw-lock-test-2 ] unit-test
+{ V{ 1 2 3 } } [ rw-lock-test-2 ] unit-test
! Test lock timeouts
:: lock-timeout-test ( -- v )
] with-write-lock
] must-fail
-[ ] [
+{ } [
<rw-lock> dup [
dup [
1 seconds [ ] with-read-lock-timeout
{ 1 1 } [ [ integer? ] mailbox-get? ] must-infer-as
-[ V{ 1 2 3 } ] [
+{ V{ 1 2 3 } } [
0 <vector>
<mailbox>
[ mailbox-get swap push ] in-thread
3 swap mailbox-put
] unit-test
-[ V{ 1 2 3 } ] [
+{ V{ 1 2 3 } } [
0 <vector>
<mailbox>
[ [ integer? ] mailbox-get? swap push ] in-thread
3 swap mailbox-put
] unit-test
-[ V{ 1 "junk" 3 "junk2" } [ 456 ] ] [
+{ V{ 1 "junk" 3 "junk2" } [ 456 ] } [
0 <vector>
<mailbox>
[ [ integer? ] mailbox-get? swap push ] in-thread
mailbox-get
] unit-test
-[ { "foo" "bar" } ] [
+{ { "foo" "bar" } } [
<mailbox>
"foo" over mailbox-put
"bar" over mailbox-put
concurrency.count-downs accessors ;
IN: concurrency.messaging.tests
-[ ] [ my-mailbox data>> clear-deque ] unit-test
+{ } [ my-mailbox data>> clear-deque ] unit-test
-[ "received" ] [
+{ "received" } [
[
receive "received" swap reply-synchronous
] "Synchronous test" spawn
"sent" swap send-synchronous
] unit-test
-[ 1 3 2 ] [
+{ 1 3 2 } [
1 self send
2 self send
3 self send
{ exit [ f ] }
} match-cond ;
-[ -5 ] [
+{ -5 } [
[ 0 [ counter ] loop ] "Counter" spawn "counter" set
{ increment 10 } "counter" get send
{ decrement 15 } "counter" get send
tools.test ;
IN: concurrency.promises.tests
-[ V{ 50 50 50 } ] [
+{ V{ 50 50 50 } } [
0 <vector>
<promise>
[ ?promise swap push ] in-thread
USING: core-foundation core-foundation.arrays
core-foundation.strings destructors sequences tools.test ;
-[ { "1" "2" "3" } ] [
+{ { "1" "2" "3" } } [
[
{ "1" "2" "3" }
[ <CFString> &CFRelease ] map
core-foundation ;
IN: core-foundation.attributed-strings.tests
-[ ] [ "Hello world" H{ } <CFAttributedString> CFRelease ] unit-test
+{ } [ "Hello world" H{ } <CFAttributedString> CFRelease ] unit-test
arrays destructors core-foundation.strings kernel namespaces ;
IN: core-foundation.dictionaries.tests
-[ ] [ { } <CFDictionary> CFRelease ] unit-test
+{ } [ { } <CFDictionary> CFRelease ] unit-test
-[ "raps in the back of cars and doesn't afraid of anything" ] [
+{ "raps in the back of cars and doesn't afraid of anything" } [
[
"cpst" <CFString> &CFRelease dup "key" set
"raps in the back of cars and doesn't afraid of anything" <CFString> &CFRelease
strings ;
IN: core-foundation
-[ ] [ "Hello" <CFString> CFRelease ] unit-test
-[ "Hello" ] [ "Hello" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test
-[ "Hello\u003456" ] [ "Hello\u003456" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test
-[ "Hello\u013456" ] [ "Hello\u013456" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test
-[ ] [ "\0" <CFString> CFRelease ] unit-test
-[ "\0" ] [ "\0" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test
+{ } [ "Hello" <CFString> CFRelease ] unit-test
+{ "Hello" } [ "Hello" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test
+{ "Hello\u003456" } [ "Hello\u003456" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test
+{ "Hello\u013456" } [ "Hello\u013456" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test
+{ } [ "\0" <CFString> CFRelease ] unit-test
+{ "\0" } [ "\0" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test
! This shouldn't fail
-[ ] [ { 0x123456 } >string <CFString> CFRelease ] unit-test
+{ } [ { 0x123456 } >string <CFString> CFRelease ] unit-test
IN: cpu.x86.assembler.tests
! small registers
-[ { 128 192 12 } ] [ [ AL 12 <byte> ADD ] { } make ] unit-test
-[ { 128 196 12 } ] [ [ AH 12 <byte> ADD ] { } make ] unit-test
-[ { 176 12 } ] [ [ AL 12 <byte> MOV ] { } make ] unit-test
-[ { 180 12 } ] [ [ AH 12 <byte> MOV ] { } make ] unit-test
-[ { 198 0 12 } ] [ [ EAX [] 12 <byte> MOV ] { } make ] unit-test
-[ { 0 235 } ] [ [ BL CH ADD ] { } make ] unit-test
-[ { 136 235 } ] [ [ BL CH MOV ] { } make ] unit-test
+{ { 128 192 12 } } [ [ AL 12 <byte> ADD ] { } make ] unit-test
+{ { 128 196 12 } } [ [ AH 12 <byte> ADD ] { } make ] unit-test
+{ { 176 12 } } [ [ AL 12 <byte> MOV ] { } make ] unit-test
+{ { 180 12 } } [ [ AH 12 <byte> MOV ] { } make ] unit-test
+{ { 198 0 12 } } [ [ EAX [] 12 <byte> MOV ] { } make ] unit-test
+{ { 0 235 } } [ [ BL CH ADD ] { } make ] unit-test
+{ { 136 235 } } [ [ BL CH MOV ] { } make ] unit-test
! immediate operands
cell 4 = [
[ { 0xb9 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 } ] [ [ ECX 1 MOV ] { } make ] unit-test
] if
-[ { 0x83 0xc1 0x01 } ] [ [ ECX 1 ADD ] { } make ] unit-test
-[ { 0x81 0xc1 0x96 0x00 0x00 0x00 } ] [ [ ECX 150 ADD ] { } make ] unit-test
-[ { 0xf7 0xc1 0xd2 0x04 0x00 0x00 } ] [ [ ECX 1234 TEST ] { } make ] unit-test
+{ { 0x83 0xc1 0x01 } } [ [ ECX 1 ADD ] { } make ] unit-test
+{ { 0x81 0xc1 0x96 0x00 0x00 0x00 } } [ [ ECX 150 ADD ] { } make ] unit-test
+{ { 0xf7 0xc1 0xd2 0x04 0x00 0x00 } } [ [ ECX 1234 TEST ] { } make ] unit-test
! 64-bit registers
-[ { 0x40 0x8a 0x2a } ] [ [ BPL RDX [] MOV ] { } make ] unit-test
+{ { 0x40 0x8a 0x2a } } [ [ BPL RDX [] MOV ] { } make ] unit-test
-[ { 0x49 0x89 0x04 0x24 } ] [ [ R12 [] RAX MOV ] { } make ] unit-test
-[ { 0x49 0x8b 0x06 } ] [ [ RAX R14 [] MOV ] { } make ] unit-test
+{ { 0x49 0x89 0x04 0x24 } } [ [ R12 [] RAX MOV ] { } make ] unit-test
+{ { 0x49 0x8b 0x06 } } [ [ RAX R14 [] MOV ] { } make ] unit-test
-[ { 0x89 0xca } ] [ [ EDX ECX MOV ] { } make ] unit-test
-[ { 0x4c 0x89 0xe2 } ] [ [ RDX R12 MOV ] { } make ] unit-test
-[ { 0x49 0x89 0xd4 } ] [ [ R12 RDX MOV ] { } make ] unit-test
+{ { 0x89 0xca } } [ [ EDX ECX MOV ] { } make ] unit-test
+{ { 0x4c 0x89 0xe2 } } [ [ RDX R12 MOV ] { } make ] unit-test
+{ { 0x49 0x89 0xd4 } } [ [ R12 RDX MOV ] { } make ] unit-test
! memory address modes
-[ { 0x8a 0x18 } ] [ [ BL RAX [] MOV ] { } make ] unit-test
-[ { 0x66 0x8b 0x18 } ] [ [ BX RAX [] MOV ] { } make ] unit-test
-[ { 0x8b 0x18 } ] [ [ EBX RAX [] MOV ] { } make ] unit-test
-[ { 0x48 0x8b 0x18 } ] [ [ RBX RAX [] MOV ] { } make ] unit-test
-[ { 0x88 0x18 } ] [ [ RAX [] BL MOV ] { } make ] unit-test
-[ { 0x66 0x89 0x18 } ] [ [ RAX [] BX MOV ] { } make ] unit-test
-[ { 0x89 0x18 } ] [ [ RAX [] EBX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x18 } ] [ [ RAX [] RBX MOV ] { } make ] unit-test
+{ { 0x8a 0x18 } } [ [ BL RAX [] MOV ] { } make ] unit-test
+{ { 0x66 0x8b 0x18 } } [ [ BX RAX [] MOV ] { } make ] unit-test
+{ { 0x8b 0x18 } } [ [ EBX RAX [] MOV ] { } make ] unit-test
+{ { 0x48 0x8b 0x18 } } [ [ RBX RAX [] MOV ] { } make ] unit-test
+{ { 0x88 0x18 } } [ [ RAX [] BL MOV ] { } make ] unit-test
+{ { 0x66 0x89 0x18 } } [ [ RAX [] BX MOV ] { } make ] unit-test
+{ { 0x89 0x18 } } [ [ RAX [] EBX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x18 } } [ [ RAX [] RBX MOV ] { } make ] unit-test
-[ { 0x0f 0xbe 0xc3 } ] [ [ EAX BL MOVSX ] { } make ] unit-test
-[ { 0x0f 0xbf 0xc3 } ] [ [ EAX BX MOVSX ] { } make ] unit-test
+{ { 0x0f 0xbe 0xc3 } } [ [ EAX BL MOVSX ] { } make ] unit-test
+{ { 0x0f 0xbf 0xc3 } } [ [ EAX BX MOVSX ] { } make ] unit-test
-[ { 0x80 0x08 0x05 } ] [ [ EAX [] 5 <byte> OR ] { } make ] unit-test
-[ { 0xc6 0x00 0x05 } ] [ [ EAX [] 5 <byte> MOV ] { } make ] unit-test
+{ { 0x80 0x08 0x05 } } [ [ EAX [] 5 <byte> OR ] { } make ] unit-test
+{ { 0xc6 0x00 0x05 } } [ [ EAX [] 5 <byte> MOV ] { } make ] unit-test
-[ { 0x49 0x89 0x04 0x1a } ] [ [ R10 RBX [+] RAX MOV ] { } make ] unit-test
-[ { 0x49 0x89 0x04 0x1b } ] [ [ R11 RBX [+] RAX MOV ] { } make ] unit-test
+{ { 0x49 0x89 0x04 0x1a } } [ [ R10 RBX [+] RAX MOV ] { } make ] unit-test
+{ { 0x49 0x89 0x04 0x1b } } [ [ R11 RBX [+] RAX MOV ] { } make ] unit-test
-[ { 0x49 0x89 0x04 0x1c } ] [ [ R12 RBX [+] RAX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x04 0x1c } ] [ [ RSP RBX [+] RAX MOV ] { } make ] unit-test
+{ { 0x49 0x89 0x04 0x1c } } [ [ R12 RBX [+] RAX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x04 0x1c } } [ [ RSP RBX [+] RAX MOV ] { } make ] unit-test
-[ { 0x49 0x89 0x44 0x1d 0x00 } ] [ [ R13 RBX [+] RAX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x44 0x1d 0x00 } ] [ [ RBP RBX [+] RAX MOV ] { } make ] unit-test
+{ { 0x49 0x89 0x44 0x1d 0x00 } } [ [ R13 RBX [+] RAX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x44 0x1d 0x00 } } [ [ RBP RBX [+] RAX MOV ] { } make ] unit-test
-[ { 0x4a 0x89 0x04 0x23 } ] [ [ RBX R12 [+] RAX MOV ] { } make ] unit-test
-[ { 0x4a 0x89 0x04 0x2b } ] [ [ RBX R13 [+] RAX MOV ] { } make ] unit-test
+{ { 0x4a 0x89 0x04 0x23 } } [ [ RBX R12 [+] RAX MOV ] { } make ] unit-test
+{ { 0x4a 0x89 0x04 0x2b } } [ [ RBX R13 [+] RAX MOV ] { } make ] unit-test
-[ { 0x4b 0x89 0x44 0x25 0x00 } ] [ [ R13 R12 [+] RAX MOV ] { } make ] unit-test
-[ { 0x4b 0x89 0x04 0x2c } ] [ [ R12 R13 [+] RAX MOV ] { } make ] unit-test
+{ { 0x4b 0x89 0x44 0x25 0x00 } } [ [ R13 R12 [+] RAX MOV ] { } make ] unit-test
+{ { 0x4b 0x89 0x04 0x2c } } [ [ R12 R13 [+] RAX MOV ] { } make ] unit-test
-[ { 0x49 0x89 0x04 0x2c } ] [ [ R12 RBP [+] RAX MOV ] { } make ] unit-test
+{ { 0x49 0x89 0x04 0x2c } } [ [ R12 RBP [+] RAX MOV ] { } make ] unit-test
[ [ R12 RSP [+] RAX MOV ] { } make ] must-fail
-[ { 0x89 0x1c 0x11 } ] [ [ ECX EDX [+] EBX MOV ] { } make ] unit-test
-[ { 0x89 0x1c 0x51 } ] [ [ ECX EDX 1 0 <indirect> EBX MOV ] { } make ] unit-test
-[ { 0x89 0x1c 0x91 } ] [ [ ECX EDX 2 0 <indirect> EBX MOV ] { } make ] unit-test
-[ { 0x89 0x1c 0xd1 } ] [ [ ECX EDX 3 0 <indirect> EBX MOV ] { } make ] unit-test
-[ { 0x89 0x5c 0x11 0x64 } ] [ [ ECX EDX 0 100 <indirect> EBX MOV ] { } make ] unit-test
-[ { 0x89 0x5c 0x51 0x64 } ] [ [ ECX EDX 1 100 <indirect> EBX MOV ] { } make ] unit-test
-[ { 0x89 0x5c 0x91 0x64 } ] [ [ ECX EDX 2 100 <indirect> EBX MOV ] { } make ] unit-test
-[ { 0x89 0x5c 0xd1 0x64 } ] [ [ ECX EDX 3 100 <indirect> EBX MOV ] { } make ] unit-test
-
-[ { 0x48 0x89 0x1c 0x11 } ] [ [ RCX RDX [+] RBX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x1c 0x51 } ] [ [ RCX RDX 1 0 <indirect> RBX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x1c 0x91 } ] [ [ RCX RDX 2 0 <indirect> RBX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x1c 0xd1 } ] [ [ RCX RDX 3 0 <indirect> RBX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x5c 0x11 0x64 } ] [ [ RCX RDX 0 100 <indirect> RBX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x5c 0x51 0x64 } ] [ [ RCX RDX 1 100 <indirect> RBX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x5c 0x91 0x64 } ] [ [ RCX RDX 2 100 <indirect> RBX MOV ] { } make ] unit-test
-[ { 0x48 0x89 0x5c 0xd1 0x64 } ] [ [ RCX RDX 3 100 <indirect> RBX MOV ] { } make ] unit-test
+{ { 0x89 0x1c 0x11 } } [ [ ECX EDX [+] EBX MOV ] { } make ] unit-test
+{ { 0x89 0x1c 0x51 } } [ [ ECX EDX 1 0 <indirect> EBX MOV ] { } make ] unit-test
+{ { 0x89 0x1c 0x91 } } [ [ ECX EDX 2 0 <indirect> EBX MOV ] { } make ] unit-test
+{ { 0x89 0x1c 0xd1 } } [ [ ECX EDX 3 0 <indirect> EBX MOV ] { } make ] unit-test
+{ { 0x89 0x5c 0x11 0x64 } } [ [ ECX EDX 0 100 <indirect> EBX MOV ] { } make ] unit-test
+{ { 0x89 0x5c 0x51 0x64 } } [ [ ECX EDX 1 100 <indirect> EBX MOV ] { } make ] unit-test
+{ { 0x89 0x5c 0x91 0x64 } } [ [ ECX EDX 2 100 <indirect> EBX MOV ] { } make ] unit-test
+{ { 0x89 0x5c 0xd1 0x64 } } [ [ ECX EDX 3 100 <indirect> EBX MOV ] { } make ] unit-test
+
+{ { 0x48 0x89 0x1c 0x11 } } [ [ RCX RDX [+] RBX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x1c 0x51 } } [ [ RCX RDX 1 0 <indirect> RBX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x1c 0x91 } } [ [ RCX RDX 2 0 <indirect> RBX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x1c 0xd1 } } [ [ RCX RDX 3 0 <indirect> RBX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x5c 0x11 0x64 } } [ [ RCX RDX 0 100 <indirect> RBX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x5c 0x51 0x64 } } [ [ RCX RDX 1 100 <indirect> RBX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x5c 0x91 0x64 } } [ [ RCX RDX 2 100 <indirect> RBX MOV ] { } make ] unit-test
+{ { 0x48 0x89 0x5c 0xd1 0x64 } } [ [ RCX RDX 3 100 <indirect> RBX MOV ] { } make ] unit-test
! r-rm / m-r sse instruction
-[ { 0x0f 0x10 0xc1 } ] [ [ XMM0 XMM1 MOVUPS ] { } make ] unit-test
-[ { 0x0f 0x10 0x01 } ] [ [ XMM0 ECX [] MOVUPS ] { } make ] unit-test
-[ { 0x0f 0x11 0x08 } ] [ [ EAX [] XMM1 MOVUPS ] { } make ] unit-test
+{ { 0x0f 0x10 0xc1 } } [ [ XMM0 XMM1 MOVUPS ] { } make ] unit-test
+{ { 0x0f 0x10 0x01 } } [ [ XMM0 ECX [] MOVUPS ] { } make ] unit-test
+{ { 0x0f 0x11 0x08 } } [ [ EAX [] XMM1 MOVUPS ] { } make ] unit-test
-[ { 0xf3 0x0f 0x10 0xc1 } ] [ [ XMM0 XMM1 MOVSS ] { } make ] unit-test
-[ { 0xf3 0x0f 0x10 0x01 } ] [ [ XMM0 ECX [] MOVSS ] { } make ] unit-test
-[ { 0xf3 0x0f 0x11 0x08 } ] [ [ EAX [] XMM1 MOVSS ] { } make ] unit-test
+{ { 0xf3 0x0f 0x10 0xc1 } } [ [ XMM0 XMM1 MOVSS ] { } make ] unit-test
+{ { 0xf3 0x0f 0x10 0x01 } } [ [ XMM0 ECX [] MOVSS ] { } make ] unit-test
+{ { 0xf3 0x0f 0x11 0x08 } } [ [ EAX [] XMM1 MOVSS ] { } make ] unit-test
-[ { 0x66 0x0f 0x6f 0xc1 } ] [ [ XMM0 XMM1 MOVDQA ] { } make ] unit-test
-[ { 0x66 0x0f 0x6f 0x01 } ] [ [ XMM0 ECX [] MOVDQA ] { } make ] unit-test
-[ { 0x66 0x0f 0x7f 0x08 } ] [ [ EAX [] XMM1 MOVDQA ] { } make ] unit-test
+{ { 0x66 0x0f 0x6f 0xc1 } } [ [ XMM0 XMM1 MOVDQA ] { } make ] unit-test
+{ { 0x66 0x0f 0x6f 0x01 } } [ [ XMM0 ECX [] MOVDQA ] { } make ] unit-test
+{ { 0x66 0x0f 0x7f 0x08 } } [ [ EAX [] XMM1 MOVDQA ] { } make ] unit-test
! r-rm only sse instruction
-[ { 0x66 0x0f 0x2e 0xc1 } ] [ [ XMM0 XMM1 UCOMISD ] { } make ] unit-test
-[ { 0x66 0x0f 0x2e 0x01 } ] [ [ XMM0 ECX [] UCOMISD ] { } make ] unit-test
+{ { 0x66 0x0f 0x2e 0xc1 } } [ [ XMM0 XMM1 UCOMISD ] { } make ] unit-test
+{ { 0x66 0x0f 0x2e 0x01 } } [ [ XMM0 ECX [] UCOMISD ] { } make ] unit-test
[ [ EAX [] XMM1 UCOMISD ] { } make ] must-fail
-[ { 0x66 0x0f 0x38 0x2a 0x01 } ] [ [ XMM0 ECX [] MOVNTDQA ] { } make ] unit-test
+{ { 0x66 0x0f 0x38 0x2a 0x01 } } [ [ XMM0 ECX [] MOVNTDQA ] { } make ] unit-test
-[ { 0x66 0x48 0x0f 0x6e 0xc8 } ] [ [ XMM1 RAX MOVD ] { } make ] unit-test
-[ { 0x66 0x0f 0x6e 0xc8 } ] [ [ XMM1 EAX MOVD ] { } make ] unit-test
-[ { 0x66 0x48 0x0f 0x7e 0xc8 } ] [ [ RAX XMM1 MOVD ] { } make ] unit-test
-[ { 0x66 0x0f 0x7e 0xc8 } ] [ [ EAX XMM1 MOVD ] { } make ] unit-test
+{ { 0x66 0x48 0x0f 0x6e 0xc8 } } [ [ XMM1 RAX MOVD ] { } make ] unit-test
+{ { 0x66 0x0f 0x6e 0xc8 } } [ [ XMM1 EAX MOVD ] { } make ] unit-test
+{ { 0x66 0x48 0x0f 0x7e 0xc8 } } [ [ RAX XMM1 MOVD ] { } make ] unit-test
+{ { 0x66 0x0f 0x7e 0xc8 } } [ [ EAX XMM1 MOVD ] { } make ] unit-test
-[ { 0xf3 0x0f 0x7e 0x08 } ] [ [ XMM1 EAX [] MOVQ ] { } make ] unit-test
-[ { 0xf3 0x0f 0x7e 0x08 } ] [ [ XMM1 EAX [] MOVQ ] { } make ] unit-test
-[ { 0xf3 0x0f 0x7e 0xca } ] [ [ XMM1 XMM2 MOVQ ] { } make ] unit-test
+{ { 0xf3 0x0f 0x7e 0x08 } } [ [ XMM1 EAX [] MOVQ ] { } make ] unit-test
+{ { 0xf3 0x0f 0x7e 0x08 } } [ [ XMM1 EAX [] MOVQ ] { } make ] unit-test
+{ { 0xf3 0x0f 0x7e 0xca } } [ [ XMM1 XMM2 MOVQ ] { } make ] unit-test
! rm-r only sse instructions
-[ { 0x0f 0x2b 0x08 } ] [ [ EAX [] XMM1 MOVNTPS ] { } make ] unit-test
-[ { 0x66 0x0f 0xe7 0x08 } ] [ [ EAX [] XMM1 MOVNTDQ ] { } make ] unit-test
+{ { 0x0f 0x2b 0x08 } } [ [ EAX [] XMM1 MOVNTPS ] { } make ] unit-test
+{ { 0x66 0x0f 0xe7 0x08 } } [ [ EAX [] XMM1 MOVNTDQ ] { } make ] unit-test
! three-byte-opcode ssse3 instruction
-[ { 0x66 0x0f 0x38 0x02 0xc1 } ] [ [ XMM0 XMM1 PHADDD ] { } make ] unit-test
+{ { 0x66 0x0f 0x38 0x02 0xc1 } } [ [ XMM0 XMM1 PHADDD ] { } make ] unit-test
! int/sse conversion instruction
-[ { 0xf2 0x0f 0x2c 0xc0 } ] [ [ EAX XMM0 CVTTSD2SI ] { } make ] unit-test
-[ { 0xf2 0x48 0x0f 0x2c 0xc0 } ] [ [ RAX XMM0 CVTTSD2SI ] { } make ] unit-test
-[ { 0xf2 0x4c 0x0f 0x2c 0xe0 } ] [ [ R12 XMM0 CVTTSD2SI ] { } make ] unit-test
-[ { 0xf2 0x0f 0x2a 0xc0 } ] [ [ XMM0 EAX CVTSI2SD ] { } make ] unit-test
-[ { 0xf2 0x48 0x0f 0x2a 0xc0 } ] [ [ XMM0 RAX CVTSI2SD ] { } make ] unit-test
-[ { 0xf2 0x48 0x0f 0x2a 0xc1 } ] [ [ XMM0 RCX CVTSI2SD ] { } make ] unit-test
-[ { 0xf2 0x48 0x0f 0x2a 0xd9 } ] [ [ XMM3 RCX CVTSI2SD ] { } make ] unit-test
-[ { 0xf2 0x48 0x0f 0x2a 0xc0 } ] [ [ XMM0 RAX CVTSI2SD ] { } make ] unit-test
-[ { 0xf2 0x49 0x0f 0x2a 0xc4 } ] [ [ XMM0 R12 CVTSI2SD ] { } make ] unit-test
+{ { 0xf2 0x0f 0x2c 0xc0 } } [ [ EAX XMM0 CVTTSD2SI ] { } make ] unit-test
+{ { 0xf2 0x48 0x0f 0x2c 0xc0 } } [ [ RAX XMM0 CVTTSD2SI ] { } make ] unit-test
+{ { 0xf2 0x4c 0x0f 0x2c 0xe0 } } [ [ R12 XMM0 CVTTSD2SI ] { } make ] unit-test
+{ { 0xf2 0x0f 0x2a 0xc0 } } [ [ XMM0 EAX CVTSI2SD ] { } make ] unit-test
+{ { 0xf2 0x48 0x0f 0x2a 0xc0 } } [ [ XMM0 RAX CVTSI2SD ] { } make ] unit-test
+{ { 0xf2 0x48 0x0f 0x2a 0xc1 } } [ [ XMM0 RCX CVTSI2SD ] { } make ] unit-test
+{ { 0xf2 0x48 0x0f 0x2a 0xd9 } } [ [ XMM3 RCX CVTSI2SD ] { } make ] unit-test
+{ { 0xf2 0x48 0x0f 0x2a 0xc0 } } [ [ XMM0 RAX CVTSI2SD ] { } make ] unit-test
+{ { 0xf2 0x49 0x0f 0x2a 0xc4 } } [ [ XMM0 R12 CVTSI2SD ] { } make ] unit-test
! 3-operand r-rm-imm sse instructions
-[ { 0x66 0x0f 0x70 0xc1 0x02 } ]
+{ { 0x66 0x0f 0x70 0xc1 0x02 } }
[ [ XMM0 XMM1 2 PSHUFD ] { } make ] unit-test
-[ { 0x0f 0xc6 0xc1 0x02 } ]
+{ { 0x0f 0xc6 0xc1 0x02 } }
[ [ XMM0 XMM1 2 SHUFPS ] { } make ] unit-test
! shufflers with arrays of indexes
-[ { 0x66 0x0f 0x70 0xc1 0x02 } ]
+{ { 0x66 0x0f 0x70 0xc1 0x02 } }
[ [ XMM0 XMM1 { 2 0 0 0 } PSHUFD ] { } make ] unit-test
-[ { 0x0f 0xc6 0xc1 0x63 } ]
+{ { 0x0f 0xc6 0xc1 0x63 } }
[ [ XMM0 XMM1 { 3 0 2 1 } SHUFPS ] { } make ] unit-test
-[ { 0x66 0x0f 0xc6 0xc1 0x2 } ]
+{ { 0x66 0x0f 0xc6 0xc1 0x2 } }
[ [ XMM0 XMM1 { 0 1 } SHUFPD ] { } make ] unit-test
-[ { 0x66 0x0f 0xc6 0xc1 0x1 } ]
+{ { 0x66 0x0f 0xc6 0xc1 0x1 } }
[ [ XMM0 XMM1 { 1 0 } SHUFPD ] { } make ] unit-test
! scalar register insert/extract sse instructions
-[ { 0x66 0x0f 0xc4 0xc1 0x02 } ] [ [ XMM0 ECX 2 PINSRW ] { } make ] unit-test
-[ { 0x66 0x0f 0xc4 0x04 0x11 0x03 } ] [ [ XMM0 ECX EDX [+] 3 PINSRW ] { } make ] unit-test
+{ { 0x66 0x0f 0xc4 0xc1 0x02 } } [ [ XMM0 ECX 2 PINSRW ] { } make ] unit-test
+{ { 0x66 0x0f 0xc4 0x04 0x11 0x03 } } [ [ XMM0 ECX EDX [+] 3 PINSRW ] { } make ] unit-test
-[ { 0x66 0x0f 0xc5 0xc1 0x02 } ] [ [ EAX XMM1 2 PEXTRW ] { } make ] unit-test
-[ { 0x66 0x0f 0x3a 0x15 0x08 0x02 } ] [ [ EAX [] XMM1 2 PEXTRW ] { } make ] unit-test
-[ { 0x66 0x0f 0x3a 0x15 0x14 0x08 0x03 } ] [ [ EAX ECX [+] XMM2 3 PEXTRW ] { } make ] unit-test
-[ { 0x66 0x0f 0x3a 0x14 0xc8 0x02 } ] [ [ EAX XMM1 2 PEXTRB ] { } make ] unit-test
-[ { 0x66 0x0f 0x3a 0x14 0x08 0x02 } ] [ [ EAX [] XMM1 2 PEXTRB ] { } make ] unit-test
+{ { 0x66 0x0f 0xc5 0xc1 0x02 } } [ [ EAX XMM1 2 PEXTRW ] { } make ] unit-test
+{ { 0x66 0x0f 0x3a 0x15 0x08 0x02 } } [ [ EAX [] XMM1 2 PEXTRW ] { } make ] unit-test
+{ { 0x66 0x0f 0x3a 0x15 0x14 0x08 0x03 } } [ [ EAX ECX [+] XMM2 3 PEXTRW ] { } make ] unit-test
+{ { 0x66 0x0f 0x3a 0x14 0xc8 0x02 } } [ [ EAX XMM1 2 PEXTRB ] { } make ] unit-test
+{ { 0x66 0x0f 0x3a 0x14 0x08 0x02 } } [ [ EAX [] XMM1 2 PEXTRB ] { } make ] unit-test
! sse shift instructions
-[ { 0x66 0x0f 0x71 0xd0 0x05 } ] [ [ XMM0 5 PSRLW ] { } make ] unit-test
-[ { 0x66 0x0f 0xd1 0xc1 } ] [ [ XMM0 XMM1 PSRLW ] { } make ] unit-test
+{ { 0x66 0x0f 0x71 0xd0 0x05 } } [ [ XMM0 5 PSRLW ] { } make ] unit-test
+{ { 0x66 0x0f 0xd1 0xc1 } } [ [ XMM0 XMM1 PSRLW ] { } make ] unit-test
! sse comparison instructions
-[ { 0x66 0x0f 0xc2 0xc1 0x02 } ] [ [ XMM0 XMM1 CMPLEPD ] { } make ] unit-test
+{ { 0x66 0x0f 0xc2 0xc1 0x02 } } [ [ XMM0 XMM1 CMPLEPD ] { } make ] unit-test
! unique sse instructions
-[ { 0x0f 0x18 0x00 } ] [ [ EAX [] PREFETCHNTA ] { } make ] unit-test
-[ { 0x0f 0x18 0x08 } ] [ [ EAX [] PREFETCHT0 ] { } make ] unit-test
-[ { 0x0f 0x18 0x10 } ] [ [ EAX [] PREFETCHT1 ] { } make ] unit-test
-[ { 0x0f 0x18 0x18 } ] [ [ EAX [] PREFETCHT2 ] { } make ] unit-test
-[ { 0x0f 0xae 0x10 } ] [ [ EAX [] LDMXCSR ] { } make ] unit-test
-[ { 0x0f 0xae 0x18 } ] [ [ EAX [] STMXCSR ] { } make ] unit-test
+{ { 0x0f 0x18 0x00 } } [ [ EAX [] PREFETCHNTA ] { } make ] unit-test
+{ { 0x0f 0x18 0x08 } } [ [ EAX [] PREFETCHT0 ] { } make ] unit-test
+{ { 0x0f 0x18 0x10 } } [ [ EAX [] PREFETCHT1 ] { } make ] unit-test
+{ { 0x0f 0x18 0x18 } } [ [ EAX [] PREFETCHT2 ] { } make ] unit-test
+{ { 0x0f 0xae 0x10 } } [ [ EAX [] LDMXCSR ] { } make ] unit-test
+{ { 0x0f 0xae 0x18 } } [ [ EAX [] STMXCSR ] { } make ] unit-test
-[ { 0x0f 0xc3 0x08 } ] [ [ EAX [] ECX MOVNTI ] { } make ] unit-test
+{ { 0x0f 0xc3 0x08 } } [ [ EAX [] ECX MOVNTI ] { } make ] unit-test
-[ { 0x0f 0x50 0xc1 } ] [ [ EAX XMM1 MOVMSKPS ] { } make ] unit-test
-[ { 0x66 0x0f 0x50 0xc1 } ] [ [ EAX XMM1 MOVMSKPD ] { } make ] unit-test
+{ { 0x0f 0x50 0xc1 } } [ [ EAX XMM1 MOVMSKPS ] { } make ] unit-test
+{ { 0x66 0x0f 0x50 0xc1 } } [ [ EAX XMM1 MOVMSKPD ] { } make ] unit-test
-[ { 0xf3 0x0f 0xb8 0xc1 } ] [ [ EAX ECX POPCNT ] { } make ] unit-test
-[ { 0xf3 0x48 0x0f 0xb8 0xc1 } ] [ [ RAX RCX POPCNT ] { } make ] unit-test
-[ { 0xf3 0x0f 0xb8 0x01 } ] [ [ EAX ECX [] POPCNT ] { } make ] unit-test
-[ { 0xf3 0x0f 0xb8 0x04 0x11 } ] [ [ EAX ECX EDX [+] POPCNT ] { } make ] unit-test
+{ { 0xf3 0x0f 0xb8 0xc1 } } [ [ EAX ECX POPCNT ] { } make ] unit-test
+{ { 0xf3 0x48 0x0f 0xb8 0xc1 } } [ [ RAX RCX POPCNT ] { } make ] unit-test
+{ { 0xf3 0x0f 0xb8 0x01 } } [ [ EAX ECX [] POPCNT ] { } make ] unit-test
+{ { 0xf3 0x0f 0xb8 0x04 0x11 } } [ [ EAX ECX EDX [+] POPCNT ] { } make ] unit-test
-[ { 0xf2 0x0f 0x38 0xf0 0xc1 } ] [ [ EAX CL CRC32B ] { } make ] unit-test
-[ { 0xf2 0x0f 0x38 0xf0 0x01 } ] [ [ EAX ECX [] CRC32B ] { } make ] unit-test
-[ { 0xf2 0x0f 0x38 0xf1 0xc1 } ] [ [ EAX ECX CRC32 ] { } make ] unit-test
-[ { 0xf2 0x0f 0x38 0xf1 0x01 } ] [ [ EAX ECX [] CRC32 ] { } make ] unit-test
+{ { 0xf2 0x0f 0x38 0xf0 0xc1 } } [ [ EAX CL CRC32B ] { } make ] unit-test
+{ { 0xf2 0x0f 0x38 0xf0 0x01 } } [ [ EAX ECX [] CRC32B ] { } make ] unit-test
+{ { 0xf2 0x0f 0x38 0xf1 0xc1 } } [ [ EAX ECX CRC32 ] { } make ] unit-test
+{ { 0xf2 0x0f 0x38 0xf1 0x01 } } [ [ EAX ECX [] CRC32 ] { } make ] unit-test
! shifts
-[ { 0x48 0xd3 0xe0 } ] [ [ RAX CL SHL ] { } make ] unit-test
-[ { 0x48 0xd3 0xe1 } ] [ [ RCX CL SHL ] { } make ] unit-test
-[ { 0x48 0xd3 0xe8 } ] [ [ RAX CL SHR ] { } make ] unit-test
-[ { 0x48 0xd3 0xe9 } ] [ [ RCX CL SHR ] { } make ] unit-test
+{ { 0x48 0xd3 0xe0 } } [ [ RAX CL SHL ] { } make ] unit-test
+{ { 0x48 0xd3 0xe1 } } [ [ RCX CL SHL ] { } make ] unit-test
+{ { 0x48 0xd3 0xe8 } } [ [ RAX CL SHR ] { } make ] unit-test
+{ { 0x48 0xd3 0xe9 } } [ [ RCX CL SHR ] { } make ] unit-test
-[ { 0xc1 0xe0 0x05 } ] [ [ EAX 5 SHL ] { } make ] unit-test
-[ { 0xc1 0xe1 0x05 } ] [ [ ECX 5 SHL ] { } make ] unit-test
-[ { 0xc1 0xe8 0x05 } ] [ [ EAX 5 SHR ] { } make ] unit-test
-[ { 0xc1 0xe9 0x05 } ] [ [ ECX 5 SHR ] { } make ] unit-test
+{ { 0xc1 0xe0 0x05 } } [ [ EAX 5 SHL ] { } make ] unit-test
+{ { 0xc1 0xe1 0x05 } } [ [ ECX 5 SHL ] { } make ] unit-test
+{ { 0xc1 0xe8 0x05 } } [ [ EAX 5 SHR ] { } make ] unit-test
+{ { 0xc1 0xe9 0x05 } } [ [ ECX 5 SHR ] { } make ] unit-test
! multiplication
-[ { 0x4d 0x6b 0xc0 0x03 } ] [ [ R8 R8 3 IMUL3 ] { } make ] unit-test
-[ { 0x49 0x6b 0xc0 0x03 } ] [ [ RAX R8 3 IMUL3 ] { } make ] unit-test
-[ { 0x4c 0x6b 0xc0 0x03 } ] [ [ R8 RAX 3 IMUL3 ] { } make ] unit-test
-[ { 0x48 0x6b 0xc1 0x03 } ] [ [ RAX RCX 3 IMUL3 ] { } make ] unit-test
-[ { 0x48 0x69 0xc1 0x44 0x03 0x00 0x00 } ] [ [ RAX RCX 0x344 IMUL3 ] { } make ] unit-test
+{ { 0x4d 0x6b 0xc0 0x03 } } [ [ R8 R8 3 IMUL3 ] { } make ] unit-test
+{ { 0x49 0x6b 0xc0 0x03 } } [ [ RAX R8 3 IMUL3 ] { } make ] unit-test
+{ { 0x4c 0x6b 0xc0 0x03 } } [ [ R8 RAX 3 IMUL3 ] { } make ] unit-test
+{ { 0x48 0x6b 0xc1 0x03 } } [ [ RAX RCX 3 IMUL3 ] { } make ] unit-test
+{ { 0x48 0x69 0xc1 0x44 0x03 0x00 0x00 } } [ [ RAX RCX 0x344 IMUL3 ] { } make ] unit-test
! BT family instructions
-[ { 0x0f 0xba 0xe0 0x01 } ] [ [ EAX 1 BT ] { } make ] unit-test
-[ { 0x0f 0xba 0xf8 0x01 } ] [ [ EAX 1 BTC ] { } make ] unit-test
-[ { 0x0f 0xba 0xe8 0x01 } ] [ [ EAX 1 BTS ] { } make ] unit-test
-[ { 0x0f 0xba 0xf0 0x01 } ] [ [ EAX 1 BTR ] { } make ] unit-test
-[ { 0x48 0x0f 0xba 0xe0 0x01 } ] [ [ RAX 1 BT ] { } make ] unit-test
-[ { 0x0f 0xba 0x20 0x01 } ] [ [ EAX [] 1 BT ] { } make ] unit-test
-
-[ { 0x0f 0xa3 0xd8 } ] [ [ EAX EBX BT ] { } make ] unit-test
-[ { 0x0f 0xbb 0xd8 } ] [ [ EAX EBX BTC ] { } make ] unit-test
-[ { 0x0f 0xab 0xd8 } ] [ [ EAX EBX BTS ] { } make ] unit-test
-[ { 0x0f 0xb3 0xd8 } ] [ [ EAX EBX BTR ] { } make ] unit-test
-[ { 0x0f 0xa3 0x18 } ] [ [ EAX [] EBX BT ] { } make ] unit-test
+{ { 0x0f 0xba 0xe0 0x01 } } [ [ EAX 1 BT ] { } make ] unit-test
+{ { 0x0f 0xba 0xf8 0x01 } } [ [ EAX 1 BTC ] { } make ] unit-test
+{ { 0x0f 0xba 0xe8 0x01 } } [ [ EAX 1 BTS ] { } make ] unit-test
+{ { 0x0f 0xba 0xf0 0x01 } } [ [ EAX 1 BTR ] { } make ] unit-test
+{ { 0x48 0x0f 0xba 0xe0 0x01 } } [ [ RAX 1 BT ] { } make ] unit-test
+{ { 0x0f 0xba 0x20 0x01 } } [ [ EAX [] 1 BT ] { } make ] unit-test
+
+{ { 0x0f 0xa3 0xd8 } } [ [ EAX EBX BT ] { } make ] unit-test
+{ { 0x0f 0xbb 0xd8 } } [ [ EAX EBX BTC ] { } make ] unit-test
+{ { 0x0f 0xab 0xd8 } } [ [ EAX EBX BTS ] { } make ] unit-test
+{ { 0x0f 0xb3 0xd8 } } [ [ EAX EBX BTR ] { } make ] unit-test
+{ { 0x0f 0xa3 0x18 } } [ [ EAX [] EBX BT ] { } make ] unit-test
! x87 instructions
-[ { 0xD8 0xC5 } ] [ [ ST0 ST5 FADD ] { } make ] unit-test
-[ { 0xDC 0xC5 } ] [ [ ST5 ST0 FADD ] { } make ] unit-test
-[ { 0xD8 0x00 } ] [ [ ST0 EAX [] FADD ] { } make ] unit-test
+{ { 0xD8 0xC5 } } [ [ ST0 ST5 FADD ] { } make ] unit-test
+{ { 0xDC 0xC5 } } [ [ ST5 ST0 FADD ] { } make ] unit-test
+{ { 0xD8 0x00 } } [ [ ST0 EAX [] FADD ] { } make ] unit-test
-[ { 0xD9 0xC2 } ] [ [ ST2 FLD ] { } make ] unit-test
-[ { 0xDD 0xD2 } ] [ [ ST2 FST ] { } make ] unit-test
-[ { 0xDD 0xDA } ] [ [ ST2 FSTP ] { } make ] unit-test
+{ { 0xD9 0xC2 } } [ [ ST2 FLD ] { } make ] unit-test
+{ { 0xDD 0xD2 } } [ [ ST2 FST ] { } make ] unit-test
+{ { 0xDD 0xDA } } [ [ ST2 FSTP ] { } make ] unit-test
-[ { 15 183 195 } ] [ [ EAX BX MOVZX ] { } make ] unit-test
+{ { 15 183 195 } } [ [ EAX BX MOVZX ] { } make ] unit-test
bootstrap-cell 4 = [
[ { 100 199 5 0 0 0 0 123 0 0 0 } ] [ [ 0 [] FS 123 MOV ] { } make ] unit-test
[ "pool-test.db" temp-file delete-file ] ignore-errors
-[ ] [ "pool-test.db" temp-file <sqlite-db> <db-pool> "pool" set ] unit-test
+{ } [ "pool-test.db" temp-file <sqlite-db> <db-pool> "pool" set ] unit-test
-[ ] [ "pool" get expired>> t >>expired drop ] unit-test
+{ } [ "pool" get expired>> t >>expired drop ] unit-test
-[ ] [ 1000 [ "pool" get [ ] with-pooled-db ] times ] unit-test
+{ } [ 1000 [ "pool" get [ ] with-pooled-db ] times ] unit-test
-[ ] [ "pool" get dispose ] unit-test
+{ } [ "pool" get dispose ] unit-test
"dont-exist" >>database ;
! Don't leak connections
-[ ] [
+{ } [
2000 [ [ nonexistant-db [ ] with-db ] ignore-errors ] times
] unit-test
! ] with-db
! ] [ sql-unknown-error? ] must-fail-with
-[ ] [
+{ } [
postgresql-test-db [
[ "drop table person;" sql-command ] ignore-errors
"create table person (name varchar(30), country varchar(30));"
] with-db
] unit-test
-[
+{
{
{ "John" "America" }
{ "Jane" "New Zealand" }
}
-] [
+} [
postgresql-test-db [
"select * from person" sql-query
] with-db
] unit-test
-[
+{
{
{ "John" "America" }
{ "Jane" "New Zealand" }
}
-] [ postgresql-test-db [ "select * from person" sql-query ] with-db ] unit-test
+} [ postgresql-test-db [ "select * from person" sql-query ] with-db ] unit-test
-[
-] [
+{
+} [
postgresql-test-db [
"insert into person(name, country) values('Jimmy', 'Canada')"
sql-command
] with-db
] unit-test
-[
+{
{
{ "John" "America" }
{ "Jane" "New Zealand" }
{ "Jimmy" "Canada" }
}
-] [ postgresql-test-db [ "select * from person" sql-query ] with-db ] unit-test
+} [ postgresql-test-db [ "select * from person" sql-query ] with-db ] unit-test
[
postgresql-test-db [
] with-db
] must-fail
-[ 3 ] [
+{ 3 } [
postgresql-test-db [
"select * from person" sql-query length
] with-db
] unit-test
-[
-] [
+{
+} [
postgresql-test-db [
[
"insert into person(name, country) values('Jose', 'Mexico')"
] with-db
] unit-test
-[ 5 ] [
+{ 5 } [
postgresql-test-db [
"select * from person" sql-query length
] with-db
: db-path ( -- path ) "test-" cell number>string ".db" 3append temp-file ;
: test.db ( -- sqlite-db ) db-path <sqlite-db> ;
-[ ] [ [ db-path delete-file ] ignore-errors ] unit-test
+{ } [ [ db-path delete-file ] ignore-errors ] unit-test
-[ ] [
+{ } [
test.db [
"create table person (name varchar(30), country varchar(30))" sql-command
"insert into person values('John', 'America')" sql-command
] unit-test
-[ { { "John" "America" } { "Jane" "New Zealand" } } ] [
+{ { { "John" "America" } { "Jane" "New Zealand" } } } [
test.db [
"select * from person" sql-query
] with-db
] unit-test
-[ { { "1" "John" "America" } { "2" "Jane" "New Zealand" } } ]
+{ { { "1" "John" "America" } { "2" "Jane" "New Zealand" } } }
[ test.db [ "select rowid, * from person" sql-query ] with-db ] unit-test
-[ ] [
+{ } [
test.db [
"insert into person(name, country) values('Jimmy', 'Canada')"
sql-command
] with-db
] unit-test
-[
+{
{
{ "1" "John" "America" }
{ "2" "Jane" "New Zealand" }
{ "3" "Jimmy" "Canada" }
}
-] [ test.db [ "select rowid, * from person" sql-query ] with-db ] unit-test
+} [ test.db [ "select rowid, * from person" sql-query ] with-db ] unit-test
[
test.db [
] with-db
] must-fail
-[ 3 ] [
+{ 3 } [
test.db [
"select * from person" sql-query length
] with-db
] unit-test
-[ ] [
+{ } [
test.db [
[
"insert into person(name, country) values('Jose', 'Mexico')"
] with-db
] unit-test
-[ 5 ] [
+{ 5 } [
test.db [
"select * from person" sql-query length
] with-db
{ "two" "TWO" INTEGER +not-null+ }
} define-persistent
-[ { { 0 0 } { 0 1 } { 1 0 } { 1 1 } } ] [
+{ { { 0 0 } { 0 1 } { 1 0 } { 1 1 } } } [
test.db [
things create-table
0 0 things boa insert-tuple
{ "try" "RETHROW" INTEGER { +foreign-id+ foo "SOMETHING" } }
} define-persistent
-[ T{ foo { slot 1 } } T{ hi { bye 1 } { try 1 } } ] [
+{ T{ foo { slot 1 } } T{ hi { bye 1 } { try 1 } } } [
test.db [
foo create-table
hi create-table
{ +foreign-id+ show "ID" } }
} define-persistent
-[ T{ user { username "littledan" } { data "foo" } } ] [
+{ T{ user { username "littledan" } { data "foo" } } } [
test.db [
user create-table
show create-table
USING: tools.test db.tester ;
IN: db.tester.tests
-[ ] [ sqlite-test-db db-tester ] unit-test
-[ ] [ sqlite-test-db db-tester2 ] unit-test
+{ } [ sqlite-test-db db-tester ] unit-test
+{ } [ sqlite-test-db db-tester2 ] unit-test
"123\nabcé" doc get set-doc-string
! char-elt
-[ { 0 0 } ] [ { 0 0 } doc get char-elt prev-elt ] unit-test
-[ { 0 0 } ] [ { 0 1 } doc get char-elt prev-elt ] unit-test
-[ { 0 3 } ] [ { 1 0 } doc get char-elt prev-elt ] unit-test
-[ { 1 3 } ] [ { 1 5 } doc get char-elt prev-elt ] unit-test
+{ { 0 0 } } [ { 0 0 } doc get char-elt prev-elt ] unit-test
+{ { 0 0 } } [ { 0 1 } doc get char-elt prev-elt ] unit-test
+{ { 0 3 } } [ { 1 0 } doc get char-elt prev-elt ] unit-test
+{ { 1 3 } } [ { 1 5 } doc get char-elt prev-elt ] unit-test
-[ { 1 5 } ] [ { 1 5 } doc get char-elt next-elt ] unit-test
-[ { 0 2 } ] [ { 0 1 } doc get char-elt next-elt ] unit-test
-[ { 1 0 } ] [ { 0 3 } doc get char-elt next-elt ] unit-test
-[ { 1 5 } ] [ { 1 3 } doc get char-elt next-elt ] unit-test
+{ { 1 5 } } [ { 1 5 } doc get char-elt next-elt ] unit-test
+{ { 0 2 } } [ { 0 1 } doc get char-elt next-elt ] unit-test
+{ { 1 0 } } [ { 0 3 } doc get char-elt next-elt ] unit-test
+{ { 1 5 } } [ { 1 3 } doc get char-elt next-elt ] unit-test
! word-elt
<document> doc set
"Hello world\nanother line" doc get set-doc-string
-[ { 0 0 } ] [ { 0 0 } doc get word-elt prev-elt ] unit-test
-[ { 0 0 } ] [ { 0 2 } doc get word-elt prev-elt ] unit-test
-[ { 0 0 } ] [ { 0 5 } doc get word-elt prev-elt ] unit-test
-[ { 0 5 } ] [ { 0 6 } doc get word-elt prev-elt ] unit-test
-[ { 0 6 } ] [ { 0 8 } doc get word-elt prev-elt ] unit-test
-[ { 0 11 } ] [ { 1 0 } doc get word-elt prev-elt ] unit-test
+{ { 0 0 } } [ { 0 0 } doc get word-elt prev-elt ] unit-test
+{ { 0 0 } } [ { 0 2 } doc get word-elt prev-elt ] unit-test
+{ { 0 0 } } [ { 0 5 } doc get word-elt prev-elt ] unit-test
+{ { 0 5 } } [ { 0 6 } doc get word-elt prev-elt ] unit-test
+{ { 0 6 } } [ { 0 8 } doc get word-elt prev-elt ] unit-test
+{ { 0 11 } } [ { 1 0 } doc get word-elt prev-elt ] unit-test
-[ { 0 5 } ] [ { 0 0 } doc get word-elt next-elt ] unit-test
-[ { 0 6 } ] [ { 0 5 } doc get word-elt next-elt ] unit-test
-[ { 0 11 } ] [ { 0 6 } doc get word-elt next-elt ] unit-test
-[ { 1 0 } ] [ { 0 11 } doc get word-elt next-elt ] unit-test
+{ { 0 5 } } [ { 0 0 } doc get word-elt next-elt ] unit-test
+{ { 0 6 } } [ { 0 5 } doc get word-elt next-elt ] unit-test
+{ { 0 11 } } [ { 0 6 } doc get word-elt next-elt ] unit-test
+{ { 1 0 } } [ { 0 11 } doc get word-elt next-elt ] unit-test
! one-word-elt
-[ { 0 0 } ] [ { 0 0 } doc get one-word-elt prev-elt ] unit-test
-[ { 0 0 } ] [ { 0 2 } doc get one-word-elt prev-elt ] unit-test
-[ { 0 0 } ] [ { 0 5 } doc get one-word-elt prev-elt ] unit-test
-[ { 0 5 } ] [ { 0 2 } doc get one-word-elt next-elt ] unit-test
-[ { 0 5 } ] [ { 0 5 } doc get one-word-elt next-elt ] unit-test
+{ { 0 0 } } [ { 0 0 } doc get one-word-elt prev-elt ] unit-test
+{ { 0 0 } } [ { 0 2 } doc get one-word-elt prev-elt ] unit-test
+{ { 0 0 } } [ { 0 5 } doc get one-word-elt prev-elt ] unit-test
+{ { 0 5 } } [ { 0 2 } doc get one-word-elt next-elt ] unit-test
+{ { 0 5 } } [ { 0 5 } doc get one-word-elt next-elt ] unit-test
! line-elt
<document> doc set
"Hello\nworld, how are\nyou?" doc get set-doc-string
-[ { 0 0 } ] [ { 0 3 } doc get line-elt prev-elt ] unit-test
-[ { 0 3 } ] [ { 1 3 } doc get line-elt prev-elt ] unit-test
-[ { 2 4 } ] [ { 2 1 } doc get line-elt next-elt ] unit-test
+{ { 0 0 } } [ { 0 3 } doc get line-elt prev-elt ] unit-test
+{ { 0 3 } } [ { 1 3 } doc get line-elt prev-elt ] unit-test
+{ { 2 4 } } [ { 2 1 } doc get line-elt next-elt ] unit-test
! one-line-elt
-[ { 1 0 } ] [ { 1 3 } doc get one-line-elt prev-elt ] unit-test
-[ { 1 14 } ] [ { 1 3 } doc get one-line-elt next-elt ] unit-test
+{ { 1 0 } } [ { 1 3 } doc get one-line-elt prev-elt ] unit-test
+{ { 1 14 } } [ { 1 3 } doc get one-line-elt next-elt ] unit-test
! page-elt
<document> doc set
Fifth line
Sixth line" doc get set-doc-string
-[ { 0 0 } ] [ { 3 3 } doc get 4 <page-elt> prev-elt ] unit-test
-[ { 1 2 } ] [ { 5 2 } doc get 4 <page-elt> prev-elt ] unit-test
+{ { 0 0 } } [ { 3 3 } doc get 4 <page-elt> prev-elt ] unit-test
+{ { 1 2 } } [ { 5 2 } doc get 4 <page-elt> prev-elt ] unit-test
-[ { 4 3 } ] [ { 0 3 } doc get 4 <page-elt> next-elt ] unit-test
-[ { 5 10 } ] [ { 4 2 } doc get 4 <page-elt> next-elt ] unit-test
+{ { 4 3 } } [ { 0 3 } doc get 4 <page-elt> next-elt ] unit-test
+{ { 5 10 } } [ { 4 2 } doc get 4 <page-elt> next-elt ] unit-test
! doc-elt
-[ { 0 0 } ] [ { 3 4 } doc get doc-elt prev-elt ] unit-test
-[ { 5 10 } ] [ { 3 4 } doc get doc-elt next-elt ] unit-test
+{ { 0 0 } } [ { 3 4 } doc get doc-elt prev-elt ] unit-test
+{ { 5 10 } } [ { 3 4 } doc get doc-elt next-elt ] unit-test
] with-threaded-server
] cleanup-unique-directory ; inline
-[ t ]
+{ t }
[
[
[
blah
;
-[ 25 ] [
+{ 25 } [
action-request-test-1 lf>crlf
[ read-request ] with-string-reader
init-request
blah
;
-[ 25 ] [
+{ 25 } [
action-request-test-2 lf>crlf
[ read-request ] with-string-reader
init-request
<users-in-memory> >>users
realm set
-[ t ] [
+{ t } [
"slava" <user>
"foobar" >>encoded-password
"slava@factorcode.org" >>email
username>> "slava" =
] unit-test
-[ f ] [
+{ f } [
"slava" <user>
H{ } clone >>profile
users new-user
] unit-test
-[ f ] [ "fdasf" "slava" check-login >boolean ] unit-test
+{ f } [ "fdasf" "slava" check-login >boolean ] unit-test
-[ ] [ "foobar" "slava" check-login "user" set ] unit-test
+{ } [ "foobar" "slava" check-login "user" set ] unit-test
-[ t ] [ "user" get >boolean ] unit-test
+{ t } [ "user" get >boolean ] unit-test
-[ ] [ "user" get "fdasf" >>encoded-password drop ] unit-test
+{ } [ "user" get "fdasf" >>encoded-password drop ] unit-test
-[ t ] [ "fdasf" "slava" check-login >boolean ] unit-test
+{ t } [ "fdasf" "slava" check-login >boolean ] unit-test
-[ f ] [ "foobar" "slava" check-login >boolean ] unit-test
+{ f } [ "foobar" "slava" check-login >boolean ] unit-test
USING: html.forms furnace.chloe-tags tools.test ;
IN: furnace.chloe-tags.tests
-[ f ] [ f parse-query-attr ] unit-test
+{ f } [ f parse-query-attr ] unit-test
-[ f ] [ "" parse-query-attr ] unit-test
+{ f } [ "" parse-query-attr ] unit-test
-[ H{ { "a" "b" } } ] [
+{ H{ { "a" "b" } } } [
begin-form
"b" "a" set-value
"a" parse-query-attr
] unit-test
-[ H{ { "a" "b" } { "c" "d" } } ] [
+{ H{ { "a" "b" } { "c" "d" } } } [
begin-form
"b" "a" set-value
"d" "c" set-value
[ ] [ close-game-input ] unit-test
] when
-[ f ] [ t t button-delta ] unit-test
-[ pressed ] [ f t button-delta ] unit-test
-[ released ] [ t f button-delta ] unit-test
+{ f } [ t t button-delta ] unit-test
+{ pressed } [ f t button-delta ] unit-test
+{ released } [ t f button-delta ] unit-test
-[ f ] [ 0.5 1.0 button-delta ] unit-test
-[ pressed ] [ f 0.7 button-delta ] unit-test
-[ released ] [ 0.2 f button-delta ] unit-test
+{ f } [ 0.5 1.0 button-delta ] unit-test
+{ pressed } [ f 0.7 button-delta ] unit-test
+{ released } [ 0.2 f button-delta ] unit-test
-[ { pressed f f released } ] [ { f t f t } { t t f f } buttons-delta ] unit-test
-[ V{ pressed f f released } ] [ { f t f t } { t t f f } V{ } buttons-delta-as ] unit-test
+{ { pressed f f released } } [ { f t f t } { t t f f } buttons-delta ] unit-test
+{ V{ pressed f f released } } [ { f t f t } { t t f f } V{ } buttons-delta-as ] unit-test
: please-stand-up ( set obj -- ? )
swap in? ;
-[ t ] [ will the-real-slim-shady please-stand-up ] unit-test
-[ t ] [ will clone the-real-slim-shady please-stand-up ] unit-test
+{ t } [ will the-real-slim-shady please-stand-up ] unit-test
+{ t } [ will clone the-real-slim-shady please-stand-up ] unit-test
-[ 2 ] [ will cardinality ] unit-test
-[ { "marshall mathers" } ] [
+{ 2 } [ will cardinality ] unit-test
+{ { "marshall mathers" } } [
the-real-slim-shady will clone
[ delete ] [ members ] bi
] unit-test
IN: hash-sets.sequences.tests
-[ t ] [ 0 4 "asdf" <slice> SHS{ "asdf" } in? ] unit-test
+{ t } [ 0 4 "asdf" <slice> SHS{ "asdf" } in? ] unit-test
-[ SHS{ "asdf" } ] [
+{ SHS{ "asdf" } } [
0 4 "asdf" <slice> SHS{ "asdf" } [ adjoin ] keep
] unit-test
-[ t ] [
+{ t } [
SHS{ } clone 0 4 "asdf" <slice> over adjoin
"asdf" swap in?
] unit-test
-[ { "asdf" } ] [ SHS{ "asdf" } members ] unit-test
+{ { "asdf" } } [ SHS{ "asdf" } members ] unit-test
: please-stand-up ( assoc key -- value )
of ;
-[ t ] [ will the-real-slim-shady please-stand-up ] unit-test
-[ t ] [ will clone the-real-slim-shady please-stand-up ] unit-test
+{ t } [ will the-real-slim-shady please-stand-up ] unit-test
+{ t } [ will clone the-real-slim-shady please-stand-up ] unit-test
-[ 2 ] [ will assoc-size ] unit-test
-[ { { "marshall mathers" f } } ] [
+{ 2 } [ will assoc-size ] unit-test
+{ { { "marshall mathers" f } } } [
the-real-slim-shady will clone
[ delete-at ] [ >alist ] bi
] unit-test
-[ t ] [
+{ t } [
t the-real-slim-shady identity-associate
t the-real-slim-shady identity-associate =
] unit-test
-[ f ] [
+{ f } [
t the-real-slim-shady identity-associate
t "marshall mathers" identity-associate =
] unit-test
IN: hashtables.sequences.tests
-[ 1000 ] [ 0 4 "asdf" <slice> SH{ { "asdf" 1000 } } at ] unit-test
+{ 1000 } [ 0 4 "asdf" <slice> SH{ { "asdf" 1000 } } at ] unit-test
-[ 1001 ] [
+{ 1001 } [
1001 0 4 "asdf" <slice> SH{ { "asdf" 1000 } }
[ set-at ] [ at ] 2bi
] unit-test
-[ 1001 ] [
+{ 1001 } [
SH{ } clone 1001 0 4 "asdf" <slice> pick set-at
"asdf" of
] unit-test
-[ { { "asdf" 1000 } } ] [ SH{ { "asdf" 1000 } } >alist ] unit-test
+{ { { "asdf" 1000 } } } [ SH{ { "asdf" 1000 } } >alist ] unit-test
USING: help.apropos tools.test ;
IN: help.apropos.tests
-[ ] [ "swp" apropos ] unit-test
+{ } [ "swp" apropos ] unit-test
help.syntax ;
IN: help.crossref.tests
-[ ] [
+{ } [
"IN: help.crossref.tests USING: help.syntax help.markup ; : foo ( -- ) ; HELP: foo \"foo is great\" ; ARTICLE: \"foo\" \"Foo\" { $subsection foo } ;" eval( -- )
] unit-test
-[ $subsection ] [
+{ $subsection } [
"foo" article-content first first
] unit-test
-[ t ] [
+{ t } [
"foo" article-children
"foo" "help.crossref.tests" lookup-word >link 1array sequence=
] unit-test
-[ "foo" ] [ "foo" "help.crossref.tests" lookup-word article-parent ] unit-test
+{ "foo" } [ "foo" "help.crossref.tests" lookup-word article-parent ] unit-test
-[ ] [
+{ } [
[ "foo" "help.crossref.tests" lookup-word forget ] with-compilation-unit
] unit-test
-[ ] [
+{ } [
"IN: help.crossref.tests USING: help.syntax help.markup ; : bar ( -- ) ; HELP: bar \"bar is great\" ; ARTICLE: \"bar\" \"Bar\" { $subsection bar } ;" eval( -- )
] unit-test
-[ ] [
+{ } [
"IN: ayy USE: help.syntax ARTICLE: \"b\" \"B\" ;"
<string-reader> "ayy" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: azz USE: help.syntax USE: help.markup ARTICLE: \"a\" \"A\" { $subsection \"b\" } ;"
<string-reader> "ayy" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: ayy USE: help.syntax ARTICLE: \"c\" \"C\" ;"
<string-reader> "ayy" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: azz USE: help.syntax USE: help.markup ARTICLE: \"a\" \"A\" { $subsection \"c\" } ;"
<string-reader> "ayy" parse-stream drop
] unit-test
-[ ] [
+{ } [
[
"IN: azz USE: help.syntax USE: help.markup ARTICLE: \"yyy\" \"YYY\" ; ARTICLE: \"xxx\" \"XXX\" { $subsection \"yyy\" } ; ARTICLE: \"yyy\" \"YYY\" ;"
<string-reader> "parent-test" parse-stream drop
] [ :1 ] recover
] unit-test
-[ "xxx" ] [ "yyy" article-parent ] unit-test
+{ "xxx" } [ "yyy" article-parent ] unit-test
ARTICLE: "crossref-test-1" "Crossref test 1"
"Hello world" ;
ARTICLE: "crossref-test-2" "Crossref test 2"
{ $markup-example { $subsection "crossref-test-1" } } ;
-[ { } ] [ "crossref-test-2" >link article-children ] unit-test
+{ { } } [ "crossref-test-2" >link article-children ] unit-test
assocs namespaces words io sequences eval accessors see ;
IN: help.definitions.tests
-[ ] [ \ + >link see ] unit-test
+{ } [ \ + >link see ] unit-test
[
[ 4 ] [
USING: help tools.test ;
IN: help.handbook.tests
-[ ] [ "article-index" print-topic ] unit-test
-[ ] [ "primitive-index" print-topic ] unit-test
-[ ] [ "error-index" print-topic ] unit-test
-[ ] [ "class-index" print-topic ] unit-test
+{ } [ "article-index" print-topic ] unit-test
+{ } [ "primitive-index" print-topic ] unit-test
+{ } [ "error-index" print-topic ] unit-test
+{ } [ "class-index" print-topic ] unit-test
math ;
IN: help.html.tests
-[ ] [ "xml" >link help>html drop ] unit-test
+{ } [ "xml" >link help>html drop ] unit-test
-[ ] [ "foobar" >link topic>filename drop ] unit-test
+{ } [ "foobar" >link topic>filename drop ] unit-test
-[ ] [ { "foo" "bar" } >link topic>filename drop ] unit-test
+{ } [ { "foo" "bar" } >link topic>filename drop ] unit-test
-[ ] [ \ + topic>filename drop ] unit-test
+{ } [ \ + topic>filename drop ] unit-test
-[ ] [ \ + >link topic>filename drop ] unit-test
+{ } [ \ + >link topic>filename drop ] unit-test
-[ ] [ "doesnotexist" >vocab-link topic>filename drop ] unit-test
+{ } [ "doesnotexist" >vocab-link topic>filename drop ] unit-test
-[ ] [ "kernel" lookup-vocab topic>filename drop ] unit-test
+{ } [ "kernel" lookup-vocab topic>filename drop ] unit-test
-[ ] [ "io" <vocab-tag> topic>filename drop ] unit-test
+{ } [ "io" <vocab-tag> topic>filename drop ] unit-test
-[ ] [ "Steve Jobs" <vocab-author> topic>filename drop ] unit-test
+{ } [ "Steve Jobs" <vocab-author> topic>filename drop ] unit-test
-[ ] [ f topic>filename drop ] unit-test
+{ } [ f topic>filename drop ] unit-test
-[ t ] [ all-vocabs-really [ vocab-spec? ] all? ] unit-test
+{ t } [ all-vocabs-really [ vocab-spec? ] all? ] unit-test
-[ t ] [ all-vocabs-really [ vocab-name "sequences.private" = ] any? ] unit-test
+{ t } [ all-vocabs-really [ vocab-name "sequences.private" = ] any? ] unit-test
-[ f ] [ all-vocabs-really [ vocab-name "scratchpad" = ] any? ] unit-test
+{ f } [ all-vocabs-really [ vocab-name "scratchpad" = ] any? ] unit-test
TUPLE: blahblah quux ;
-[ "int" ] [ [ { "int" } $instance ] with-markup-test ] unit-test
+{ "int" } [ [ { "int" } $instance ] with-markup-test ] unit-test
-[ ] [ \ quux>> print-topic ] unit-test
-[ ] [ \ >>quux print-topic ] unit-test
-[ ] [ \ blahblah? print-topic ] unit-test
+{ } [ \ quux>> print-topic ] unit-test
+{ } [ \ >>quux print-topic ] unit-test
+{ } [ \ blahblah? print-topic ] unit-test
: fooey ( -- * ) "fooey" throw ;
-[ ] [ \ fooey print-topic ] unit-test
+{ } [ \ fooey print-topic ] unit-test
-[ ] [ gensym print-topic ] unit-test
+{ } [ gensym print-topic ] unit-test
-[ "a string" ]
+{ "a string" }
[ [ { $or string } print-element ] with-markup-test ] unit-test
-[ "a string or an integer" ]
+{ "a string or an integer" }
[ [ { $or string integer } print-element ] with-markup-test ] unit-test
-[ "a string, a fixnum, or an integer" ]
+{ "a string, a fixnum, or an integer" }
[ [ { $or string fixnum integer } print-element ] with-markup-test ] unit-test
! Layout
-[ "span" ]
+{ "span" }
[ [ { "span" } print-content ] with-markup-test ] unit-test
-[ "span1span2" ]
+{ "span1span2" }
[ [ { "span1" "span2" } print-content ] with-markup-test ] unit-test
-[ "span1\n\nspan2" ]
+{ "span1\n\nspan2" }
[ [ { "span1" { $nl } "span2" } print-content ] with-markup-test ] unit-test
-[ "\nspan" ]
+{ "\nspan" }
[ [ { { $nl } "span" } print-content ] with-markup-test ] unit-test
-[ "2 2 +\nspan" ]
+{ "2 2 +\nspan" }
[ [ { { $code "2 2 +" } "span" } print-content ] with-markup-test ] unit-test
-[ "2 2 +" ]
+{ "2 2 +" }
[ [ { { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
-[ "span\n2 2 +" ]
+{ "span\n2 2 +" }
[ [ { "span" { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
-[ "\n2 2 +" ]
+{ "\n2 2 +" }
[ [ { { $nl } { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
-[ "span\n\n2 2 +" ]
+{ "span\n\n2 2 +" }
[ [ { "span" { $nl } { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
-[ "Heading" ]
+{ "Heading" }
[ [ { { $heading "Heading" } } print-content ] with-markup-test ] unit-test
-[ "Heading1\n\nHeading2" ]
+{ "Heading1\n\nHeading2" }
[ [ { { $heading "Heading1" } { $heading "Heading2" } } print-content ] with-markup-test ] unit-test
-[ "span\n\nHeading" ]
+{ "span\n\nHeading" }
[ [ { "span" { $heading "Heading" } } print-content ] with-markup-test ] unit-test
-[ "\nHeading" ]
+{ "\nHeading" }
[ [ { { $nl } { $heading "Heading" } } print-content ] with-markup-test ] unit-test
-[ "span\n\nHeading" ]
+{ "span\n\nHeading" }
[ [ { "span" { $nl } { $heading "Heading" } } print-content ] with-markup-test ] unit-test
: word-related-words ( word -- word related-words )
! Test help cross-referencing
-[ ] [ "Test B" { "Hello world." } <article> { "test" "b" } add-article ] unit-test
+{ } [ "Test B" { "Hello world." } <article> { "test" "b" } add-article ] unit-test
-[ ] [ "Test A" { { $subsection { "test" "b" } } } <article> { "test" "a" } add-article ] unit-test
+{ } [ "Test A" { { $subsection { "test" "b" } } } <article> { "test" "a" } add-article ] unit-test
SYMBOL: foo
-[ ] [ "Test A" { { $subsection foo } } <article> { "test" "a" } add-article ] unit-test
+{ } [ "Test A" { { $subsection foo } } <article> { "test" "a" } add-article ] unit-test
! Test article location recording
-[ ] [
+{ } [
{
"USE: help.syntax"
"ARTICLE: { \"test\" 1 } \"Hello\""
] with-scope
] unit-test
-[ { "testfile" 2 } ]
+{ { "testfile" 2 } }
[ { "test" 1 } articles get at loc>> ] unit-test
-[ ] [ { "test" 1 } remove-article ] unit-test
+{ } [ { "test" 1 } remove-article ] unit-test
USING: help.vocabs tools.test help.markup help vocabs io ;
IN: help.vocabs.tests
-[ ] [ { $vocab "scratchpad" } print-content ] unit-test
-[ ] [ "classes" lookup-vocab print-topic ] unit-test
-[ ] [ nl ] unit-test
+{ } [ { $vocab "scratchpad" } print-content ] unit-test
+{ } [ "classes" lookup-vocab print-topic ] unit-test
+{ } [ nl ] unit-test
FROM: html.components => inspector ;
IN: html.components.tests
-[ ] [ begin-form ] unit-test
+{ } [ begin-form ] unit-test
-[ ] [ 3 "hi" set-value ] unit-test
+{ } [ 3 "hi" set-value ] unit-test
-[ 3 ] [ "hi" value ] unit-test
+{ 3 } [ "hi" value ] unit-test
TUPLE: color red green blue ;
-[ ] [ 1 2 3 color boa from-object ] unit-test
+{ } [ 1 2 3 color boa from-object ] unit-test
-[ 1 ] [ "red" value ] unit-test
+{ 1 } [ "red" value ] unit-test
-[ ] [ "jimmy" "red" set-value ] unit-test
+{ } [ "jimmy" "red" set-value ] unit-test
-[ "jimmy" ] [
+{ "jimmy" } [
[
"red" label render
] with-string-writer
] unit-test
-[ ] [ "<jimmy>" "red" set-value ] unit-test
+{ } [ "<jimmy>" "red" set-value ] unit-test
-[ "<jimmy>" ] [
+{ "<jimmy>" } [
[
"red" label render
] with-string-writer
] unit-test
-[ "<input value=\"<jimmy>\" name=\"red\" type=\"hidden\"/>" ] [
+{ "<input value=\"<jimmy>\" name=\"red\" type=\"hidden\"/>" } [
[
"red" hidden render
] with-string-writer
] unit-test
-[ "<input value=\"<jimmy>\" name=\"red\" type=\"hidden\"/>" ] [
+{ "<input value=\"<jimmy>\" name=\"red\" type=\"hidden\"/>" } [
[
"red" hidden render
] with-string-writer
] unit-test
-[ ] [ "'jimmy'" "red" set-value ] unit-test
+{ } [ "'jimmy'" "red" set-value ] unit-test
-[ "<input value=\"'jimmy'\" name=\"red\" size=\"5\" type=\"text\"/>" ] [
+{ "<input value=\"'jimmy'\" name=\"red\" size=\"5\" type=\"text\"/>" } [
[
"red" <field> 5 >>size render
] with-string-writer
] unit-test
-[ "<input value=\"\" name=\"red\" size=\"5\" type=\"password\"/>" ] [
+{ "<input value=\"\" name=\"red\" size=\"5\" type=\"password\"/>" } [
[
"red" <password> 5 >>size render
] with-string-writer
] unit-test
-[ ] [
+{ } [
[
"green" <textarea> render
] with-null-writer
] unit-test
-[ ] [
+{ } [
[
"green" <textarea> 25 >>rows 30 >>cols render
] with-null-writer
] unit-test
-[ ] [ begin-form ] unit-test
+{ } [ begin-form ] unit-test
-[ ] [ "new york" "city1" set-value ] unit-test
+{ } [ "new york" "city1" set-value ] unit-test
-[ ] [ { "new york" "los angeles" "chicago" } "cities" set-value ] unit-test
+{ } [ { "new york" "los angeles" "chicago" } "cities" set-value ] unit-test
-[ ] [
+{ } [
[
"city1"
<choice>
] with-null-writer
] unit-test
-[ ] [ { "los angeles" "new york" } "city2" set-value ] unit-test
+{ } [ { "los angeles" "new york" } "city2" set-value ] unit-test
-[ ] [
+{ } [
[
"city2"
<choice>
] with-null-writer
] unit-test
-[ ] [
+{ } [
[
"city2"
<choice>
] with-null-writer
] unit-test
-[ ] [ begin-form ] unit-test
+{ } [ begin-form ] unit-test
-[ ] [ t "delivery" set-value ] unit-test
+{ } [ t "delivery" set-value ] unit-test
-[ "<input type=\"checkbox\" checked=\"true\" name=\"delivery\">Delivery</input>" ] [
+{ "<input type=\"checkbox\" checked=\"true\" name=\"delivery\">Delivery</input>" } [
[
"delivery"
<checkbox>
] with-string-writer
] unit-test
-[ ] [ f "delivery" set-value ] unit-test
+{ } [ f "delivery" set-value ] unit-test
-[ "<input type=\"checkbox\" name=\"delivery\">Delivery</input>" ] [
+{ "<input type=\"checkbox\" name=\"delivery\">Delivery</input>" } [
[
"delivery"
<checkbox>
M: link-test link-href drop "http://www.apple.com/foo&bar" ;
-[ ] [ link-test "link" set-value ] unit-test
+{ } [ link-test "link" set-value ] unit-test
-[ "<a href=\"http://www.apple.com/foo&bar\"><Link Title></a>" ] [
+{ "<a href=\"http://www.apple.com/foo&bar\"><Link Title></a>" } [
[ "link" link new render ] with-string-writer
] unit-test
-[ ] [
+{ } [
"<html>arbitrary <b>markup</b> for the win!</html>" "html" set-value
] unit-test
-[ "<html>arbitrary <b>markup</b> for the win!</html>" ] [
+{ "<html>arbitrary <b>markup</b> for the win!</html>" } [
[ "html" html render ] with-string-writer
] unit-test
-[ ] [ "int x = 4;" "code" set-value ] unit-test
+{ } [ "int x = 4;" "code" set-value ] unit-test
-[ ] [ "java" "mode" set-value ] unit-test
+{ } [ "java" "mode" set-value ] unit-test
-[ "<span class=\"KEYWORD3\">int</span> x <span class=\"OPERATOR\">=</span> <span class=\"DIGIT\">4</span>;" ] [
+{ "<span class=\"KEYWORD3\">int</span> x <span class=\"OPERATOR\">=</span> <span class=\"DIGIT\">4</span>;" } [
[ "code" <code> "mode" >>mode render ] with-string-writer
] unit-test
-[ ] [ "-foo\n-bar" "farkup" set-value ] unit-test
+{ } [ "-foo\n-bar" "farkup" set-value ] unit-test
-[ "<ul><li>foo</li><li>bar</li></ul>" ] [
+{ "<ul><li>foo</li><li>bar</li></ul>" } [
[ "farkup" T{ farkup } render ] with-string-writer
] unit-test
-[ ] [ { 1 2 3 } "object" set-value ] unit-test
+{ } [ { 1 2 3 } "object" set-value ] unit-test
-[ t ] [
+{ t } [
[ "object" inspector render ] with-string-writer
"object" value [ describe ] with-html-writer xml>string
=
] unit-test
-[ ] [ begin-form ] unit-test
+{ } [ begin-form ] unit-test
-[ ] [
+{ } [
"factor" [
"concatenative" "model" set-value
] nest-form
] unit-test
-[
+{
H{
{
"factor"
T{ form f V{ } H{ { "model" "concatenative" } } }
}
}
-] [ values ] unit-test
+} [ values ] unit-test
-[ ] [ "error" "blah" <validation-error-state> "error" set-value ] unit-test
+{ } [ "error" "blah" <validation-error-state> "error" set-value ] unit-test
-[ ] [
+{ } [
"error" hidden render
] unit-test
! Test xml in html components
-[ ] [
+{ } [
[XML <foo/> XML] "xmltest" set-value
] unit-test
-[ "<foo/>" ] [
+{ "<foo/>" } [
[
"xmltest" html render
] with-string-writer
call
] with-scope ; inline
-[ 14 ] [
+{ 14 } [
[
"14" [ v-number 13 v-min-value 100 v-max-value ] validate
] with-validation
] unit-test
-[ t ] [
+{ t } [
[
"140" [ v-number 13 v-min-value 100 v-max-value ] validate
[ validation-error-state? ]
{ "age" [ v-number 13 v-min-value 100 v-max-value ] }
} define-validators
-[ t t ] [
+{ t t } [
[
{ { "age" "" } }
{ { "age" [ v-required ] } }
] with-validation
] unit-test
-[ H{ { "a" 123 } } f ] [
+{ H{ { "a" 123 } } f } [
[
H{
{ "a" "123" }
] with-validation
] unit-test
-[ t "foo" ] [
+{ t "foo" } [
[
"foo" validation-error
validation-failed?
[ [ ] make-html-string ] must-infer
-[ "" ] [
+{ "" } [
[ "" write ] make-html-string
] unit-test
-[ "a" ] [
+{ "a" } [
[ CHAR: a write1 ] make-html-string
] unit-test
-[ "<" ] [
+{ "<" } [
[ "<" write ] make-html-string
] unit-test
M: funky url-of "http://www.funky-town.com/" swap town>> append ;
-[ "<a href=\"http://www.funky-town.com/austin\"><</a>" ] [
+{ "<a href=\"http://www.funky-town.com/austin\"><</a>" } [
[
"<" "austin" funky boa write-object
] make-html-string
] unit-test
-[ "<span style=\"font-family: monospace; \">car</span>" ]
+{ "<span style=\"font-family: monospace; \">car</span>" }
[
[
"car"
] make-html-string
] unit-test
-[ "<span style=\"color: #ff00ff; \">car</span>" ]
+{ "<span style=\"color: #ff00ff; \">car</span>" }
[
[
"car"
] make-html-string
] unit-test
-[ "<div style=\"background-color: #ff00ff; white-space: pre; font-family: monospace; display: inline-block;\">cdr</div>" ]
+{ "<div style=\"background-color: #ff00ff; white-space: pre; font-family: monospace; display: inline-block;\">cdr</div>" }
[
[
H{ { page-color T{ rgba f 1 0 1 1 } } }
] make-html-string
] unit-test
-[ "<div style=\"white-space: pre; font-family: monospace; display: inline-block;\"></div><br/>" ] [
+{ "<div style=\"white-space: pre; font-family: monospace; display: inline-block;\"></div><br/>" } [
[ H{ } [ ] with-nesting nl ] make-html-string
] unit-test
-[ ] [ [ { 1 2 3 } describe ] with-html-writer drop ] unit-test
+{ } [ [ { 1 2 3 } describe ] with-html-writer drop ] unit-test
-[ "<img src=\"/icons/class-word.tiff\"/>" ] [
+{ "<img src=\"/icons/class-word.tiff\"/>" } [
[
"text"
{ { image "vocab:definitions/icons/class-word.tiff" } }
IN: html.templates.chloe.tests
! So that changes to code are reflected
-[ ] [ reset-cache ] unit-test
+{ } [ reset-cache ] unit-test
: run-template ( quot -- string )
with-string-writer [ "\r\n\t" member? ] reject
"vocab:html/templates/chloe/test/"
prepend <chloe> ;
-[ "Hello world" ] [
+{ "Hello world" } [
[
"test1" test-template call-template
] run-template
] unit-test
-[ "Blah blah" "Hello world" ] [
+{ "Blah blah" "Hello world" } [
[
<box> title set
[
] with-scope
] unit-test
-[ "<html><head><title>Hello world</title></head><body>Blah blah</body></html>" ] [
+{ "<html><head><title>Hello world</title></head><body>Blah blah</body></html>" } [
[
[
"test2" test-template call-template
: test4-aux? ( -- ? ) t ;
-[ "True" ] [
+{ "True" } [
[
"test4" test-template call-template
] run-template
: test5-aux? ( -- ? ) f ;
-[ "" ] [
+{ "" } [
[
"test5" test-template call-template
] run-template
] unit-test
-[ ] [ begin-form ] unit-test
+{ } [ begin-form ] unit-test
-[ ] [ "A label" "label" set-value ] unit-test
+{ } [ "A label" "label" set-value ] unit-test
SINGLETON: link-test
M: link-test link-href drop "http://www.apple.com/foo&bar" ;
-[ ] [ link-test "link" set-value ] unit-test
+{ } [ link-test "link" set-value ] unit-test
-[ ] [ "int x = 5;" "code" set-value ] unit-test
+{ } [ "int x = 5;" "code" set-value ] unit-test
-[ ] [ "c" "mode" set-value ] unit-test
+{ } [ "c" "mode" set-value ] unit-test
-[ ] [ { 1 2 3 } "inspector" set-value ] unit-test
+{ } [ { 1 2 3 } "inspector" set-value ] unit-test
-[ ] [ "<p>a paragraph</p>" "html" set-value ] unit-test
+{ } [ "<p>a paragraph</p>" "html" set-value ] unit-test
-[ ] [ "sheeple" "field" set-value ] unit-test
+{ } [ "sheeple" "field" set-value ] unit-test
-[ ] [ "a password" "password" set-value ] unit-test
+{ } [ "a password" "password" set-value ] unit-test
-[ ] [ "a\nb\nc" "textarea" set-value ] unit-test
+{ } [ "a\nb\nc" "textarea" set-value ] unit-test
-[ ] [ "new york" "choice" set-value ] unit-test
+{ } [ "new york" "choice" set-value ] unit-test
-[ ] [ { "new york" "detroit" "minneapolis" } "choices" set-value ] unit-test
+{ } [ { "new york" "detroit" "minneapolis" } "choices" set-value ] unit-test
-[ ] [
+{ } [
[
"test8" test-template call-template
] run-template drop
] unit-test
-[ ] [ { 1 2 3 } "numbers" set-value ] unit-test
+{ } [ { 1 2 3 } "numbers" set-value ] unit-test
-[ "<ul><li>1</li><li>2</li><li>3</li></ul>" ] [
+{ "<ul><li>1</li><li>2</li><li>3</li></ul>" } [
[
"test7" test-template call-template
] run-template [ blank? ] reject
TUPLE: person first-name last-name ;
-[ ] [
+{ } [
{
T{ person f "RBaxter" "Unknown" }
T{ person f "Doug" "Coleman" }
} "people" set-value
] unit-test
-[ "<table><tr><td>RBaxter</td><td>Unknown</td></tr><tr><td>Doug</td><td>Coleman</td></tr></table>" ] [
+{ "<table><tr><td>RBaxter</td><td>Unknown</td></tr><tr><td>Doug</td><td>Coleman</td></tr></table>" } [
[
"test8" test-template call-template
] run-template [ blank? ] reject
] unit-test
-[ ] [
+{ } [
{
H{ { "first-name" "RBaxter" } { "last-name" "Unknown" } }
H{ { "first-name" "Doug" } { "last-name" "Coleman" } }
} "people" set-value
] unit-test
-[ "<table><tr><td>RBaxter</td><td>Unknown</td></tr><tr><td>Doug</td><td>Coleman</td></tr></table>" ] [
+{ "<table><tr><td>RBaxter</td><td>Unknown</td></tr><tr><td>Doug</td><td>Coleman</td></tr></table>" } [
[
"test8" test-template call-template
] run-template [ blank? ] reject
] unit-test
-[ ] [ 1 "id" set-value ] unit-test
+{ } [ 1 "id" set-value ] unit-test
-[ "<a name=\"1\">Hello</a>" ] [
+{ "<a name=\"1\">Hello</a>" } [
[
"test9" test-template call-template
] run-template
] unit-test
-[ ] [ H{ { "a" H{ { "b" "c" } } } } values set ] unit-test
+{ } [ H{ { "a" H{ { "b" "c" } } } } values set ] unit-test
-[ "<form method=\"post\" action=\"foo\"><div style=\"display: none;\"><input type=\"hidden\" value=\"a\" name=\"__n\"/></div></form>" ] [
+{ "<form method=\"post\" action=\"foo\"><div style=\"display: none;\"><input type=\"hidden\" value=\"a\" name=\"__n\"/></div></form>" } [
[
"test10" test-template call-template
] run-template
] unit-test
-[ ] [ begin-form ] unit-test
+{ } [ begin-form ] unit-test
-[ ] [
+{ } [
<form> H{ { "first-name" "RBaxter" } { "last-name" "Unknown" } } >>values "person" set-value
] unit-test
-[ "<table><tr><td>RBaxter</td><td>Unknown</td></tr></table>" ] [
+{ "<table><tr><td>RBaxter</td><td>Unknown</td></tr></table>" } [
[
"test11" test-template call-template
] run-template [ blank? ] reject
] unit-test
-[ ] [
+{ } [
begin-form
{ "a" "b" } "choices" set-value
"true" "b" set-value
] unit-test
-[ "<input type=\"checkbox\" name=\"a\">a</input><input type=\"checkbox\" checked=\"true\" name=\"b\">b</input>" ] [
+{ "<input type=\"checkbox\" name=\"a\">a</input><input type=\"checkbox\" checked=\"true\" name=\"b\">b</input>" } [
[
"test12" test-template call-template
] run-template
] run-template
] [ error>> T{ unknown-chloe-tag f "this-tag-does-not-exist" } = ] must-fail-with
-[ "Hello <world> &escaping test;" "Hello <world> &escaping test;" ] [
+{ "Hello <world> &escaping test;" "Hello <world> &escaping test;" } [
[
<box> title set
[
[ ".html" append utf8 file-contents ] bi
[ . . ] [ = ] 2bi ;
-[ t ] [ "example" test-template ] unit-test
-[ t ] [ "bug" test-template ] unit-test
-[ t ] [ "stack" test-template ] unit-test
+{ t } [ "example" test-template ] unit-test
+{ t } [ "bug" test-template ] unit-test
+{ t } [ "stack" test-template ] unit-test
[
[ ] [ "<%\n%>" parse-template drop ] unit-test
io.streams.string kernel namespaces sequences tools.test urls ;
IN: http.client.tests
-[ "localhost" f ] [ "localhost" parse-host ] unit-test
-[ "localhost" 8888 ] [ "localhost:8888" parse-host ] unit-test
+{ "localhost" f } [ "localhost" parse-host ] unit-test
+{ "localhost" 8888 } [ "localhost:8888" parse-host ] unit-test
-[ "foo.txt" ] [ "http://www.paulgraham.com/foo.txt" download-name ] unit-test
-[ "foo.txt" ] [ "http://www.arc.com/foo.txt?xxx" download-name ] unit-test
-[ "foo.txt" ] [ "http://www.arc.com/foo.txt/" download-name ] unit-test
-[ "www.arc.com" ] [ "http://www.arc.com////" download-name ] unit-test
+{ "foo.txt" } [ "http://www.paulgraham.com/foo.txt" download-name ] unit-test
+{ "foo.txt" } [ "http://www.arc.com/foo.txt?xxx" download-name ] unit-test
+{ "foo.txt" } [ "http://www.arc.com/foo.txt/" download-name ] unit-test
+{ "www.arc.com" } [ "http://www.arc.com////" download-name ] unit-test
-[
+{
T{ request
{ url T{ url { protocol "http" } { host "www.apple.com" } { port 80 } { path "/index.html" } } }
{ method "GET" }
{ header H{ { "connection" "close" } { "user-agent" "Factor http.client" } } }
{ redirects 10 }
}
-] [
+} [
"http://www.apple.com/index.html"
<get-request>
] unit-test
-[
+{
T{ request
{ url T{ url { protocol "https" } { host "www.amazon.com" } { port 443 } { path "/index.html" } } }
{ method "GET" }
{ header H{ { "connection" "close" } { "user-agent" "Factor http.client" } } }
{ redirects 10 }
}
-] [
+} [
"https://www.amazon.com/index.html"
<get-request>
] unit-test
-[ "HEAD" ] [ "http://google.com" <head-request> method>> ] unit-test
-[ "DELETE" ] [ "http://arc.com" <delete-request> method>> ] unit-test
-[ "TRACE" ] [ "http://concatenative.org" <trace-request> method>> ] unit-test
-[ "OPTIONS" ] [ "http://factorcode.org" <options-request> method>> ] unit-test
+{ "HEAD" } [ "http://google.com" <head-request> method>> ] unit-test
+{ "DELETE" } [ "http://arc.com" <delete-request> method>> ] unit-test
+{ "TRACE" } [ "http://concatenative.org" <trace-request> method>> ] unit-test
+{ "OPTIONS" } [ "http://factorcode.org" <options-request> method>> ] unit-test
-[ t ] [
+{ t } [
{
"HTTP/1.1 200 Document follows"
"connection: close"
USING: http http.parsers tools.test ;
IN: http.parsers.tests
-[ { } ] [ "" parse-cookie ] unit-test
-[ { } ] [ "" parse-set-cookie ] unit-test
+{ { } } [ "" parse-cookie ] unit-test
+{ { } } [ "" parse-set-cookie ] unit-test
! Make sure that totally invalid cookies don't confuse us
-[ { } ] [ "hello world; how are you" parse-cookie ] unit-test
+{ { } } [ "hello world; how are you" parse-cookie ] unit-test
-[ { T{ cookie { name "__s" } { value "12345567" } } } ]
+{ { T{ cookie { name "__s" } { value "12345567" } } } }
[ "__s=12345567" parse-cookie ]
unit-test
-[ { T{ cookie { name "CaseSensitive" } { value "aBc" } } } ]
+{ { T{ cookie { name "CaseSensitive" } { value "aBc" } } } }
[ "CaseSensitive=aBc" parse-cookie ]
unit-test
-[ { T{ cookie { name "__s" } { value "12345567" } } } ]
+{ { T{ cookie { name "__s" } { value "12345567" } } } }
[ "__s=12345567;" parse-cookie ]
unit-test
drop
>array "text/plain" <content> ;
-[ { "c" } ] [
+{ { "c" } } [
V{ } clone responder-nesting set
{ "b" "c" }
] unit-test
! Test that "" dispatcher works with default>>
-[ ] [
+{ } [
<dispatcher>
"" <mock-responder> "" add-responder
"bar" <mock-responder> "bar" add-responder
! line(s) received where a Request-Line is expected. In other words, if
! the server is reading the protocol stream at the beginning of a
! message and receives a CRLF first, it should ignore the CRLF.
-[
+{
T{ request
{ method "GET" }
{ url URL" /" }
{ cookies V{ } }
{ redirects 10 }
}
-] [
+} [
"\r\n\r\n\r\nGET / HTTP/1.0\r\n\r\n" [ read-request ] with-string-reader
] unit-test
! The line terminator for message-header fields is the sequence CRLF.
! However, we recommend that applications, when parsing such headers,
! recognize a single LF as a line terminator and ignore the leading CR.
-[ t ] [
+{ t } [
{
"GET / HTTP/1.1"
"connection: close"
"rewritten-param" >>param
"rewrite" set
-[ { { } "DEFAULT!" } ] [ { } "rewrite" get call-responder ] unit-test
-[ { { } "xxx" } ] [ { "xxx" } "rewrite" get call-responder ] unit-test
-[ { { "blah" } "xxx" } ] [ { "xxx" "blah" } "rewrite" get call-responder ] unit-test
+{ { { } "DEFAULT!" } } [ { } "rewrite" get call-responder ] unit-test
+{ { { } "xxx" } } [ { "xxx" } "rewrite" get call-responder ] unit-test
+{ { { "blah" } "xxx" } } [ { "xxx" "blah" } "rewrite" get call-responder ] unit-test
<vhost-rewrite>
rewrite-test-child new >>child
"blogs.vegan.net" >>suffix
"rewrite" set
-[ { { } "DEFAULT!" } ] [
+{ { { } "DEFAULT!" } } [
URL" http://blogs.vegan.net" url set
{ } "rewrite" get call-responder
] unit-test
-[ { { } "DEFAULT!" } ] [
+{ { { } "DEFAULT!" } } [
URL" http://www.blogs.vegan.net" url set
{ } "rewrite" get call-responder
] unit-test
-[ { { } "erg" } ] [
+{ { { } "erg" } } [
URL" http://erg.blogs.vegan.net" url set
{ } "rewrite" get call-responder
] unit-test
kernel math peg sequences tools.test urls ;
IN: http.server.tests
-[ t ] [ [ \ + first ] [ <500> ] recover response? ] unit-test
+{ t } [ [ \ + first ] [ <500> ] recover response? ] unit-test
-[ "text/plain; charset=ASCII" ] [
+{ "text/plain; charset=ASCII" } [
<response>
"text/plain" >>content-type
"ASCII" >>content-charset
unparse-content-type
] unit-test
-[ "text/xml; charset=UTF-8" ] [
+{ "text/xml; charset=UTF-8" } [
<response>
"text/xml" >>content-type
unparse-content-type
] unit-test
-[ "image/jpeg" ] [
+{ "image/jpeg" } [
<response>
"image/jpeg" >>content-type
unparse-content-type
] unit-test
-[ "application/octet-stream" ] [
+{ "application/octet-stream" } [
<response>
unparse-content-type
] unit-test
! The line terminator for message-header fields is the sequence CRLF.
! However, we recommend that applications, when parsing such headers,
! recognize a single LF as a line terminator and ignore the leading CR.
-[ t ] [
+{ t } [
{
"GET / HTTP/1.1"
"connection: close"
! line(s) received where a Request-Line is expected. In other words, if
! the server is reading the protocol stream at the beginning of a
! message and receives a CRLF first, it should ignore the CRLF.
-[
+{
T{ request
{ method "GET" }
{ url URL" /" }
{ cookies V{ } }
{ redirects 10 }
}
-] [
+} [
"\r\n\r\n\r\nGET / HTTP/1.0\r\n\r\n"
[ read-request ] with-string-reader
] unit-test
! RFC 1945; Section 4.1
! Implement a version of Simple-Request, although rather than
! parse version 0.9, we parse 1.0 to return a Full-Response.
-[
+{
T{ request
{ method "GET" }
{ url URL" /" }
{ cookies V{ } }
{ redirects 10 }
}
-] [
+} [
"\r\n\r\n\r\nGET /\r\n\r\n"
[ read-request ] with-string-reader
] unit-test
USING: http.server.static tools.test xml.writer ;
IN: http.server.static.tests
-[ ] [ "resource:basis" directory>html write-xml ] unit-test
+{ } [ "resource:basis" directory>html write-xml ] unit-test
: open-png-image ( -- image )
"vocab:images/testing/png/basi0g01.png" load-image ;
-[ t ] [
+{ t } [
open-png-image [ dim>> ] [
image>GdkPixbuf &g_object_unref
[ gdk_pixbuf_get_width ] [ gdk_pixbuf_get_height ] bi 2array
] bi =
] unit-test
-[ t ] [
+{ t } [
[
open-png-image image>GdkPixbuf &g_object_unref
"frob" GdkPixbuf>byte-array
! 1>x
-[ B{ 255 255 } ]
+{ B{ 255 255 } }
[ B{ 0 1 } 2 2 A L permute ] unit-test
-[ B{ 255 255 255 255 } ]
+{ B{ 255 255 255 255 } }
[ B{ 0 1 } 2 2 A RG permute ] unit-test
-[ B{ 255 255 255 255 255 255 } ]
+{ B{ 255 255 255 255 255 255 } }
[ B{ 0 1 } 2 2 A BGR permute ] unit-test
-[ B{ 0 255 255 255 1 255 255 255 } ]
+{ B{ 0 255 255 255 1 255 255 255 } }
[ B{ 0 1 } 2 2 A ABGR permute ] unit-test
! Difference stride
! The last byte is padding, so it should not end up in the image
-[ B{ 255 255 } ]
+{ B{ 255 255 } }
[ B{ 0 1 0 } 2 3 A L permute ] unit-test
-[ B{ 255 255 255 255 } ]
+{ B{ 255 255 255 255 } }
[ B{ 0 1 0 } 2 3 A RG permute ] unit-test
-[ B{ 255 255 255 255 255 255 } ]
+{ B{ 255 255 255 255 255 255 } }
[ B{ 0 1 0 } 2 3 A BGR permute ] unit-test
-[ B{ 0 255 255 255 1 255 255 255 } ]
+{ B{ 0 255 255 255 1 255 255 255 } }
[ B{ 0 1 0 } 2 3 A ABGR permute ] unit-test
! 2>x
-[ B{ 0 2 } ]
+{ B{ 0 2 } }
[ B{ 0 1 2 3 } 2 4 LA L permute ] unit-test
-[ B{ 255 255 255 255 } ]
+{ B{ 255 255 255 255 } }
[ B{ 0 1 2 3 } 2 4 LA RG permute ] unit-test
-[ B{ 255 255 255 255 255 255 } ]
+{ B{ 255 255 255 255 255 255 } }
[ B{ 0 1 2 3 } 2 4 LA BGR permute ] unit-test
-[ B{ 1 255 255 255 3 255 255 255 } ]
+{ B{ 1 255 255 255 3 255 255 255 } }
[ B{ 0 1 2 3 } 2 4 LA ABGR permute ] unit-test
! 3>x
-[ B{ 255 255 } ]
+{ B{ 255 255 } }
[ B{ 0 1 2 3 4 5 } 2 6 RGB L permute ] unit-test
-[ B{ 0 1 3 4 } ]
+{ B{ 0 1 3 4 } }
[ B{ 0 1 2 3 4 5 } 2 6 RGB RG permute ] unit-test
-[ B{ 2 1 0 5 4 3 } ]
+{ B{ 2 1 0 5 4 3 } }
[ B{ 0 1 2 3 4 5 } 2 6 RGB BGR permute ] unit-test
-[ B{ 255 2 1 0 255 5 4 3 } ]
+{ B{ 255 2 1 0 255 5 4 3 } }
[ B{ 0 1 2 3 4 5 } 2 6 RGB ABGR permute ] unit-test
! 4>x
-[ B{ 255 255 } ]
+{ B{ 255 255 } }
[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA L permute ] unit-test
-[ B{ 0 1 4 5 } ]
+{ B{ 0 1 4 5 } }
[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA RG permute ] unit-test
-[ B{ 2 1 0 6 5 4 } ]
+{ B{ 2 1 0 6 5 4 } }
[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA BGR permute ] unit-test
-[ B{ 3 2 1 0 7 6 5 4 } ]
+{ B{ 3 2 1 0 7 6 5 4 } }
[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA ABGR permute ] unit-test
! Edge cases
-[ B{ 0 4 } ]
+{ B{ 0 4 } }
[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA R permute ] unit-test
-[ B{ 255 0 1 2 255 4 5 6 } ]
+{ B{ 255 0 1 2 255 4 5 6 } }
[ B{ 0 1 2 3 4 5 6 7 } 2 8 RGBA XRGB permute ] unit-test
-[ B{ 1 2 3 255 5 6 7 255 } ]
+{ B{ 1 2 3 255 5 6 7 255 } }
[ B{ 0 1 2 3 4 5 6 7 } 2 8 XRGB RGBA permute ] unit-test
-[ B{ 255 255 255 255 255 255 255 255 } ]
+{ B{ 255 255 255 255 255 255 255 255 } }
[ B{ 0 1 } 2 2 L RGBA permute ] unit-test
! Invalid inputs
IN: images.tessellation
! Check an invariant we depend on
-[ t ] [
+{ t } [
<image> B{ 1 2 3 } >>bitmap dup clone [ bitmap>> ] bi@ eq?
] unit-test
-[
+{
{
{
T{ image f { 2 2 } L ubyte-components f f B{ 1 2 5 6 } }
T{ image f { 2 2 } L ubyte-components f f B{ 11 12 15 16 } }
}
}
-] [
+} [
<image>
1 16 [a,b] >byte-array >>bitmap
{ 4 4 } >>dim
{ 2 2 } tesselate
] unit-test
-[
+{
{
{
T{ image f { 2 2 } L ubyte-components f f B{ 1 2 4 5 } }
T{ image f { 1 1 } L ubyte-components f f B{ 9 } }
}
}
-] [
+} [
<image>
1 9 [a,b] >byte-array >>bitmap
{ 3 3 } >>dim
yield
-[ { "Hello world" "FOO" } ] [
+{ { "Hello world" "FOO" } } [
[
socket-server <local> ascii [
readln ,
[ datagram-client delete-file ] ignore-errors
-[ ] [ datagram-client <local> <datagram> "d" set ] unit-test
+{ } [ datagram-client <local> <datagram> "d" set ] unit-test
-[ ] [
+{ } [
"hello" >byte-array
datagram-server <local>
"d" get send
] unit-test
-[ "olleh" t ] [
+{ "olleh" t } [
"d" get receive
datagram-server <local> =
[ >string ] dip
] unit-test
-[ ] [
+{ } [
"hello" >byte-array
datagram-server <local>
"d" get send
] unit-test
-[ "hello world" t ] [
+{ "hello world" t } [
"d" get receive
datagram-server <local> =
[ >string ] dip
] unit-test
-[ ] [ "d" get dispose ] unit-test
+{ } [ "d" get dispose ] unit-test
! Test error behavior
: another-datagram ( -- path ) "unix-domain-datagram-test-3" temp-file ;
datagram-client delete-file
-[ ] [ datagram-client <local> <datagram> "d" set ] unit-test
+{ } [ datagram-client <local> <datagram> "d" set ] unit-test
[ B{ 1 2 3 } another-datagram <local> "d" get send ] must-fail
-[ ] [ "d" get dispose ] unit-test
+{ } [ "d" get dispose ] unit-test
! See what happens on send/receive after close
] must-fail
! closing stdin caused some problems
-[ ] [
+{ } [
[
vm ,
"-i=" image append ,
: buffer-read-all ( buffer -- byte-array )
[ buffer@ ] [ buffer-length ] bi memory>byte-array ;
-[ B{ } 65536 ] [
+{ B{ } 65536 } [
65536 <buffer>
dup buffer-read-all
over buffer-capacity
rot dispose
] unit-test
-[ "hello world" "" ] [
+{ "hello world" "" } [
"hello world" string>buffer
dup buffer-read-all >string
0 pick buffer-reset
rot dispose
] unit-test
-[ "hello" ] [
+{ "hello" } [
"hello world" string>buffer
5 over buffer-read >string swap dispose
] unit-test
-[ 11 ] [
+{ 11 } [
"hello world" string>buffer
[ buffer-length ] keep dispose
] unit-test
-[ "hello world" ] [
+{ "hello world" } [
"hello" 1024 <buffer> [ buffer-set ] keep
" world" >byte-array binary-object pick buffer-write
dup buffer-read-all >string swap dispose
] unit-test
-[ CHAR: e ] [
+{ CHAR: e } [
"hello" string>buffer
1 over buffer-consume [ buffer-pop ] keep dispose
] unit-test
"hello world" string>buffer "b" set
-[ "hello world" ] [ 1000 "b" get buffer-read >string ] unit-test
+{ "hello world" } [ 1000 "b" get buffer-read >string ] unit-test
"b" get dispose
100 <buffer> "b" set
"b" get dispose
"hello world" string>buffer "b" set
-[ "hello" CHAR: \s ] [ " " "b" get buffer-read-until [ >string ] dip ] unit-test
+{ "hello" CHAR: \s } [ " " "b" get buffer-read-until [ >string ] dip ] unit-test
"b" get dispose
-[ 4 B{ 1 2 3 4 0 0 0 0 0 0 } ] [
+{ 4 B{ 1 2 3 4 0 0 0 0 0 0 } } [
10 <buffer>
[ B{ 1 2 3 4 } binary-object rot buffer-write ]
[ 10 <byte-array> [ 10 rot buffer-read-into ] keep ] bi
] unit-test
-[ 4 { 1 2 3 4 f f f f f f } ] [
+{ 4 { 1 2 3 4 f f f f f f } } [
10 <buffer>
[ B{ 1 2 3 4 } binary-object rot buffer-write ]
[ 10 f <array> [ 10 rot buffer-read-into ] keep ] bi
IN: io.crlf.tests
USING: io.crlf tools.test io.streams.string io ;
-[ "Hello, world." ] [ "Hello, world." [ read-crlf ] with-string-reader ] unit-test
-[ "Hello, world." ] [ "Hello, world.\r\n" [ read-crlf ] with-string-reader ] unit-test
+{ "Hello, world." } [ "Hello, world." [ read-crlf ] with-string-reader ] unit-test
+{ "Hello, world." } [ "Hello, world.\r\n" [ read-crlf ] with-string-reader ] unit-test
[ "Hello, world.\r" [ read-crlf ] with-string-reader ] must-fail
-[ f ] [ "" [ read-crlf ] with-string-reader ] unit-test
-[ "" ] [ "\r\n" [ read-crlf ] with-string-reader ] unit-test
+{ f } [ "" [ read-crlf ] with-string-reader ] unit-test
+{ "" } [ "\r\n" [ read-crlf ] with-string-reader ] unit-test
[ "foo\r" [ read-?crlf ] with-string-reader ] must-fail
-[ f ] [ "" [ read-?crlf ] with-string-reader ] unit-test
-[ "" ] [ "\n" [ read-?crlf ] with-string-reader ] unit-test
-[ "foo" ] [ "foo\n" [ read-?crlf ] with-string-reader ] unit-test
+{ f } [ "" [ read-?crlf ] with-string-reader ] unit-test
+{ "" } [ "\n" [ read-?crlf ] with-string-reader ] unit-test
+{ "foo" } [ "foo\n" [ read-?crlf ] with-string-reader ] unit-test
-[ "foo\nbar" ] [ "foo\n\rbar" crlf>lf ] unit-test
-[ "foo\r\nbar" ] [ "foo\nbar" lf>crlf ] unit-test
+{ "foo\nbar" } [ "foo\n\rbar" crlf>lf ] unit-test
+{ "foo\r\nbar" } [ "foo\nbar" lf>crlf ] unit-test
kernel sequences tools.test ;
IN: io.directories.tests
-[ { "kernel" } ] [
+{ { "kernel" } } [
"core" resource-path [
"." directory-files [ "kernel" = ] filter
] with-directory
] unit-test
-[ { "kernel" } ] [
+{ { "kernel" } } [
"resource:core" [
"." directory-files [ "kernel" = ] filter
] with-directory
] unit-test
-[ { "kernel" } ] [
+{ { "kernel" } } [
"resource:core" [
[ "kernel" = ] filter
] with-directory-files
] unit-test
-[ ] [ "blahblah" temp-file dup exists? [ delete-directory ] [ drop ] if ] unit-test
-[ ] [ "blahblah" temp-file make-directory ] unit-test
-[ t ] [ "blahblah" temp-file file-info directory? ] unit-test
+{ } [ "blahblah" temp-file dup exists? [ delete-directory ] [ drop ] if ] unit-test
+{ } [ "blahblah" temp-file make-directory ] unit-test
+{ t } [ "blahblah" temp-file file-info directory? ] unit-test
-[ t ] [
+{ t } [
[ temp-directory "loldir" append-path delete-directory ] ignore-errors
temp-directory [
"loldir" make-directory
temp-directory "loldir" append-path exists?
] unit-test
-[ ] [
+{ } [
[ temp-directory "loldir" append-path delete-directory ] ignore-errors
temp-directory [
"loldir" make-directory
] with-directory
] unit-test
-[ "file1 contents" ] [
+{ "file1 contents" } [
[ temp-directory "loldir" append-path delete-directory ] ignore-errors
temp-directory [
"file1 contents" "file1" utf8 set-file-contents
"file2" temp-file delete-file
] unit-test
-[ "file3 contents" ] [
+{ "file3 contents" } [
temp-directory [
"file3 contents" "file3" utf8 set-file-contents
"file3" "file4" move-file
[ "file5" temp-file delete-file ] ignore-errors
-[ ] [
+{ } [
temp-directory [
"file5" touch-file
"file5" delete-file
[ "file6" temp-file delete-file ] ignore-errors
-[ ] [
+{ } [
temp-directory [
"file6" touch-file
"file6" link-info drop
] with-directory
] unit-test
-[ ] [
+{ } [
{ "Hello world." }
"test-foo.txt" temp-file ascii set-file-lines
] unit-test
-[ ] [
+{ } [
"test-foo.txt" temp-file ascii [
"Hello appender." print
] with-file-appender
] unit-test
-[ ] [
+{ } [
"test-bar.txt" temp-file ascii [
"Hello appender." print
] with-file-appender
] unit-test
-[ "Hello world.\nHello appender.\n" ] [
+{ "Hello world.\nHello appender.\n" } [
"test-foo.txt" temp-file ascii file-contents
] unit-test
-[ "Hello appender.\n" ] [
+{ "Hello appender.\n" } [
"test-bar.txt" temp-file ascii file-contents
] unit-test
-[ ] [ "test-foo.txt" temp-file delete-file ] unit-test
+{ } [ "test-foo.txt" temp-file delete-file ] unit-test
-[ ] [ "test-bar.txt" temp-file delete-file ] unit-test
+{ } [ "test-bar.txt" temp-file delete-file ] unit-test
-[ f ] [ "test-foo.txt" temp-file exists? ] unit-test
+{ f } [ "test-foo.txt" temp-file exists? ] unit-test
-[ f ] [ "test-bar.txt" temp-file exists? ] unit-test
+{ f } [ "test-bar.txt" temp-file exists? ] unit-test
[ "test-blah" temp-file delete-tree ] ignore-errors
-[ ] [ "test-blah" temp-file make-directory ] unit-test
+{ } [ "test-blah" temp-file make-directory ] unit-test
-[ ] [
+{ } [
"test-blah/fooz" temp-file ascii <file-writer> dispose
] unit-test
-[ t ] [
+{ t } [
"test-blah/fooz" temp-file exists?
] unit-test
-[ ] [ "test-blah/fooz" temp-file delete-file ] unit-test
+{ } [ "test-blah/fooz" temp-file delete-file ] unit-test
-[ ] [ "test-blah" temp-file delete-directory ] unit-test
+{ } [ "test-blah" temp-file delete-directory ] unit-test
-[ f ] [ "test-blah" temp-file exists? ] unit-test
+{ f } [ "test-blah" temp-file exists? ] unit-test
-[ ] [ "delete-tree-test/a/b/c" temp-file make-directories ] unit-test
+{ } [ "delete-tree-test/a/b/c" temp-file make-directories ] unit-test
-[ ] [
+{ } [
{ "Hi" }
"delete-tree-test/a/b/c/d" temp-file ascii set-file-lines
] unit-test
-[ ] [
+{ } [
"delete-tree-test" temp-file delete-tree
] unit-test
-[ ] [
+{ } [
"copy-tree-test/a/b/c" temp-file make-directories
] unit-test
-[ ] [
+{ } [
"Foobar"
"copy-tree-test/a/b/c/d" temp-file
ascii set-file-contents
] unit-test
-[ ] [
+{ } [
"copy-tree-test" temp-file
"copy-destination" temp-file copy-tree
] unit-test
-[ "Foobar" ] [
+{ "Foobar" } [
"copy-destination/a/b/c/d" temp-file ascii file-contents
] unit-test
-[ ] [
+{ } [
"copy-destination" temp-file delete-tree
] unit-test
-[ ] [
+{ } [
"copy-tree-test" temp-file
"copy-destination" temp-file copy-tree-into
] unit-test
-[ "Foobar" ] [
+{ "Foobar" } [
"copy-destination/copy-tree-test/a/b/c/d" temp-file ascii file-contents
] unit-test
-[ ] [
+{ } [
"copy-destination/copy-tree-test/a/b/c/d" temp-file "" temp-file copy-file-into
] unit-test
-[ "Foobar" ] [
+{ "Foobar" } [
"d" temp-file ascii file-contents
] unit-test
-[ ] [ "d" temp-file delete-file ] unit-test
+{ } [ "d" temp-file delete-file ] unit-test
-[ ] [ "copy-destination" temp-file delete-tree ] unit-test
+{ } [ "copy-destination" temp-file delete-tree ] unit-test
-[ ] [ "copy-tree-test" temp-file delete-tree ] unit-test
+{ } [ "copy-tree-test" temp-file delete-tree ] unit-test
-[ ] [ "resource:deleteme" touch-file ] unit-test
-[ ] [ "resource:deleteme" delete-file ] unit-test
+{ } [ "resource:deleteme" touch-file ] unit-test
+{ } [ "resource:deleteme" delete-file ] unit-test
! Issue #890
sequences tools.test ;
IN: io.directories.hierarchy.tests
-[ { "classes/tuple/tuple.factor" } ] [
+{ { "classes/tuple/tuple.factor" } } [
"resource:core" [
"." directory-tree-files [ "classes/tuple/tuple.factor" = ] filter
] with-directory
] unit-test
-[ { "classes/tuple" } ] [
+{ { "classes/tuple" } } [
"resource:core" [
"." directory-tree-files [ "classes/tuple" = ] filter
] with-directory
] unit-test
-[ { "classes/tuple/tuple.factor" } ] [
+{ { "classes/tuple/tuple.factor" } } [
"resource:core" [
[ "classes/tuple/tuple.factor" = ] filter
] with-directory-tree-files
sorting strings tools.test ;
IN: io.directories.search.tests
-[ t ] [
+{ t } [
[
10 [ "io.paths.test" "gogogo" make-unique-file ] replicate
current-temporary-directory get [ ] find-all-files
] cleanup-unique-directory [ natural-sort ] same?
] unit-test
-[ f ] [
+{ f } [
{ "omg you shoudnt have a directory called this" "or this" }
t
[ "asdfasdfasdfasdfasdf" tail? ] find-in-directories
] unit-test
-[ f ] [
+{ f } [
{ } t [ "asdfasdfasdfasdfasdf" tail? ] find-in-directories
] unit-test
-[ t ] [
+{ t } [
[
current-temporary-directory get
"the-head" unique-file drop t
] cleanup-unique-directory
] unit-test
-[ t ] [
+{ t } [
[ unique-directory unique-directory ] output>array
[ [ "abcd" append-path touch-file ] each ]
[ [ file-name "abcd" = ] find-all-in-directories length 2 = ]
io.encodings.8-bit.latin1 io.encodings.8-bit.windows-1252 ;
IN: io.encodings.8-bit.tests
-[ B{ CHAR: f CHAR: o CHAR: o } ] [ "foo" latin1 encode ] unit-test
+{ B{ CHAR: f CHAR: o CHAR: o } } [ "foo" latin1 encode ] unit-test
[ { 256 } >string latin1 encode ] must-fail
-[ B{ 255 } ] [ { 255 } >string latin1 encode ] unit-test
+{ B{ 255 } } [ { 255 } >string latin1 encode ] unit-test
-[ "bar" ] [ "bar" latin1 decode ] unit-test
-[ { CHAR: b 233 CHAR: r } ] [ B{ CHAR: b 233 CHAR: r } latin1 decode >array ] unit-test
-[ { 0xfffd 0x20AC } ] [ B{ 0x81 0x80 } windows-1252 decode >array ] unit-test
+{ "bar" } [ "bar" latin1 decode ] unit-test
+{ { CHAR: b 233 CHAR: r } } [ B{ CHAR: b 233 CHAR: r } latin1 decode >array ] unit-test
+{ { 0xfffd 0x20AC } } [ B{ 0x81 0x80 } windows-1252 decode >array ] unit-test
-[ t ] [ \ latin1 8-bit-encoding? ] unit-test
-[ "bar" ] [ "bar" \ latin1 decode ] unit-test
+{ t } [ \ latin1 8-bit-encoding? ] unit-test
+{ "bar" } [ "bar" \ latin1 decode ] unit-test
: unicode>euc-kr ( ch -- ch/f )
euc-kr euc-table word-prop value-at ;
-[ f ] [ 0x80 euc-kr>unicode ] unit-test
-[ f ] [ 0xff euc-kr>unicode ] unit-test
-[ 0xac02 ] [ 0x8141 euc-kr>unicode ] unit-test
-[ 0x7f ] [ 0x7f euc-kr>unicode ] unit-test
-[ 0xc724 ] [ 0xc0b1 euc-kr>unicode ] unit-test
+{ f } [ 0x80 euc-kr>unicode ] unit-test
+{ f } [ 0xff euc-kr>unicode ] unit-test
+{ 0xac02 } [ 0x8141 euc-kr>unicode ] unit-test
+{ 0x7f } [ 0x7f euc-kr>unicode ] unit-test
+{ 0xc724 } [ 0xc0b1 euc-kr>unicode ] unit-test
-[ 0x8141 ] [ 0xac02 unicode>euc-kr ] unit-test
-[ 0x7f ] [ 0x7f unicode>euc-kr ] unit-test
-[ 0xc0b1 ] [ 0xc724 unicode>euc-kr ] unit-test
+{ 0x8141 } [ 0xac02 unicode>euc-kr ] unit-test
+{ 0x7f } [ 0x7f unicode>euc-kr ] unit-test
+{ 0xc0b1 } [ 0xc724 unicode>euc-kr ] unit-test
: phrase-unicode ( -- s )
"\u00b3d9\u00d574\u00bb3c\u00acfc \u00bc31\u00b450\u00c0b0\u00c774!" ;
: phrase-euc-kr>unicode ( -- s )
phrase-euc-kr euc-kr decode ;
-[ t ] [ phrase-unicode>euc-kr >array phrase-euc-kr = ] unit-test
+{ t } [ phrase-unicode>euc-kr >array phrase-euc-kr = ] unit-test
-[ t ] [ phrase-euc-kr>unicode phrase-unicode = ] unit-test
+{ t } [ phrase-euc-kr>unicode phrase-unicode = ] unit-test
-[ t ] [ phrase-euc-kr 1 head* euc-kr decode phrase-unicode 1 head* = ] unit-test
+{ t } [ phrase-euc-kr 1 head* euc-kr decode phrase-unicode 1 head* = ] unit-test
-[ t ] [ phrase-euc-kr 3 head* euc-kr decode phrase-unicode 2 head* = ] unit-test
+{ t } [ phrase-euc-kr 3 head* euc-kr decode phrase-unicode 2 head* = ] unit-test
-[ t ] [ phrase-euc-kr 2 head* euc-kr decode phrase-unicode 2 head* CHAR: replacement-character suffix = ] unit-test
+{ t } [ phrase-euc-kr 2 head* euc-kr decode phrase-unicode 2 head* CHAR: replacement-character suffix = ] unit-test
USING: io.encodings.gb18030 io.encodings.string strings tools.test arrays ;
IN: io.encodings.gb18030.tests
-[ "hello" ] [ "hello" gb18030 encode >string ] unit-test
-[ "hello" ] [ "hello" gb18030 decode ] unit-test
-[ B{ 0xA1 0xA4 0x81 0x30 0x86 0x30 } ]
+{ "hello" } [ "hello" gb18030 encode >string ] unit-test
+{ "hello" } [ "hello" gb18030 decode ] unit-test
+{ B{ 0xA1 0xA4 0x81 0x30 0x86 0x30 } }
[ B{ 0xB7 0xB8 } >string gb18030 encode ] unit-test
-[ { 0xB7 0xB8 } ]
+{ { 0xB7 0xB8 } }
[ B{ 0xA1 0xA4 0x81 0x30 0x86 0x30 } gb18030 decode >array ] unit-test
-[ { 0xB7 CHAR: replacement-character } ]
+{ { 0xB7 CHAR: replacement-character } }
[ B{ 0xA1 0xA4 0x81 0x30 0x86 } gb18030 decode >array ] unit-test
-[ { 0xB7 CHAR: replacement-character } ]
+{ { 0xB7 CHAR: replacement-character } }
[ B{ 0xA1 0xA4 0x81 0x30 } gb18030 decode >array ] unit-test
-[ { 0xB7 CHAR: replacement-character } ]
+{ { 0xB7 CHAR: replacement-character } }
[ B{ 0xA1 0xA4 0x81 } gb18030 decode >array ] unit-test
-[ { 0xB7 } ]
+{ { 0xB7 } }
[ B{ 0xA1 0xA4 } gb18030 decode >array ] unit-test
-[ { CHAR: replacement-character } ]
+{ { CHAR: replacement-character } }
[ B{ 0xA1 } >string gb18030 decode >array ] unit-test
-[ { 0x44D7 0x464B } ]
+{ { 0x44D7 0x464B } }
[ B{ 0x82 0x33 0xA3 0x39 0x82 0x33 0xC9 0x31 }
gb18030 decode >array ] unit-test
-[ { 0x82 0x33 0xA3 0x39 0x82 0x33 0xC9 0x31 } ]
+{ { 0x82 0x33 0xA3 0x39 0x82 0x33 0xC9 0x31 } }
[ { 0x44D7 0x464B } >string gb18030 encode >array ] unit-test
io.encodings.utf8 tools.test assocs namespaces ;
IN: io.encodings.iana.tests
-[ utf8 ] [ "UTF-8" name>encoding ] unit-test
-[ utf8 ] [ "utf8" name>encoding ] unit-test
-[ "UTF-8" ] [ utf8 encoding>name ] unit-test
+{ utf8 } [ "UTF-8" name>encoding ] unit-test
+{ utf8 } [ "utf8" name>encoding ] unit-test
+{ "UTF-8" } [ utf8 encoding>name ] unit-test
! We will never implement EBCDIC-FI-SE-A
SINGLETON: ebcdic-fisea
ebcdic-fisea "EBCDIC-FI-SE-A" register-encoding
-[ ebcdic-fisea ] [ "EBCDIC-FI-SE-A" name>encoding ] unit-test
-[ ebcdic-fisea ] [ "csEBCDICFISEA" name>encoding ] unit-test
-[ "EBCDIC-FI-SE-A" ] [ ebcdic-fisea encoding>name ] unit-test
+{ ebcdic-fisea } [ "EBCDIC-FI-SE-A" name>encoding ] unit-test
+{ ebcdic-fisea } [ "csEBCDICFISEA" name>encoding ] unit-test
+{ "EBCDIC-FI-SE-A" } [ ebcdic-fisea encoding>name ] unit-test
! Clean up after myself
-[ ] [
+{ } [
"EBCDIC-FI-SE-A" n>e-table get delete-at
"csEBCDICFISEA" n>e-table get delete-at
ebcdic-fisea e>n-table get delete-at
] unit-test
-[ f ] [ "EBCDIC-FI-SE-A" name>encoding ] unit-test
-[ f ] [ "csEBCDICFISEA" name>encoding ] unit-test
-[ f ] [ ebcdic-fisea encoding>name ] unit-test
+{ f } [ "EBCDIC-FI-SE-A" name>encoding ] unit-test
+{ f } [ "csEBCDICFISEA" name>encoding ] unit-test
+{ f } [ ebcdic-fisea encoding>name ] unit-test
[ ebcdic-fisea "foobar" register-encoding ] must-fail
-[ f ] [ "foobar" name>encoding ] unit-test
-[ f ] [ ebcdic-fisea encoding>name ] unit-test
+{ f } [ "foobar" name>encoding ] unit-test
+{ f } [ ebcdic-fisea encoding>name ] unit-test
io.encodings.iso2022.private literals strings byte-arrays ;
IN: io.encodings.iso2022
-[ "hello" ] [ "hello" >byte-array iso2022 decode ] unit-test
-[ "hello" ] [ "hello" iso2022 encode >string ] unit-test
+{ "hello" } [ "hello" >byte-array iso2022 decode ] unit-test
+{ "hello" } [ "hello" iso2022 encode >string ] unit-test
-[ "hi" ] [ B{ CHAR: h ESC CHAR: ( CHAR: B CHAR: i } iso2022 decode ] unit-test
-[ "hi" ] [ B{ CHAR: h CHAR: i ESC CHAR: ( CHAR: B } iso2022 decode ] unit-test
-[ "hi\u00fffd" ] [ B{ CHAR: h CHAR: i ESC CHAR: ( } iso2022 decode ] unit-test
-[ "hi\u00fffd" ] [ B{ CHAR: h CHAR: i ESC } iso2022 decode ] unit-test
+{ "hi" } [ B{ CHAR: h ESC CHAR: ( CHAR: B CHAR: i } iso2022 decode ] unit-test
+{ "hi" } [ B{ CHAR: h CHAR: i ESC CHAR: ( CHAR: B } iso2022 decode ] unit-test
+{ "hi\u00fffd" } [ B{ CHAR: h CHAR: i ESC CHAR: ( } iso2022 decode ] unit-test
+{ "hi\u00fffd" } [ B{ CHAR: h CHAR: i ESC } iso2022 decode ] unit-test
-[ B{ CHAR: h ESC CHAR: ( CHAR: J 0xD8 } ] [ "h\u00ff98" iso2022 encode ] unit-test
-[ "h\u00ff98" ] [ B{ CHAR: h ESC CHAR: ( CHAR: J 0xD8 } iso2022 decode ] unit-test
-[ "hi" ] [ B{ CHAR: h ESC CHAR: ( CHAR: J CHAR: i } iso2022 decode ] unit-test
-[ "h" ] [ B{ CHAR: h ESC CHAR: ( CHAR: J } iso2022 decode ] unit-test
-[ "h\u00fffd" ] [ B{ CHAR: h ESC CHAR: ( CHAR: J 0x80 } iso2022 decode ] unit-test
+{ B{ CHAR: h ESC CHAR: ( CHAR: J 0xD8 } } [ "h\u00ff98" iso2022 encode ] unit-test
+{ "h\u00ff98" } [ B{ CHAR: h ESC CHAR: ( CHAR: J 0xD8 } iso2022 decode ] unit-test
+{ "hi" } [ B{ CHAR: h ESC CHAR: ( CHAR: J CHAR: i } iso2022 decode ] unit-test
+{ "h" } [ B{ CHAR: h ESC CHAR: ( CHAR: J } iso2022 decode ] unit-test
+{ "h\u00fffd" } [ B{ CHAR: h ESC CHAR: ( CHAR: J 0x80 } iso2022 decode ] unit-test
-[ B{ CHAR: h ESC CHAR: $ CHAR: B 0x3E 0x47 } ] [ "h\u007126" iso2022 encode ] unit-test
-[ "h\u007126" ] [ B{ CHAR: h ESC CHAR: $ CHAR: B 0x3E 0x47 } iso2022 decode ] unit-test
-[ "h\u00fffd" ] [ B{ CHAR: h ESC CHAR: $ CHAR: B 0x3E } iso2022 decode ] unit-test
-[ "h" ] [ B{ CHAR: h ESC CHAR: $ CHAR: B } iso2022 decode ] unit-test
-[ "h\u00fffd" ] [ B{ CHAR: h ESC CHAR: $ } iso2022 decode ] unit-test
-[ "h\u00fffd" ] [ B{ CHAR: h ESC } iso2022 decode ] unit-test
-[ "h\u00fffd" ] [ B{ CHAR: h ESC CHAR: $ CHAR: B 0x80 0x80 } iso2022 decode ] unit-test
+{ B{ CHAR: h ESC CHAR: $ CHAR: B 0x3E 0x47 } } [ "h\u007126" iso2022 encode ] unit-test
+{ "h\u007126" } [ B{ CHAR: h ESC CHAR: $ CHAR: B 0x3E 0x47 } iso2022 decode ] unit-test
+{ "h\u00fffd" } [ B{ CHAR: h ESC CHAR: $ CHAR: B 0x3E } iso2022 decode ] unit-test
+{ "h" } [ B{ CHAR: h ESC CHAR: $ CHAR: B } iso2022 decode ] unit-test
+{ "h\u00fffd" } [ B{ CHAR: h ESC CHAR: $ } iso2022 decode ] unit-test
+{ "h\u00fffd" } [ B{ CHAR: h ESC } iso2022 decode ] unit-test
+{ "h\u00fffd" } [ B{ CHAR: h ESC CHAR: $ CHAR: B 0x80 0x80 } iso2022 decode ] unit-test
-[ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D 0x38 0x54 } ] [ "h\u0058ce" iso2022 encode ] unit-test
-[ "h\u0058ce" ] [ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D 0x38 0x54 } iso2022 decode ] unit-test
-[ "h\u00fffd" ] [ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D 0x38 } iso2022 decode ] unit-test
-[ "h" ] [ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D } iso2022 decode ] unit-test
-[ "h\u00fffd" ] [ B{ CHAR: h ESC CHAR: $ CHAR: ( } iso2022 decode ] unit-test
-[ "h\u00fffd" ] [ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D 0x70 0x70 } iso2022 decode ] unit-test
+{ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D 0x38 0x54 } } [ "h\u0058ce" iso2022 encode ] unit-test
+{ "h\u0058ce" } [ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D 0x38 0x54 } iso2022 decode ] unit-test
+{ "h\u00fffd" } [ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D 0x38 } iso2022 decode ] unit-test
+{ "h" } [ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D } iso2022 decode ] unit-test
+{ "h\u00fffd" } [ B{ CHAR: h ESC CHAR: $ CHAR: ( } iso2022 decode ] unit-test
+{ "h\u00fffd" } [ B{ CHAR: h ESC CHAR: $ CHAR: ( CHAR: D 0x70 0x70 } iso2022 decode ] unit-test
[ "\u{syriac-music}" iso2022 encode ] must-fail
johab euc-table word-prop value-at ;
! johab encodings
-[ 0x20 ] [ 0x20 johab>unicode ] unit-test
-[ 0x3133 ] [ 0x8444 johab>unicode ] unit-test
-[ 0x8A5D ] [ 0xAD4F unicode>johab ] unit-test
+{ 0x20 } [ 0x20 johab>unicode ] unit-test
+{ 0x3133 } [ 0x8444 johab>unicode ] unit-test
+{ 0x8A5D } [ 0xAD4F unicode>johab ] unit-test
: phrase-unicode ( -- s )
"\u00b3d9\u00d574\u00bb3c\u00acfc \u00bc31\u00b450\u00c0b0\u00c774!" ;
: phrase-unicode>johab ( -- s )
phrase-unicode johab encode ;
-[ t ] [ phrase-johab>unicode phrase-unicode = ] unit-test
-[ t ] [ phrase-unicode>johab phrase-johab = ] unit-test
+{ t } [ phrase-johab>unicode phrase-unicode = ] unit-test
+{ t } [ phrase-unicode>johab phrase-johab = ] unit-test
USING: io.encodings.shift-jis tools.test io.encodings.string arrays strings ;
IN: io.encodings.shift-jis.tests
-[ { CHAR: replacement-character } ] [ { 141 } shift-jis decode >array ] unit-test
-[ "" ] [ "" shift-jis decode >string ] unit-test
-[ "" ] [ "" shift-jis encode >string ] unit-test
+{ { CHAR: replacement-character } } [ { 141 } shift-jis decode >array ] unit-test
+{ "" } [ "" shift-jis decode >string ] unit-test
+{ "" } [ "" shift-jis encode >string ] unit-test
[ { CHAR: replacement-character } shift-jis encode ] must-fail
-[ "ab¥ィ" ] [ { CHAR: a CHAR: b 0x5C 0xA8 } shift-jis decode ] unit-test
-[ { CHAR: a CHAR: b 0x5C 0xA8 } ] [ "ab¥ィ" shift-jis encode >array ] unit-test
-[ "ab\\ィ" ] [ { CHAR: a CHAR: b 0x5C 0xA8 } windows-31j decode ] unit-test
-[ { CHAR: a CHAR: b 0x5C 0xA8 } ] [ "ab\\ィ" windows-31j encode >array ] unit-test
-[ "\u000081\u0000c8" ] [ CHAR: logical-and 1string windows-31j encode >string ] unit-test
-[ "\u000081\u0000c8" ] [ CHAR: logical-and 1string shift-jis encode >string ] unit-test
-[ { CHAR: logical-and } ] [ "\u000081\u0000c8" windows-31j decode >array ] unit-test
-[ { CHAR: logical-and } ] [ "\u000081\u0000c8" shift-jis decode >array ] unit-test
+{ "ab¥ィ" } [ { CHAR: a CHAR: b 0x5C 0xA8 } shift-jis decode ] unit-test
+{ { CHAR: a CHAR: b 0x5C 0xA8 } } [ "ab¥ィ" shift-jis encode >array ] unit-test
+{ "ab\\ィ" } [ { CHAR: a CHAR: b 0x5C 0xA8 } windows-31j decode ] unit-test
+{ { CHAR: a CHAR: b 0x5C 0xA8 } } [ "ab\\ィ" windows-31j encode >array ] unit-test
+{ "\u000081\u0000c8" } [ CHAR: logical-and 1string windows-31j encode >string ] unit-test
+{ "\u000081\u0000c8" } [ CHAR: logical-and 1string shift-jis encode >string ] unit-test
+{ { CHAR: logical-and } } [ "\u000081\u0000c8" windows-31j decode >array ] unit-test
+{ { CHAR: logical-and } } [ "\u000081\u0000c8" shift-jis decode >array ] unit-test
arrays io.encodings.string ;
IN: io.encodings.strict.test
-[ { 0xfffd } ] [ { 128 } ascii decode >array ] unit-test
+{ { 0xfffd } } [ { 128 } ascii decode >array ] unit-test
[ { 128 } ascii strict decode ] must-fail
io.encodings.string tools.test io.encodings.binary ;
IN: io.encodings.string.tests
-[ "hello" ] [ "hello" utf8 decode ] unit-test
-[ B{ 0 1 22 255 } ] [ B{ 0 1 22 255 } binary decode ] unit-test
-[ "he" ] [ "\0h\0e" utf16be decode ] unit-test
+{ "hello" } [ "hello" utf8 decode ] unit-test
+{ B{ 0 1 22 255 } } [ B{ 0 1 22 255 } binary decode ] unit-test
+{ "he" } [ "\0h\0e" utf16be decode ] unit-test
-[ "hello" ] [ "hello" utf8 encode >string ] unit-test
-[ "\0h\0e" ] [ "he" utf16be encode >string ] unit-test
+{ "hello" } [ "hello" utf8 encode >string ] unit-test
+{ "\0h\0e" } [ "he" utf16be encode >string ] unit-test
io.encodings.string alien.c-types alien.strings accessors classes ;
IN: io.encodings.utf32.tests
-[ { CHAR: x } ] [ B{ 0 0 0 CHAR: x } utf32be decode >array ] unit-test
-[ { 0x1D11E } ] [ B{ 0 1 0xD1 0x1E } utf32be decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ B{ 0 1 0xD1 } utf32be decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ B{ 0 1 } utf32be decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ B{ 0 } utf32be decode >array ] unit-test
-[ { } ] [ { } utf32be decode >array ] unit-test
+{ { CHAR: x } } [ B{ 0 0 0 CHAR: x } utf32be decode >array ] unit-test
+{ { 0x1D11E } } [ B{ 0 1 0xD1 0x1E } utf32be decode >array ] unit-test
+{ { CHAR: replacement-character } } [ B{ 0 1 0xD1 } utf32be decode >array ] unit-test
+{ { CHAR: replacement-character } } [ B{ 0 1 } utf32be decode >array ] unit-test
+{ { CHAR: replacement-character } } [ B{ 0 } utf32be decode >array ] unit-test
+{ { } } [ { } utf32be decode >array ] unit-test
-[ B{ 0 0 0 CHAR: x 0 1 0xD1 0x1E } ] [ { CHAR: x 0x1d11e } >string utf32be encode ] unit-test
+{ B{ 0 0 0 CHAR: x 0 1 0xD1 0x1E } } [ { CHAR: x 0x1d11e } >string utf32be encode ] unit-test
-[ { CHAR: x } ] [ B{ CHAR: x 0 0 0 } utf32le decode >array ] unit-test
-[ { 0x1d11e } ] [ B{ 0x1e 0xd1 1 0 } utf32le decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ B{ 0x1e 0xd1 1 } utf32le decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ B{ 0x1e 0xd1 } utf32le decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ B{ 0x1e } utf32le decode >array ] unit-test
-[ { } ] [ { } utf32le decode >array ] unit-test
+{ { CHAR: x } } [ B{ CHAR: x 0 0 0 } utf32le decode >array ] unit-test
+{ { 0x1d11e } } [ B{ 0x1e 0xd1 1 0 } utf32le decode >array ] unit-test
+{ { CHAR: replacement-character } } [ B{ 0x1e 0xd1 1 } utf32le decode >array ] unit-test
+{ { CHAR: replacement-character } } [ B{ 0x1e 0xd1 } utf32le decode >array ] unit-test
+{ { CHAR: replacement-character } } [ B{ 0x1e } utf32le decode >array ] unit-test
+{ { } } [ { } utf32le decode >array ] unit-test
-[ B{ 120 0 0 0 0x1e 0xd1 1 0 } ] [ { CHAR: x 0x1d11e } >string utf32le encode ] unit-test
+{ B{ 120 0 0 0 0x1e 0xd1 1 0 } } [ { CHAR: x 0x1d11e } >string utf32le encode ] unit-test
-[ { CHAR: x } ] [ B{ 0xff 0xfe 0 0 CHAR: x 0 0 0 } utf32 decode >array ] unit-test
-[ { CHAR: x } ] [ B{ 0 0 0xfe 0xff 0 0 0 CHAR: x } utf32 decode >array ] unit-test
+{ { CHAR: x } } [ B{ 0xff 0xfe 0 0 CHAR: x 0 0 0 } utf32 decode >array ] unit-test
+{ { CHAR: x } } [ B{ 0 0 0xfe 0xff 0 0 0 CHAR: x } utf32 decode >array ] unit-test
-[ B{ 0xff 0xfe 0 0 120 0 0 0 0x1e 0xd1 1 0 } ] [ { CHAR: x 0x1d11e } >string utf32 encode ] unit-test
+{ B{ 0xff 0xfe 0 0 120 0 0 0 0x1e 0xd1 1 0 } } [ { CHAR: x 0x1d11e } >string utf32 encode ] unit-test
tools.test ;
IN: io.encodings.utf7.tests
-[
+{
{
"~/b&AOU-g&APg-"
"b&AOU-x"
"~/F&APg-lder/mailb&AOU-x &- stuff + more"
"~peter/mail/&ZeVnLIqe-/&U,BTFw-"
}
-] [
+} [
{
"~/bågø"
"båx"
} [ utf7imap4 encode >string ] map
] unit-test
-[ t ] [
+{ t } [
{
"~/bågø"
"båx"
} dup [ utf7 encode utf7 decode ] map =
] unit-test
-[ t ] [
+{ t } [
{
"~/bågø"
"båx"
sequences io.files.temp ;
IN: io.files.info.tests
-[ t ] [
+{ t } [
temp-directory [ "hi41" "test41" utf8 set-file-contents ] with-directory
temp-directory "test41" append-path utf8 file-contents "hi41" =
] unit-test
-[ t ] [
+{ t } [
temp-directory [ "test41" file-info size>> ] with-directory 4 =
] unit-test
-[ t ] [ "/" file-system-info file-system-info-tuple? ] unit-test
-[ t ] [ file-systems [ file-system-info-tuple? ] all? ] unit-test
+{ t } [ "/" file-system-info file-system-info-tuple? ] unit-test
+{ t } [ file-systems [ file-system-info-tuple? ] all? ] unit-test
[ '[ [ 1 + ] keep [ number>string _ prepend ] bi@ make-link ] each-integer ]
[ [ number>string ] dip prepend touch-file ] 2bi ; inline
-[ t ] [
+{ t } [
[
current-temporary-directory get [
5 "lol" make-test-links
] with-unique-directory
] [ too-many-symlinks? ] must-fail-with
-[ t ] [
+{ t } [
110 symlink-depth [
[
current-temporary-directory get [
io.files.info io.pathnames io.directories ;
IN: io.files.unique.tests
-[ 123 ] [
+{ 123 } [
"core" ".test" [
[ [ 123 CHAR: a <string> ] dip ascii set-file-contents ]
[ file-info size>> ] bi
] cleanup-unique-file
] unit-test
-[ t ] [
+{ t } [
[ current-directory get file-info directory? ] cleanup-unique-directory
] unit-test
-[ t ] [
+{ t } [
current-directory get
[ [ "FAILDOG" throw ] cleanup-unique-directory ] [ drop ] recover
current-directory get =
] unit-test
-[ t ] [
+{ t } [
[
"asdf" unique-file drop
"asdf2" unique-file drop
] cleanup-unique-directory
] unit-test
-[ t ] [
+{ t } [
[ ] with-unique-directory >boolean
] unit-test
-[ t ] [
+{ t } [
[
"asdf" unique-file drop
"asdf" unique-file drop
grouping io.pathnames.private literals ;
IN: io.files.unix.tests
-[ "/usr/libexec/" ] [ "/usr/libexec/awk/" parent-directory ] unit-test
-[ "/etc/" ] [ "/etc/passwd" parent-directory ] unit-test
-[ "/" ] [ "/etc/" parent-directory ] unit-test
-[ "/" ] [ "/etc" parent-directory ] unit-test
-[ "/" ] [ "/" parent-directory ] unit-test
-
-[ f ] [ "" root-directory? ] unit-test
-[ t ] [ "/" root-directory? ] unit-test
-[ t ] [ "//" root-directory? ] unit-test
-[ t ] [ "///////" root-directory? ] unit-test
-
-[ "/" ] [ "/" file-name ] unit-test
-[ "///" ] [ "///" file-name ] unit-test
-
-[ "/" ] [ "/" "../.." append-path ] unit-test
-[ "/" ] [ "/" "../../" append-path ] unit-test
-[ "/lib" ] [ "/" "../lib" append-path ] unit-test
-[ "/lib/" ] [ "/" "../lib/" append-path ] unit-test
-[ "/lib" ] [ "/" "../../lib" append-path ] unit-test
-[ "/lib/" ] [ "/" "../../lib/" append-path ] unit-test
-
-[ "/lib" ] [ "/usr/" "/lib" append-path ] unit-test
-[ "/lib/" ] [ "/usr/" "/lib/" append-path ] unit-test
-[ "/lib/bux" ] [ "/usr" "/lib/bux" append-path ] unit-test
-[ "/lib/bux/" ] [ "/usr" "/lib/bux/" append-path ] unit-test
-[ t ] [ "/foo" absolute-path? ] unit-test
+{ "/usr/libexec/" } [ "/usr/libexec/awk/" parent-directory ] unit-test
+{ "/etc/" } [ "/etc/passwd" parent-directory ] unit-test
+{ "/" } [ "/etc/" parent-directory ] unit-test
+{ "/" } [ "/etc" parent-directory ] unit-test
+{ "/" } [ "/" parent-directory ] unit-test
+
+{ f } [ "" root-directory? ] unit-test
+{ t } [ "/" root-directory? ] unit-test
+{ t } [ "//" root-directory? ] unit-test
+{ t } [ "///////" root-directory? ] unit-test
+
+{ "/" } [ "/" file-name ] unit-test
+{ "///" } [ "///" file-name ] unit-test
+
+{ "/" } [ "/" "../.." append-path ] unit-test
+{ "/" } [ "/" "../../" append-path ] unit-test
+{ "/lib" } [ "/" "../lib" append-path ] unit-test
+{ "/lib/" } [ "/" "../lib/" append-path ] unit-test
+{ "/lib" } [ "/" "../../lib" append-path ] unit-test
+{ "/lib/" } [ "/" "../../lib/" append-path ] unit-test
+
+{ "/lib" } [ "/usr/" "/lib" append-path ] unit-test
+{ "/lib/" } [ "/usr/" "/lib/" append-path ] unit-test
+{ "/lib/bux" } [ "/usr" "/lib/bux" append-path ] unit-test
+{ "/lib/bux/" } [ "/usr" "/lib/bux/" append-path ] unit-test
+{ t } [ "/foo" absolute-path? ] unit-test
: test-file ( -- path )
"permissions" temp-file ;
prepare-test-file
-[ t ]
+{ t }
[ test-file flags{ USER-ALL GROUP-ALL OTHER-ALL } set-file-permissions perms 0o777 = ] unit-test
-[ t ] [ test-file user-read? ] unit-test
-[ t ] [ test-file user-write? ] unit-test
-[ t ] [ test-file user-execute? ] unit-test
-[ t ] [ test-file group-read? ] unit-test
-[ t ] [ test-file group-write? ] unit-test
-[ t ] [ test-file group-execute? ] unit-test
-[ t ] [ test-file other-read? ] unit-test
-[ t ] [ test-file other-write? ] unit-test
-[ t ] [ test-file other-execute? ] unit-test
+{ t } [ test-file user-read? ] unit-test
+{ t } [ test-file user-write? ] unit-test
+{ t } [ test-file user-execute? ] unit-test
+{ t } [ test-file group-read? ] unit-test
+{ t } [ test-file group-write? ] unit-test
+{ t } [ test-file group-execute? ] unit-test
+{ t } [ test-file other-read? ] unit-test
+{ t } [ test-file other-write? ] unit-test
+{ t } [ test-file other-execute? ] unit-test
-[ t ] [ test-file f set-other-execute perms 0o776 = ] unit-test
-[ f ] [ test-file file-info other-execute? ] unit-test
+{ t } [ test-file f set-other-execute perms 0o776 = ] unit-test
+{ f } [ test-file file-info other-execute? ] unit-test
-[ t ] [ test-file f set-other-write perms 0o774 = ] unit-test
-[ f ] [ test-file file-info other-write? ] unit-test
+{ t } [ test-file f set-other-write perms 0o774 = ] unit-test
+{ f } [ test-file file-info other-write? ] unit-test
-[ t ] [ test-file f set-other-read perms 0o770 = ] unit-test
-[ f ] [ test-file file-info other-read? ] unit-test
+{ t } [ test-file f set-other-read perms 0o770 = ] unit-test
+{ f } [ test-file file-info other-read? ] unit-test
-[ t ] [ test-file f set-group-execute perms 0o760 = ] unit-test
-[ f ] [ test-file file-info group-execute? ] unit-test
+{ t } [ test-file f set-group-execute perms 0o760 = ] unit-test
+{ f } [ test-file file-info group-execute? ] unit-test
-[ t ] [ test-file f set-group-write perms 0o740 = ] unit-test
-[ f ] [ test-file file-info group-write? ] unit-test
+{ t } [ test-file f set-group-write perms 0o740 = ] unit-test
+{ f } [ test-file file-info group-write? ] unit-test
-[ t ] [ test-file f set-group-read perms 0o700 = ] unit-test
-[ f ] [ test-file file-info group-read? ] unit-test
+{ t } [ test-file f set-group-read perms 0o700 = ] unit-test
+{ f } [ test-file file-info group-read? ] unit-test
-[ t ] [ test-file f set-user-execute perms 0o600 = ] unit-test
-[ f ] [ test-file file-info other-execute? ] unit-test
+{ t } [ test-file f set-user-execute perms 0o600 = ] unit-test
+{ f } [ test-file file-info other-execute? ] unit-test
-[ t ] [ test-file f set-user-write perms 0o400 = ] unit-test
-[ f ] [ test-file file-info other-write? ] unit-test
+{ t } [ test-file f set-user-write perms 0o400 = ] unit-test
+{ f } [ test-file file-info other-write? ] unit-test
-[ t ] [ test-file f set-user-read perms 0o000 = ] unit-test
-[ f ] [ test-file file-info other-read? ] unit-test
+{ t } [ test-file f set-user-read perms 0o000 = ] unit-test
+{ f } [ test-file file-info other-read? ] unit-test
-[ t ]
+{ t }
[ test-file flags{ USER-ALL GROUP-ALL OTHER-EXECUTE } set-file-permissions perms 0o771 = ] unit-test
prepare-test-file
-[ t ]
+{ t }
[
test-file now
[ set-file-access-time ] 2keep
[ [ [ truncate >integer ] change-second >gmt ] bi@ ] bi* =
] unit-test
-[ t ]
+{ t }
[
test-file now
[ set-file-modified-time ] 2keep
[ [ [ truncate >integer ] change-second >gmt ] bi@ ] bi* =
] unit-test
-[ t ]
+{ t }
[
test-file now [ dup 2array set-file-times ] 2keep
[ file-info [ modified>> ] [ accessed>> ] bi ] dip
[ [ truncate >integer ] change-second >gmt ] map all-equal?
] unit-test
-[ ] [ test-file f now 2array set-file-times ] unit-test
-[ ] [ test-file now f 2array set-file-times ] unit-test
-[ ] [ test-file f f 2array set-file-times ] unit-test
+{ } [ test-file f now 2array set-file-times ] unit-test
+{ } [ test-file now f 2array set-file-times ] unit-test
+{ } [ test-file f f 2array set-file-times ] unit-test
-[ ] [ test-file real-user-name set-file-user ] unit-test
-[ ] [ test-file real-user-id set-file-user ] unit-test
-[ ] [ test-file real-group-name set-file-group ] unit-test
-[ ] [ test-file real-group-id set-file-group ] unit-test
+{ } [ test-file real-user-name set-file-user ] unit-test
+{ } [ test-file real-user-id set-file-user ] unit-test
+{ } [ test-file real-group-name set-file-group ] unit-test
+{ } [ test-file real-group-id set-file-group ] unit-test
-[ t ] [ test-file file-user-name real-user-name = ] unit-test
-[ t ] [ test-file file-group-name real-group-name = ] unit-test
+{ t } [ test-file file-user-name real-user-name = ] unit-test
+{ t } [ test-file file-group-name real-group-name = ] unit-test
-[ ]
+{ }
[ test-file real-user-id real-group-id set-file-ids ] unit-test
-[ ]
+{ }
[ test-file f real-group-id set-file-ids ] unit-test
-[ ]
+{ }
[ test-file real-user-id f set-file-ids ] unit-test
-[ ]
+{ }
[ test-file f f set-file-ids ] unit-test
-[ t ] [ 0o4000 uid? ] unit-test
-[ t ] [ 0o2000 gid? ] unit-test
-[ t ] [ 0o1000 sticky? ] unit-test
-[ t ] [ 0o400 user-read? ] unit-test
-[ t ] [ 0o200 user-write? ] unit-test
-[ t ] [ 0o100 user-execute? ] unit-test
-[ t ] [ 0o040 group-read? ] unit-test
-[ t ] [ 0o020 group-write? ] unit-test
-[ t ] [ 0o010 group-execute? ] unit-test
-[ t ] [ 0o004 other-read? ] unit-test
-[ t ] [ 0o002 other-write? ] unit-test
-[ t ] [ 0o001 other-execute? ] unit-test
-
-[ f ] [ 0 uid? ] unit-test
-[ f ] [ 0 gid? ] unit-test
-[ f ] [ 0 sticky? ] unit-test
-[ f ] [ 0 user-read? ] unit-test
-[ f ] [ 0 user-write? ] unit-test
-[ f ] [ 0 user-execute? ] unit-test
-[ f ] [ 0 group-read? ] unit-test
-[ f ] [ 0 group-write? ] unit-test
-[ f ] [ 0 group-execute? ] unit-test
-[ f ] [ 0 other-read? ] unit-test
-[ f ] [ 0 other-write? ] unit-test
-[ f ] [ 0 other-execute? ] unit-test
+{ t } [ 0o4000 uid? ] unit-test
+{ t } [ 0o2000 gid? ] unit-test
+{ t } [ 0o1000 sticky? ] unit-test
+{ t } [ 0o400 user-read? ] unit-test
+{ t } [ 0o200 user-write? ] unit-test
+{ t } [ 0o100 user-execute? ] unit-test
+{ t } [ 0o040 group-read? ] unit-test
+{ t } [ 0o020 group-write? ] unit-test
+{ t } [ 0o010 group-execute? ] unit-test
+{ t } [ 0o004 other-read? ] unit-test
+{ t } [ 0o002 other-write? ] unit-test
+{ t } [ 0o001 other-execute? ] unit-test
+
+{ f } [ 0 uid? ] unit-test
+{ f } [ 0 gid? ] unit-test
+{ f } [ 0 sticky? ] unit-test
+{ f } [ 0 user-read? ] unit-test
+{ f } [ 0 user-write? ] unit-test
+{ f } [ 0 user-execute? ] unit-test
+{ f } [ 0 group-read? ] unit-test
+{ f } [ 0 group-write? ] unit-test
+{ f } [ 0 group-execute? ] unit-test
+{ f } [ 0 other-read? ] unit-test
+{ f } [ 0 other-write? ] unit-test
+{ f } [ 0 other-execute? ] unit-test
: arch-temp-file ( str -- str' )
"-" my-arch 3append temp-file ;
-[ ] [
+{ } [
[ "launcher-test-1" arch-temp-file delete-file ] ignore-errors
] unit-test
-[ ] [
+{ } [
"touch"
"launcher-test-1" arch-temp-file
2array
try-process
] unit-test
-[ t ] [ "launcher-test-1" arch-temp-file exists? ] unit-test
+{ t } [ "launcher-test-1" arch-temp-file exists? ] unit-test
-[ ] [
+{ } [
[ "launcher-test-1" arch-temp-file delete-file ] ignore-errors
] unit-test
-[ ] [
+{ } [
<process>
"echo Hello" >>command
"launcher-test-1" arch-temp-file >>stdout
try-process
] unit-test
-[ "Hello\n" ] [
+{ "Hello\n" } [
"cat"
"launcher-test-1" arch-temp-file
2array
ascii <process-reader> stream-contents
] unit-test
-[ ] [
+{ } [
[ "launcher-test-1" arch-temp-file delete-file ] ignore-errors
] unit-test
-[ ] [
+{ } [
<process>
"cat" >>command
+closed+ >>stdin
try-process
] unit-test
-[ "" ] [
+{ "" } [
"cat"
"launcher-test-1" arch-temp-file
2array
ascii <process-reader> stream-contents
] unit-test
-[ ] [
+{ } [
2 [
"launcher-test-1" arch-temp-file binary <file-appender> [
<process>
] times
] unit-test
-[ "Hello\nHello\n" ] [
+{ "Hello\nHello\n" } [
"cat"
"launcher-test-1" arch-temp-file
2array
ascii <process-reader> stream-contents
] unit-test
-[ t ] [
+{ t } [
<process>
"env" >>command
{ { "A" "B" } } >>environment
"A=B" swap member?
] unit-test
-[ { "A=B" } ] [
+{ { "A=B" } } [
<process>
"env" >>command
{ { "A" "B" } } >>environment
ascii <process-reader> stream-lines
] unit-test
-[ "hi\n" ] [
+{ "hi\n" } [
temp-directory [
[ "aloha" delete-file ] ignore-errors
<process>
[ "append-test" arch-temp-file delete-file ] ignore-errors
-[ "hi\nhi\n" ] [
+{ "hi\nhi\n" } [
2 [
<process>
"echo hi" >>command
"append-test" arch-temp-file utf8 file-contents
] unit-test
-[ t ] [ "ls" utf8 <process-stream> stream-contents >boolean ] unit-test
+{ t } [ "ls" utf8 <process-stream> stream-contents >boolean ] unit-test
-[ "Hello world.\n" ] [
+{ "Hello world.\n" } [
"cat" utf8 <process-stream> [
"Hello world.\n" write
output-stream get dispose
] [ io-timeout? ] must-fail-with
! Killed processes were exiting with code 0 on FreeBSD
-[ f ] [
+{ f } [
[let
<promise> :> p
<promise> :> s
"SIGPIPE" signal-names index 1 +
kill io-error ;
-[ ] [ (current-process) send-sigpipe ] unit-test
+{ } [ (current-process) send-sigpipe ] unit-test
! Spawn a process
-[ T{ signal f 13 } ] [
+{ T{ signal f 13 } } [
"sleep 1000" run-detached
1 seconds sleep
[ handle>> send-sigpipe ]
] unit-test
! Test priority
-[ 0 ] [
+{ 0 } [
<process>
{ "bash" "-c" "sleep 2&" } >>command
+low-priority+ >>priority
IN: io.mmap.tests
[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
-[ ] [ "12345" "mmap-test-file.txt" temp-file ascii set-file-contents ] unit-test
-[ ] [ "mmap-test-file.txt" temp-file [ char <mapped-array> CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test
-[ 5 ] [ "mmap-test-file.txt" temp-file [ char <mapped-array> length ] with-mapped-file ] unit-test
-[ 5 ] [ "mmap-test-file.txt" temp-file [ char <mapped-array> length ] with-mapped-file-reader ] unit-test
-[ "22345" ] [ "mmap-test-file.txt" temp-file ascii file-contents ] unit-test
+{ } [ "12345" "mmap-test-file.txt" temp-file ascii set-file-contents ] unit-test
+{ } [ "mmap-test-file.txt" temp-file [ char <mapped-array> CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test
+{ 5 } [ "mmap-test-file.txt" temp-file [ char <mapped-array> length ] with-mapped-file ] unit-test
+{ 5 } [ "mmap-test-file.txt" temp-file [ char <mapped-array> length ] with-mapped-file-reader ] unit-test
+{ "22345" } [ "mmap-test-file.txt" temp-file ascii file-contents ] unit-test
SPECIALIZED-ARRAY: uint
-[ t ] [
+{ t } [
"mmap-test-file.txt" temp-file uint [ sum ] with-mapped-array
integer?
] unit-test
-[ t ] [
+{ t } [
"mmap-test-file.txt" temp-file uint [ sum ] with-mapped-array-reader
integer?
] unit-test
[ "mmap-empty-file.txt" temp-file delete-file ] ignore-errors
-[ ] [ "mmap-empty-file.txt" temp-file touch-file ] unit-test
+{ } [ "mmap-empty-file.txt" temp-file touch-file ] unit-test
[
"mmap-empty-file.txt" temp-file [
] with-mapped-file
] [ bad-mmap-size? ] must-fail-with
-[ t ] [
+{ t } [
[ "test.txt" <mapped-file> void* <c-direct-array> first-unsafe ]
{ nth-unsafe } inlined?
] unit-test
M: mock-io-backend link-info
global [ link-info ] with-variables ;
-[ ] [ 0 mock-counter boa dummy-monitor-created set ] unit-test
-[ ] [ 0 mock-counter boa dummy-monitor-disposed set ] unit-test
+{ } [ 0 mock-counter boa dummy-monitor-created set ] unit-test
+{ } [ 0 mock-counter boa dummy-monitor-disposed set ] unit-test
-[ ] [
+{ } [
mock-io-backend io-backend [
"resource:core/io" resource-path <mailbox> <recursive-monitor> dispose
] with-variable
] unit-test
-[ t ] [ dummy-monitor-created get i>> 0 > ] unit-test
+{ t } [ dummy-monitor-created get i>> 0 > ] unit-test
-[ t ] [ dummy-monitor-created get i>> dummy-monitor-disposed get i>> = ] unit-test
+{ t } [ dummy-monitor-created get i>> dummy-monitor-disposed get i>> = ] unit-test
[ "doesnotexist" temp-file delete-tree ] ignore-errors
] with-variable
] must-fail
-[ ] [ 0 mock-counter boa dummy-monitor-created set ] unit-test
-[ ] [ 0 mock-counter boa dummy-monitor-disposed set ] unit-test
+{ } [ 0 mock-counter boa dummy-monitor-created set ] unit-test
+{ } [ 0 mock-counter boa dummy-monitor-disposed set ] unit-test
! Test that disposing twice is allowed
-[ ] [
+{ } [
"resource:core/io" resource-path <mailbox> <recursive-monitor>
[ dispose ] [ dispose ] bi
] unit-test
concurrency.count-downs fry ;
IN: io.pipes.tests
-[ "Hello" ] [
+{ "Hello" } [
utf8 <pipe> [
"Hello" print flush
readln
] unit-test
! Test run-pipeline
-[ { } ] [ { } run-pipeline ] unit-test
-[ { f } ] [ { [ f ] } run-pipeline ] unit-test
-[ { "Hello" } ] [
+{ { } } [ { } run-pipeline ] unit-test
+{ { f } } [ { [ f ] } run-pipeline ] unit-test
+{ { "Hello" } } [
"Hello" [
{ [ input-stream [ utf8 <decoder> ] change readln ] } run-pipeline
] with-string-reader
] unit-test
-[ { f "Hello" } ] [
+{ { f "Hello" } } [
{
[ output-stream [ utf8 <encoder> ] change "Hello" print flush f ]
[ input-stream [ utf8 <decoder> ] change readln ]
] must-fail
! Test writing to a half-open pipe
-[ ] [
+{ } [
1000 [
utf8 <pipe> [
[ in>> dispose ]
] unit-test
! Test non-blocking operation
-[ ] [
+{ } [
[
2 <count-down> "count-down" set
] unit-test
! 0 read should not block
-[ f ] [
+{ f } [
[
binary <pipe> &dispose
in>>
! Make sure that writing malloced storage to a file works, and
! also make sure that writes larger than the buffer size work
-[ ] [
+{ } [
"test.txt" temp-file binary [
[
100,000 iota
] with-file-writer
] unit-test
-[ t ] [
+{ t } [
"test.txt" temp-file binary [
100,000 4 * read int cast-array 100,000 iota sequence=
] with-file-reader
] unit-test
-[ ] [ "test.txt" temp-file delete-file ] unit-test
+{ } [ "test.txt" temp-file delete-file ] unit-test
! Getting the stream-element-type of an output-port was broken
-[ +byte+ ] [ binary <pipe> [ stream-element-type ] with-disposal ] unit-test
-[ +byte+ ] [ binary <pipe> [ out>> stream-element-type ] with-disposal ] unit-test
-[ +character+ ] [ ascii <pipe> [ stream-element-type ] with-disposal ] unit-test
-[ +character+ ] [ ascii <pipe> [ out>> stream-element-type ] with-disposal ] unit-test
+{ +byte+ } [ binary <pipe> [ stream-element-type ] with-disposal ] unit-test
+{ +byte+ } [ binary <pipe> [ out>> stream-element-type ] with-disposal ] unit-test
+{ +character+ } [ ascii <pipe> [ stream-element-type ] with-disposal ] unit-test
+{ +character+ } [ ascii <pipe> [ out>> stream-element-type ] with-disposal ] unit-test
! Issue #1256 regression test
! Port length would be zero before data is received
sequences threads tools.test ;
IN: io.servers
-[ t ] [ ascii <threaded-server> listen-on empty? ] unit-test
+{ t } [ ascii <threaded-server> listen-on empty? ] unit-test
-[ f ] [
+{ f } [
ascii <threaded-server>
25 internet-server >>insecure
listen-on
empty?
] unit-test
-[ t ] [
+{ t } [
T{ inet4 f "1.2.3.4" 1234 } T{ inet4 f "1.2.3.5" 1235 }
[ log-connection ] 2keep
[ remote-address get = ] [ local-address get = ] bi*
and
] unit-test
-[ ] [ ascii <threaded-server> init-server drop ] unit-test
+{ } [ ascii <threaded-server> init-server drop ] unit-test
-[ 10 ] [
+{ 10 } [
ascii <threaded-server>
10 >>max-connections
init-server semaphore>> count>>
] unit-test
-[ "Hello world." ] [
+{ "Hello world." } [
ascii <threaded-server>
5 >>max-connections
0 >>insecure
] with-threaded-server
] unit-test
-[ ] [
+{ } [
ascii <threaded-server>
5 >>max-connections
0 >>insecure
IN: io.sockets.icmp.tests
-[ { } ] [
+{ { } } [
"localhost" <icmp> resolve-host
[ [ icmp4? ] [ icmp6? ] bi or ] reject
] unit-test
IN: io.sockets.secure.tests
USING: accessors kernel io.sockets io.sockets.secure system tools.test ;
-[ "hello" 24 ] [ "hello" 24 <inet> <secure> [ host>> ] [ port>> ] bi ] unit-test
+{ "hello" 24 } [ "hello" 24 <inet> <secure> [ host>> ] [ port>> ] bi ] unit-test
-[ ] [
+{ } [
<secure-config>
"vocab:openssl/test/server.pem" >>key-file
"vocab:openssl/test/dh1024.pem" >>dh-file
[ ] with-secure-context
] unit-test
-[ t ] [ os windows? ssl-certificate-verification-supported? or ] unit-test
+{ t } [ os windows? ssl-certificate-verification-supported? or ] unit-test
{ 1 0 } [ [ ] with-secure-context ] must-infer-as
-[ ] [ <promise> "port" set ] unit-test
+{ } [ <promise> "port" set ] unit-test
:: server-test ( quot -- )
[
"127.0.0.1" "port" get ?promise <inet4> <secure> ascii <client> drop stream-contents
] with-secure-context ;
-[ ] [ [ class-of name>> write ] server-test ] unit-test
+{ } [ [ class-of name>> write ] server-test ] unit-test
-[ "secure" ] [ client-test ] unit-test
+{ "secure" } [ client-test ] unit-test
! Now, see what happens if the server closes the connection prematurely
-[ ] [ <promise> "port" set ] unit-test
+{ } [ <promise> "port" set ] unit-test
-[ ] [
+{ } [
[
drop
"hello" write flush
! (eg, google.com) do this.
! [ client-test ] [ premature-close? ] must-fail-with
-[ "hello" ] [ client-test ] unit-test
+{ "hello" } [ client-test ] unit-test
! Now, try validating the certificate. This should fail because its
! actually an invalid certificate
-[ ] [ <promise> "port" set ] unit-test
+{ } [ <promise> "port" set ] unit-test
-[ ] [ [ drop "hi" write ] server-test ] unit-test
+{ } [ [ drop "hi" write ] server-test ] unit-test
[
<secure-config> [
] [ certificate-verify-error? ] must-fail-with
! Client-side handshake timeout
-[ ] [ <promise> "port" set ] unit-test
+{ } [ <promise> "port" set ] unit-test
-[ ] [
+{ } [
[
[
"127.0.0.1" 0 <inet4> ascii <server> &dispose
] [ io-timeout? ] must-fail-with
! Server-side handshake timeout
-[ ] [ <promise> "port" set ] unit-test
+{ } [ <promise> "port" set ] unit-test
-[ ] [
+{ } [
[
[
"127.0.0.1" "port" get ?promise
[ T{ local f "/tmp/foo" } ] [ "/tmp/foo" <local> ] unit-test
] when
-[ T{ inet4 f f 0 } ] [ f 0 <inet4> ] unit-test
-[ T{ inet6 f f 0 1 } ] [ f 1 <inet6> ] unit-test
+{ T{ inet4 f f 0 } } [ f 0 <inet4> ] unit-test
+{ T{ inet6 f f 0 1 } } [ f 1 <inet6> ] unit-test
-[ T{ inet f "google.com" f } ] [ "google.com" f <inet> ] unit-test
+{ T{ inet f "google.com" f } } [ "google.com" f <inet> ] unit-test
-[ T{ inet f "google.com" 0 } ] [ "google.com" 0 <inet> ] unit-test
-[ T{ inet f "google.com" 80 } ] [ "google.com" 0 <inet> 80 with-port ] unit-test
-[ T{ inet4 f "8.8.8.8" 0 } ] [ "8.8.8.8" 0 <inet4> ] unit-test
-[ T{ inet4 f "8.8.8.8" 53 } ] [ "8.8.8.8" 0 <inet4> 53 with-port ] unit-test
-[ T{ inet6 f "5:5:5:5:6:6:6:6" 0 12 } ] [ "5:5:5:5:6:6:6:6" 0 <inet6> 12 with-port ] unit-test
-[ T{ inet6 f "fe80::1" 1 80 } ] [ T{ ipv6 f "fe80::1" 1 } 80 with-port ] unit-test
+{ T{ inet f "google.com" 0 } } [ "google.com" 0 <inet> ] unit-test
+{ T{ inet f "google.com" 80 } } [ "google.com" 0 <inet> 80 with-port ] unit-test
+{ T{ inet4 f "8.8.8.8" 0 } } [ "8.8.8.8" 0 <inet4> ] unit-test
+{ T{ inet4 f "8.8.8.8" 53 } } [ "8.8.8.8" 0 <inet4> 53 with-port ] unit-test
+{ T{ inet6 f "5:5:5:5:6:6:6:6" 0 12 } } [ "5:5:5:5:6:6:6:6" 0 <inet6> 12 with-port ] unit-test
+{ T{ inet6 f "fe80::1" 1 80 } } [ T{ ipv6 f "fe80::1" 1 } 80 with-port ] unit-test
: test-sockaddr ( addrspec -- )
[ dup make-sockaddr ] keep parse-sockaddr assert= ;
-[ ] [ T{ inet4 f "8.8.8.8" 53 } test-sockaddr ] unit-test
-[ ] [ T{ inet6 f "5:5:5:5:6:6:6:6" 0 12 } test-sockaddr ] unit-test
-[ ] [ T{ inet6 f "fe80:0:0:0:0:0:0:1" 1 80 } test-sockaddr ] unit-test
+{ } [ T{ inet4 f "8.8.8.8" 53 } test-sockaddr ] unit-test
+{ } [ T{ inet6 f "5:5:5:5:6:6:6:6" 0 12 } test-sockaddr ] unit-test
+{ } [ T{ inet6 f "fe80:0:0:0:0:0:0:1" 1 80 } test-sockaddr ] unit-test
-[ T{ inet f "google.com" 80 } ] [ "google.com" 80 with-port ] unit-test
+{ T{ inet f "google.com" 80 } } [ "google.com" 80 with-port ] unit-test
! Test bad hostnames
[ "google.com" f <inet4> ] must-fail
[ "a.b.c.d" f <inet6> ] must-fail
! Test present on addrspecs
-[ "4.4.4.4:12" ] [ "4.4.4.4" 12 <inet4> present ] unit-test
-[ "::1:12" ] [ "::1" 12 <inet6> present ] unit-test
-[ "fe80::1%1:12" ] [ "fe80::1" 1 12 inet6 boa present ] unit-test
+{ "4.4.4.4:12" } [ "4.4.4.4" 12 <inet4> present ] unit-test
+{ "::1:12" } [ "::1" 12 <inet6> present ] unit-test
+{ "fe80::1%1:12" } [ "fe80::1" 1 12 inet6 boa present ] unit-test
-[ B{ 1 2 3 4 } ]
+{ B{ 1 2 3 4 } }
[ "1.2.3.4" T{ inet4 } inet-pton ] unit-test
-[ "1.2.3.4" ]
+{ "1.2.3.4" }
[ B{ 1 2 3 4 } T{ inet4 } inet-ntop ] unit-test
-[ "255.255.255.255" ]
+{ "255.255.255.255" }
[ B{ 255 255 255 255 } T{ inet4 } inet-ntop ] unit-test
-[ B{ 255 255 255 255 } ]
+{ B{ 255 255 255 255 } }
[ "255.255.255.255" T{ inet4 } inet-pton ] unit-test
-[ B{ 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 } ]
+{ B{ 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 } }
[ "1:2:3:4:5:6:7:8" T{ inet6 } inet-pton ] unit-test
-[ "1:2:3:4:5:6:7:8" ]
+{ "1:2:3:4:5:6:7:8" }
[ B{ 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 } T{ inet6 } inet-ntop ] unit-test
-[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } ]
+{ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } }
[ "::" T{ inet6 } inet-pton ] unit-test
-[ "0:0:0:0:0:0:0:0" ]
+{ "0:0:0:0:0:0:0:0" }
[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } T{ inet6 } inet-ntop ] unit-test
-[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } ]
+{ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } }
[ "1::" T{ inet6 } inet-pton ] unit-test
-[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } ]
+{ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } }
[ "::1" T{ inet6 } inet-pton ] unit-test
-[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 } ]
+{ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 } }
[ "::100" T{ inet6 } inet-pton ] unit-test
-[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 } ]
+{ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 } }
[ "1::2" T{ inet6 } inet-pton ] unit-test
-[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 3 } ]
+{ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 3 } }
[ "1::2:3" T{ inet6 } inet-pton ] unit-test
-[ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } ]
+{ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } }
[ "1:2::3:4" T{ inet6 } inet-pton ] unit-test
-[ "1:2:0:0:0:0:3:4" ]
+{ "1:2:0:0:0:0:3:4" }
[ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } T{ inet6 } inet-ntop ] unit-test
-[ B{ 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 1 } ]
+{ B{ 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 1 } }
[ "::127.0.0.1" T{ inet6 } inet-pton ] unit-test
-[ B{ 0 2 0 0 0 0 0 9 0 127 0 0 0 0 0 1 } ]
+{ B{ 0 2 0 0 0 0 0 9 0 127 0 0 0 0 0 1 } }
[ "2::9:127.0.0.1" T{ inet6 } inet-pton ] unit-test
-[ "2001:6f8:37a:5:0:0:0:1" ]
+{ "2001:6f8:37a:5:0:0:0:1" }
[ "2001:6f8:37a:5::1" T{ inet6 } [ inet-pton ] [ inet-ntop ] bi ] unit-test
-[ t t ] [
+{ t t } [
"localhost" 80 <inet> resolve-host
[ length 1 >= ]
[ [ [ inet4? ] [ inet6? ] bi or ] all? ] bi
] unit-test
-[ t t ] [
+{ t t } [
"localhost" resolve-host
[ length 1 >= ]
[ [ [ ipv4? ] [ ipv6? ] bi or ] all? ] bi
] unit-test
-[ t t ] [
+{ t t } [
f resolve-host
[ length 1 >= ]
[ [ [ ipv4? ] [ ipv6? ] bi or ] all? ] bi
] unit-test
-[ t t ] [
+{ t t } [
f 0 <inet> resolve-host
[ length 1 >= ]
[ [ [ ipv4? ] [ ipv6? ] bi or ] all? ] bi
] unit-test
! Smoke-test UDP
-[ ] [ "127.0.0.1" 0 <inet4> <datagram> "datagram1" set ] unit-test
-[ ] [ "datagram1" get addr>> "addr1" set ] unit-test
-[ f ] [ "addr1" get port>> 0 = ] unit-test
+{ } [ "127.0.0.1" 0 <inet4> <datagram> "datagram1" set ] unit-test
+{ } [ "datagram1" get addr>> "addr1" set ] unit-test
+{ f } [ "addr1" get port>> 0 = ] unit-test
-[ ] [ "127.0.0.1" 0 <inet4> <datagram> "datagram2" set ] unit-test
-[ ] [ "datagram2" get addr>> "addr2" set ] unit-test
-[ f ] [ "addr2" get port>> 0 = ] unit-test
+{ } [ "127.0.0.1" 0 <inet4> <datagram> "datagram2" set ] unit-test
+{ } [ "datagram2" get addr>> "addr2" set ] unit-test
+{ f } [ "addr2" get port>> 0 = ] unit-test
-[ ] [ B{ 1 2 3 4 } "addr2" get "datagram1" get send ] unit-test
-[ B{ 1 2 3 4 } ] [ "datagram2" get receive "from" set ] unit-test
-[ ] [ B{ 4 3 2 1 } "from" get "datagram2" get send ] unit-test
-[ B{ 4 3 2 1 } t ] [ "datagram1" get receive "addr2" get = ] unit-test
+{ } [ B{ 1 2 3 4 } "addr2" get "datagram1" get send ] unit-test
+{ B{ 1 2 3 4 } } [ "datagram2" get receive "from" set ] unit-test
+{ } [ B{ 4 3 2 1 } "from" get "datagram2" get send ] unit-test
+{ B{ 4 3 2 1 } t } [ "datagram1" get receive "addr2" get = ] unit-test
-[ ] [ "datagram1" get dispose ] unit-test
-[ ] [ "datagram2" get dispose ] unit-test
+{ } [ "datagram1" get dispose ] unit-test
+{ } [ "datagram2" get dispose ] unit-test
! Test timeouts
-[ ] [ "127.0.0.1" 0 <inet4> <datagram> "datagram3" set ] unit-test
+{ } [ "127.0.0.1" 0 <inet4> <datagram> "datagram3" set ] unit-test
-[ ] [ 1 seconds "datagram3" get set-timeout ] unit-test
+{ } [ 1 seconds "datagram3" get set-timeout ] unit-test
[ "datagram3" get receive ] must-fail
! See what happens if other end is closed
-[ ] [ <promise> "port" set ] unit-test
+{ } [ <promise> "port" set ] unit-test
-[ ] [ "datagram3" get dispose ] unit-test
+{ } [ "datagram3" get dispose ] unit-test
-[ ] [
+{ } [
[
"127.0.0.1" 0 <inet4> utf8 <server>
dup addr>> "port" get fulfill
] "Socket close test" spawn drop
] unit-test
-[ "hello" f ] [
+{ "hello" f } [
"port" get ?promise utf8 [
1 seconds input-stream get set-timeout
1 seconds output-stream get set-timeout
] unit-test
! Binding to all interfaces should work
-[ ] [ f 0 <inet4> <datagram> dispose ] unit-test
-[ ] [ f 0 <inet6> <datagram> dispose ] unit-test
+{ } [ f 0 <inet4> <datagram> dispose ] unit-test
+{ } [ f 0 <inet6> <datagram> dispose ] unit-test
-[ 80 ] [ "http" protocol-port ] unit-test
-[ f ] [ f protocol-port ] unit-test
+{ 80 } [ "http" protocol-port ] unit-test
+{ f } [ f protocol-port ] unit-test
[ "you-cant-resolve-me!" resolve-host ] [ addrinfo-error? ] must-fail-with
USING: io.standard-paths io.standard-paths.macosx tools.test ;
IN: io.standard-paths.macosx.tests
-[ "/System/Library/CoreServices/Finder.app" ]
+{ "/System/Library/CoreServices/Finder.app" }
[ "com.apple.finder" find-native-bundle ] unit-test
M: unclosable-stream dispose
"Can't close me!" throw ;
-[ ] [
+{ } [
<closing-stream> <closing-stream> <duplex-stream>
dup dispose dispose
] unit-test
-[ t ] [
+{ t } [
<unclosable-stream> <closing-stream> [
<duplex-stream>
[ dup dispose ] [ 2drop ] recover
] keep disposed>>
] unit-test
-[ t ] [
+{ t } [
<closing-stream> [ <unclosable-stream>
<duplex-stream>
[ dup dispose ] [ 2drop ] recover
] keep disposed>>
] unit-test
-[ "Hey" ] [
+{ "Hey" } [
"Hey\nThere" <string-reader> <string-writer> <duplex-stream>
stream-readln
] unit-test
io.encodings.8-bit.latin1 ;
IN: io.streams.limited.tests
-[ ] [
+{ } [
"hello world\nhow are you today\nthis is a very long line indeed"
ascii encode binary <byte-reader> "data" set
] unit-test
-[ ] [ "data" get 24 <limited-stream> "limited" set ] unit-test
+{ } [ "data" get 24 <limited-stream> "limited" set ] unit-test
-[ CHAR: h ] [ "limited" get stream-read1 ] unit-test
+{ CHAR: h } [ "limited" get stream-read1 ] unit-test
-[ ] [ "limited" get ascii <decoder> "decoded" set ] unit-test
+{ } [ "limited" get ascii <decoder> "decoded" set ] unit-test
-[ "ello world" ] [ "decoded" get stream-readln ] unit-test
+{ "ello world" } [ "decoded" get stream-readln ] unit-test
-[ "how " ] [ 4 "decoded" get stream-read ] unit-test
+{ "how " } [ 4 "decoded" get stream-read ] unit-test
-[ "are you " ] [ "decoded" get stream-readln ] unit-test
+{ "are you " } [ "decoded" get stream-readln ] unit-test
-[ f ] [ "decoded" get stream-readln ] unit-test
+{ f } [ "decoded" get stream-readln ] unit-test
-[ ] [
+{ } [
"abc\ndef\nghi"
ascii encode binary <byte-reader> "data" set
] unit-test
-[ ] [ "data" get 4 <limited-stream> "limited" set ] unit-test
+{ } [ "data" get 4 <limited-stream> "limited" set ] unit-test
-[ "abc" CHAR: \n ]
+{ "abc" CHAR: \n }
[ "\n" "limited" get stream-read-until [ >string ] dip ] unit-test
-[ "" f ] [ "\n" "limited" get stream-read-until [ >string ] dip ] unit-test
+{ "" f } [ "\n" "limited" get stream-read-until [ >string ] dip ] unit-test
-[ CHAR: a ]
+{ CHAR: a }
[ "a" <string-reader> 1 <limited-stream> stream-read1 ] unit-test
-[ "abc" ]
+{ "abc" }
[
"abc" <string-reader> 3 <limited-stream>
4 swap stream-read
] unit-test
-[ f ]
+{ f }
[
"abc" <string-reader> 3 <limited-stream>
4 over stream-read drop 10 swap stream-read
] unit-test
! pipes are duplex and not seekable
-[ "as" ] [
+{ "as" } [
latin1 <pipe> [
input-stream [ 2 <limited-stream> ] change
"asdf" write flush 2 read
] with-stream
] unit-test
-[ "as" ] [
+{ "as" } [
latin1 <pipe> [
input-stream [ 2 <limited-stream> ] change
"asdf" write flush 3 read
] unit-test
! test seeking on limited unseekable streams
-[ "as" ] [
+{ "as" } [
latin1 <pipe> [
input-stream [ 2 <limited-stream> ] change
"asdf" write flush 2 read
] with-stream
] unit-test
-[ "as" ] [
+{ "as" } [
latin1 <pipe> [
input-stream [ 2 <limited-stream> ] change
"asdf" write flush 3 read
] with-stream
] unit-test
-[ t ]
+{ t }
[
"abc" <string-reader> 3 limit-stream unlimit-stream
"abc" <string-reader> =
] unit-test
-[ t ]
+{ t }
[
"abc" <string-reader> 3 limit-stream unlimit-stream
"abc" <string-reader> =
] unit-test
-[ t ]
+{ t }
[
[
"resource:license.txt" utf8 <file-reader> &dispose
] with-destructors
] unit-test
-[ "asdf" ] [
+{ "asdf" } [
"asdf" <string-reader> 2 <limited-stream> [
unlimited-input contents
] with-input-stream
] unit-test
-[ "asdf" ] [
+{ "asdf" } [
"asdf" <string-reader> 2 <limited-stream> [
[ contents ] with-unlimited-input
] with-input-stream
] unit-test
-[ "gh" ] [
+{ "gh" } [
"asdfgh" <string-reader> 4 <limited-stream> [
2 [
[ contents drop ] with-unlimited-input
tools.test ;
IN: io.streams.string.tests
-[ "" ] [ "" [ contents ] with-string-reader ] unit-test
+{ "" } [ "" [ contents ] with-string-reader ] unit-test
-[ "line 1" CHAR: l ]
+{ "line 1" CHAR: l }
[
"line 1\nline 2\nline 3" [ readln read1 ] with-string-reader
]
"\rfoo\r\nbar\rbaz\n" [ lines ] with-string-reader
] unit-test
-[ f ] [ "" [ readln ] with-string-reader ] unit-test
+{ f } [ "" [ readln ] with-string-reader ] unit-test
-[ "xyzzy" ] [ [ "xyzzy" write ] with-string-writer ] unit-test
+{ "xyzzy" } [ [ "xyzzy" write ] with-string-writer ] unit-test
-[ "a" ] [ "abc" [ 1 read ] with-string-reader ] unit-test
-[ "ab" ] [ "abc" [ 2 read ] with-string-reader ] unit-test
-[ "abc" ] [ "abc" [ 3 read ] with-string-reader ] unit-test
-[ "abc" ] [ "abc" [ 4 read ] with-string-reader ] unit-test
-[ "abc" f ] [ "abc" [ 3 read read1 ] with-string-reader ] unit-test
+{ "a" } [ "abc" [ 1 read ] with-string-reader ] unit-test
+{ "ab" } [ "abc" [ 2 read ] with-string-reader ] unit-test
+{ "abc" } [ "abc" [ 3 read ] with-string-reader ] unit-test
+{ "abc" } [ "abc" [ 4 read ] with-string-reader ] unit-test
+{ "abc" f } [ "abc" [ 3 read read1 ] with-string-reader ] unit-test
-[
+{
{ "It seems " CHAR: J }
{ "obs has lost h" CHAR: i }
{ "s grasp on reality again.\n" f }
-] [
+} [
"It seems Jobs has lost his grasp on reality again.\n" [
"J" read-until 2array
"i" read-until 2array
{ "" CHAR: \r } [ "\r\n" [ "\r" read-until ] with-string-reader ] unit-test
{ f f } [ "" [ "\r" read-until ] with-string-reader ] unit-test
-[ "hello" "hi" ] [
+{ "hello" "hi" } [
"hello\nhi" [ readln 2 read ] with-string-reader
] unit-test
-[ "hello" "hi" ] [
+{ "hello" "hi" } [
"hello\r\nhi" [ readln 2 read ] with-string-reader
] unit-test
-[ "hello" "hi" ] [
+{ "hello" "hi" } [
"hello\rhi" [ readln 2 read ] with-string-reader
] unit-test
! Issue #70 github
-[ f ] [ "" [ 0 read ] with-string-reader ] unit-test
-[ f ] [ "" [ 1 read ] with-string-reader ] unit-test
-[ f ] [ "" [ readln ] with-string-reader ] unit-test
-[ "\"\"" ] [ "\"\"" [ readln ] with-string-reader ] unit-test
+{ f } [ "" [ 0 read ] with-string-reader ] unit-test
+{ f } [ "" [ 1 read ] with-string-reader ] unit-test
+{ f } [ "" [ readln ] with-string-reader ] unit-test
+{ "\"\"" } [ "\"\"" [ readln ] with-string-reader ] unit-test
io.streams.throwing kernel namespaces tools.test ;
IN: io.streams.throwing.tests
-[ "asdf" ]
+{ "asdf" }
[
"asdf" [ [ 6 read-partial ] throw-on-eof ] with-string-reader
] unit-test
"asdf" [ [ 4 read 4 read ] throw-on-eof ] with-string-reader
] [ stream-exhausted? ] must-fail-with
-[ "as" "df" ] [
+{ "as" "df" } [
"asdf" [ [ 2 read ] throw-on-eof 3 read ] with-string-reader
] unit-test
-[ "as" "df\n" ] [
+{ "as" "df\n" } [
"vocab:io/streams/throwing/asdf.txt" utf8 [
[ 2 read ] throw-on-eof 20 read
] with-file-reader
] unit-test
-[ B{ 0 1 2 3 } B{ 0 1 2 3 } ] [
+{ B{ 0 1 2 3 } B{ 0 1 2 3 } } [
B{ 0 1 2 3 } binary [
[ 4 read 0 seek-absolute seek-input 4 read ] throw-on-eof
] with-byte-reader
] with-byte-reader
] [ stream-exhausted? ] must-fail-with
-[ "asd" CHAR: f ] [
+{ "asd" CHAR: f } [
"asdf" [ [ "f" read-until ] throw-on-eof ] with-string-reader
] unit-test
{ """">json"""" } [ \ >json >json ] unit-test
-[ { 0.5 } ] [ { 1/2 } >json json> ] unit-test
+{ { 0.5 } } [ { 1/2 } >json json> ] unit-test
TUPLE: person first-name age ;
-[ "{\"first-name\":\"David\",\"age\":32}" ]
+{ "{\"first-name\":\"David\",\"age\":32}" }
[
f json-friendly-keys?
[ "David" 32 person boa >json ]
with-variable
] unit-test
-[ "{\"first_name\":\"David\",\"age\":32}" ]
+{ "{\"first_name\":\"David\",\"age\":32}" }
[
t json-friendly-keys?
[ "David" 32 person boa >json ]
USING: lists.lazy.examples lists.lazy lists tools.test ;
IN: lists.lazy.examples.tests
-[ { 1 3 5 7 } ] [ 4 odds ltake list>array ] unit-test
-[ { 0 1 4 9 16 } ] [ first-five-squares ] unit-test
+{ { 1 3 5 7 } } [ 4 odds ltake list>array ] unit-test
+{ { 0 1 4 9 16 } } [ first-five-squares ] unit-test
lists.lazy math sequences tools.test ;
IN: lists.lazy.tests
-[ { 1 2 3 4 } ] [
+{ { 1 2 3 4 } } [
{ 1 2 3 4 } >list list>array
] unit-test
-[ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } ] [
+{ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } } [
{ 1 2 3 } >list { 4 5 } >list 2list lcartesian-product* list>array
] unit-test
-[ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } ] [
+{ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } } [
{ 1 2 3 } >list { 4 5 } >list lcartesian-product list>array
] unit-test
-[ { 5 6 6 7 7 8 } ] [
+{ { 5 6 6 7 7 8 } } [
{ 1 2 3 } >list { 4 5 } >list 2list [ first2 + ] lcomp list>array
] unit-test
-[ { 5 6 7 8 } ] [
+{ { 5 6 7 8 } } [
{ 1 2 3 } >list { 4 5 } >list 2list { [ first odd? ] } [ first2 + ] lcomp* list>array
] unit-test
-[ { 4 5 6 } ] [
+{ { 4 5 6 } } [
3 { 1 2 3 } >list [ + ] with lazy-map list>array
] unit-test
-[ { 1 2 4 8 16 } ] [
+{ { 1 2 4 8 16 } } [
5 1 [ 2 * ] lfrom-by ltake list>array
] unit-test
[ [ drop ] leach ] must-infer
[ lnth ] must-infer
-[ { 1 2 3 } ] [ { 1 2 3 4 5 } >list [ 2 > ] luntil list>array ] unit-test
+{ { 1 2 3 } } [ { 1 2 3 4 5 } >list [ 2 > ] luntil list>array ] unit-test
-[ ] [
+{ } [
"resource:license.txt" utf8 <file-reader> [
llines list>array drop
] with-disposal
] unit-test
-[ ] [
+{ } [
"resource:license.txt" utf8 <file-reader> [
lcontents list>array drop
] with-disposal
\ get-local-test-1 def>> must-infer
-[ 3 ] [ get-local-test-1 ] unit-test
+{ 3 } [ get-local-test-1 ] unit-test
: get-local-test-2 ( -- x ) 3 4 2 load-locals -1 get-local 2 drop-locals ;
\ get-local-test-2 def>> must-infer
-[ 3 ] [ get-local-test-2 ] unit-test
+{ 3 } [ get-local-test-2 ] unit-test
USING: macros.expander tools.test math combinators.short-circuit
kernel combinators ;
-[ t ] [ 20 [ { [ integer? ] [ even? ] [ 10 > ] } 1&& ] expand-macros call ] unit-test
+{ t } [ 20 [ { [ integer? ] [ even? ] [ 10 > ] } 1&& ] expand-macros call ] unit-test
-[ f ] [ 15 [ { [ integer? ] [ even? ] [ 10 > ] } 1&& ] expand-macros call ] unit-test
+{ f } [ 15 [ { [ integer? ] [ even? ] [ 10 > ] } 1&& ] expand-macros call ] unit-test
-[ f ] [ 5.0 [ { [ integer? ] [ even? ] [ 10 > ] } 1&& ] expand-macros call ] unit-test
+{ f } [ 5.0 [ { [ integer? ] [ even? ] [ 10 > ] } 1&& ] expand-macros call ] unit-test
-[ [ no-case ] ] [ [ { } case ] expand-macros ] unit-test
+{ [ no-case ] } [ [ { } case ] expand-macros ] unit-test
USING: tools.test math math.bits sequences arrays ;
IN: math.bits.tests
-[ t ] [ 0b111111 3 <bits> second ] unit-test
-[ { t t t } ] [ 0b111111 3 <bits> >array ] unit-test
-[ f ] [ 0b111101 3 <bits> second ] unit-test
-[ { f f t } ] [ 0b111100 3 <bits> >array ] unit-test
-[ 3 ] [ 0b111111 3 <bits> length ] unit-test
-[ 6 ] [ 0b111111 make-bits length ] unit-test
-[ 0 ] [ 0 make-bits length ] unit-test
-[ 2 ] [ 3 make-bits length ] unit-test
-[ 1 ] [ 1 make-bits length ] unit-test
+{ t } [ 0b111111 3 <bits> second ] unit-test
+{ { t t t } } [ 0b111111 3 <bits> >array ] unit-test
+{ f } [ 0b111101 3 <bits> second ] unit-test
+{ { f f t } } [ 0b111100 3 <bits> >array ] unit-test
+{ 3 } [ 0b111111 3 <bits> length ] unit-test
+{ 6 } [ 0b111111 make-bits length ] unit-test
+{ 0 } [ 0 make-bits length ] unit-test
+{ 2 } [ 3 make-bits length ] unit-test
+{ 1 } [ 1 make-bits length ] unit-test
[ -3 make-bits length ] [ non-negative-integer-expected? ] must-fail-with
! Odd bug
-[ t ] [
+{ t } [
1067811677921310779 make-bits
1067811677921310779 >bignum make-bits
sequence=
] unit-test
-[ t ] [
+{ t } [
1067811677921310779 make-bits last
] unit-test
-[ t ] [
+{ t } [
1067811677921310779 >bignum make-bits last
] unit-test
-[ 6 ] [ 6 make-bits bits>number ] unit-test
-[ 6 ] [ 6 3 <bits> >array bits>number ] unit-test
+{ 6 } [ 6 make-bits bits>number ] unit-test
+{ 6 } [ 6 3 <bits> >array bits>number ] unit-test
SPECIALIZED-ARRAY: int
IN: math.bitwise.tests
-[ 0 ] [ 1 0 0 bitroll ] unit-test
-[ 1 ] [ 1 0 1 bitroll ] unit-test
-[ 1 ] [ 1 1 1 bitroll ] unit-test
-[ 1 ] [ 1 0 2 bitroll ] unit-test
-[ 1 ] [ 1 0 1 bitroll ] unit-test
-[ 1 ] [ 1 20 2 bitroll ] unit-test
-[ 1 ] [ 1 8 8 bitroll ] unit-test
-[ 1 ] [ 1 -8 8 bitroll ] unit-test
-[ 1 ] [ 1 -32 8 bitroll ] unit-test
-[ 128 ] [ 1 -1 8 bitroll ] unit-test
-[ 8 ] [ 1 3 32 bitroll ] unit-test
-
-[ 0 ] [ { } bitfield ] unit-test
-[ 256 ] [ 1 { 8 } bitfield ] unit-test
-[ 268 ] [ 3 1 { 8 2 } bitfield ] unit-test
-[ 268 ] [ 1 { 8 { 3 2 } } bitfield ] unit-test
+{ 0 } [ 1 0 0 bitroll ] unit-test
+{ 1 } [ 1 0 1 bitroll ] unit-test
+{ 1 } [ 1 1 1 bitroll ] unit-test
+{ 1 } [ 1 0 2 bitroll ] unit-test
+{ 1 } [ 1 0 1 bitroll ] unit-test
+{ 1 } [ 1 20 2 bitroll ] unit-test
+{ 1 } [ 1 8 8 bitroll ] unit-test
+{ 1 } [ 1 -8 8 bitroll ] unit-test
+{ 1 } [ 1 -32 8 bitroll ] unit-test
+{ 128 } [ 1 -1 8 bitroll ] unit-test
+{ 8 } [ 1 3 32 bitroll ] unit-test
+
+{ 0 } [ { } bitfield ] unit-test
+{ 256 } [ 1 { 8 } bitfield ] unit-test
+{ 268 } [ 3 1 { 8 2 } bitfield ] unit-test
+{ 268 } [ 1 { 8 { 3 2 } } bitfield ] unit-test
: test-1+ ( x -- y ) 1 + ;
-[ 512 ] [ 1 { { test-1+ 8 } } bitfield ] unit-test
+{ 512 } [ 1 { { test-1+ 8 } } bitfield ] unit-test
-[ 8 ] [ 0 3 toggle-bit ] unit-test
-[ 0 ] [ 8 3 toggle-bit ] unit-test
+{ 8 } [ 0 3 toggle-bit ] unit-test
+{ 0 } [ 8 3 toggle-bit ] unit-test
-[ 4 ] [ 0b1010101 bit-count ] unit-test
-[ 0 ] [ 0b0 bit-count ] unit-test
-[ 1 ] [ 0b1 bit-count ] unit-test
-[ 2 ] [ B{ 1 1 } bit-count ] unit-test
-[ 64 ] [ 0xffffffffffffffff bit-count ] unit-test
+{ 4 } [ 0b1010101 bit-count ] unit-test
+{ 0 } [ 0b0 bit-count ] unit-test
+{ 1 } [ 0b1 bit-count ] unit-test
+{ 2 } [ B{ 1 1 } bit-count ] unit-test
+{ 64 } [ 0xffffffffffffffff bit-count ] unit-test
STRUCT: bit-count-struct { a uint } ;
-[ 2 ] [ S{ bit-count-struct { a 3 } } bit-count ] unit-test
+{ 2 } [ S{ bit-count-struct { a 3 } } bit-count ] unit-test
SPECIALIZED-ARRAY: uint
SPECIALIZED-ARRAY: uint-4
-[ 1 ] [ uint-4{ 1 0 0 0 } bit-count ] unit-test
+{ 1 } [ uint-4{ 1 0 0 0 } bit-count ] unit-test
-[ 1 ] [
+{ 1 } [
[
2 int malloc-array &free 1 0 pick set-nth bit-count
] with-destructors
] unit-test
-[ 1 ] [ B{ 1 0 0 } bit-count ] unit-test
-[ 3 ] [ B{ 1 1 1 } bit-count ] unit-test
+{ 1 } [ B{ 1 0 0 } bit-count ] unit-test
+{ 3 } [ B{ 1 1 1 } bit-count ] unit-test
-[ t ] [ 0b0 even-parity? ] unit-test
-[ f ] [ 0b1 even-parity? ] unit-test
-[ f ] [ 0b0 odd-parity? ] unit-test
-[ t ] [ 0b1 odd-parity? ] unit-test
+{ t } [ 0b0 even-parity? ] unit-test
+{ f } [ 0b1 even-parity? ] unit-test
+{ f } [ 0b0 odd-parity? ] unit-test
+{ t } [ 0b1 odd-parity? ] unit-test
-[ -1 ] [ 0xff 4 >signed ] unit-test
-[ -1 ] [ 0xff 8 >signed ] unit-test
-[ 255 ] [ 0xff 16 >signed ] unit-test
+{ -1 } [ 0xff 4 >signed ] unit-test
+{ -1 } [ 0xff 8 >signed ] unit-test
+{ 255 } [ 0xff 16 >signed ] unit-test
-[ 2 ] [ 3 >even ] unit-test
-[ 3 ] [ 3 >odd ] unit-test
-[ 5 ] [ 4 >odd ] unit-test
+{ 2 } [ 3 >even ] unit-test
+{ 3 } [ 3 >odd ] unit-test
+{ 5 } [ 4 >odd ] unit-test
-[ t ] [ 0b111 0b110 mask? ] unit-test
-[ f ] [ 0b101 0b110 mask? ] unit-test
-[ t ] [ 0xff 1 mask? ] unit-test
-[ f ] [ 0x0 1 mask? ] unit-test
+{ t } [ 0b111 0b110 mask? ] unit-test
+{ f } [ 0b101 0b110 mask? ] unit-test
+{ t } [ 0xff 1 mask? ] unit-test
+{ f } [ 0x0 1 mask? ] unit-test
-[ 7 ] [ 5 next-odd ] unit-test
-[ 7 ] [ 6 next-odd ] unit-test
+{ 7 } [ 5 next-odd ] unit-test
+{ 7 } [ 6 next-odd ] unit-test
-[ 6 ] [ 5 next-even ] unit-test
-[ 8 ] [ 6 next-even ] unit-test
+{ 6 } [ 5 next-even ] unit-test
+{ 8 } [ 6 next-even ] unit-test
[ -1 bit-count ] [ non-negative-integer-expected? ] must-fail-with
[ -1 bit-length ] [ non-negative-integer-expected? ] must-fail-with
math.combinatorics.private tools.test sequences ;
IN: math.combinatorics.tests
-[ 1 ] [ -1 factorial ] unit-test ! required by other math.combinatorics words
-[ 1 ] [ 0 factorial ] unit-test
-[ 1 ] [ 1 factorial ] unit-test
-[ 3628800 ] [ 10 factorial ] unit-test
-
-[ 1 ] [ 3 0 nPk ] unit-test
-[ 6 ] [ 3 2 nPk ] unit-test
-[ 6 ] [ 3 3 nPk ] unit-test
-[ 0 ] [ 3 4 nPk ] unit-test
-[ 311875200 ] [ 52 5 nPk ] unit-test
-[ 672151459757865654763838640470031391460745878674027315200000000000 ] [ 52 47 nPk ] unit-test
-
-[ 1 ] [ 3 0 nCk ] unit-test
-[ 3 ] [ 3 2 nCk ] unit-test
-[ 1 ] [ 3 3 nCk ] unit-test
-[ 0 ] [ 3 4 nCk ] unit-test
-[ 2598960 ] [ 52 5 nCk ] unit-test
-[ 2598960 ] [ 52 47 nCk ] unit-test
-
-
-[ { } ] [ 0 factoradic ] unit-test
-[ { 1 0 } ] [ 1 factoradic ] unit-test
-[ { 1 1 0 3 0 1 0 } ] [ 859 factoradic ] unit-test
-
-[ { 0 1 2 3 } ] [ { 0 0 0 0 } >permutation ] unit-test
-[ { 0 1 3 2 } ] [ { 0 0 1 0 } >permutation ] unit-test
-[ { 1 2 0 6 3 5 4 } ] [ { 1 1 0 3 0 1 0 } >permutation ] unit-test
-
-[ { 0 1 2 3 } ] [ 0 4 iota permutation-indices ] unit-test
-[ { 0 1 3 2 } ] [ 1 4 iota permutation-indices ] unit-test
-[ { 1 2 0 6 3 5 4 } ] [ 859 7 iota permutation-indices ] unit-test
-
-[ { "a" "b" "c" "d" } ] [ 0 { "a" "b" "c" "d" } permutation ] unit-test
-[ { "d" "c" "b" "a" } ] [ 23 { "a" "b" "c" "d" } permutation ] unit-test
-[ { "d" "a" "b" "c" } ] [ 18 { "a" "b" "c" "d" } permutation ] unit-test
-
-[ { { "a" "b" "c" } { "a" "c" "b" }
+{ 1 } [ -1 factorial ] unit-test ! required by other math.combinatorics words
+{ 1 } [ 0 factorial ] unit-test
+{ 1 } [ 1 factorial ] unit-test
+{ 3628800 } [ 10 factorial ] unit-test
+
+{ 1 } [ 3 0 nPk ] unit-test
+{ 6 } [ 3 2 nPk ] unit-test
+{ 6 } [ 3 3 nPk ] unit-test
+{ 0 } [ 3 4 nPk ] unit-test
+{ 311875200 } [ 52 5 nPk ] unit-test
+{ 672151459757865654763838640470031391460745878674027315200000000000 } [ 52 47 nPk ] unit-test
+
+{ 1 } [ 3 0 nCk ] unit-test
+{ 3 } [ 3 2 nCk ] unit-test
+{ 1 } [ 3 3 nCk ] unit-test
+{ 0 } [ 3 4 nCk ] unit-test
+{ 2598960 } [ 52 5 nCk ] unit-test
+{ 2598960 } [ 52 47 nCk ] unit-test
+
+
+{ { } } [ 0 factoradic ] unit-test
+{ { 1 0 } } [ 1 factoradic ] unit-test
+{ { 1 1 0 3 0 1 0 } } [ 859 factoradic ] unit-test
+
+{ { 0 1 2 3 } } [ { 0 0 0 0 } >permutation ] unit-test
+{ { 0 1 3 2 } } [ { 0 0 1 0 } >permutation ] unit-test
+{ { 1 2 0 6 3 5 4 } } [ { 1 1 0 3 0 1 0 } >permutation ] unit-test
+
+{ { 0 1 2 3 } } [ 0 4 iota permutation-indices ] unit-test
+{ { 0 1 3 2 } } [ 1 4 iota permutation-indices ] unit-test
+{ { 1 2 0 6 3 5 4 } } [ 859 7 iota permutation-indices ] unit-test
+
+{ { "a" "b" "c" "d" } } [ 0 { "a" "b" "c" "d" } permutation ] unit-test
+{ { "d" "c" "b" "a" } } [ 23 { "a" "b" "c" "d" } permutation ] unit-test
+{ { "d" "a" "b" "c" } } [ 18 { "a" "b" "c" "d" } permutation ] unit-test
+
+{ { { "a" "b" "c" } { "a" "c" "b" }
{ "b" "a" "c" } { "b" "c" "a" }
- { "c" "a" "b" } { "c" "b" "a" } } ] [ { "a" "b" "c" } all-permutations ] unit-test
+ { "c" "a" "b" } { "c" "b" "a" } } } [ { "a" "b" "c" } all-permutations ] unit-test
-[ { 0 1 2 } ] [ { "a" "b" "c" } inverse-permutation ] unit-test
-[ { 2 1 0 } ] [ { "c" "b" "a" } inverse-permutation ] unit-test
-[ { 3 0 2 1 } ] [ { 12 45 34 2 } inverse-permutation ] unit-test
+{ { 0 1 2 } } [ { "a" "b" "c" } inverse-permutation ] unit-test
+{ { 2 1 0 } } [ { "c" "b" "a" } inverse-permutation ] unit-test
+{ { 3 0 2 1 } } [ { 12 45 34 2 } inverse-permutation ] unit-test
-[ "" ] [ "" next-permutation ] unit-test
-[ "1" ] [ "1" next-permutation ] unit-test
-[ "21" ] [ "12" next-permutation ] unit-test
-[ "8344112666" ] [ "8342666411" next-permutation ] unit-test
-[ "ABC" "ACB" "BAC" "BCA" "CAB" "CBA" "ABC" ]
+{ "" } [ "" next-permutation ] unit-test
+{ "1" } [ "1" next-permutation ] unit-test
+{ "21" } [ "12" next-permutation ] unit-test
+{ "8344112666" } [ "8342666411" next-permutation ] unit-test
+{ "ABC" "ACB" "BAC" "BCA" "CAB" "CBA" "ABC" }
[ "ABC" 6 [ dup dup clone-like next-permutation ] times ] unit-test
-[ { 0 1 2 } ] [ 0 3 5 combination-indices ] unit-test
-[ { 2 3 4 } ] [ 9 3 5 combination-indices ] unit-test
+{ { 0 1 2 } } [ 0 3 5 combination-indices ] unit-test
+{ { 2 3 4 } } [ 9 3 5 combination-indices ] unit-test
-[ { "a" "b" "c" } ] [ 0 { "a" "b" "c" "d" "e" } 3 combination ] unit-test
-[ { "c" "d" "e" } ] [ 9 { "a" "b" "c" "d" "e" } 3 combination ] unit-test
+{ { "a" "b" "c" } } [ 0 { "a" "b" "c" "d" "e" } 3 combination ] unit-test
+{ { "c" "d" "e" } } [ 9 { "a" "b" "c" "d" "e" } 3 combination ] unit-test
-[ { { "a" "b" } { "a" "c" }
+{ { { "a" "b" } { "a" "c" }
{ "a" "d" } { "b" "c" }
- { "b" "d" } { "c" "d" } } ] [ { "a" "b" "c" "d" } 2 all-combinations ] unit-test
+ { "b" "d" } { "c" "d" } } } [ { "a" "b" "c" "d" } 2 all-combinations ] unit-test
-[ { { } } ] [ { } all-subsets ] unit-test
+{ { { } } } [ { } all-subsets ] unit-test
-[ { { } { 1 } { 2 } { 3 } { 1 2 } { 1 3 } { 2 3 } { 1 2 3 } } ]
+{ { { } { 1 } { 2 } { 3 } { 1 2 } { 1 3 } { 2 3 } { 1 2 3 } } }
[ { 1 2 3 } all-subsets ] unit-test
-[ { } ] [ { 1 2 } 0 selections ] unit-test
+{ { } } [ { 1 2 } 0 selections ] unit-test
-[ { { 1 } { 2 } } ] [ { 1 2 } 1 selections ] unit-test
-[ { { { 1 } } { 2 } } ] [ { { 1 } 2 } 1 selections ] unit-test
+{ { { 1 } { 2 } } } [ { 1 2 } 1 selections ] unit-test
+{ { { { 1 } } { 2 } } } [ { { 1 } 2 } 1 selections ] unit-test
-[ { { 1 1 } { 1 2 } { 2 1 } { 2 2 } } ]
+{ { { 1 1 } { 1 2 } { 2 1 } { 2 2 } } }
[ { 1 2 } 2 selections ] unit-test
-[ { { 1 1 1 } { 1 1 2 } { 1 2 1 } { 1 2 2 }
- { 2 1 1 } { 2 1 2 } { 2 2 1 } { 2 2 2 } } ]
+{ { { 1 1 1 } { 1 1 2 } { 1 2 1 } { 1 2 2 }
+ { 2 1 1 } { 2 1 2 } { 2 2 1 } { 2 2 2 } } }
[ { 1 2 } 3 selections ] unit-test
{ { "aa" "ab" "ac" "ba" "bb" "bc" "ca" "cb" "cc" } }
[ 1 C{ 0 1 } rect> ] must-fail
[ C{ 0 1 } 1 rect> ] must-fail
-[ f ] [ C{ 5 12.5 } 5 = ] unit-test
-[ f ] [ C{ 5 12.5 } 5 number= ] unit-test
+{ f } [ C{ 5 12.5 } 5 = ] unit-test
+{ f } [ C{ 5 12.5 } 5 number= ] unit-test
-[ f ] [ C{ 1.0 2.0 } C{ 1 2 } = ] unit-test
-[ t ] [ C{ 1.0 2.0 } C{ 1 2 } number= ] unit-test
+{ f } [ C{ 1.0 2.0 } C{ 1 2 } = ] unit-test
+{ t } [ C{ 1.0 2.0 } C{ 1 2 } number= ] unit-test
-[ f ] [ C{ 1.0 2.3 } C{ 1 2 } = ] unit-test
-[ f ] [ C{ 1.0 2.3 } C{ 1 2 } number= ] unit-test
+{ f } [ C{ 1.0 2.3 } C{ 1 2 } = ] unit-test
+{ f } [ C{ 1.0 2.3 } C{ 1 2 } number= ] unit-test
-[ C{ 2 5 } ] [ 2 5 rect> ] unit-test
+{ C{ 2 5 } } [ 2 5 rect> ] unit-test
{ 2 } [ 2 0 rect> ] unit-test
{ C{ 2 0.0 } } [ 2 0.0 rect> ] unit-test
-[ 2 5 ] [ C{ 2 5 } >rect ] unit-test
-[ C{ 1/2 1 } ] [ 1/2 C{ 0 1 } + ] unit-test
-[ C{ 1/2 1 } ] [ C{ 0 1 } 1/2 + ] unit-test
-[ t ] [ C{ 11 64 } C{ 11 64 } = ] unit-test
-[ C{ 2 1 } ] [ 2 C{ 0 1 } + ] unit-test
-[ C{ 2 1 } ] [ C{ 0 1 } 2 + ] unit-test
-[ C{ 5 4 } ] [ C{ 2 2 } C{ 3 2 } + ] unit-test
-[ 5 ] [ C{ 2 2 } C{ 3 -2 } + ] unit-test
-[ C{ 1.0 1 } ] [ 1.0 C{ 0 1 } + ] unit-test
-
-[ C{ 1/2 -1 } ] [ 1/2 C{ 0 1 } - ] unit-test
-[ C{ -1/2 1 } ] [ C{ 0 1 } 1/2 - ] unit-test
-[ C{ 1/3 1/4 } ] [ 1 3 / 1 2 / i* + 1 4 / i* - ] unit-test
-[ C{ -1/3 -1/4 } ] [ 1 4 / i* 1 3 / 1 2 / i* + - ] unit-test
-[ C{ 1/5 1/4 } ] [ C{ 3/5 1/2 } C{ 2/5 1/4 } - ] unit-test
-[ 4 ] [ C{ 5 10/3 } C{ 1 10/3 } - ] unit-test
-[ C{ 1.0 -1 } ] [ 1.0 C{ 0 1 } - ] unit-test
-
-[ C{ 0 1 } ] [ C{ 0 1 } 1 * ] unit-test
-[ C{ 0 1 } ] [ 1 C{ 0 1 } * ] unit-test
-[ C{ 0.0 1.0 } ] [ 1.0 C{ 0 1 } * ] unit-test
-[ -1 ] [ C{ 0 1 } C{ 0 1 } * ] unit-test
-[ C{ 0 1 } ] [ 1 C{ 0 1 } * ] unit-test
-[ C{ 0 1 } ] [ C{ 0 1 } 1 * ] unit-test
-[ C{ 0 1/2 } ] [ 1/2 C{ 0 1 } * ] unit-test
-[ C{ 0 1/2 } ] [ C{ 0 1 } 1/2 * ] unit-test
-[ 2 ] [ C{ 1 1 } C{ 1 -1 } * ] unit-test
-[ 1 ] [ C{ 0 1 } C{ 0 -1 } * ] unit-test
-
-[ -1 ] [ C{ 0 1 } C{ 0 -1 } / ] unit-test
-[ C{ 0 1 } ] [ 1 C{ 0 -1 } / ] unit-test
-[ t ] [ C{ 12 13 } C{ 13 14 } / C{ 13 14 } * C{ 12 13 } = ] unit-test
-
-[ C{ -3 4 } ] [ C{ 3 -4 } neg ] unit-test
-
-[ 5.0 ] [ C{ 3 4 } abs ] unit-test
-[ 5.0 ] [ -5.0 abs ] unit-test
+{ 2 5 } [ C{ 2 5 } >rect ] unit-test
+{ C{ 1/2 1 } } [ 1/2 C{ 0 1 } + ] unit-test
+{ C{ 1/2 1 } } [ C{ 0 1 } 1/2 + ] unit-test
+{ t } [ C{ 11 64 } C{ 11 64 } = ] unit-test
+{ C{ 2 1 } } [ 2 C{ 0 1 } + ] unit-test
+{ C{ 2 1 } } [ C{ 0 1 } 2 + ] unit-test
+{ C{ 5 4 } } [ C{ 2 2 } C{ 3 2 } + ] unit-test
+{ 5 } [ C{ 2 2 } C{ 3 -2 } + ] unit-test
+{ C{ 1.0 1 } } [ 1.0 C{ 0 1 } + ] unit-test
+
+{ C{ 1/2 -1 } } [ 1/2 C{ 0 1 } - ] unit-test
+{ C{ -1/2 1 } } [ C{ 0 1 } 1/2 - ] unit-test
+{ C{ 1/3 1/4 } } [ 1 3 / 1 2 / i* + 1 4 / i* - ] unit-test
+{ C{ -1/3 -1/4 } } [ 1 4 / i* 1 3 / 1 2 / i* + - ] unit-test
+{ C{ 1/5 1/4 } } [ C{ 3/5 1/2 } C{ 2/5 1/4 } - ] unit-test
+{ 4 } [ C{ 5 10/3 } C{ 1 10/3 } - ] unit-test
+{ C{ 1.0 -1 } } [ 1.0 C{ 0 1 } - ] unit-test
+
+{ C{ 0 1 } } [ C{ 0 1 } 1 * ] unit-test
+{ C{ 0 1 } } [ 1 C{ 0 1 } * ] unit-test
+{ C{ 0.0 1.0 } } [ 1.0 C{ 0 1 } * ] unit-test
+{ -1 } [ C{ 0 1 } C{ 0 1 } * ] unit-test
+{ C{ 0 1 } } [ 1 C{ 0 1 } * ] unit-test
+{ C{ 0 1 } } [ C{ 0 1 } 1 * ] unit-test
+{ C{ 0 1/2 } } [ 1/2 C{ 0 1 } * ] unit-test
+{ C{ 0 1/2 } } [ C{ 0 1 } 1/2 * ] unit-test
+{ 2 } [ C{ 1 1 } C{ 1 -1 } * ] unit-test
+{ 1 } [ C{ 0 1 } C{ 0 -1 } * ] unit-test
+
+{ -1 } [ C{ 0 1 } C{ 0 -1 } / ] unit-test
+{ C{ 0 1 } } [ 1 C{ 0 -1 } / ] unit-test
+{ t } [ C{ 12 13 } C{ 13 14 } / C{ 13 14 } * C{ 12 13 } = ] unit-test
+
+{ C{ -3 4 } } [ C{ 3 -4 } neg ] unit-test
+
+{ 5.0 } [ C{ 3 4 } abs ] unit-test
+{ 5.0 } [ -5.0 abs ] unit-test
! Make sure arguments are sane
-[ 0.0 ] [ 0 arg ] unit-test
-[ 0.0 ] [ 1 arg ] unit-test
-[ t ] [ -1 arg 3.14 3.15 between? ] unit-test
-[ t ] [ C{ 0 1 } arg 1.57 1.58 between? ] unit-test
-[ t ] [ C{ 0 -1 } arg -1.58 -1.57 between? ] unit-test
+{ 0.0 } [ 0 arg ] unit-test
+{ 0.0 } [ 1 arg ] unit-test
+{ t } [ -1 arg 3.14 3.15 between? ] unit-test
+{ t } [ C{ 0 1 } arg 1.57 1.58 between? ] unit-test
+{ t } [ C{ 0 -1 } arg -1.58 -1.57 between? ] unit-test
-[ 1.0 0.0 ] [ 1 >polar ] unit-test
-[ 1.0 ] [ -1 >polar drop ] unit-test
-[ t ] [ -1 >polar nip 3.14 3.15 between? ] unit-test
+{ 1.0 0.0 } [ 1 >polar ] unit-test
+{ 1.0 } [ -1 >polar drop ] unit-test
+{ t } [ -1 >polar nip 3.14 3.15 between? ] unit-test
! I broke something
-[ ] [ C{ 1 4 } tanh drop ] unit-test
-[ ] [ C{ 1 4 } tan drop ] unit-test
-[ ] [ C{ 1 4 } coth drop ] unit-test
-[ ] [ C{ 1 4 } cot drop ] unit-test
+{ } [ C{ 1 4 } tanh drop ] unit-test
+{ } [ C{ 1 4 } tan drop ] unit-test
+{ } [ C{ 1 4 } coth drop ] unit-test
+{ } [ C{ 1 4 } cot drop ] unit-test
-[ t ] [ 0.0 pi rect> e^ C{ -1 0 } 1.0e-7 ~ ] unit-test
-[ t ] [ 0 pi rect> e^ C{ -1 0 } 1.0e-7 ~ ] unit-test
+{ t } [ 0.0 pi rect> e^ C{ -1 0 } 1.0e-7 ~ ] unit-test
+{ t } [ 0 pi rect> e^ C{ -1 0 } 1.0e-7 ~ ] unit-test
10 number-base [
[ "C{ 1/2 2/3 }" ] [ C{ 1/2 2/3 } unparse ] unit-test
SPECIALIZED-ARRAY: half
IN: math.floats.half.tests
-[ 0x0000 ] [ 0.0 half>bits ] unit-test
-[ 0x8000 ] [ -0.0 half>bits ] unit-test
-[ 0x3e00 ] [ 1.5 half>bits ] unit-test
-[ 0xbe00 ] [ -1.5 half>bits ] unit-test
-[ 0x7c00 ] [ 1/0. half>bits ] unit-test
-[ 0xfc00 ] [ -1/0. half>bits ] unit-test
-[ 0x7eaa ] [ NAN: aaaaaaaaaaaaa half>bits ] unit-test
+{ 0x0000 } [ 0.0 half>bits ] unit-test
+{ 0x8000 } [ -0.0 half>bits ] unit-test
+{ 0x3e00 } [ 1.5 half>bits ] unit-test
+{ 0xbe00 } [ -1.5 half>bits ] unit-test
+{ 0x7c00 } [ 1/0. half>bits ] unit-test
+{ 0xfc00 } [ -1/0. half>bits ] unit-test
+{ 0x7eaa } [ NAN: aaaaaaaaaaaaa half>bits ] unit-test
! too-big floats overflow to infinity
-[ 0x7c00 ] [ 65536.0 half>bits ] unit-test
-[ 0xfc00 ] [ -65536.0 half>bits ] unit-test
-[ 0x7c00 ] [ 131072.0 half>bits ] unit-test
-[ 0xfc00 ] [ -131072.0 half>bits ] unit-test
+{ 0x7c00 } [ 65536.0 half>bits ] unit-test
+{ 0xfc00 } [ -65536.0 half>bits ] unit-test
+{ 0x7c00 } [ 131072.0 half>bits ] unit-test
+{ 0xfc00 } [ -131072.0 half>bits ] unit-test
! too-small floats flush to zero
-[ 0x0000 ] [ 1.0e-9 half>bits ] unit-test
-[ 0x8000 ] [ -1.0e-9 half>bits ] unit-test
-
-[ 0.0 ] [ 0x0000 bits>half ] unit-test
-[ -0.0 ] [ 0x8000 bits>half ] unit-test
-[ 1.5 ] [ 0x3e00 bits>half ] unit-test
-[ -1.5 ] [ 0xbe00 bits>half ] unit-test
-[ 1/0. ] [ 0x7c00 bits>half ] unit-test
-[ -1/0. ] [ 0xfc00 bits>half ] unit-test
-[ 3.0 ] [ 0x4200 bits>half ] unit-test
-[ t ] [ 0x7e00 bits>half fp-nan? ] unit-test
+{ 0x0000 } [ 1.0e-9 half>bits ] unit-test
+{ 0x8000 } [ -1.0e-9 half>bits ] unit-test
+
+{ 0.0 } [ 0x0000 bits>half ] unit-test
+{ -0.0 } [ 0x8000 bits>half ] unit-test
+{ 1.5 } [ 0x3e00 bits>half ] unit-test
+{ -1.5 } [ 0xbe00 bits>half ] unit-test
+{ 1/0. } [ 0x7c00 bits>half ] unit-test
+{ -1/0. } [ 0xfc00 bits>half ] unit-test
+{ 3.0 } [ 0x4200 bits>half ] unit-test
+{ t } [ 0x7e00 bits>half fp-nan? ] unit-test
STRUCT: halves
{ tom half }
{ harry half }
{ harry-jr half } ;
-[ 8 ] [ halves heap-size ] unit-test
+{ 8 } [ halves heap-size ] unit-test
-[ 3.0 ] [
+{ 3.0 } [
halves <struct>
3.0 >>dick
dick>>
] unit-test
-[ half-array{ 1.0 2.0 3.0 1/0. -1/0. } ]
+{ half-array{ 1.0 2.0 3.0 1/0. -1/0. } }
[ { 1.0 2.0 3.0 1/0. -1/0. } half >c-array ] unit-test
IN: math.functions.tests
-[ t ] [ 4 4 .00000001 ~ ] unit-test
-[ t ] [ 4.0000001 4.0000001 .000001 ~ ] unit-test
-[ f ] [ -4.0000001 4.0000001 .00001 ~ ] unit-test
-[ t ] [ -.0000000000001 0 .0000000001 ~ ] unit-test
-[ t ] [ 100 101 -.9 ~ ] unit-test
-[ f ] [ 100 120 -.09 ~ ] unit-test
-[ t ] [ 0 0 -.9 ~ ] unit-test
-[ f ] [ 0 10 -.9 ~ ] unit-test
+{ t } [ 4 4 .00000001 ~ ] unit-test
+{ t } [ 4.0000001 4.0000001 .000001 ~ ] unit-test
+{ f } [ -4.0000001 4.0000001 .00001 ~ ] unit-test
+{ t } [ -.0000000000001 0 .0000000001 ~ ] unit-test
+{ t } [ 100 101 -.9 ~ ] unit-test
+{ f } [ 100 120 -.09 ~ ] unit-test
+{ t } [ 0 0 -.9 ~ ] unit-test
+{ f } [ 0 10 -.9 ~ ] unit-test
! Lets get the argument order correct, eh?
-[ 0.0 ] [ 0.0 1.0 fatan2 ] unit-test
-[ 0.25 ] [ 2.0 -2.0 fpow ] unit-test
-
-[ 4.0 ] [ 16 sqrt ] unit-test
-[ 2.0 ] [ 4.0 0.5 ^ ] unit-test
-[ C{ 0.0 4.0 } ] [ -16 sqrt ] unit-test
-
-[ 4 ] [ 2 2 ^ ] unit-test
-[ 1/4 ] [ 2 -2 ^ ] unit-test
-[ t ] [ 2 0.5 ^ 2 ^ 2 2.00001 between? ] unit-test
-[ t ] [ e pi i* ^ real-part -1.0 = ] unit-test
-[ t ] [ e pi i* ^ imaginary-part -0.00001 0.00001 between? ] unit-test
-
-[ 1/0. ] [ 2.0 1024 ^ ] unit-test
-[ 0x1.0p-1024 ] [ 2.0 -1024 ^ ] unit-test
-
-[ t ] [ 0 0 ^ fp-nan? ] unit-test
-[ 0.0 ] [ 0.0 1.0 ^ ] unit-test
-[ 1/0. ] [ 0 -2 ^ ] unit-test
-[ t ] [ 0 0.0 ^ fp-nan? ] unit-test
-[ t ] [ 0.0 0.0 ^ fp-nan? ] unit-test
-[ 1/0. ] [ 0 -2.0 ^ ] unit-test
-[ 0 ] [ 0 3.0 ^ ] unit-test
-[ 0 ] [ 0 3 ^ ] unit-test
+{ 0.0 } [ 0.0 1.0 fatan2 ] unit-test
+{ 0.25 } [ 2.0 -2.0 fpow ] unit-test
+
+{ 4.0 } [ 16 sqrt ] unit-test
+{ 2.0 } [ 4.0 0.5 ^ ] unit-test
+{ C{ 0.0 4.0 } } [ -16 sqrt ] unit-test
+
+{ 4 } [ 2 2 ^ ] unit-test
+{ 1/4 } [ 2 -2 ^ ] unit-test
+{ t } [ 2 0.5 ^ 2 ^ 2 2.00001 between? ] unit-test
+{ t } [ e pi i* ^ real-part -1.0 = ] unit-test
+{ t } [ e pi i* ^ imaginary-part -0.00001 0.00001 between? ] unit-test
+
+{ 1/0. } [ 2.0 1024 ^ ] unit-test
+{ 0x1.0p-1024 } [ 2.0 -1024 ^ ] unit-test
+
+{ t } [ 0 0 ^ fp-nan? ] unit-test
+{ 0.0 } [ 0.0 1.0 ^ ] unit-test
+{ 1/0. } [ 0 -2 ^ ] unit-test
+{ t } [ 0 0.0 ^ fp-nan? ] unit-test
+{ t } [ 0.0 0.0 ^ fp-nan? ] unit-test
+{ 1/0. } [ 0 -2.0 ^ ] unit-test
+{ 0 } [ 0 3.0 ^ ] unit-test
+{ 0 } [ 0 3 ^ ] unit-test
: factorial ( n -- n! ) [ 1 ] [ [1,b] 1 [ * ] reduce ] if-zero ;
-[ 0.0 0 ] [ 0 frexp ] unit-test
-[ 0.5 1 ] [ 1 frexp ] unit-test
-[ -0.5 1 ] [ -1 frexp ] unit-test
-[ 0.5 2 ] [ 2 frexp ] unit-test
-[ -0.5 2 ] [ -2 frexp ] unit-test
-[ 0.75 2 ] [ 3 frexp ] unit-test
-[ -0.75 2 ] [ -3 frexp ] unit-test
-[ 0.75 0 ] [ 0.75 frexp ] unit-test
-[ -0.75 0 ] [ -0.75 frexp ] unit-test
-[ 1/0. ] [ 1/0. frexp drop ] unit-test
-[ -1/0. ] [ -1/0. frexp drop ] unit-test
-[ t ] [ 0/0. frexp drop fp-nan? ] unit-test
-[ 0.75 10,002 t ] [ 3 10,000 2^ * [ frexp ] [ bignum? ] bi ] unit-test
-[ -0.75 10,002 t ] [ -3 10,000 2^ * [ frexp ] [ bignum? ] bi ] unit-test
+{ 0.0 0 } [ 0 frexp ] unit-test
+{ 0.5 1 } [ 1 frexp ] unit-test
+{ -0.5 1 } [ -1 frexp ] unit-test
+{ 0.5 2 } [ 2 frexp ] unit-test
+{ -0.5 2 } [ -2 frexp ] unit-test
+{ 0.75 2 } [ 3 frexp ] unit-test
+{ -0.75 2 } [ -3 frexp ] unit-test
+{ 0.75 0 } [ 0.75 frexp ] unit-test
+{ -0.75 0 } [ -0.75 frexp ] unit-test
+{ 1/0. } [ 1/0. frexp drop ] unit-test
+{ -1/0. } [ -1/0. frexp drop ] unit-test
+{ t } [ 0/0. frexp drop fp-nan? ] unit-test
+{ 0.75 10,002 t } [ 3 10,000 2^ * [ frexp ] [ bignum? ] bi ] unit-test
+{ -0.75 10,002 t } [ -3 10,000 2^ * [ frexp ] [ bignum? ] bi ] unit-test
{ 0.0 } [ 0.0 1 ldexp ] unit-test
{ -0.0 } [ -0.0 1 ldexp ] unit-test
{ 49152 } [ 12 12 ldexp ] unit-test
{ 0 } [ 12 -12 ldexp ] unit-test
-[ 0.0 ] [ 1 log ] unit-test
-[ 0.0 ] [ 1.0 log ] unit-test
-[ 1.0 ] [ e log ] unit-test
+{ 0.0 } [ 1 log ] unit-test
+{ 0.0 } [ 1.0 log ] unit-test
+{ 1.0 } [ e log ] unit-test
CONSTANT: log-factorial-1000 0x1.71820d04e2eb6p12
CONSTANT: log10-factorial-1000 0x1.40f3593ed6f8ep11
-[ $ log-factorial-1000 t ] [ 1000 factorial [ log ] [ bignum? ] bi ] unit-test
-[ C{ $ log-factorial-1000 $ pi } t ] [ 1000 factorial neg [ log ] [ bignum? ] bi ] unit-test
-
-[ 0.0 ] [ 1.0 log10 ] unit-test
-[ 1.0 ] [ 10.0 log10 ] unit-test
-[ 2.0 ] [ 100.0 log10 ] unit-test
-[ 3.0 ] [ 1000.0 log10 ] unit-test
-[ 4.0 ] [ 10000.0 log10 ] unit-test
-[ $ log10-factorial-1000 t ] [ 1000 factorial [ log10 ] [ bignum? ] bi ] unit-test
-
-[ t ] [ 1 e^ e 1.e-10 ~ ] unit-test
-[ f ] [ 1 e^ 0/0. 1.e-10 ~ ] unit-test
-[ f ] [ 0/0. 1 e^ 1.e-10 ~ ] unit-test
-[ t ] [ 1.0 e^ e 1.e-10 ~ ] unit-test
-[ t ] [ -1 e^ e * 1.0 1.e-10 ~ ] unit-test
-[ f ] [ 1/0. 1/0. 1.e-10 ~ ] unit-test
-[ f ] [ 1/0. -1/0. 1.e-10 ~ ] unit-test
-[ f ] [ 1/0. 0/0. 1.e-10 ~ ] unit-test
-[ f ] [ 0/0. -1/0. 1.e-10 ~ ] unit-test
-
-[ 1.0 ] [ 0 cosh ] unit-test
-[ 1.0 ] [ 0.0 cosh ] unit-test
-[ 0.0 ] [ 1 acosh ] unit-test
-[ 0.0 ] [ 1.0 acosh ] unit-test
-
-[ 1.0 ] [ 0 cos ] unit-test
-[ 1.0 ] [ 0.0 cos ] unit-test
-[ 0.0 ] [ 1 acos ] unit-test
-[ 0.0 ] [ 1.0 acos ] unit-test
-
-[ 0.0 ] [ 0 sinh ] unit-test
-[ 0.0 ] [ 0.0 sinh ] unit-test
-[ 0.0 ] [ 0 asinh ] unit-test
-[ 0.0 ] [ 0.0 asinh ] unit-test
-
-[ 0.0 ] [ 0 sin ] unit-test
-[ 0.0 ] [ 0.0 sin ] unit-test
-[ 0.0 ] [ 0 asin ] unit-test
-[ 0.0 ] [ 0.0 asin ] unit-test
-
-[ 0.0 ] [ 0 tan ] unit-test
-[ t ] [ pi 2 / tan 1.e10 > ] unit-test
-
-[ t ] [ 10 atan real? ] unit-test
-[ t ] [ 10.0 atan real? ] unit-test
-[ f ] [ 10 atanh real? ] unit-test
-[ f ] [ 10.0 atanh real? ] unit-test
-
-[ t ] [ 10 asin sin 10 1.e-10 ~ ] unit-test
-[ t ] [ -1 sqrt neg dup acos cos 1.e-10 ~ ] unit-test
-[ t ] [ -100 atan tan -100 1.e-10 ~ ] unit-test
-[ t ] [ 10 asinh sinh 10 1.e-10 ~ ] unit-test
-[ t ] [ 10 atanh tanh 10 1.e-10 ~ ] unit-test
-[ t ] [ 0.5 atanh tanh 0.5 1.e-10 ~ ] unit-test
-
-[ 100 ] [ 100 100 gcd nip ] unit-test
-[ 100 ] [ 1000 100 gcd nip ] unit-test
-[ 100 ] [ 100 1000 gcd nip ] unit-test
-[ 4 ] [ 132 64 gcd nip ] unit-test
-[ 4 ] [ -132 64 gcd nip ] unit-test
-[ 4 ] [ -132 -64 gcd nip ] unit-test
-[ 4 ] [ 132 -64 gcd nip ] unit-test
-[ 4 ] [ -132 -64 gcd nip ] unit-test
-
-[ 100 ] [ 100 >bignum 100 >bignum gcd nip ] unit-test
-[ 100 ] [ 1000 >bignum 100 >bignum gcd nip ] unit-test
-[ 100 ] [ 100 >bignum 1000 >bignum gcd nip ] unit-test
-[ 4 ] [ 132 >bignum 64 >bignum gcd nip ] unit-test
-[ 4 ] [ -132 >bignum 64 >bignum gcd nip ] unit-test
-[ 4 ] [ -132 >bignum -64 >bignum gcd nip ] unit-test
-[ 4 ] [ 132 >bignum -64 >bignum gcd nip ] unit-test
-[ 4 ] [ -132 >bignum -64 >bignum gcd nip ] unit-test
-
-[ 6 ] [
+{ $ log-factorial-1000 t } [ 1000 factorial [ log ] [ bignum? ] bi ] unit-test
+{ C{ $ log-factorial-1000 $ pi } t } [ 1000 factorial neg [ log ] [ bignum? ] bi ] unit-test
+
+{ 0.0 } [ 1.0 log10 ] unit-test
+{ 1.0 } [ 10.0 log10 ] unit-test
+{ 2.0 } [ 100.0 log10 ] unit-test
+{ 3.0 } [ 1000.0 log10 ] unit-test
+{ 4.0 } [ 10000.0 log10 ] unit-test
+{ $ log10-factorial-1000 t } [ 1000 factorial [ log10 ] [ bignum? ] bi ] unit-test
+
+{ t } [ 1 e^ e 1.e-10 ~ ] unit-test
+{ f } [ 1 e^ 0/0. 1.e-10 ~ ] unit-test
+{ f } [ 0/0. 1 e^ 1.e-10 ~ ] unit-test
+{ t } [ 1.0 e^ e 1.e-10 ~ ] unit-test
+{ t } [ -1 e^ e * 1.0 1.e-10 ~ ] unit-test
+{ f } [ 1/0. 1/0. 1.e-10 ~ ] unit-test
+{ f } [ 1/0. -1/0. 1.e-10 ~ ] unit-test
+{ f } [ 1/0. 0/0. 1.e-10 ~ ] unit-test
+{ f } [ 0/0. -1/0. 1.e-10 ~ ] unit-test
+
+{ 1.0 } [ 0 cosh ] unit-test
+{ 1.0 } [ 0.0 cosh ] unit-test
+{ 0.0 } [ 1 acosh ] unit-test
+{ 0.0 } [ 1.0 acosh ] unit-test
+
+{ 1.0 } [ 0 cos ] unit-test
+{ 1.0 } [ 0.0 cos ] unit-test
+{ 0.0 } [ 1 acos ] unit-test
+{ 0.0 } [ 1.0 acos ] unit-test
+
+{ 0.0 } [ 0 sinh ] unit-test
+{ 0.0 } [ 0.0 sinh ] unit-test
+{ 0.0 } [ 0 asinh ] unit-test
+{ 0.0 } [ 0.0 asinh ] unit-test
+
+{ 0.0 } [ 0 sin ] unit-test
+{ 0.0 } [ 0.0 sin ] unit-test
+{ 0.0 } [ 0 asin ] unit-test
+{ 0.0 } [ 0.0 asin ] unit-test
+
+{ 0.0 } [ 0 tan ] unit-test
+{ t } [ pi 2 / tan 1.e10 > ] unit-test
+
+{ t } [ 10 atan real? ] unit-test
+{ t } [ 10.0 atan real? ] unit-test
+{ f } [ 10 atanh real? ] unit-test
+{ f } [ 10.0 atanh real? ] unit-test
+
+{ t } [ 10 asin sin 10 1.e-10 ~ ] unit-test
+{ t } [ -1 sqrt neg dup acos cos 1.e-10 ~ ] unit-test
+{ t } [ -100 atan tan -100 1.e-10 ~ ] unit-test
+{ t } [ 10 asinh sinh 10 1.e-10 ~ ] unit-test
+{ t } [ 10 atanh tanh 10 1.e-10 ~ ] unit-test
+{ t } [ 0.5 atanh tanh 0.5 1.e-10 ~ ] unit-test
+
+{ 100 } [ 100 100 gcd nip ] unit-test
+{ 100 } [ 1000 100 gcd nip ] unit-test
+{ 100 } [ 100 1000 gcd nip ] unit-test
+{ 4 } [ 132 64 gcd nip ] unit-test
+{ 4 } [ -132 64 gcd nip ] unit-test
+{ 4 } [ -132 -64 gcd nip ] unit-test
+{ 4 } [ 132 -64 gcd nip ] unit-test
+{ 4 } [ -132 -64 gcd nip ] unit-test
+
+{ 100 } [ 100 >bignum 100 >bignum gcd nip ] unit-test
+{ 100 } [ 1000 >bignum 100 >bignum gcd nip ] unit-test
+{ 100 } [ 100 >bignum 1000 >bignum gcd nip ] unit-test
+{ 4 } [ 132 >bignum 64 >bignum gcd nip ] unit-test
+{ 4 } [ -132 >bignum 64 >bignum gcd nip ] unit-test
+{ 4 } [ -132 >bignum -64 >bignum gcd nip ] unit-test
+{ 4 } [ 132 >bignum -64 >bignum gcd nip ] unit-test
+{ 4 } [ -132 >bignum -64 >bignum gcd nip ] unit-test
+
+{ 6 } [
1326264299060955293181542400000006
1591517158873146351817850880000000
gcd nip
] unit-test
-[ 11 ] [
+{ 11 } [
13262642990609552931815424
159151715887314635181785
gcd nip
] unit-test
-[ 3 ] [
+{ 3 } [
13262642990609552931
1591517158873146351
gcd nip
] unit-test
-[ 26525285981219 ] [
+{ 26525285981219 } [
132626429906095
159151715887314
gcd nip
2dup gcd
[ rot * swap rem ] dip = ;
-[ t ] [ 123 124 verify-gcd ] unit-test
-[ t ] [ 50 120 verify-gcd ] unit-test
+{ t } [ 123 124 verify-gcd ] unit-test
+{ t } [ 50 120 verify-gcd ] unit-test
-[ t ] [ 0 42 divisor? ] unit-test
-[ t ] [ 42 7 divisor? ] unit-test
-[ t ] [ 42 -7 divisor? ] unit-test
-[ t ] [ 42 42 divisor? ] unit-test
-[ f ] [ 42 16 divisor? ] unit-test
+{ t } [ 0 42 divisor? ] unit-test
+{ t } [ 42 7 divisor? ] unit-test
+{ t } [ 42 -7 divisor? ] unit-test
+{ t } [ 42 42 divisor? ] unit-test
+{ f } [ 42 16 divisor? ] unit-test
-[ 3 ] [ 5 7 mod-inv ] unit-test
-[ 78572682077 ] [ 234829342 342389423843 mod-inv ] unit-test
+{ 3 } [ 5 7 mod-inv ] unit-test
+{ 78572682077 } [ 234829342 342389423843 mod-inv ] unit-test
[ 2 10 mod-inv ] must-fail
-[ t ] [ 15 37 137 ^mod 15 37 ^ 137 mod = ] unit-test
+{ t } [ 15 37 137 ^mod 15 37 ^ 137 mod = ] unit-test
-[ t ] [ 0 0 ^ fp-nan? ] unit-test
-[ 1 ] [ 10 0 ^ ] unit-test
-[ 1/8 ] [ 1/2 3 ^ ] unit-test
-[ 1/8 ] [ 2 -3 ^ ] unit-test
-[ t ] [ 1 100 shift 2 100 ^ = ] unit-test
+{ t } [ 0 0 ^ fp-nan? ] unit-test
+{ 1 } [ 10 0 ^ ] unit-test
+{ 1/8 } [ 1/2 3 ^ ] unit-test
+{ 1/8 } [ 2 -3 ^ ] unit-test
+{ t } [ 1 100 shift 2 100 ^ = ] unit-test
-[ 1 ] [ 7/8 ceiling ] unit-test
-[ 2 ] [ 3/2 ceiling ] unit-test
-[ 0 ] [ -7/8 ceiling ] unit-test
-[ -1 ] [ -3/2 ceiling ] unit-test
+{ 1 } [ 7/8 ceiling ] unit-test
+{ 2 } [ 3/2 ceiling ] unit-test
+{ 0 } [ -7/8 ceiling ] unit-test
+{ -1 } [ -3/2 ceiling ] unit-test
-[ 4.0 ] [ 4.5 truncate ] unit-test
-[ 4.0 ] [ 4.5 floor ] unit-test
-[ 5.0 ] [ 4.5 ceiling ] unit-test
+{ 4.0 } [ 4.5 truncate ] unit-test
+{ 4.0 } [ 4.5 floor ] unit-test
+{ 5.0 } [ 4.5 ceiling ] unit-test
-[ -4.0 ] [ -4.5 truncate ] unit-test
-[ -5.0 ] [ -4.5 floor ] unit-test
-[ -4.0 ] [ -4.5 ceiling ] unit-test
+{ -4.0 } [ -4.5 truncate ] unit-test
+{ -5.0 } [ -4.5 floor ] unit-test
+{ -4.0 } [ -4.5 ceiling ] unit-test
-[ -4.0 ] [ -4.0 truncate ] unit-test
-[ -4.0 ] [ -4.0 floor ] unit-test
-[ -4.0 ] [ -4.0 ceiling ] unit-test
+{ -4.0 } [ -4.0 truncate ] unit-test
+{ -4.0 } [ -4.0 floor ] unit-test
+{ -4.0 } [ -4.0 ceiling ] unit-test
-[ -5 ] [ -9/2 round ] unit-test
-[ -4 ] [ -22/5 round ] unit-test
-[ 5 ] [ 9/2 round ] unit-test
-[ 4 ] [ 22/5 round ] unit-test
+{ -5 } [ -9/2 round ] unit-test
+{ -4 } [ -22/5 round ] unit-test
+{ 5 } [ 9/2 round ] unit-test
+{ 4 } [ 22/5 round ] unit-test
-[ -5.0 ] [ -4.5 round ] unit-test
-[ -4.0 ] [ -4.4 round ] unit-test
-[ 5.0 ] [ 4.5 round ] unit-test
-[ 4.0 ] [ 4.4 round ] unit-test
+{ -5.0 } [ -4.5 round ] unit-test
+{ -4.0 } [ -4.4 round ] unit-test
+{ 5.0 } [ 4.5 round ] unit-test
+{ 4.0 } [ 4.4 round ] unit-test
-[ 6 59967 ] [ 3837888 factor-2s ] unit-test
-[ 6 -59967 ] [ -3837888 factor-2s ] unit-test
+{ 6 59967 } [ 3837888 factor-2s ] unit-test
+{ 6 -59967 } [ -3837888 factor-2s ] unit-test
-[ 1 ] [
+{ 1 } [
183009416410801897
1067811677921310779
2135623355842621559
^mod
] unit-test
-[ 1 ] [
+{ 1 } [
183009416410801897
1067811677921310779
2135623355842621559
[ >bignum ] tri@ ^mod
] unit-test
-[ 1.0 ] [ 1.0 2.5 0.0 lerp ] unit-test
-[ 2.5 ] [ 1.0 2.5 1.0 lerp ] unit-test
-[ 1.75 ] [ 1.0 2.5 0.5 lerp ] unit-test
+{ 1.0 } [ 1.0 2.5 0.0 lerp ] unit-test
+{ 2.5 } [ 1.0 2.5 1.0 lerp ] unit-test
+{ 1.75 } [ 1.0 2.5 0.5 lerp ] unit-test
-[ C{ 1 2 } ] [ C{ 1 2 } 1 ^ ] unit-test
+{ C{ 1 2 } } [ C{ 1 2 } 1 ^ ] unit-test
{ { t t t } } [
3 3 roots {
accessors math.constants fry ;
IN: math.intervals.tests
-[ empty-interval ] [ 2 2 (a,b) ] unit-test
+{ empty-interval } [ 2 2 (a,b) ] unit-test
-[ empty-interval ] [ 2 2.0 (a,b) ] unit-test
+{ empty-interval } [ 2 2.0 (a,b) ] unit-test
-[ empty-interval ] [ 2 2 [a,b) ] unit-test
+{ empty-interval } [ 2 2 [a,b) ] unit-test
-[ empty-interval ] [ 2 2 (a,b] ] unit-test
+{ empty-interval } [ 2 2 (a,b] ] unit-test
-[ empty-interval ] [ 3 2 [a,b] ] unit-test
+{ empty-interval } [ 3 2 [a,b] ] unit-test
-[ T{ interval f { 1 t } { 2 t } } ] [ 1 2 [a,b] ] unit-test
+{ T{ interval f { 1 t } { 2 t } } } [ 1 2 [a,b] ] unit-test
-[ T{ interval f { 1 t } { 2 f } } ] [ 1 2 [a,b) ] unit-test
+{ T{ interval f { 1 t } { 2 f } } } [ 1 2 [a,b) ] unit-test
-[ T{ interval f { 1 f } { 2 f } } ] [ 1 2 (a,b) ] unit-test
+{ T{ interval f { 1 f } { 2 f } } } [ 1 2 (a,b) ] unit-test
-[ T{ interval f { 1 f } { 2 t } } ] [ 1 2 (a,b] ] unit-test
+{ T{ interval f { 1 f } { 2 t } } } [ 1 2 (a,b] ] unit-test
-[ T{ interval f { 1 t } { 1 t } } ] [ 1 [a,a] ] unit-test
+{ T{ interval f { 1 t } { 1 t } } } [ 1 [a,a] ] unit-test
! Not sure how to handle NaNs yet...
! [ 1 0/0. [a,b] ] must-fail
! [ 0/0. 1 [a,b] ] must-fail
-[ t ] [ { 3 t } { 3 f } endpoint< ] unit-test
-[ t ] [ { 2 f } { 3 f } endpoint< ] unit-test
-[ f ] [ { 3 f } { 3 t } endpoint< ] unit-test
-[ t ] [ { 4 f } { 3 t } endpoint> ] unit-test
-[ f ] [ { 3 f } { 3 t } endpoint> ] unit-test
+{ t } [ { 3 t } { 3 f } endpoint< ] unit-test
+{ t } [ { 2 f } { 3 f } endpoint< ] unit-test
+{ f } [ { 3 f } { 3 t } endpoint< ] unit-test
+{ t } [ { 4 f } { 3 t } endpoint> ] unit-test
+{ f } [ { 3 f } { 3 t } endpoint> ] unit-test
-[ empty-interval ] [ 1 2 [a,b] empty-interval interval+ ] unit-test
+{ empty-interval } [ 1 2 [a,b] empty-interval interval+ ] unit-test
-[ empty-interval ] [ empty-interval 1 2 [a,b] interval+ ] unit-test
+{ empty-interval } [ empty-interval 1 2 [a,b] interval+ ] unit-test
-[ t ] [
+{ t } [
1 2 [a,b] -3 3 [a,b] interval+ -2 5 [a,b] =
] unit-test
-[ t ] [
+{ t } [
1 2 [a,b] -3 3 (a,b) interval+ -2 5 (a,b) =
] unit-test
-[ empty-interval ] [ 1 2 [a,b] empty-interval interval- ] unit-test
+{ empty-interval } [ 1 2 [a,b] empty-interval interval- ] unit-test
-[ empty-interval ] [ empty-interval 1 2 [a,b] interval- ] unit-test
+{ empty-interval } [ empty-interval 1 2 [a,b] interval- ] unit-test
-[ t ] [
+{ t } [
1 2 [a,b] 0 1 [a,b] interval- 0 2 [a,b] =
] unit-test
-[ empty-interval ] [ 1 2 [a,b] empty-interval interval* ] unit-test
+{ empty-interval } [ 1 2 [a,b] empty-interval interval* ] unit-test
-[ empty-interval ] [ empty-interval 1 2 [a,b] interval* ] unit-test
+{ empty-interval } [ empty-interval 1 2 [a,b] interval* ] unit-test
-[ t ] [
+{ t } [
1 2 [a,b] 0 4 [a,b] interval* 0 8 [a,b] =
] unit-test
-[ t ] [
+{ t } [
1 2 [a,b] -4 4 [a,b] interval* -8 8 [a,b] =
] unit-test
-[ t ] [
+{ t } [
1 2 [a,b] -0.5 0.5 [a,b] interval* -1.0 1.0 [a,b] =
] unit-test
-[ t ] [
+{ t } [
1 2 [a,b] -0.5 0.5 (a,b] interval* -1.0 1.0 (a,b] =
] unit-test
-[ t ] [
+{ t } [
-1 1 [a,b] -1 1 (a,b] interval* -1 1 [a,b] =
] unit-test
-[ t ] [ 1 2 [a,b] dup empty-interval interval-union = ] unit-test
+{ t } [ 1 2 [a,b] dup empty-interval interval-union = ] unit-test
-[ t ] [ 1 2 [a,b] empty-interval over interval-union = ] unit-test
+{ t } [ 1 2 [a,b] empty-interval over interval-union = ] unit-test
-[ t ] [
+{ t } [
0 1 (a,b) 0 1 [a,b] interval-union 0 1 [a,b] =
] unit-test
-[ t ] [
+{ t } [
0 1 (a,b) 1 2 [a,b] interval-union 0 2 (a,b] =
] unit-test
-[ t ] [
+{ t } [
0 1 (a,b) 0 1 [a,b] interval-intersect 0 1 (a,b) =
] unit-test
-[ empty-interval ] [ 0 5 [a,b] -1 [a,a] interval-intersect ] unit-test
+{ empty-interval } [ 0 5 [a,b] -1 [a,a] interval-intersect ] unit-test
-[ empty-interval ] [ 0 5 (a,b] 0 [a,a] interval-intersect ] unit-test
+{ empty-interval } [ 0 5 (a,b] 0 [a,a] interval-intersect ] unit-test
-[ empty-interval ] [ empty-interval -1 [a,a] interval-intersect ] unit-test
+{ empty-interval } [ empty-interval -1 [a,a] interval-intersect ] unit-test
-[ empty-interval ] [ 0 5 (a,b] empty-interval interval-intersect ] unit-test
+{ empty-interval } [ 0 5 (a,b] empty-interval interval-intersect ] unit-test
-[ t ] [
+{ t } [
0 1 (a,b) full-interval interval-intersect 0 1 (a,b) =
] unit-test
-[ t ] [
+{ t } [
empty-interval empty-interval interval-subset?
] unit-test
-[ t ] [
+{ t } [
empty-interval 0 1 [a,b] interval-subset?
] unit-test
-[ t ] [
+{ t } [
0 1 (a,b) 0 1 [a,b] interval-subset?
] unit-test
-[ t ] [
+{ t } [
full-interval -1/0. 1/0. [a,b] interval-subset?
] unit-test
-[ t ] [
+{ t } [
-1/0. 1/0. [a,b] full-interval interval-subset?
] unit-test
-[ f ] [
+{ f } [
full-interval 0 1/0. [a,b] interval-subset?
] unit-test
-[ t ] [
+{ t } [
0 1/0. [a,b] full-interval interval-subset?
] unit-test
-[ f ] [
+{ f } [
0 0 1 (a,b) interval-contains?
] unit-test
-[ t ] [
+{ t } [
0.5 0 1 (a,b) interval-contains?
] unit-test
-[ f ] [
+{ f } [
1 0 1 (a,b) interval-contains?
] unit-test
-[ empty-interval ] [ -1 1 (a,b) empty-interval interval/ ] unit-test
+{ empty-interval } [ -1 1 (a,b) empty-interval interval/ ] unit-test
-[ t ] [ 0 0 331 [a,b) -1775 -953 (a,b) interval/ interval-contains? ] unit-test
+{ t } [ 0 0 331 [a,b) -1775 -953 (a,b) interval/ interval-contains? ] unit-test
-[ t ] [ -1 1 (a,b) -1 1 (a,b) interval/ [-inf,inf] = ] unit-test
+{ t } [ -1 1 (a,b) -1 1 (a,b) interval/ [-inf,inf] = ] unit-test
-[ t ] [ -1 1 (a,b) 0 1 (a,b) interval/ [-inf,inf] = ] unit-test
+{ t } [ -1 1 (a,b) 0 1 (a,b) interval/ [-inf,inf] = ] unit-test
"math.ratios.private" lookup-vocab [
[ t ] [
] unit-test
] when
-[ f ] [ empty-interval interval-singleton? ] unit-test
+{ f } [ empty-interval interval-singleton? ] unit-test
-[ t ] [ 1 [a,a] interval-singleton? ] unit-test
+{ t } [ 1 [a,a] interval-singleton? ] unit-test
-[ f ] [ 1 1 [a,b) interval-singleton? ] unit-test
+{ f } [ 1 1 [a,b) interval-singleton? ] unit-test
-[ f ] [ 1 3 [a,b) interval-singleton? ] unit-test
+{ f } [ 1 3 [a,b) interval-singleton? ] unit-test
-[ f ] [ 1 1 (a,b) interval-singleton? ] unit-test
+{ f } [ 1 1 (a,b) interval-singleton? ] unit-test
-[ 2 ] [ 1 3 [a,b) interval-length ] unit-test
+{ 2 } [ 1 3 [a,b) interval-length ] unit-test
-[ 0 ] [ empty-interval interval-length ] unit-test
+{ 0 } [ empty-interval interval-length ] unit-test
-[ t ] [ 0 5 [a,b] 5 [a,a] interval<= ] unit-test
+{ t } [ 0 5 [a,b] 5 [a,a] interval<= ] unit-test
-[ incomparable ] [ empty-interval 5 [a,a] interval< ] unit-test
+{ incomparable } [ empty-interval 5 [a,a] interval< ] unit-test
-[ incomparable ] [ 5 [a,a] empty-interval interval< ] unit-test
+{ incomparable } [ 5 [a,a] empty-interval interval< ] unit-test
-[ incomparable ] [ 0 5 [a,b] 5 [a,a] interval< ] unit-test
+{ incomparable } [ 0 5 [a,b] 5 [a,a] interval< ] unit-test
-[ t ] [ 0 5 [a,b) 5 [a,a] interval< ] unit-test
+{ t } [ 0 5 [a,b) 5 [a,a] interval< ] unit-test
-[ f ] [ 0 5 [a,b] -1 [a,a] interval< ] unit-test
+{ f } [ 0 5 [a,b] -1 [a,a] interval< ] unit-test
-[ incomparable ] [ 0 5 [a,b] 1 [a,a] interval< ] unit-test
+{ incomparable } [ 0 5 [a,b] 1 [a,a] interval< ] unit-test
-[ t ] [ -1 1 (a,b) -1 [a,a] interval> ] unit-test
+{ t } [ -1 1 (a,b) -1 [a,a] interval> ] unit-test
-[ t ] [ -1 1 (a,b) -1 [a,a] interval>= ] unit-test
+{ t } [ -1 1 (a,b) -1 [a,a] interval>= ] unit-test
-[ f ] [ -1 1 (a,b) -1 [a,a] interval< ] unit-test
+{ f } [ -1 1 (a,b) -1 [a,a] interval< ] unit-test
-[ f ] [ -1 1 (a,b) -1 [a,a] interval<= ] unit-test
+{ f } [ -1 1 (a,b) -1 [a,a] interval<= ] unit-test
-[ t ] [ -1 1 (a,b] 1 [a,a] interval<= ] unit-test
+{ t } [ -1 1 (a,b] 1 [a,a] interval<= ] unit-test
-[ t ] [ -1 1 (a,b] 1 2 [a,b] interval<= ] unit-test
+{ t } [ -1 1 (a,b] 1 2 [a,b] interval<= ] unit-test
-[ incomparable ] [ -1 1 (a,b] empty-interval interval>= ] unit-test
+{ incomparable } [ -1 1 (a,b] empty-interval interval>= ] unit-test
-[ incomparable ] [ empty-interval -1 1 (a,b] interval>= ] unit-test
+{ incomparable } [ empty-interval -1 1 (a,b] interval>= ] unit-test
-[ incomparable ] [ -1 1 (a,b] 1 2 [a,b] interval>= ] unit-test
+{ incomparable } [ -1 1 (a,b] 1 2 [a,b] interval>= ] unit-test
-[ incomparable ] [ -1 1 (a,b] 1 2 [a,b] interval> ] unit-test
+{ incomparable } [ -1 1 (a,b] 1 2 [a,b] interval> ] unit-test
-[ t ] [ -1 1 (a,b] 1 2 (a,b] interval<= ] unit-test
+{ t } [ -1 1 (a,b] 1 2 (a,b] interval<= ] unit-test
-[ f ] [ 0 10 [a,b] 0 [a,a] interval< ] unit-test
+{ f } [ 0 10 [a,b] 0 [a,a] interval< ] unit-test
-[ f ] [ 0 10 [a,b] 0.0 [a,a] interval< ] unit-test
+{ f } [ 0 10 [a,b] 0.0 [a,a] interval< ] unit-test
-[ f ] [ 0.0 10 [a,b] 0 [a,a] interval< ] unit-test
+{ f } [ 0.0 10 [a,b] 0 [a,a] interval< ] unit-test
-[ f ] [ 0 10 [a,b] 10 [a,a] interval> ] unit-test
+{ f } [ 0 10 [a,b] 10 [a,a] interval> ] unit-test
-[ incomparable ] [ 0 [a,a] 0 10 [a,b] interval< ] unit-test
+{ incomparable } [ 0 [a,a] 0 10 [a,b] interval< ] unit-test
-[ incomparable ] [ 10 [a,a] 0 10 [a,b] interval> ] unit-test
+{ incomparable } [ 10 [a,a] 0 10 [a,b] interval> ] unit-test
-[ t ] [ 0 [a,a] 0 10 [a,b] interval<= ] unit-test
+{ t } [ 0 [a,a] 0 10 [a,b] interval<= ] unit-test
-[ incomparable ] [ 0 [a,a] 0 10 [a,b] interval>= ] unit-test
+{ incomparable } [ 0 [a,a] 0 10 [a,b] interval>= ] unit-test
-[ t ] [ 0 10 [a,b] 0 [a,a] interval>= ] unit-test
+{ t } [ 0 10 [a,b] 0 [a,a] interval>= ] unit-test
-[ t ] [
+{ t } [
418
418 423 [a,b)
79 893 (a,b]
interval-contains?
] unit-test
-[ t ] [ full-interval 10 10 [a,b] interval-max 10 1/0. [a,b] = ] unit-test
+{ t } [ full-interval 10 10 [a,b] interval-max 10 1/0. [a,b] = ] unit-test
-[ t ] [ full-interval 10 10 [a,b] interval-min -1/0. 10 [a,b] = ] unit-test
+{ t } [ full-interval 10 10 [a,b] interval-min -1/0. 10 [a,b] = ] unit-test
-[ t ] [ 1 100 [a,b] -1 1 [a,b] interval/i [-inf,inf] = ] unit-test
+{ t } [ 1 100 [a,b] -1 1 [a,b] interval/i [-inf,inf] = ] unit-test
! Accuracy of interval-mod
-[ t ] [ full-interval 40 40 [a,b] interval-mod -40 40 (a,b) interval-subset?
+{ t } [ full-interval 40 40 [a,b] interval-mod -40 40 (a,b) interval-subset?
] unit-test
! Interval random tester
[ [ t ] ] dip '[ 8000 iota [ drop _ comparison-test ] all? ] unit-test
] each
-[ t ] [ -10 10 [a,b] 0 100 [a,b] assume> 0 10 (a,b] = ] unit-test
+{ t } [ -10 10 [a,b] 0 100 [a,b] assume> 0 10 (a,b] = ] unit-test
-[ t ] [ -10 10 [a,b] 0 100 [a,b] assume>= 0 10 [a,b] = ] unit-test
+{ t } [ -10 10 [a,b] 0 100 [a,b] assume>= 0 10 [a,b] = ] unit-test
-[ t ] [ -10 10 [a,b] 0 100 [a,b] assume< -10 10 [a,b] = ] unit-test
+{ t } [ -10 10 [a,b] 0 100 [a,b] assume< -10 10 [a,b] = ] unit-test
-[ t ] [ -10 10 [a,b] -100 0 [a,b] assume< -10 0 [a,b) = ] unit-test
+{ t } [ -10 10 [a,b] -100 0 [a,b] assume< -10 0 [a,b) = ] unit-test
-[ t ] [ -10 10 [a,b] -100 0 [a,b] assume<= -10 0 [a,b] = ] unit-test
+{ t } [ -10 10 [a,b] -100 0 [a,b] assume<= -10 0 [a,b] = ] unit-test
-[ t ] [ -10 10 [a,b] 0 100 [a,b] assume<= -10 10 [a,b] = ] unit-test
+{ t } [ -10 10 [a,b] 0 100 [a,b] assume<= -10 10 [a,b] = ] unit-test
-[ t ] [ -10 10 [a,b] interval-abs 0 10 [a,b] = ] unit-test
+{ t } [ -10 10 [a,b] interval-abs 0 10 [a,b] = ] unit-test
-[ t ] [ full-interval interval-abs [0,inf] = ] unit-test
+{ t } [ full-interval interval-abs [0,inf] = ] unit-test
-[ t ] [ [0,inf] interval-abs [0,inf] = ] unit-test
+{ t } [ [0,inf] interval-abs [0,inf] = ] unit-test
-[ t ] [ empty-interval interval-abs empty-interval = ] unit-test
+{ t } [ empty-interval interval-abs empty-interval = ] unit-test
-[ t ] [ [0,inf] interval-sq [0,inf] = ] unit-test
+{ t } [ [0,inf] interval-sq [0,inf] = ] unit-test
! Test that commutative interval ops really are
: random-interval-or-empty ( -- obj )
USING: kernel math.matrices math.matrices.elimination
tools.test sequences ;
-[
+{
{
{ 1 0 0 0 }
{ 0 1 0 0 }
{ 0 0 1 0 }
{ 0 0 0 1 }
}
-] [
+} [
{
{ 1 0 0 0 }
{ 0 1 0 0 }
} echelon
] unit-test
-[
+{
{
{ 1 0 0 0 }
{ 0 1 0 0 }
{ 0 0 1 0 }
{ 0 0 0 1 }
}
-] [
+} [
{
{ 1 0 0 0 }
{ 1 1 0 0 }
} echelon
] unit-test
-[
+{
{
{ 1 0 0 0 }
{ 0 1 0 0 }
{ 0 0 1 0 }
{ 0 0 0 1 }
}
-] [
+} [
{
{ 1 0 0 0 }
{ 1 1 0 0 }
} echelon
] unit-test
-[
+{
{
{ 1 0 0 0 }
{ 0 1 0 0 }
{ 0 0 1 0 }
{ 0 0 0 1 }
}
-] [
+} [
{
{ 1 0 0 0 }
{ 1 1 0 0 }
} echelon
] unit-test
-[
+{
{
{ 1 0 0 0 }
{ 0 1 0 0 }
{ 0 0 0 0 }
{ 0 0 0 0 }
}
-] [
+} [
{
{ 0 1 0 0 }
{ 1 0 0 0 }
] with-matrix
] unit-test
-[
+{
{
{ 1 0 0 0 }
{ 0 1 0 0 }
{ 0 0 0 0 }
{ 0 0 0 0 }
}
-] [
+} [
{
{ 0 1 0 0 }
{ 1 0 0 0 }
} echelon
] unit-test
-[
+{
{
{ 1 0 0 0 }
{ 0 1 0 0 }
{ 0 0 0 1 }
{ 0 0 0 0 }
}
-] [
+} [
{
{ 1 0 0 0 }
{ 0 1 0 0 }
} echelon
] unit-test
-[
+{
{
{ 1 0 0 1 }
{ 0 1 0 1 }
{ 0 0 0 -1 }
{ 0 0 0 0 }
}
-] [
+} [
{
{ 0 1 0 1 }
{ 1 0 0 1 }
} echelon
] unit-test
-[
+{
2
-] [
+} [
{
{ 0 0 }
{ 0 0 }
} nullspace length
] unit-test
-[
+{
1 3
-] [
+} [
{
{ 0 1 0 1 }
{ 1 0 0 1 }
} null/rank
] unit-test
-[
+{
1 3
-] [
+} [
{
{ 0 0 0 0 0 1 0 1 }
{ 0 0 0 0 1 0 0 1 }
} null/rank
] unit-test
-[ { { 1 0 -1 } { 0 1 2 } } ]
+{ { { 1 0 -1 } { 0 1 2 } } }
[ { { 1 2 3 } { 4 5 6 } } solution ] unit-test
USING: math.matrices math.vectors tools.test math kernel ;
IN: math.matrices.tests
-[
+{
{ { 0 } { 0 } { 0 } }
-] [
+} [
3 1 zero-matrix
] unit-test
4 3 -1 eye
] unit-test
-[
+{
{ { 1 1/2 1/3 1/4 }
{ 1/2 1/3 1/4 1/5 }
{ 1/3 1/4 1/5 1/6 }
}
-] [ 3 4 hilbert-matrix ] unit-test
+} [ 3 4 hilbert-matrix ] unit-test
-[
+{
{ { 1 2 3 4 }
{ 2 1 2 3 }
{ 3 2 1 2 }
{ 4 3 2 1 } }
-] [ 4 toeplitz-matrix ] unit-test
+} [ 4 toeplitz-matrix ] unit-test
-[
+{
{ { 1 2 3 4 }
{ 2 3 4 0 }
{ 3 4 0 0 }
{ 4 0 0 0 } }
-] [ 4 hankel-matrix ] unit-test
+} [ 4 hankel-matrix ] unit-test
-[
+{
{ { 1 0 4 }
{ 0 7 0 }
{ 6 0 3 } }
-] [
+} [
{ { 1 0 0 }
{ 0 2 0 }
{ 0 0 3 } }
m+
] unit-test
-[
+{
{ { 1 0 4 }
{ 0 7 0 }
{ 6 0 3 } }
-] [
+} [
{ { 1 0 0 }
{ 0 2 0 }
{ 0 0 3 } }
m-
] unit-test
-[
+{
{ 10 20 30 }
-] [
+} [
10 { 1 2 3 } n*v
] unit-test
-[
+{
{ 3 4 }
-] [
+} [
{ { 1 0 }
{ 0 1 } }
m.v
] unit-test
-[
+{
{ 4 3 }
-] [
+} [
{ { 0 1 }
{ 1 0 } }
m.v
] unit-test
-[
+{
{ { 6 } }
-] [
+} [
{ { 3 } } { { 2 } } m.
] unit-test
-[
+{
{ { 11 } }
-] [
+} [
{ { 1 3 } } { { 5 } { 2 } } m.
] unit-test
-[
+{
{ { 28 } }
-] [
+} [
{ { 2 4 6 } }
{ { 1 }
m.
] unit-test
-[ { 0 0 1 } ] [ { 1 0 0 } { 0 1 0 } cross ] unit-test
-[ { 1 0 0 } ] [ { 0 1 0 } { 0 0 1 } cross ] unit-test
-[ { 0 1 0 } ] [ { 0 0 1 } { 1 0 0 } cross ] unit-test
-[ { 0.0 -0.707 0.707 } ] [ { 1.0 0.0 0.0 } { 0.0 0.707 0.707 } cross ] unit-test
-[ { 0 -2 2 } ] [ { -1 -1 -1 } { 1 -1 -1 } cross ] unit-test
-[ { 1 0 0 } ] [ { 1 1 0 } { 1 0 0 } proj ] unit-test
+{ { 0 0 1 } } [ { 1 0 0 } { 0 1 0 } cross ] unit-test
+{ { 1 0 0 } } [ { 0 1 0 } { 0 0 1 } cross ] unit-test
+{ { 0 1 0 } } [ { 0 0 1 } { 1 0 0 } cross ] unit-test
+{ { 0.0 -0.707 0.707 } } [ { 1.0 0.0 0.0 } { 0.0 0.707 0.707 } cross ] unit-test
+{ { 0 -2 2 } } [ { -1 -1 -1 } { 1 -1 -1 } cross ] unit-test
+{ { 1 0 0 } } [ { 1 1 0 } { 1 0 0 } proj ] unit-test
-[ { { 4181 6765 } { 6765 10946 } } ]
+{ { { 4181 6765 } { 6765 10946 } } }
[ { { 0 1 } { 1 1 } } 20 m^n ] unit-test
[ { { 0 1 } { 1 1 } } -20 m^n ] [ negative-power-matrix? ] must-fail-with
USING: math.partial-dispatch math.private
tools.test math kernel sequences ;
-[ t ] [ \ + integer fixnum math-both-known? ] unit-test
-[ t ] [ \ + bignum fixnum math-both-known? ] unit-test
-[ t ] [ \ + integer bignum math-both-known? ] unit-test
-[ t ] [ \ + float fixnum math-both-known? ] unit-test
-[ f ] [ \ + real fixnum math-both-known? ] unit-test
-[ f ] [ \ + object number math-both-known? ] unit-test
-[ f ] [ \ number= fixnum object math-both-known? ] unit-test
-[ t ] [ \ number= integer fixnum math-both-known? ] unit-test
-[ f ] [ \ >fixnum \ shift derived-ops member-eq? ] unit-test
-[ f ] [ \ >integer \ /i derived-ops member-eq? ] unit-test
-[ t ] [ \ fixnum-shift \ shift derived-ops member-eq? ] unit-test
+{ t } [ \ + integer fixnum math-both-known? ] unit-test
+{ t } [ \ + bignum fixnum math-both-known? ] unit-test
+{ t } [ \ + integer bignum math-both-known? ] unit-test
+{ t } [ \ + float fixnum math-both-known? ] unit-test
+{ f } [ \ + real fixnum math-both-known? ] unit-test
+{ f } [ \ + object number math-both-known? ] unit-test
+{ f } [ \ number= fixnum object math-both-known? ] unit-test
+{ t } [ \ number= integer fixnum math-both-known? ] unit-test
+{ f } [ \ >fixnum \ shift derived-ops member-eq? ] unit-test
+{ f } [ \ >integer \ /i derived-ops member-eq? ] unit-test
+{ t } [ \ fixnum-shift \ shift derived-ops member-eq? ] unit-test
-[ { integer fixnum } ] [ \ +-integer-fixnum integer-op-input-classes ] unit-test
-[ { fixnum fixnum } ] [ \ fixnum+ integer-op-input-classes ] unit-test
-[ { fixnum fixnum } ] [ \ fixnum+fast integer-op-input-classes ] unit-test
-[ { integer } ] [ \ bitnot integer-op-input-classes ] unit-test
+{ { integer fixnum } } [ \ +-integer-fixnum integer-op-input-classes ] unit-test
+{ { fixnum fixnum } } [ \ fixnum+ integer-op-input-classes ] unit-test
+{ { fixnum fixnum } } [ \ fixnum+fast integer-op-input-classes ] unit-test
+{ { integer } } [ \ bitnot integer-op-input-classes ] unit-test
-[ shift ] [ \ fixnum-shift generic-variant ] unit-test
-[ fixnum-shift-fast ] [ \ fixnum-shift no-overflow-variant ] unit-test
+{ shift } [ \ fixnum-shift generic-variant ] unit-test
+{ fixnum-shift-fast } [ \ fixnum-shift no-overflow-variant ] unit-test
-[ fixnum-shift-fast ] [ \ shift modular-variant ] unit-test
-[ fixnum-bitnot ] [ \ bitnot modular-variant ] unit-test
-[ fixnum+fast ] [ \ fixnum+ modular-variant ] unit-test
-[ fixnum+fast ] [ \ fixnum+fast modular-variant ] unit-test
+{ fixnum-shift-fast } [ \ shift modular-variant ] unit-test
+{ fixnum-bitnot } [ \ bitnot modular-variant ] unit-test
+{ fixnum+fast } [ \ fixnum+ modular-variant ] unit-test
+{ fixnum+fast } [ \ fixnum+fast modular-variant ] unit-test
-[ 3 ] [ 1 2 +-integer-integer ] unit-test
-[ 3 ] [ 1 >bignum 2 +-integer-integer ] unit-test
-[ 3 ] [ 1 2 >bignum +-integer-integer ] unit-test
-[ 3 ] [ 1 >bignum 2 >bignum +-integer-integer ] unit-test
+{ 3 } [ 1 2 +-integer-integer ] unit-test
+{ 3 } [ 1 >bignum 2 +-integer-integer ] unit-test
+{ 3 } [ 1 2 >bignum +-integer-integer ] unit-test
+{ 3 } [ 1 >bignum 2 >bignum +-integer-integer ] unit-test
USING: kernel math math.polynomials tools.test ;
IN: math.polynomials.tests
-[ { 0 1 } ] [ { 0 1 0 0 } ptrim ] unit-test
-[ { 1 } ] [ { 1 0 0 } ptrim ] unit-test
-[ { 0 } ] [ { 0 } ptrim ] unit-test
-[ { 3 10 8 } ] [ { 1 2 } { 3 4 } p* ] unit-test
-[ { 3 10 8 } ] [ { 3 4 } { 1 2 } p* ] unit-test
-[ { 0 0 0 0 0 0 0 0 0 0 } ] [ { 0 0 0 } { 0 0 0 0 0 0 0 0 } p* ] unit-test
-[ { 0 1 } ] [ { 0 1 } { 1 } p* ] unit-test
-[ { 0 } ] [ { } { } p* ] unit-test
-[ { 0 } ] [ { 0 } { } p* ] unit-test
-[ { 0 } ] [ { } { 0 } p* ] unit-test
-[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p+ ] unit-test
-[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p- ] unit-test
-[ { 0 0 0 } ] [ 4 { 0 0 0 } n*p ] unit-test
-[ { 4 8 0 12 } ] [ 4 { 1 2 0 3 } n*p ] unit-test
-[ { 1 4 4 0 0 } ] [ { 1 2 0 } p-sq ] unit-test
-[ { 1 6 12 8 0 0 0 } ] [ { 1 2 0 } 3 p^ ] unit-test
+{ { 0 1 } } [ { 0 1 0 0 } ptrim ] unit-test
+{ { 1 } } [ { 1 0 0 } ptrim ] unit-test
+{ { 0 } } [ { 0 } ptrim ] unit-test
+{ { 3 10 8 } } [ { 1 2 } { 3 4 } p* ] unit-test
+{ { 3 10 8 } } [ { 3 4 } { 1 2 } p* ] unit-test
+{ { 0 0 0 0 0 0 0 0 0 0 } } [ { 0 0 0 } { 0 0 0 0 0 0 0 0 } p* ] unit-test
+{ { 0 1 } } [ { 0 1 } { 1 } p* ] unit-test
+{ { 0 } } [ { } { } p* ] unit-test
+{ { 0 } } [ { 0 } { } p* ] unit-test
+{ { 0 } } [ { } { 0 } p* ] unit-test
+{ { 0 0 0 } } [ { 0 0 0 } { 0 0 0 } p+ ] unit-test
+{ { 0 0 0 } } [ { 0 0 0 } { 0 0 0 } p- ] unit-test
+{ { 0 0 0 } } [ 4 { 0 0 0 } n*p ] unit-test
+{ { 4 8 0 12 } } [ 4 { 1 2 0 3 } n*p ] unit-test
+{ { 1 4 4 0 0 } } [ { 1 2 0 } p-sq ] unit-test
+{ { 1 6 12 8 0 0 0 } } [ { 1 2 0 } 3 p^ ] unit-test
[ { 1 2 0 } -3 p^ ] [ negative-power-polynomial? ] must-fail-with
-[ { 1 } ] [ { 1 2 0 } 0 p^ ] unit-test
-[ { 1 4 7 6 0 0 0 0 0 } ] [ { 1 2 3 0 0 0 } { 1 2 0 0 } p* ] unit-test
-[ V{ 7 -2 1 } V{ -20 0 0 } ] [ { 1 1 1 1 } { 3 1 } p/mod ] unit-test
-[ V{ 0 0 } V{ 1 1 } ] [ { 1 1 } { 1 1 1 1 } p/mod ] unit-test
-[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 } p/mod ] unit-test
-[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 0 0 0 0 0 0 } p/mod ] unit-test
-[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 0 0 0 0 } { 1 1 0 0 } p/mod ] unit-test
-[ V{ 5.0 } V{ 0 } ] [ { 10.0 } { 2.0 } p/mod ] unit-test
-[ V{ 15/16 } V{ 0 } ] [ { 3/4 } { 4/5 } p/mod ] unit-test
-[ t ] [ { 0 1 } { 0 1 0 } p= ] unit-test
-[ f ] [ { 0 0 1 } { 0 1 0 } p= ] unit-test
-[ t ] [ { 1 1 1 } { 1 1 1 } p= ] unit-test
-[ { 0 0 } { 1 1 } ] [ { 1 1 1 1 } { 1 1 } pgcd ] unit-test
+{ { 1 } } [ { 1 2 0 } 0 p^ ] unit-test
+{ { 1 4 7 6 0 0 0 0 0 } } [ { 1 2 3 0 0 0 } { 1 2 0 0 } p* ] unit-test
+{ V{ 7 -2 1 } V{ -20 0 0 } } [ { 1 1 1 1 } { 3 1 } p/mod ] unit-test
+{ V{ 0 0 } V{ 1 1 } } [ { 1 1 } { 1 1 1 1 } p/mod ] unit-test
+{ V{ 1 0 1 } V{ 0 0 0 } } [ { 1 1 1 1 } { 1 1 } p/mod ] unit-test
+{ V{ 1 0 1 } V{ 0 0 0 } } [ { 1 1 1 1 } { 1 1 0 0 0 0 0 0 } p/mod ] unit-test
+{ V{ 1 0 1 } V{ 0 0 0 } } [ { 1 1 1 1 0 0 0 0 } { 1 1 0 0 } p/mod ] unit-test
+{ V{ 5.0 } V{ 0 } } [ { 10.0 } { 2.0 } p/mod ] unit-test
+{ V{ 15/16 } V{ 0 } } [ { 3/4 } { 4/5 } p/mod ] unit-test
+{ t } [ { 0 1 } { 0 1 0 } p= ] unit-test
+{ f } [ { 0 0 1 } { 0 1 0 } p= ] unit-test
+{ t } [ { 1 1 1 } { 1 1 1 } p= ] unit-test
+{ { 0 0 } { 1 1 } } [ { 1 1 1 1 } { 1 1 } pgcd ] unit-test
-[ { 10 200 3000 } ] [ { 1 10 100 1000 } pdiff ] unit-test
+{ { 10 200 3000 } } [ { 1 10 100 1000 } pdiff ] unit-test
-[ { -512 2304 -4608 5376 -4032 2016 -672 144 -18 1 } ]
+{ { -512 2304 -4608 5376 -4032 2016 -672 144 -18 1 } }
[ { -2 1 } 9 p^ ] unit-test
-[ 0 ]
+{ 0 }
[ 2 { -2 1 } 9 p^ polyval ] unit-test
USING: fry kernel math math.bitwise math.primes.erato
math.ranges sequences tools.test ;
-[ B{ 255 251 247 126 } ] [ 100 sieve ] unit-test
+{ B{ 255 251 247 126 } } [ 100 sieve ] unit-test
[ 1 100 sieve marked-prime? ] [ bounds-error? ] must-fail-with
[ 120 100 sieve marked-prime? ] [ bounds-error? ] must-fail-with
-[ f ] [ 119 100 sieve marked-prime? ] unit-test
-[ t ] [ 113 100 sieve marked-prime? ] unit-test
+{ f } [ 119 100 sieve marked-prime? ] unit-test
+{ t } [ 113 100 sieve marked-prime? ] unit-test
! There are 25997 primes below 300000. 1 must be removed and 3 5 7 added.
-[ 25997 ] [ 299999 sieve [ bit-count ] map-sum 2 + ] unit-test
+{ 25997 } [ 299999 sieve [ bit-count ] map-sum 2 + ] unit-test
! Check sieve array length logic by making sure we get the right
! end-point for numbers with all possibilities mod 30. If something
! were to go wrong, we'd get a bounds-error.
-[ ] [ 2 100 [a,b] [ dup sieve marked-prime? drop ] each ] unit-test
+{ } [ 2 100 [a,b] [ dup sieve marked-prime? drop ] each ] unit-test
{ t } [
{ 2 3 5 7 11 13 } 100 sieve '[ _ marked-prime? ] all?
USING: tools.test math.primes.lucas-lehmer ;
IN: math.primes.lucas-lehmer.tests
-[ t ] [ 2 lucas-lehmer ] unit-test
-[ t ] [ 3 lucas-lehmer ] unit-test
-[ f ] [ 4 lucas-lehmer ] unit-test
-[ t ] [ 5 lucas-lehmer ] unit-test
-[ f ] [ 6 lucas-lehmer ] unit-test
-[ f ] [ 11 lucas-lehmer ] unit-test
-[ t ] [ 13 lucas-lehmer ] unit-test
-[ t ] [ 61 lucas-lehmer ] unit-test
+{ t } [ 2 lucas-lehmer ] unit-test
+{ t } [ 3 lucas-lehmer ] unit-test
+{ f } [ 4 lucas-lehmer ] unit-test
+{ t } [ 5 lucas-lehmer ] unit-test
+{ f } [ 6 lucas-lehmer ] unit-test
+{ f } [ 11 lucas-lehmer ] unit-test
+{ t } [ 13 lucas-lehmer ] unit-test
+{ t } [ 61 lucas-lehmer ] unit-test
USING: kernel math.primes.miller-rabin sequences tools.test ;
IN: math.primes.miller-rabin.tests
-[ f ] [ 473155932665450549999756893736999469773678960651272093993257221235459777950185377130233556540099119926369437865330559863 miller-rabin ] unit-test
-[ t ] [ 2 miller-rabin ] unit-test
-[ t ] [ 3 miller-rabin ] unit-test
-[ f ] [ 36 miller-rabin ] unit-test
-[ t ] [ 37 miller-rabin ] unit-test
-[ t ] [ 2135623355842621559 miller-rabin ] unit-test
+{ f } [ 473155932665450549999756893736999469773678960651272093993257221235459777950185377130233556540099119926369437865330559863 miller-rabin ] unit-test
+{ t } [ 2 miller-rabin ] unit-test
+{ t } [ 3 miller-rabin ] unit-test
+{ f } [ 36 miller-rabin ] unit-test
+{ t } [ 37 miller-rabin ] unit-test
+{ t } [ 2135623355842621559 miller-rabin ] unit-test
-[ f ] [ 1000 iota [ drop 15 miller-rabin ] any? ] unit-test
+{ f } [ 1000 iota [ drop 15 miller-rabin ] any? ] unit-test
{ { 2 } } [ 1.5 2.5 primes-between >array ] unit-test
-[ 2 ] [ 1 next-prime ] unit-test
-[ 3 ] [ 2 next-prime ] unit-test
-[ 5 ] [ 3 next-prime ] unit-test
-[ 101 ] [ 100 next-prime ] unit-test
-[ t ] [ 2135623355842621559 miller-rabin ] unit-test
-[ 100000000000031 ] [ 100000000000000 next-prime ] unit-test
+{ 2 } [ 1 next-prime ] unit-test
+{ 3 } [ 2 next-prime ] unit-test
+{ 5 } [ 3 next-prime ] unit-test
+{ 101 } [ 100 next-prime ] unit-test
+{ t } [ 2135623355842621559 miller-rabin ] unit-test
+{ 100000000000031 } [ 100000000000000 next-prime ] unit-test
-[ 49 ] [ 50 random-prime log2 ] unit-test
+{ 49 } [ 50 random-prime log2 ] unit-test
-[ t ] [ 5000077 dup find-relative-prime coprime? ] unit-test
+{ t } [ 5000077 dup find-relative-prime coprime? ] unit-test
-[ 5 t { 14 14 14 14 14 } ]
+{ 5 t { 14 14 14 14 14 } }
[ 5 15 unique-primes [ length ] [ [ prime? ] all? ] [ [ log2 ] map ] tri ] unit-test
{ t t } [ 11 dup >bignum [ prime? ] bi@ ] unit-test
USING: math.primes.safe math.primes.safe.private tools.test ;
IN: math.primes.safe.tests
-[ 863 ] [ 862 next-safe-prime ] unit-test
-[ f ] [ 862 safe-prime? ] unit-test
-[ t ] [ 7 safe-prime? ] unit-test
-[ f ] [ 31 safe-prime? ] unit-test
-[ t ] [ 47 safe-prime-candidate? ] unit-test
-[ t ] [ 47 safe-prime? ] unit-test
-[ t ] [ 863 safe-prime? ] unit-test
+{ 863 } [ 862 next-safe-prime ] unit-test
+{ f } [ 862 safe-prime? ] unit-test
+{ t } [ 7 safe-prime? ] unit-test
+{ f } [ 31 safe-prime? ] unit-test
+{ t } [ 47 safe-prime-candidate? ] unit-test
+{ t } [ 47 safe-prime? ] unit-test
+{ t } [ 863 safe-prime? ] unit-test
-[ 47 ] [ 31 next-safe-prime ] unit-test
+{ 47 } [ 31 next-safe-prime ] unit-test
CONSTANT: qj { 0 0 1 0 }
CONSTANT: qk { 0 0 0 1 }
-[ 1.0 ] [ qi norm ] unit-test
-[ 1.0 ] [ qj norm ] unit-test
-[ 1.0 ] [ qk norm ] unit-test
-[ 1.0 ] [ q1 norm ] unit-test
-[ 0.0 ] [ q0 norm ] unit-test
-[ t ] [ qi qj q* qk = ] unit-test
-[ t ] [ qj qk q* qi = ] unit-test
-[ t ] [ qk qi q* qj = ] unit-test
-[ t ] [ qi qi q* q1 q+ q0 = ] unit-test
-[ t ] [ qj qj q* q1 q+ q0 = ] unit-test
-[ t ] [ qk qk q* q1 q+ q0 = ] unit-test
-[ t ] [ qi qj qk q* q* q1 q+ q0 = ] unit-test
-[ t ] [ qk qj q/ qi = ] unit-test
-[ t ] [ qi qk q/ qj = ] unit-test
-[ t ] [ qj qi q/ qk = ] unit-test
-[ t ] [ 1 c>q q1 = ] unit-test
-[ t ] [ C{ 0 1 } c>q qi = ] unit-test
-[ t ] [ qi qi q+ qi 2 q*n = ] unit-test
-[ t ] [ qi qi q- q0 = ] unit-test
-[ t ] [ qi qj q+ qj qi q+ = ] unit-test
-[ t ] [ qi qj q- qj qi q- -1 q*n = ] unit-test
+{ 1.0 } [ qi norm ] unit-test
+{ 1.0 } [ qj norm ] unit-test
+{ 1.0 } [ qk norm ] unit-test
+{ 1.0 } [ q1 norm ] unit-test
+{ 0.0 } [ q0 norm ] unit-test
+{ t } [ qi qj q* qk = ] unit-test
+{ t } [ qj qk q* qi = ] unit-test
+{ t } [ qk qi q* qj = ] unit-test
+{ t } [ qi qi q* q1 q+ q0 = ] unit-test
+{ t } [ qj qj q* q1 q+ q0 = ] unit-test
+{ t } [ qk qk q* q1 q+ q0 = ] unit-test
+{ t } [ qi qj qk q* q* q1 q+ q0 = ] unit-test
+{ t } [ qk qj q/ qi = ] unit-test
+{ t } [ qi qk q/ qj = ] unit-test
+{ t } [ qj qi q/ qk = ] unit-test
+{ t } [ 1 c>q q1 = ] unit-test
+{ t } [ C{ 0 1 } c>q qi = ] unit-test
+{ t } [ qi qi q+ qi 2 q*n = ] unit-test
+{ t } [ qi qi q- q0 = ] unit-test
+{ t } [ qi qj q+ qj qi q+ = ] unit-test
+{ t } [ qi qj q- qj qi q- -1 q*n = ] unit-test
-[ { 2 2 2 2 } ] [ { 1 1 1 1 } 2 q*n ] unit-test
-[ { 2 2 2 2 } ] [ 2 { 1 1 1 1 } n*q ] unit-test
+{ { 2 2 2 2 } } [ { 1 1 1 1 } 2 q*n ] unit-test
+{ { 2 2 2 2 } } [ 2 { 1 1 1 1 } n*q ] unit-test
USING: arrays kernel math math.ranges sequences sets tools.test ;
IN: math.ranges.tests
-[ { } ] [ 1 1 (a,b) >array ] unit-test
-[ { } ] [ 1 1 (a,b] >array ] unit-test
-[ { } ] [ 1 1 [a,b) >array ] unit-test
-[ { 1 } ] [ 1 1 [a,b] >array ] unit-test
+{ { } } [ 1 1 (a,b) >array ] unit-test
+{ { } } [ 1 1 (a,b] >array ] unit-test
+{ { } } [ 1 1 [a,b) >array ] unit-test
+{ { 1 } } [ 1 1 [a,b] >array ] unit-test
-[ { } ] [ 1 2 (a,b) >array ] unit-test
-[ { 2 } ] [ 1 2 (a,b] >array ] unit-test
-[ { 1 } ] [ 1 2 [a,b) >array ] unit-test
-[ { 1 2 } ] [ 1 2 [a,b] >array ] unit-test
+{ { } } [ 1 2 (a,b) >array ] unit-test
+{ { 2 } } [ 1 2 (a,b] >array ] unit-test
+{ { 1 } } [ 1 2 [a,b) >array ] unit-test
+{ { 1 2 } } [ 1 2 [a,b] >array ] unit-test
-[ { } ] [ 2 1 (a,b) >array ] unit-test
-[ { 1 } ] [ 2 1 (a,b] >array ] unit-test
-[ { 2 } ] [ 2 1 [a,b) >array ] unit-test
-[ { 2 1 } ] [ 2 1 [a,b] >array ] unit-test
+{ { } } [ 2 1 (a,b) >array ] unit-test
+{ { 1 } } [ 2 1 (a,b] >array ] unit-test
+{ { 2 } } [ 2 1 [a,b) >array ] unit-test
+{ { 2 1 } } [ 2 1 [a,b] >array ] unit-test
-[ { 1 2 3 4 5 } ] [ 1 5 1 <range> >array ] unit-test
-[ { 5 4 3 2 1 } ] [ 5 1 -1 <range> >array ] unit-test
+{ { 1 2 3 4 5 } } [ 1 5 1 <range> >array ] unit-test
+{ { 5 4 3 2 1 } } [ 5 1 -1 <range> >array ] unit-test
-[ { 0 1/3 2/3 1 } ] [ 0 1 1/3 <range> >array ] unit-test
-[ { 0 1/3 2/3 1 } ] [ 1 0 -1/3 <range> >array reverse ] unit-test
+{ { 0 1/3 2/3 1 } } [ 0 1 1/3 <range> >array ] unit-test
+{ { 0 1/3 2/3 1 } } [ 1 0 -1/3 <range> >array reverse ] unit-test
{ 0 } [ 0 -1 .0001 <range> length ] unit-test
{ 0 } [ 0 -1 .5 <range> length ] unit-test
{ 0 } [ -2 0 -3 <range> length ] unit-test
{ 0 } [ -2 0 -4 <range> length ] unit-test
-[ 100 ] [
+{ 100 } [
1 100 [a,b] [ 2^ [1,b] ] map members length
] unit-test
math.functions tools.test ;
IN: math.ratios.tests
-[ 1 2 ] [ 1/2 >fraction ] unit-test
-
-[ 1/2 ] [ 1 >bignum 2 >bignum / ] unit-test
-[ t ] [ 10 3 / ratio? ] unit-test
-[ f ] [ 10 2 / ratio? ] unit-test
-[ 10 ] [ 10 numerator ] unit-test
-[ 1 ] [ 10 denominator ] unit-test
-[ 12 ] [ -12 -13 / numerator ] unit-test
-[ 13 ] [ -12 -13 / denominator ] unit-test
-[ 1 ] [ -1 -1 / numerator ] unit-test
-[ 1 ] [ -1 -1 / denominator ] unit-test
-
-[ -1 ] [ 2 -2 / ] unit-test
-[ -1 ] [ -2 2 / ] unit-test
-
-[ t ] [ 1 3 / 1 3 / = ] unit-test
-
-[ -10 ] [ -100 10 /i ] unit-test
-[ 10 ] [ -100 -10 /i ] unit-test
-[ -10 ] [ 100 -10 /i ] unit-test
-[ -10 ] [ -100 >bignum 10 >bignum /i ] unit-test
-[ 10 ] [ -100 >bignum -10 >bignum /i ] unit-test
-[ -10 ] [ 100 >bignum -10 >bignum /i ] unit-test
-
-[ 3/2 ] [ 1 1/2 + ] unit-test
-[ 3/2 ] [ 1 >bignum 1/2 + ] unit-test
-[ -1/2 ] [ 1/2 1 - ] unit-test
-[ -1/2 ] [ 1/2 1 >bignum - ] unit-test
-[ 41/20 ] [ 5/4 4/5 + ] unit-test
-
-[ 1 ] [ 1/2 2 * ] unit-test
-[ 1/3 ] [ 1/2 2/3 * ] unit-test
-
-[ 1 ] [ 1/2 1/2 / ] unit-test
-[ 27/4 ] [ 3/2 2/9 / ] unit-test
-
-[ t ] [ 5768 476343 < ] unit-test
-[ t ] [ 5768 476343 <= ] unit-test
-[ f ] [ 5768 476343 > ] unit-test
-[ f ] [ 5768 476343 >= ] unit-test
-[ t ] [ 3434 >bignum 3434 >= ] unit-test
-[ t ] [ 3434 3434 >bignum <= ] unit-test
-
-[ t ] [ 1 1/3 > ] unit-test
-[ t ] [ 2/3 3/4 <= ] unit-test
-[ f ] [ -2/3 1/3 > ] unit-test
-
-[ t ] [ 1000000000/999999 1000 > ] unit-test
-[ f ] [ 100000 100000000000/999999 > ] unit-test
-[ t ]
+{ 1 2 } [ 1/2 >fraction ] unit-test
+
+{ 1/2 } [ 1 >bignum 2 >bignum / ] unit-test
+{ t } [ 10 3 / ratio? ] unit-test
+{ f } [ 10 2 / ratio? ] unit-test
+{ 10 } [ 10 numerator ] unit-test
+{ 1 } [ 10 denominator ] unit-test
+{ 12 } [ -12 -13 / numerator ] unit-test
+{ 13 } [ -12 -13 / denominator ] unit-test
+{ 1 } [ -1 -1 / numerator ] unit-test
+{ 1 } [ -1 -1 / denominator ] unit-test
+
+{ -1 } [ 2 -2 / ] unit-test
+{ -1 } [ -2 2 / ] unit-test
+
+{ t } [ 1 3 / 1 3 / = ] unit-test
+
+{ -10 } [ -100 10 /i ] unit-test
+{ 10 } [ -100 -10 /i ] unit-test
+{ -10 } [ 100 -10 /i ] unit-test
+{ -10 } [ -100 >bignum 10 >bignum /i ] unit-test
+{ 10 } [ -100 >bignum -10 >bignum /i ] unit-test
+{ -10 } [ 100 >bignum -10 >bignum /i ] unit-test
+
+{ 3/2 } [ 1 1/2 + ] unit-test
+{ 3/2 } [ 1 >bignum 1/2 + ] unit-test
+{ -1/2 } [ 1/2 1 - ] unit-test
+{ -1/2 } [ 1/2 1 >bignum - ] unit-test
+{ 41/20 } [ 5/4 4/5 + ] unit-test
+
+{ 1 } [ 1/2 2 * ] unit-test
+{ 1/3 } [ 1/2 2/3 * ] unit-test
+
+{ 1 } [ 1/2 1/2 / ] unit-test
+{ 27/4 } [ 3/2 2/9 / ] unit-test
+
+{ t } [ 5768 476343 < ] unit-test
+{ t } [ 5768 476343 <= ] unit-test
+{ f } [ 5768 476343 > ] unit-test
+{ f } [ 5768 476343 >= ] unit-test
+{ t } [ 3434 >bignum 3434 >= ] unit-test
+{ t } [ 3434 3434 >bignum <= ] unit-test
+
+{ t } [ 1 1/3 > ] unit-test
+{ t } [ 2/3 3/4 <= ] unit-test
+{ f } [ -2/3 1/3 > ] unit-test
+
+{ t } [ 1000000000/999999 1000 > ] unit-test
+{ f } [ 100000 100000000000/999999 > ] unit-test
+{ t }
[ 1000000000000/999999999999 1000000000001/999999999998 < ]
unit-test
-[ -3 ] [ -3 10 mod ] unit-test
-[ 7 ] [ -3 10 rem ] unit-test
-[ 7 ] [ -13 10 rem ] unit-test
-[ 0 ] [ 37 37 rem ] unit-test
+{ -3 } [ -3 10 mod ] unit-test
+{ 7 } [ -3 10 rem ] unit-test
+{ 7 } [ -13 10 rem ] unit-test
+{ 0 } [ 37 37 rem ] unit-test
-[ -1 ] [ -12.55 sgn ] unit-test
-[ 1 ] [ 100000000000000000000000000000000 sgn ] unit-test
-[ 0 ] [ 0.0 sgn ] unit-test
+{ -1 } [ -12.55 sgn ] unit-test
+{ 1 } [ 100000000000000000000000000000000 sgn ] unit-test
+{ 0 } [ 0.0 sgn ] unit-test
-[ 1/2 ] [ 1/2 1 mod ] unit-test
-[ 1/3 ] [ 10/3 3 mod ] unit-test
-[ -1/3 ] [ -10/3 3 mod ] unit-test
+{ 1/2 } [ 1/2 1 mod ] unit-test
+{ 1/3 } [ 10/3 3 mod ] unit-test
+{ -1/3 } [ -10/3 3 mod ] unit-test
{ 4 1/2 } [ 3+1/2 3/4 /mod ] unit-test
{ -4 -1/2 } [ -3-1/2 3/4 /mod ] unit-test
{ 4 -1/2 } [ -3-1/2 -3/4 /mod ] unit-test
{ -4 1/2 } [ 3+1/2 -3/4 /mod ] unit-test
-[ 5 ] [ 5 floor ] unit-test
-[ -5 ] [ -5 floor ] unit-test
-[ 6 ] [ 6 truncate ] unit-test
-[ 3 ] [ 10/3 floor ] unit-test
-[ -4 ] [ -10/3 floor ] unit-test
-[ 4 ] [ 10/3 ceiling ] unit-test
-[ -3 ] [ -10/3 ceiling ] unit-test
-[ 3 ] [ 10/3 truncate ] unit-test
-[ -3 ] [ -10/3 truncate ] unit-test
+{ 5 } [ 5 floor ] unit-test
+{ -5 } [ -5 floor ] unit-test
+{ 6 } [ 6 truncate ] unit-test
+{ 3 } [ 10/3 floor ] unit-test
+{ -4 } [ -10/3 floor ] unit-test
+{ 4 } [ 10/3 ceiling ] unit-test
+{ -3 } [ -10/3 ceiling ] unit-test
+{ 3 } [ 10/3 truncate ] unit-test
+{ -3 } [ -10/3 truncate ] unit-test
-[ -1/2 ] [ 1/2 1 - ] unit-test
-[ 3/2 ] [ 1/2 1 + ] unit-test
+{ -1/2 } [ 1/2 1 - ] unit-test
+{ 3/2 } [ 1/2 1 + ] unit-test
-[ 1.0 ] [ 0.5 1/2 + ] unit-test
-[ 1.0 ] [ 1/2 0.5 + ] unit-test
+{ 1.0 } [ 0.5 1/2 + ] unit-test
+{ 1.0 } [ 1/2 0.5 + ] unit-test
-[ 1/134217728 ] [ -1 -134217728 >fixnum / ] unit-test
-[ 134217728 ] [ -134217728 >fixnum -1 / ] unit-test
+{ 1/134217728 } [ -1 -134217728 >fixnum / ] unit-test
+{ 134217728 } [ -134217728 >fixnum -1 / ] unit-test
-[ 5 ]
+{ 5 }
[ "10/2" string>number ]
unit-test
-[ -5 ]
+{ -5 }
[ "-10/2" string>number ]
unit-test
-[ f ]
+{ f }
[ "10/-2" string>number ]
unit-test
-[ f ]
+{ f }
[ "-10/-2" string>number ]
unit-test
-[ "33/100" ]
+{ "33/100" }
[ "66/200" string>number number>string ]
unit-test
-[ 3 ] [ "1+1/2" string>number 2 * ] unit-test
-[ -3 ] [ "-1-1/2" string>number 2 * ] unit-test
-[ "2+1/7" ] [ 1 7 / 2 + number>string ] unit-test
-[ "1/8" ] [ 1 8 / number>string ] unit-test
+{ 3 } [ "1+1/2" string>number 2 * ] unit-test
+{ -3 } [ "-1-1/2" string>number 2 * ] unit-test
+{ "2+1/7" } [ 1 7 / 2 + number>string ] unit-test
+{ "1/8" } [ 1 8 / number>string ] unit-test
{ t } [ 2/3 dup number= ] unit-test
{ t } [ 2/33333333333333333333333333333333 dup number= ] unit-test
USING: tools.test math.rectangles math.rectangles.positioning ;
IN: math.rectangles.positioning.tests
-[ T{ rect f { 0 1 } { 30 30 } } ] [
+{ T{ rect f { 0 1 } { 30 30 } } } [
T{ rect f { 0 0 } { 1 1 } }
{ 30 30 }
{ 100 100 }
popup-rect
] unit-test
-[ T{ rect f { 10 21 } { 30 30 } } ] [
+{ T{ rect f { 10 21 } { 30 30 } } } [
T{ rect f { 10 20 } { 1 1 } }
{ 30 30 }
{ 100 100 }
popup-rect
] unit-test
-[ T{ rect f { 10 30 } { 30 30 } } ] [
+{ T{ rect f { 10 30 } { 30 30 } } } [
T{ rect f { 10 20 } { 1 10 } }
{ 30 30 }
{ 100 100 }
popup-rect
] unit-test
-[ T{ rect f { 20 20 } { 80 30 } } ] [
+{ T{ rect f { 20 20 } { 80 30 } } } [
T{ rect f { 40 10 } { 1 10 } }
{ 80 30 }
{ 100 100 }
popup-rect
] unit-test
-[ T{ rect f { 50 20 } { 50 50 } } ] [
+{ T{ rect f { 50 20 } { 50 50 } } } [
T{ rect f { 50 70 } { 0 0 } }
{ 50 50 }
{ 100 100 }
popup-rect
] unit-test
-[ T{ rect f { 0 20 } { 50 50 } } ] [
+{ T{ rect f { 0 20 } { 50 50 } } } [
T{ rect f { -50 70 } { 0 0 } }
{ 50 50 }
{ 100 100 }
popup-rect
] unit-test
-[ T{ rect f { 0 50 } { 50 50 } } ] [
+{ T{ rect f { 0 50 } { 50 50 } } } [
T{ rect f { 0 50 } { 0 0 } }
{ 50 60 }
{ 100 100 }
popup-rect
] unit-test
-[ T{ rect f { 0 90 } { 10 10 } } ] [
+{ T{ rect f { 0 90 } { 10 10 } } } [
T{ rect f { 0 1000 } { 0 0 } }
{ 10 10 }
{ 100 100 }
kernel accessors ;
IN: math.rectangles.tests
-[ RECT: { 10 10 } { 20 20 } ]
+{ RECT: { 10 10 } { 20 20 } }
[
RECT: { 10 10 } { 50 50 }
RECT: { -10 -10 } { 40 40 }
rect-intersect
] unit-test
-[ RECT: { 200 200 } { 0 0 } ]
+{ RECT: { 200 200 } { 0 0 } }
[
RECT: { 100 100 } { 50 50 }
RECT: { 200 200 } { 40 40 }
rect-intersect
] unit-test
-[ f ] [
+{ f } [
RECT: { 100 100 } { 50 50 }
RECT: { 200 200 } { 40 40 }
contains-rect?
] unit-test
-[ t ] [
+{ t } [
RECT: { 100 100 } { 50 50 }
RECT: { 120 120 } { 40 40 }
contains-rect?
] unit-test
-[ f ] [
+{ f } [
RECT: { 1000 100 } { 50 50 }
RECT: { 120 120 } { 40 40 }
contains-rect?
] unit-test
-[ RECT: { 10 20 } { 20 20 } ] [
+{ RECT: { 10 20 } { 20 20 } } [
{
{ 20 20 }
{ 10 40 }
] unit-test
! Prettyprint for RECT: didn't do nesting check properly
-[ ] [ [ RECT: f f dup >>dim . ] with-string-writer drop ] unit-test
+{ } [ [ RECT: f f dup >>dim . ] with-string-writer drop ] unit-test
FROM: math.ranges => [a,b] ;
IN: math.statistics.tests
-[ 3 ] [ { 1 2 3 4 5 } 1 power-mean ] unit-test
-[ t ] [ { 1 2 3 4 5 } [ 2 power-mean ] [ quadratic-mean ] bi 1e-10 ~ ] unit-test
-[ 1 ] [ { 1 } mean ] unit-test
-[ 0 ] [ { } mean ] unit-test
-[ 3/2 ] [ { 1 2 } mean ] unit-test
-[ 0.0 ] [ { 0 0 0 } geometric-mean ] unit-test
-[ t ] [ { 2 2 2 2 } geometric-mean 2.0 .0001 ~ ] unit-test
-[ 1.0 ] [ { 1 1 1 } geometric-mean ] unit-test
-[ t ] [ 1000 1000 <array> geometric-mean 1000 .01 ~ ] unit-test
-[ t ] [ 100000 100000 <array> geometric-mean 100000 .01 ~ ] unit-test
-[ 1/3 ] [ { 1 1 1 } harmonic-mean ] unit-test
-[ 5+1/4 ] [ { 1 3 5 7 } contraharmonic-mean ] unit-test
-[ 18 ] [ { 4 8 15 16 23 42 } 0 trimmed-mean ] unit-test
-[ 15+1/2 ] [ { 4 8 15 16 23 42 } 0.2 trimmed-mean ] unit-test
-[ 3 ] [ { 1 3 3 3 3 5 } 0.2 winsorized-mean ] unit-test
-
-[ 0 ] [ { 1 } range ] unit-test
-[ 89 ] [ { 1 2 30 90 } range ] unit-test
-[ 2 ] [ { 1 2 3 } median ] unit-test
-[ 5/2 ] [ { 1 2 3 4 } median ] unit-test
+{ 3 } [ { 1 2 3 4 5 } 1 power-mean ] unit-test
+{ t } [ { 1 2 3 4 5 } [ 2 power-mean ] [ quadratic-mean ] bi 1e-10 ~ ] unit-test
+{ 1 } [ { 1 } mean ] unit-test
+{ 0 } [ { } mean ] unit-test
+{ 3/2 } [ { 1 2 } mean ] unit-test
+{ 0.0 } [ { 0 0 0 } geometric-mean ] unit-test
+{ t } [ { 2 2 2 2 } geometric-mean 2.0 .0001 ~ ] unit-test
+{ 1.0 } [ { 1 1 1 } geometric-mean ] unit-test
+{ t } [ 1000 1000 <array> geometric-mean 1000 .01 ~ ] unit-test
+{ t } [ 100000 100000 <array> geometric-mean 100000 .01 ~ ] unit-test
+{ 1/3 } [ { 1 1 1 } harmonic-mean ] unit-test
+{ 5+1/4 } [ { 1 3 5 7 } contraharmonic-mean ] unit-test
+{ 18 } [ { 4 8 15 16 23 42 } 0 trimmed-mean ] unit-test
+{ 15+1/2 } [ { 4 8 15 16 23 42 } 0.2 trimmed-mean ] unit-test
+{ 3 } [ { 1 3 3 3 3 5 } 0.2 winsorized-mean ] unit-test
+
+{ 0 } [ { 1 } range ] unit-test
+{ 89 } [ { 1 2 30 90 } range ] unit-test
+{ 2 } [ { 1 2 3 } median ] unit-test
+{ 5/2 } [ { 1 2 3 4 } median ] unit-test
{ 1 } [ { 1 2 3 4 } 0 kth-smallest ] unit-test
{ 3 } [ { 1 2 3 4 } 2 kth-smallest ] unit-test
[ { 1 2 3 4 } 2 [ [ ] compare ] kth-object ] [ bounds-error? ] must-fail-with
{ 3 } [ { 1 2 3 4 } 2 [ before? ] kth-object ] unit-test
-[ 1 ] [ { 1 } mode ] unit-test
-[ 3 ] [ { 1 2 3 3 3 4 5 6 76 7 2 21 1 3 3 3 } mode ] unit-test
+{ 1 } [ { 1 } mode ] unit-test
+{ 3 } [ { 1 2 3 3 3 4 5 6 76 7 2 21 1 3 3 3 } mode ] unit-test
[ { } median ] must-fail
[ { } upper-median ] must-fail
[ { } lower-median ] must-fail
-[ 2 ] [ { 1 2 3 4 } lower-median ] unit-test
-[ 3 ] [ { 1 2 3 4 } upper-median ] unit-test
-[ 3 ] [ { 1 2 3 4 5 } lower-median ] unit-test
-[ 3 ] [ { 1 2 3 4 5 } upper-median ] unit-test
+{ 2 } [ { 1 2 3 4 } lower-median ] unit-test
+{ 3 } [ { 1 2 3 4 } upper-median ] unit-test
+{ 3 } [ { 1 2 3 4 5 } lower-median ] unit-test
+{ 3 } [ { 1 2 3 4 5 } upper-median ] unit-test
-[ 1 ] [ { 1 } lower-median ] unit-test
-[ 1 ] [ { 1 } upper-median ] unit-test
-[ 1 ] [ { 1 } median ] unit-test
+{ 1 } [ { 1 } lower-median ] unit-test
+{ 1 } [ { 1 } upper-median ] unit-test
+{ 1 } [ { 1 } median ] unit-test
-[ 1 ] [ { 1 2 } lower-median ] unit-test
-[ 2 ] [ { 1 2 } upper-median ] unit-test
-[ 3/2 ] [ { 1 2 } median ] unit-test
+{ 1 } [ { 1 2 } lower-median ] unit-test
+{ 2 } [ { 1 2 } upper-median ] unit-test
+{ 3/2 } [ { 1 2 } median ] unit-test
-[ 1 ] [ { 1 2 3 } sample-var ] unit-test
-[ 16 ] [ { 4 6 8 10 10 12 14 16 } sample-var ] unit-test
+{ 1 } [ { 1 2 3 } sample-var ] unit-test
+{ 16 } [ { 4 6 8 10 10 12 14 16 } sample-var ] unit-test
{ 16 } [ { 4 6 8 10 12 14 16 } population-var ] unit-test
{ 1.0 } [ { 7 8 9 } sample-std ] unit-test
{ t } [ { 7 8 9 } 2 std-ddof 1.414213562373095 .0001 ~ ] unit-test
{ 0.0 } [ { 7 8 9 } 3 std-ddof ] unit-test
-[ t ] [ { 1 2 3 4 } sample-ste 0.6454972243679028 - .0001 < ] unit-test
+{ t } [ { 1 2 3 4 } sample-ste 0.6454972243679028 - .0001 < ] unit-test
-[ t ] [ { 23.2 33.4 22.5 66.3 44.5 } sample-std 18.1906 - .0001 < ] unit-test
+{ t } [ { 23.2 33.4 22.5 66.3 44.5 } sample-std 18.1906 - .0001 < ] unit-test
-[ 0 ] [ { 1 } sample-var ] unit-test
-[ 0.0 ] [ { 1 } sample-std ] unit-test
-[ 0.0 ] [ { 1 } sample-ste ] unit-test
+{ 0 } [ { 1 } sample-var ] unit-test
+{ 0.0 } [ { 1 } sample-std ] unit-test
+{ 0.0 } [ { 1 } sample-ste ] unit-test
{ 2 } [ { 1 3 5 7 } mean-dev ] unit-test
{ 4/5 } [ { 1 3 3 3 5 } median-dev ] unit-test
-[
+{
H{
{ 97 2 }
{ 98 2 }
{ 99 2 }
}
-] [
+} [
"aabbcc" histogram
] unit-test
[ 0 of ] [ 1 of ] [ 2 of ] tri
] unit-test
-[ 0 ] [ { 1 } { 1 } sample-cov ] unit-test
-[ 2/3 ] [ { 1 2 3 } { 4 5 6 } population-cov ] unit-test
+{ 0 } [ { 1 } { 1 } sample-cov ] unit-test
+{ 2/3 } [ { 1 2 3 } { 4 5 6 } population-cov ] unit-test
-[ 0.75 ] [ { 1 2 3 4 } dup sample-corr ] unit-test
-[ 1.0 ] [ { 1 2 3 4 } dup population-corr ] unit-test
-[ -0.75 ] [ { 1 2 3 4 } { -4 -5 -6 -7 } sample-corr ] unit-test
+{ 0.75 } [ { 1 2 3 4 } dup sample-corr ] unit-test
+{ 1.0 } [ { 1 2 3 4 } dup population-corr ] unit-test
+{ -0.75 } [ { 1 2 3 4 } { -4 -5 -6 -7 } sample-corr ] unit-test
-[ { 1 2 4 7 } ] [ { 1 1 2 3 } cum-sum ] unit-test
-[ { 1 1 2 6 } ] [ { 1 1 2 3 } cum-product ] unit-test
-[ { 5 3 3 1 } ] [ { 5 3 4 1 } cum-min ] unit-test
-[ { 1 3 3 5 } ] [ { 1 3 1 5 } cum-max ] unit-test
-[ { 1.0 1.5 2.0 } ] [ { 1.0 2.0 3.0 } cum-mean ] unit-test
+{ { 1 2 4 7 } } [ { 1 1 2 3 } cum-sum ] unit-test
+{ { 1 1 2 6 } } [ { 1 1 2 3 } cum-product ] unit-test
+{ { 5 3 3 1 } } [ { 5 3 4 1 } cum-min ] unit-test
+{ { 1 3 3 5 } } [ { 1 3 1 5 } cum-max ] unit-test
+{ { 1.0 1.5 2.0 } } [ { 1.0 2.0 3.0 } cum-mean ] unit-test
{ t }
[
[ uint-4{ 5 1 2 6 } int-4 longlong-2 vconvert ]
[ bad-vconvert-input? ] must-fail-with
-[ float-4{ -5.0 1.0 2.0 6.0 } ]
+{ float-4{ -5.0 1.0 2.0 6.0 } }
[ int-4{ -5 1 2 6 } int-4 float-4 test-vconvert ] unit-test
-[ int-4{ -5 1 2 6 } ]
+{ int-4{ -5 1 2 6 } }
[ float-4{ -5.0 1.0 2.0 6.0 } float-4 int-4 test-vconvert ] unit-test
-[ int-4{ -5 1 2 6 } ]
+{ int-4{ -5 1 2 6 } }
[ float-4{ -5.0 1.0 2.3 6.7 } float-4 int-4 test-vconvert ] unit-test
-[ double-2{ -5.0 1.0 } ]
+{ double-2{ -5.0 1.0 } }
[ longlong-2{ -5 1 } longlong-2 double-2 test-vconvert ] unit-test
-[ longlong-2{ -5 1 } ]
+{ longlong-2{ -5 1 } }
[ double-2{ -5.0 1.0 } double-2 longlong-2 test-vconvert ] unit-test
! TODO we should be able to do double->int pack
[ double-2{ -5.0 1.0 } double-2{ 12.0 34.0 } double-2 int-4 test-vconvert ]
[ error>> bad-vconvert? ] must-fail-with
-[ float-4{ -1.25 2.0 3.0 -4.0 } ]
+{ float-4{ -1.25 2.0 3.0 -4.0 } }
[ double-2{ -1.25 2.0 } double-2{ 3.0 -4.0 } double-2 float-4 test-vconvert ] unit-test
-[ int-4{ -1 2 3 -4 } ]
+{ int-4{ -1 2 3 -4 } }
[ longlong-2{ -1 2 } longlong-2{ 3 -4 } longlong-2 int-4 test-vconvert ] unit-test
-[ short-8{ -1 2 3 -32768 5 32767 -7 32767 } ]
+{ short-8{ -1 2 3 -32768 5 32767 -7 32767 } }
[ int-4{ -1 2 3 -40000 } int-4{ 5 60000 -7 80000 } int-4 short-8 test-vconvert ] unit-test
-[ short-8{ -1 2 3 -32768 5 32767 -7 32767 } ]
+{ short-8{ -1 2 3 -32768 5 32767 -7 32767 } }
[
int-4{ -1 2 3 -40000 }
int-4{ 5 60000 -7 80000 } int-4 short-8 test-vconvert
] unit-test
-[ ushort-8{ 0 2 3 0 5 60000 0 65535 } ]
+{ ushort-8{ 0 2 3 0 5 60000 0 65535 } }
[ int-4{ -1 2 3 -40000 } int-4{ 5 60000 -7 80000 } int-4 ushort-8 test-vconvert ] unit-test
-[ ushort-8{ 65535 2 3 65535 5 60000 65535 65535 } ]
+{ ushort-8{ 65535 2 3 65535 5 60000 65535 65535 } }
[ uint-4{ -1 2 3 -40000 } uint-4{ 5 60000 -7 80000 } uint-4 ushort-8 test-vconvert ] unit-test
[ uint-4{ -1 2 3 -40000 } uint-4{ 5 60000 -7 80000 } uint-4 short-8 test-vconvert ]
[ error>> bad-vconvert? ] must-fail-with
-[ ushort-8{ 0 1 2 3 128 129 130 131 } ushort-8{ 4 5 6 7 132 133 134 135 } ]
+{ ushort-8{ 0 1 2 3 128 129 130 131 } ushort-8{ 4 5 6 7 132 133 134 135 } }
[
uchar-16{ 0 1 2 3 128 129 130 131 4 5 6 7 132 133 134 135 }
uchar-16 ushort-8 test-vconvert
] unit-test
-[ double-2{ -1.25 2.0 } double-2{ 3.0 -4.0 } ]
+{ double-2{ -1.25 2.0 } double-2{ 3.0 -4.0 } }
[ float-4{ -1.25 2.0 3.0 -4.0 } float-4 double-2 test-vconvert ] unit-test
-[ int-4{ -1 2 3 -4 } ]
+{ int-4{ -1 2 3 -4 } }
[ int-4{ -1 2 3 -4 } int-4 int-4 test-vconvert ] unit-test
-[ longlong-2{ -1 2 } longlong-2{ 3 -4 } ]
+{ longlong-2{ -1 2 } longlong-2{ 3 -4 } }
[ int-4{ -1 2 3 -4 } int-4 longlong-2 test-vconvert ] unit-test
[ int-4{ -1 2 3 -4 } int-4 ulonglong-2 test-vconvert ]
[ error>> bad-vconvert? ] must-fail-with
-[ ulonglong-2{ 1 2 } ulonglong-2{ 3 4 } ]
+{ ulonglong-2{ 1 2 } ulonglong-2{ 3 4 } }
[ uint-4{ 1 2 3 4 } uint-4 ulonglong-2 test-vconvert ] unit-test
-[ longlong-2{ 1 2 } longlong-2{ 3 4 } ]
+{ longlong-2{ 1 2 } longlong-2{ 3 4 } }
[ uint-4{ 1 2 3 4 } uint-4 longlong-2 test-vconvert ] unit-test
-[ int-4{ 1 2 -3 -4 } int-4{ 5 -6 7 -8 } ]
+{ int-4{ 1 2 -3 -4 } int-4{ 5 -6 7 -8 } }
[ short-8{ 1 2 -3 -4 5 -6 7 -8 } short-8 int-4 test-vconvert ] unit-test
-[ uint-4{ 1 2 3 4 } uint-4{ 5 6 7 8 } ]
+{ uint-4{ 1 2 3 4 } uint-4{ 5 6 7 8 } }
[ ushort-8{ 1 2 3 4 5 6 7 8 } ushort-8 uint-4 test-vconvert ] unit-test
-[ longlong-2{ 1 2 } longlong-2{ 3 4 } ]
+{ longlong-2{ 1 2 } longlong-2{ 3 4 } }
[ uint-4{ 1 2 3 4 } uint-4 longlong-2 test-vconvert ] unit-test
! TODO we should be able to do multi-tier pack/unpack
USING: math.vectors.simd math.vectors.simd.cords tools.test ;
IN: math.vectors.simd.cords.tests
-[ float-4{ 1.0 2.0 3.0 4.0 } ] [ double-4{ 1.0 2.0 3.0 4.0 } >float-4 ] unit-test
+{ float-4{ 1.0 2.0 3.0 4.0 } } [ double-4{ 1.0 2.0 3.0 4.0 } >float-4 ] unit-test
IN: math.vectors.simd.tests
! Test type propagation
-[ V{ float } ] [ [ { float-4 } declare norm-sq ] final-classes ] unit-test
+{ V{ float } } [ [ { float-4 } declare norm-sq ] final-classes ] unit-test
-[ V{ float } ] [ [ { float-4 } declare norm ] final-classes ] unit-test
+{ V{ float } } [ [ { float-4 } declare norm ] final-classes ] unit-test
-[ V{ float-4 } ] [ [ { float-4 } declare normalize ] final-classes ] unit-test
+{ V{ float-4 } } [ [ { float-4 } declare normalize ] final-classes ] unit-test
-[ V{ float-4 } ] [ [ { float-4 float-4 } declare v+ ] final-classes ] unit-test
+{ V{ float-4 } } [ [ { float-4 float-4 } declare v+ ] final-classes ] unit-test
-[ V{ float } ] [ [ { float-4 } declare second ] final-classes ] unit-test
+{ V{ float } } [ [ { float-4 } declare second ] final-classes ] unit-test
-[ V{ int-4 } ] [ [ { int-4 int-4 } declare v+ ] final-classes ] unit-test
+{ V{ int-4 } } [ [ { int-4 int-4 } declare v+ ] final-classes ] unit-test
-[ t ] [ [ { int-4 } declare second ] final-classes first integer class<= ] unit-test
+{ t } [ [ { int-4 } declare second ] final-classes first integer class<= ] unit-test
-[ V{ longlong-2 } ] [ [ { longlong-2 longlong-2 } declare v+ ] final-classes ] unit-test
+{ V{ longlong-2 } } [ [ { longlong-2 longlong-2 } declare v+ ] final-classes ] unit-test
-[ V{ integer } ] [ [ { longlong-2 } declare second ] final-classes ] unit-test
+{ V{ integer } } [ [ { longlong-2 } declare second ] final-classes ] unit-test
! Test puns; only on x86
cpu x86? [
"== Checking -new constructors" print
-[ { } ] [
+{ { } } [
simd-classes [ [ [ ] ] dip '[ _ new ] ] [ = ] check-optimizer
] unit-test
-[ { } ] [
+{ { } } [
simd-classes [ '[ _ new ] compile-call [ zero? ] all? ] reject
] unit-test
"== Checking -with constructors" print
-[ { } ] [
+{ { } } [
with-ctors [
[ 1000 random '[ _ ] ] dip '[ _ execute ]
] [ = ] check-optimizer
] unit-test
-[ 0xffffffff ] [ 0xffffffff uint-4-with first ] unit-test
+{ 0xffffffff } [ 0xffffffff uint-4-with first ] unit-test
-[ 0xffffffff ] [ 0xffffffff [ uint-4-with ] compile-call first ] unit-test
+{ 0xffffffff } [ 0xffffffff [ uint-4-with ] compile-call first ] unit-test
-[ 0xffffffff ] [ [ 0xffffffff uint-4-with ] compile-call first ] unit-test
+{ 0xffffffff } [ [ 0xffffffff uint-4-with ] compile-call first ] unit-test
"== Checking -boa constructors" print
-[ { } ] [
+{ { } } [
boa-ctors [
[ stack-effect in>> length [ 1000 random ] [ ] replicate-as ] keep
'[ _ execute ]
] [ = ] check-optimizer
] unit-test
-[ 0xffffffff ] [ 0xffffffff 2 3 4 [ uint-4-boa ] compile-call first ] unit-test
+{ 0xffffffff } [ 0xffffffff 2 3 4 [ uint-4-boa ] compile-call first ] unit-test
"== Checking vector operations" print
"== Checking vector blend" print
-[ char-16{ 0 1 22 33 4 5 6 77 8 99 110 121 12 143 14 15 } ]
+{ char-16{ 0 1 22 33 4 5 6 77 8 99 110 121 12 143 14 15 } }
[
char-16{ t t f f t t t f t f f f t f t t }
char-16{ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 }
char-16{ 0 11 22 33 44 55 66 77 88 99 110 121 132 143 154 165 } v?
] unit-test
-[ char-16{ 0 1 22 33 4 5 6 77 8 99 110 121 12 143 14 15 } ]
+{ char-16{ 0 1 22 33 4 5 6 77 8 99 110 121 12 143 14 15 } }
[
char-16{ t t f f t t t f t f f f t f t t }
char-16{ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 }
[ { char-16 char-16 char-16 } declare v? ] compile-call
] unit-test
-[ int-4{ 1 22 33 4 } ]
+{ int-4{ 1 22 33 4 } }
[ int-4{ t f f t } int-4{ 1 2 3 4 } int-4{ 11 22 33 44 } v? ] unit-test
-[ int-4{ 1 22 33 4 } ]
+{ int-4{ 1 22 33 4 } }
[
int-4{ t f f t } int-4{ 1 2 3 4 } int-4{ 11 22 33 44 }
[ { int-4 int-4 int-4 } declare v? ] compile-call
] unit-test
-[ float-4{ 1.0 22.0 33.0 4.0 } ]
+{ float-4{ 1.0 22.0 33.0 4.0 } }
[ float-4{ t f f t } float-4{ 1.0 2.0 3.0 4.0 } float-4{ 11.0 22.0 33.0 44.0 } v? ] unit-test
-[ float-4{ 1.0 22.0 33.0 4.0 } ]
+{ float-4{ 1.0 22.0 33.0 4.0 } }
[
float-4{ t f f t } float-4{ 1.0 2.0 3.0 4.0 } float-4{ 11.0 22.0 33.0 44.0 }
[ { float-4 float-4 float-4 } declare v? ] compile-call
"== Checking shifts and permutations" print
-[ char-16{ 0 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 } ]
+{ char-16{ 0 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 } }
[ char-16{ 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 } 1 hlshift ] unit-test
-[ char-16{ 0 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 } ]
+{ char-16{ 0 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 } }
[ char-16{ 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 } [ { char-16 } declare 1 hlshift ] compile-call ] unit-test
-[ char-16{ 0 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 } ]
+{ char-16{ 0 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 } }
[ char-16{ 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 } [ { char-16 } declare 1 >bignum hlshift ] compile-call ] unit-test
-[ char-16{ 0 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 } ]
+{ char-16{ 0 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 } }
[ char-16{ 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 } 1 [ { char-16 fixnum } declare hlshift ] compile-call ] unit-test
-[ char-16{ 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 0 } ]
+{ char-16{ 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 0 } }
[ char-16{ 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 } 1 hrshift ] unit-test
-[ char-16{ 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 0 } ]
+{ char-16{ 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 0 } }
[ char-16{ 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 } [ { char-16 } declare 1 hrshift ] compile-call ] unit-test
-[ char-16{ 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 0 } ]
+{ char-16{ 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 0 } }
[ char-16{ 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 } [ { char-16 } declare 1 >bignum hrshift ] compile-call ] unit-test
-[ char-16{ 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 0 } ]
+{ char-16{ 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 0 } }
[ char-16{ 1 2 4 8 1 2 4 8 1 2 4 8 1 2 4 8 } 1 [ { char-16 fixnum } declare hrshift ] compile-call ] unit-test
-[ int-4{ 4 8 12 16 } ]
+{ int-4{ 4 8 12 16 } }
[ int-4{ 1 2 3 4 } 2 vlshift ] unit-test
-[ int-4{ 4 8 12 16 } ]
+{ int-4{ 4 8 12 16 } }
[ int-4{ 1 2 3 4 } 2 [ { int-4 fixnum } declare vlshift ] compile-call ] unit-test
-[ int-4{ 4 8 12 16 } ]
+{ int-4{ 4 8 12 16 } }
[ int-4{ 1 2 3 4 } 2 >bignum [ { int-4 bignum } declare vlshift ] compile-call ] unit-test
! Invalid inputs should not cause the compiler to throw errors
-[ ] [
+{ } [
[ [ { int-4 } declare t hrshift ] ( a -- b ) define-temp drop ] with-compilation-unit
] unit-test
-[ ] [
+{ } [
[ [ { int-4 } declare { 3 2 1 } vshuffle ] ( a -- b ) define-temp drop ] with-compilation-unit
] unit-test
bool-all branch-all ?inconsistent
] call( -- none? any? all? ) ;
-[ f t t ]
+{ f t t }
[ float-4{ t t t t } { float-4 } test-vector-tests ] unit-test
-[ f t f ]
+{ f t f }
[ float-4{ f t t t } { float-4 } test-vector-tests ] unit-test
-[ t f f ]
+{ t f f }
[ float-4{ f f f f } { float-4 } test-vector-tests ] unit-test
-[ f t t ]
+{ f t t }
[ double-2{ t t } { double-2 } test-vector-tests ] unit-test
-[ f t f ]
+{ f t f }
[ double-2{ f t } { double-2 } test-vector-tests ] unit-test
-[ t f f ]
+{ t f f }
[ double-2{ f f } { double-2 } test-vector-tests ] unit-test
-[ f t t ]
+{ f t t }
[ int-4{ t t t t } { int-4 } test-vector-tests ] unit-test
-[ f t f ]
+{ f t f }
[ int-4{ f t t t } { int-4 } test-vector-tests ] unit-test
-[ t f f ]
+{ t f f }
[ int-4{ f f f f } { int-4 } test-vector-tests ] unit-test
"== Checking element access" print
[ length iota dup [ >bignum ] map append ] keep
'[ [ _ 1quotation ] dip '[ _ swap nth ] ] [ = ] check-optimizer ; inline
-[ { } ] [ float-4{ 1.0 2.0 3.0 4.0 } test-accesses ] unit-test
-[ { } ] [ int-4{ 0x7fffffff 3 4 -8 } test-accesses ] unit-test
-[ { } ] [ uint-4{ 0xffffffff 2 3 4 } test-accesses ] unit-test
+{ { } } [ float-4{ 1.0 2.0 3.0 4.0 } test-accesses ] unit-test
+{ { } } [ int-4{ 0x7fffffff 3 4 -8 } test-accesses ] unit-test
+{ { } } [ uint-4{ 0xffffffff 2 3 4 } test-accesses ] unit-test
-[ 0x7fffffff ] [ int-4{ 0x7fffffff 3 4 -8 } first ] unit-test
-[ -8 ] [ int-4{ 0x7fffffff 3 4 -8 } last ] unit-test
-[ 0xffffffff ] [ uint-4{ 0xffffffff 2 3 4 } first ] unit-test
+{ 0x7fffffff } [ int-4{ 0x7fffffff 3 4 -8 } first ] unit-test
+{ -8 } [ int-4{ 0x7fffffff 3 4 -8 } last ] unit-test
+{ 0xffffffff } [ uint-4{ 0xffffffff 2 3 4 } first ] unit-test
-[ { } ] [ double-2{ 1.0 2.0 } test-accesses ] unit-test
-[ { } ] [ longlong-2{ 1 2 } test-accesses ] unit-test
-[ { } ] [ ulonglong-2{ 1 2 } test-accesses ] unit-test
+{ { } } [ double-2{ 1.0 2.0 } test-accesses ] unit-test
+{ { } } [ longlong-2{ 1 2 } test-accesses ] unit-test
+{ { } } [ ulonglong-2{ 1 2 } test-accesses ] unit-test
"== Checking broadcast" print
: test-broadcast ( seq -- failures )
[ length iota >array ] keep
'[ [ _ 1quotation ] dip '[ _ vbroadcast ] ] [ = ] check-optimizer ;
-[ { } ] [ float-4{ 1.0 2.0 3.0 4.0 } test-broadcast ] unit-test
-[ { } ] [ int-4{ 0x7fffffff 3 4 -8 } test-broadcast ] unit-test
-[ { } ] [ uint-4{ 0xffffffff 2 3 4 } test-broadcast ] unit-test
+{ { } } [ float-4{ 1.0 2.0 3.0 4.0 } test-broadcast ] unit-test
+{ { } } [ int-4{ 0x7fffffff 3 4 -8 } test-broadcast ] unit-test
+{ { } } [ uint-4{ 0xffffffff 2 3 4 } test-broadcast ] unit-test
-[ { } ] [ double-2{ 1.0 2.0 } test-broadcast ] unit-test
-[ { } ] [ longlong-2{ 1 2 } test-broadcast ] unit-test
-[ { } ] [ ulonglong-2{ 1 2 } test-broadcast ] unit-test
+{ { } } [ double-2{ 1.0 2.0 } test-broadcast ] unit-test
+{ { } } [ longlong-2{ 1 2 } test-broadcast ] unit-test
+{ { } } [ ulonglong-2{ 1 2 } test-broadcast ] unit-test
! Make sure we use the fallback in the correct situations
-[ int-4{ 3 3 3 3 } ] [ int-4{ 12 34 3 17 } 2 [ { int-4 fixnum } declare vbroadcast ] compile-call ] unit-test
+{ int-4{ 3 3 3 3 } } [ int-4{ 12 34 3 17 } 2 [ { int-4 fixnum } declare vbroadcast ] compile-call ] unit-test
"== Checking alien operations" print
-[ float-4{ 1 2 3 4 } ] [
+{ float-4{ 1 2 3 4 } } [
[
float-4{ 1 2 3 4 }
underlying>> 0 float-4-rep alien-vector
] compile-call float-4 boa
] unit-test
-[ B{ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 } ] [
+{ B{ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 } } [
16 [ 1 ] B{ } replicate-as 16 <byte-array>
[
0 [
] keep
] unit-test
-[ float-array{ 1 2 3 4 } ] [
+{ float-array{ 1 2 3 4 } } [
[
float-array{ 1 2 3 4 } underlying>>
float-array{ 4 3 2 1 } clone
{ z double-2 }
{ w int-4 } ;
-[ t ] [ [ simd-struct <struct> ] compile-call >c-ptr [ 0 = ] all? ] unit-test
+{ t } [ [ simd-struct <struct> ] compile-call >c-ptr [ 0 = ] all? ] unit-test
-[
+{
float-4{ 1 2 3 4 }
longlong-2{ 2 1 }
double-2{ 4 3 }
int-4{ 1 2 3 4 }
-] [
+} [
simd-struct <struct>
float-4{ 1 2 3 4 } >>x
longlong-2{ 2 1 } >>y
{ [ x>> ] [ y>> ] [ z>> ] [ w>> ] } cleave
] unit-test
-[
+{
float-4{ 1 2 3 4 }
longlong-2{ 2 1 }
double-2{ 4 3 }
int-4{ 1 2 3 4 }
-] [
+} [
[
simd-struct <struct>
float-4{ 1 2 3 4 } >>x
"== Misc tests" print
-[ ] [ char-16 new 1array stack. ] unit-test
+{ } [ char-16 new 1array stack. ] unit-test
! Test some sequence protocol stuff
-[ t ] [ 4 double-4{ 1 2 3 4 } new-sequence double-4? ] unit-test
-[ double-4{ 2 3 4 5 } ] [ double-4{ 1 2 3 4 } [ 1 + ] map ] unit-test
+{ t } [ 4 double-4{ 1 2 3 4 } new-sequence double-4? ] unit-test
+{ double-4{ 2 3 4 5 } } [ double-4{ 1 2 3 4 } [ 1 + ] map ] unit-test
! Test cross product
-[ float-4{ 0.0 0.0 1.0 0.0 } ] [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 1.0 0.0 0.0 } cross ] unit-test
-[ float-4{ 0.0 0.0 1.0 0.0 } ] [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 1.0 0.0 0.0 } [ { float-4 float-4 } declare cross ] compile-call ] unit-test
-[ float-4{ 0.0 -1.0 0.0 0.0 } ] [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 0.0 1.0 0.0 } cross ] unit-test
-[ float-4{ 0.0 -1.0 0.0 0.0 } ] [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 0.0 1.0 0.0 } [ { float-4 float-4 } declare cross ] compile-call ] unit-test
+{ float-4{ 0.0 0.0 1.0 0.0 } } [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 1.0 0.0 0.0 } cross ] unit-test
+{ float-4{ 0.0 0.0 1.0 0.0 } } [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 1.0 0.0 0.0 } [ { float-4 float-4 } declare cross ] compile-call ] unit-test
+{ float-4{ 0.0 -1.0 0.0 0.0 } } [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 0.0 1.0 0.0 } cross ] unit-test
+{ float-4{ 0.0 -1.0 0.0 0.0 } } [ float-4{ 1.0 0.0 0.0 0.0 } float-4{ 0.0 0.0 1.0 0.0 } [ { float-4 float-4 } declare cross ] compile-call ] unit-test
-[ double-4{ 0.0 0.0 1.0 0.0 } ] [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 1.0 0.0 0.0 } cross ] unit-test
-[ double-4{ 0.0 0.0 1.0 0.0 } ] [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 1.0 0.0 0.0 } [ { double-4 double-4 } declare cross ] compile-call ] unit-test
-[ double-4{ 0.0 -1.0 0.0 0.0 } ] [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 0.0 1.0 0.0 } cross ] unit-test
-[ double-4{ 0.0 -1.0 0.0 0.0 } ] [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 0.0 1.0 0.0 } [ { double-4 double-4 } declare cross ] compile-call ] unit-test
+{ double-4{ 0.0 0.0 1.0 0.0 } } [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 1.0 0.0 0.0 } cross ] unit-test
+{ double-4{ 0.0 0.0 1.0 0.0 } } [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 1.0 0.0 0.0 } [ { double-4 double-4 } declare cross ] compile-call ] unit-test
+{ double-4{ 0.0 -1.0 0.0 0.0 } } [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 0.0 1.0 0.0 } cross ] unit-test
+{ double-4{ 0.0 -1.0 0.0 0.0 } } [ double-4{ 1.0 0.0 0.0 0.0 } double-4{ 0.0 0.0 1.0 0.0 } [ { double-4 double-4 } declare cross ] compile-call ] unit-test
! CSSA bug
-[ 4000000 ] [
+{ 4000000 } [
int-4{ 1000 1000 1000 1000 }
[ { int-4 } declare dup [ * ] [ + ] 2map-reduce ] compile-call
] unit-test
diagonal cc ss ; inline
-[ t ] [
+{ t } [
float-4{ 1.0 0.0 1.0 0.0 } pi [ broken 3array ]
[ compile-call ] [ call ] 3bi =
] unit-test
{ float-4 float-4 float } declare
[ v+ ] dip sin v*n ;
-[ float-4{ 0 0 0 0 } ]
+{ float-4{ 0 0 0 0 } }
[ float-4{ 1 2 3 4 } float-4{ 4 5 6 7 } 0.0 simd-spill-test-1 ] unit-test
: simd-spill-test-2 ( a b d c -- v )
{ float float-4 float-4 float } declare
[ [ 3.0 + ] 2dip v+ ] dip sin v*n n*v ;
-[ float-4{ 0 0 0 0 } ]
+{ float-4{ 0 0 0 0 } }
[ 5.0 float-4{ 1 2 3 4 } float-4{ 4 5 6 7 } 0.0 simd-spill-test-2 ] unit-test
: callback-1 ( -- c )
[ [ 3.0 + ] 2dip v+ ] dip sin v*n n*v
10 5 100 50 500 callback-1 indirect-1 665 assert= ;
-[ float-4{ 0 0 0 0 } ]
+{ float-4{ 0 0 0 0 } }
[ 5.0 float-4{ 1 2 3 4 } float-4{ 4 5 6 7 } 0.0 simd-spill-test-3 ] unit-test
! Stack allocation of SIMD values -- make sure that everything is
[ float-4{ 1 2 3 4 } swap 0 float-4 c:set-alien-value ] bi*
] with-out-parameters ;
-[ 123 float-4{ 1 2 3 4 } ] [ simd-stack-test ] unit-test
+{ 123 float-4{ 1 2 3 4 } } [ simd-stack-test ] unit-test
! Stack allocation + spilling
>float (simd-stack-spill-test) float-4-with swap cos v*n
] with-out-parameters ;
-[ ] [
+{ } [
1.047197551196598 simd-stack-spill-test
[ float-4{ 8.5 8.5 8.5 8.5 } approx= t assert= ]
[ 123 assert= ]
kernel.private alien.c-types math.functions ;
SPECIALIZED-ARRAY: int
-[ { 1 2 3 } ] [ 1/2 { 2 4 6 } n*v ] unit-test
-[ { 1 2 3 } ] [ { 2 4 6 } 1/2 v*n ] unit-test
-[ { 1 2 3 } ] [ { 2 4 6 } 2 v/n ] unit-test
-[ { 1/1 1/2 1/3 } ] [ 1 { 1 2 3 } n/v ] unit-test
+{ { 1 2 3 } } [ 1/2 { 2 4 6 } n*v ] unit-test
+{ { 1 2 3 } } [ { 2 4 6 } 1/2 v*n ] unit-test
+{ { 1 2 3 } } [ { 2 4 6 } 2 v/n ] unit-test
+{ { 1/1 1/2 1/3 } } [ 1 { 1 2 3 } n/v ] unit-test
{ { 1 4 27 } } [ { 1 2 3 } { 1 2 3 } v^ ] unit-test
{ { 1 4 9 } } [ { 1 2 3 } 2 v^n ] unit-test
{ { 2 4 8 } } [ 2 { 1 2 3 } n^v ] unit-test
-[ 5 ] [ { 1 2 } norm-sq ] unit-test
-[ 13 ] [ { 2 3 } norm-sq ] unit-test
+{ 5 } [ { 1 2 } norm-sq ] unit-test
+{ 13 } [ { 2 3 } norm-sq ] unit-test
{ t } [ { 1 2 3 } [ norm ] [ 2 p-norm ] bi = ] unit-test
{ t } [ { 1 2 3 } 3 p-norm 3.301927248894626 1e-10 ~ ] unit-test
-[ { 1.0 2.5 } ] [ { 1.0 2.5 } { 2.5 1.0 } 0.0 vnlerp ] unit-test
-[ { 2.5 1.0 } ] [ { 1.0 2.5 } { 2.5 1.0 } 1.0 vnlerp ] unit-test
-[ { 1.75 1.75 } ] [ { 1.0 2.5 } { 2.5 1.0 } 0.5 vnlerp ] unit-test
+{ { 1.0 2.5 } } [ { 1.0 2.5 } { 2.5 1.0 } 0.0 vnlerp ] unit-test
+{ { 2.5 1.0 } } [ { 1.0 2.5 } { 2.5 1.0 } 1.0 vnlerp ] unit-test
+{ { 1.75 1.75 } } [ { 1.0 2.5 } { 2.5 1.0 } 0.5 vnlerp ] unit-test
-[ { 1.75 2.125 } ] [ { 1.0 2.5 } { 2.5 1.0 } { 0.5 0.25 } vlerp ] unit-test
+{ { 1.75 2.125 } } [ { 1.0 2.5 } { 2.5 1.0 } { 0.5 0.25 } vlerp ] unit-test
-[ 1.125 ] [ 0.0 1.0 2.0 4.0 { 0.5 0.25 } bilerp ] unit-test
+{ 1.125 } [ 0.0 1.0 2.0 4.0 { 0.5 0.25 } bilerp ] unit-test
-[ 17 ] [ 0 1 2 3 4 5 6 7 { 1 2 3 } trilerp ] unit-test
+{ 17 } [ 0 1 2 3 4 5 6 7 { 1 2 3 } trilerp ] unit-test
-[ { 0 3 2 5 4 } ] [ { 1 2 3 4 5 } { 1 1 1 1 1 } v+- ] unit-test
+{ { 0 3 2 5 4 } } [ { 1 2 3 4 5 } { 1 1 1 1 1 } v+- ] unit-test
-[ 32 ] [ { 1 2 3 } { 4 5 6 } v. ] unit-test
-[ -1 ] [ { C{ 0 1 } } dup v. ] unit-test
+{ 32 } [ { 1 2 3 } { 4 5 6 } v. ] unit-test
+{ -1 } [ { C{ 0 1 } } dup v. ] unit-test
-[ 1 ] [ { C{ 0 1 } } dup h. ] unit-test
+{ 1 } [ { C{ 0 1 } } dup h. ] unit-test
{ { 1 2 3 } } [
"mime" "test" make-unique-file ascii
[ set-file-contents ] [ <file-reader> ] 2bi ;
-[ ] [ mime-test-stream [ ] with-input-stream ] unit-test
+{ } [ mime-test-stream [ ] with-input-stream ] unit-test
-[ t ] [
+{ t } [
mime-test-stream [ separator1 parse-multipart ] with-input-stream
"file1" swap key?
] unit-test
-[ t ] [
+{ t } [
mime-test-stream [ separator1 parse-multipart ] with-input-stream
"file1" swap key?
] unit-test
-[ t ] [
+{ t } [
mime-test-stream [ separator1 parse-multipart ] with-input-stream
"file1" of filename>> "up.txt" =
] unit-test
CONSTANT: separator2 "768de80194d942619886d23f1337aa15"
CONSTANT: upload2 "--768de80194d942619886d23f1337aa15\r\nContent-Disposition: form-data; name=\"text\"; filename=\"upload.txt\"\r\nContent-Type: text/plain\r\n\r\nhello\r\n--768de80194d942619886d23f1337aa15--\r\n"
-[
+{
"upload.txt"
H{
{ "content-disposition"
"form-data; name=\"text\"; filename=\"upload.txt\"" }
{ "content-type" "text/plain" }
}
-] [
+} [
upload2 [ separator2 parse-multipart ] with-string-reader
"text" of [ filename>> ] [ headers>> ] bi
] unit-test
CONSTANT: separator3 "3f116598c7f0431b9f98148ed235c822"
CONSTANT: upload3 "--3f116598c7f0431b9f98148ed235c822\r\nContent-Disposition: form-data; name=\"text\"; filename=\"upload.txt\"\r\n\r\nhello\r\n--3f116598c7f0431b9f98148ed235c822\r\nContent-Disposition: form-data; name=\"text2\"; filename=\"upload.txt\"\r\n\r\nhello\r\n--3f116598c7f0431b9f98148ed235c822--\r\n"
-[
+{
{ "text" "text2" }
-] [
+} [
upload3 [ separator3 parse-multipart ] with-string-reader
keys natural-sort
] unit-test
: a-stream ( n -- stream )
CHAR: a <string> <string-reader> ;
-[ ] [
+{ } [
[
] with-test-server
] unit-test
IN: mime.types.tests
USING: mime.types tools.test ;
-[ "application/postscript" ] [ "foo.ps" mime-type ] unit-test
-[ "application/octet-stream" ] [ "foo.ps.gz" mime-type ] unit-test
-[ "text/plain" ] [ "foo.factor" mime-type ] unit-test
+{ "application/postscript" } [ "foo.ps" mime-type ] unit-test
+{ "application/octet-stream" } [ "foo.ps.gz" mime-type ] unit-test
+{ "text/plain" } [ "foo.factor" mime-type ] unit-test
3 <model> "x" set
"x" get [ 2 * ] <arrow> dup "z" set
[ 1 + ] <arrow> "y" set
-[ ] [ "y" get activate-model ] unit-test
-[ t ] [ "z" get "x" get connections>> member-eq? ] unit-test
-[ 7 ] [ "y" get value>> ] unit-test
-[ ] [ 4 "x" get set-model ] unit-test
-[ 9 ] [ "y" get value>> ] unit-test
-[ ] [ "y" get deactivate-model ] unit-test
-[ f ] [ "z" get "x" get connections>> member-eq? ] unit-test
+{ } [ "y" get activate-model ] unit-test
+{ t } [ "z" get "x" get connections>> member-eq? ] unit-test
+{ 7 } [ "y" get value>> ] unit-test
+{ } [ 4 "x" get set-model ] unit-test
+{ 9 } [ "y" get value>> ] unit-test
+{ } [ "y" get deactivate-model ] unit-test
+{ f } [ "z" get "x" get connections>> member-eq? ] unit-test
3 <model> "x" set
"x" get [ sq ] <arrow> "y" set
4 "x" get set-model
"y" get activate-model
-[ 16 ] [ "y" get value>> ] unit-test
+{ 16 } [ "y" get value>> ] unit-test
"y" get deactivate-model
IN: models.arrows.smart.tests
USING: models.arrow.smart tools.test accessors models math kernel ;
-[ 7 ] [ 3 <model> 4 <model> [ + ] <smart-arrow> [ activate-model ] [ value>> ] bi ] unit-test
+{ 7 } [ 3 <model> 4 <model> [ + ] <smart-arrow> [ activate-model ] [ value>> ] bi ] unit-test
IN: models.mapping.tests
! Test mapping
-[ ] [
+{ } [
[
1 <model> "one" ,,
2 <model> "two" ,,
<mapping> "m" set
] unit-test
-[ ] [ "m" get activate-model ] unit-test
+{ } [ "m" get activate-model ] unit-test
-[ H{ { "one" 1 } { "two" 2 } } ] [
+{ H{ { "one" 1 } { "two" 2 } } } [
"m" get value>>
] unit-test
-[ ] [
+{ } [
H{ { "one" 3 } { "two" 4 } }
"m" get set-model
] unit-test
-[ H{ { "one" 3 } { "two" 4 } } ] [
+{ H{ { "one" 3 } { "two" 4 } } } [
"m" get value>>
] unit-test
-[ H{ { "one" 5 } { "two" 4 } } ] [
+{ H{ { "one" 5 } { "two" 4 } } } [
5 "one" "m" get assoc>> at set-model
"m" get value>>
] unit-test
-[ ] [ "m" get deactivate-model ] unit-test
+{ } [ "m" get deactivate-model ] unit-test
tools.test models.product accessors locals ;
IN: models.product.tests
-[ ] [
+{ } [
1 <model> "a" set
2 <model> "b" set
"a" get "b" get 2array <product> "c" set
] unit-test
-[ ] [ "c" get activate-model ] unit-test
+{ } [ "c" get activate-model ] unit-test
-[ { 1 2 } ] [ "c" get value>> ] unit-test
+{ { 1 2 } } [ "c" get value>> ] unit-test
-[ ] [ 3 "b" get set-model ] unit-test
+{ } [ 3 "b" get set-model ] unit-test
-[ { 1 3 } ] [ "c" get value>> ] unit-test
+{ { 1 3 } } [ "c" get value>> ] unit-test
-[ ] [ { 4 5 } "c" get set-model ] unit-test
+{ } [ { 4 5 } "c" get set-model ] unit-test
-[ { 4 5 } ] [ "c" get value>> ] unit-test
+{ { 4 5 } } [ "c" get value>> ] unit-test
-[ ] [ "c" get deactivate-model ] unit-test
+{ } [ "c" get deactivate-model ] unit-test
TUPLE: an-observer { i integer } ;
M: an-observer model-changed nip [ 1 + ] change-i drop ;
-[ 1 0 ] [
+{ 1 0 } [
[let
1 <model> :> m1
2 <model> :> m2
: setup-stepped-range ( -- range ) 0 0 0 255 2 <range> ;
! clamp-value should not go past range ends
-[ 0 ] [ -10 setup-range clamp-value ] unit-test
-[ 255 ] [ 2000 setup-range clamp-value ] unit-test
-[ 14 ] [ 14 setup-range clamp-value ] unit-test
+{ 0 } [ -10 setup-range clamp-value ] unit-test
+{ 255 } [ 2000 setup-range clamp-value ] unit-test
+{ 14 } [ 14 setup-range clamp-value ] unit-test
! step-value
-[ 14 ] [ 15 setup-stepped-range step-value ] unit-test
+{ 14 } [ 15 setup-stepped-range step-value ] unit-test
! range min/max/page values should be correct
-[ 0 ] [ setup-range range-page-value ] unit-test
-[ 0 ] [ setup-range range-min-value ] unit-test
-[ 255 ] [ setup-range range-max-value ] unit-test
+{ 0 } [ setup-range range-page-value ] unit-test
+{ 0 } [ setup-range range-min-value ] unit-test
+{ 255 } [ setup-range range-max-value ] unit-test
! should be able to set the value within the range and get back
-[ 15 ] [ setup-range 15 over set-range-value range-value ] unit-test
-[ 0 ] [ setup-range -15 over set-range-value range-value ] unit-test
-[ 255 ] [ setup-range 4000 over set-range-value range-value ] unit-test
+{ 15 } [ setup-range 15 over set-range-value range-value ] unit-test
+{ 0 } [ setup-range -15 over set-range-value range-value ] unit-test
+{ 255 } [ setup-range 4000 over set-range-value range-value ] unit-test
! should be able to change the range min/max/page value
-[ 1 ] [ setup-range 1 over set-range-page-value range-page-value ] unit-test
-[ 50 ] [ setup-range 50 over set-range-min-value range-min-value ] unit-test
-[ 4000 ] [ setup-range 4000 over set-range-max-value range-max-value ] unit-test
+{ 1 } [ setup-range 1 over set-range-page-value range-page-value ] unit-test
+{ 50 } [ setup-range 50 over set-range-min-value range-min-value ] unit-test
+{ 4000 } [ setup-range 4000 over set-range-max-value range-max-value ] unit-test
! should be able to move by positive and negative values
-[ 30 ] [ setup-range 30 over move-by range-value ] unit-test
-[ 0 ] [ setup-range 30 over move-by -30 over move-by range-value ] unit-test
+{ 30 } [ setup-range 30 over move-by range-value ] unit-test
+{ 0 } [ setup-range 30 over move-by -30 over move-by range-value ] unit-test
! should be able to move by a page of 10
-[ 10 ] [
+{ 10 } [
setup-range 10 over set-range-page-value
1 over move-by-page range-value
] unit-test
"GL_EXT_slipgate"
}
-[ t ]
+{ t }
[ "GL_ARB_vent_core_frogblast" test-extensions (has-extension?) ] unit-test
-[ f ]
+{ f }
[ "GL_ARB_wallhack" test-extensions (has-extension?) ] unit-test
-[ t ] [
+{ t } [
{ "GL_EXT_dimensional_portal" "GL_EXT_slipgate" }
test-extensions (has-extension?)
] unit-test
images kernel namespaces accessors sequences literals ;
IN: opengl.textures.tests
-[
+{
{
{ { 0 0 } { 10 0 } }
{ { 0 20 } { 10 20 } }
}
-] [
+} [
{
{ { 10 20 } { 30 20 } }
{ { 10 30 } { 30 300 } }
tools.test ;
IN: openssl.libcrypto.tests
-[ t ] [ "factorcode.org:80" BIO_new_connect bio_st? ] unit-test
+{ t } [ "factorcode.org:80" BIO_new_connect bio_st? ] unit-test
-[ 1 1 ] [
+{ 1 1 } [
"factorcode.org:80" BIO_new_connect [
BIO_C_DO_STATE_MACHINE 0 f BIO_ctrl
] keep BIO_free
] unit-test
-[ "HTTP/1.1 200 Document follows" 1 ] [
+{ "HTTP/1.1 200 Document follows" 1 } [
"factorcode.org:80" BIO_new_connect [
[ BIO_C_DO_STATE_MACHINE 0 f BIO_ctrl drop ]
[
new-ctx SSL_new ;
! Test default options
-[ { f f f f f } ] [ new-ctx all-opts [ has-opt ] with map ] unit-test
+{ { f f f f f } } [ new-ctx all-opts [ has-opt ] with map ] unit-test
! Test setting options
-[ 5 ] [
+{ 5 } [
new-ctx all-opts [ [ set-opt ] [ has-opt ] 2bi ] with map [ t = ] count
] unit-test
! Initial state
-[ { "before/connect initialization" "read header" 1 f } ] [
+{ { "before/connect initialization" "read header" 1 f } } [
new-ssl {
SSL_state_string_long
SSL_rstate_string_long
error>> [ redefined-rule? ] [ name>> "lol" = ] bi and
] must-fail-with
-[
+{
{ "a" "a" }
-] [
+} [
EBNF: foo Bar = "a":a1 "a":a2 => [[ a1 a2 2array ]] ;EBNF
"aa" foo
] unit-test
-[
+{
{ "a" "a" }
-] [
+} [
EBNF: foo2 Bar = "a":a-1 "a":a-2 => [[ a-1 a-2 2array ]] ;EBNF
"aa" foo2
] unit-test
USING: tools.test persistent.deques kernel math ;
IN: persistent.deques.tests
-[ 3 2 1 t ]
+{ 3 2 1 t }
[ { 1 2 3 } sequence>deque 3 [ pop-back ] times deque-empty? ] unit-test
-[ 1 2 3 t ]
+{ 1 2 3 t }
[ { 1 2 3 } sequence>deque 3 [ pop-front ] times deque-empty? ] unit-test
-[ 1 3 2 t ]
+{ 1 3 2 t }
[ { 1 2 3 } sequence>deque pop-front 2 [ pop-back ] times deque-empty? ]
unit-test
-[ { 2 3 4 5 6 1 } ]
+{ { 2 3 4 5 6 1 } }
[ { 1 2 3 4 5 6 } sequence>deque pop-front swap push-back deque>sequence ]
unit-test
-[ 1 ] [ { 1 2 3 4 } sequence>deque peek-front ] unit-test
-[ 4 ] [ { 1 2 3 4 } sequence>deque peek-back ] unit-test
+{ 1 } [ { 1 2 3 4 } sequence>deque peek-front ] unit-test
+{ 4 } [ { 1 2 3 4 } sequence>deque peek-back ] unit-test
-[ 1 t ] [ <deque> 1 push-front pop-back deque-empty? ] unit-test
-[ 1 t ] [ <deque> 1 push-front pop-front deque-empty? ] unit-test
-[ 1 t ] [ <deque> 1 push-back pop-front deque-empty? ] unit-test
-[ 1 t ] [ <deque> 1 push-back pop-back deque-empty? ] unit-test
+{ 1 t } [ <deque> 1 push-front pop-back deque-empty? ] unit-test
+{ 1 t } [ <deque> 1 push-front pop-front deque-empty? ] unit-test
+{ 1 t } [ <deque> 1 push-back pop-front deque-empty? ] unit-test
+{ 1 t } [ <deque> 1 push-back pop-back deque-empty? ] unit-test
-[ 1 f ]
+{ 1 f }
[ <deque> 1 push-front 2 push-front pop-back deque-empty? ] unit-test
-[ 1 f ]
+{ 1 f }
[ <deque> 1 push-back 2 push-back pop-front deque-empty? ] unit-test
-[ 2 f ]
+{ 2 f }
[ <deque> 1 push-back 2 push-back pop-back deque-empty? ] unit-test
-[ 2 f ]
+{ 2 f }
[ <deque> 1 push-front 2 push-front pop-front deque-empty? ] unit-test
USING: persistent.hashtables persistent.assocs hashtables assocs
tools.test kernel locals namespaces random math.ranges sequences fry ;
-[ t ] [ PH{ } assoc-empty? ] unit-test
+{ t } [ PH{ } assoc-empty? ] unit-test
-[ PH{ { "A" "B" } } ] [ PH{ } "B" "A" rot new-at ] unit-test
+{ PH{ { "A" "B" } } } [ PH{ } "B" "A" rot new-at ] unit-test
-[ "B" ] [ "A" PH{ { "A" "B" } } at ] unit-test
+{ "B" } [ "A" PH{ { "A" "B" } } at ] unit-test
-[ f ] [ "X" PH{ { "A" "B" } } at ] unit-test
+{ f } [ "X" PH{ { "A" "B" } } at ] unit-test
! We have to define these first so that they're compiled before
! the below hashtables are parsed...
>>
-[ ] [
+{ } [
PH{ }
"a" T{ hash-0-a } rot new-at
"b" T{ hash-0-b } rot new-at
"ph" set
] unit-test
-[
+{
H{
{ T{ hash-0-a } "a" }
{ T{ hash-0-b } "b" }
}
-] [ "ph" get >hashtable ] unit-test
+} [ "ph" get >hashtable ] unit-test
-[
+{
H{
{ T{ hash-0-b } "b" }
}
-] [ "ph" get T{ hash-0-a } swap pluck-at >hashtable ] unit-test
+} [ "ph" get T{ hash-0-a } swap pluck-at >hashtable ] unit-test
-[
+{
H{
{ T{ hash-0-a } "a" }
}
-] [ "ph" get T{ hash-0-b } swap pluck-at >hashtable ] unit-test
+} [ "ph" get T{ hash-0-b } swap pluck-at >hashtable ] unit-test
-[
+{
H{
{ T{ hash-0-a } "a" }
{ T{ hash-0-b } "b" }
}
-] [ "ph" get "X" swap pluck-at >hashtable ] unit-test
+} [ "ph" get "X" swap pluck-at >hashtable ] unit-test
-[ ] [
+{ } [
PH{ }
"B" "A" rot new-at
"D" "C" rot new-at
"ph" set
] unit-test
-[ H{ { "A" "B" } { "C" "D" } } ] [
+{ H{ { "A" "B" } { "C" "D" } } } [
"ph" get >hashtable
] unit-test
-[ H{ { "C" "D" } } ] [
+{ H{ { "C" "D" } } } [
"ph" get "A" swap pluck-at >hashtable
] unit-test
-[ H{ { "A" "B" } { "C" "D" } { "E" "F" } } ] [
+{ H{ { "A" "B" } { "C" "D" } { "E" "F" } } } [
"ph" get "F" "E" rot new-at >hashtable
] unit-test
-[ H{ { "C" "D" } { "E" "F" } } ] [
+{ H{ { "C" "D" } { "E" "F" } } } [
"ph" get "F" "E" rot new-at "A" swap pluck-at >hashtable
] unit-test
: test-persistent-hashtables-1 ( n -- ? )
random-assocs ok? ;
-[ t ] [ 10 test-persistent-hashtables-1 ] unit-test
-[ t ] [ 20 test-persistent-hashtables-1 ] unit-test
-[ t ] [ 30 test-persistent-hashtables-1 ] unit-test
-[ t ] [ 50 test-persistent-hashtables-1 ] unit-test
-[ t ] [ 100 test-persistent-hashtables-1 ] unit-test
-[ t ] [ 500 test-persistent-hashtables-1 ] unit-test
-[ t ] [ 1000 test-persistent-hashtables-1 ] unit-test
-[ t ] [ 5000 test-persistent-hashtables-1 ] unit-test
-[ t ] [ 10000 test-persistent-hashtables-1 ] unit-test
-[ t ] [ 50000 test-persistent-hashtables-1 ] unit-test
+{ t } [ 10 test-persistent-hashtables-1 ] unit-test
+{ t } [ 20 test-persistent-hashtables-1 ] unit-test
+{ t } [ 30 test-persistent-hashtables-1 ] unit-test
+{ t } [ 50 test-persistent-hashtables-1 ] unit-test
+{ t } [ 100 test-persistent-hashtables-1 ] unit-test
+{ t } [ 500 test-persistent-hashtables-1 ] unit-test
+{ t } [ 1000 test-persistent-hashtables-1 ] unit-test
+{ t } [ 5000 test-persistent-hashtables-1 ] unit-test
+{ t } [ 10000 test-persistent-hashtables-1 ] unit-test
+{ t } [ 50000 test-persistent-hashtables-1 ] unit-test
: test-persistent-hashtables-2 ( n -- ? )
random-assocs
2dup ok?
] all? 2nip ;
-[ t ] [ 6000 test-persistent-hashtables-2 ] unit-test
+{ t } [ 6000 test-persistent-hashtables-2 ] unit-test
{ { "hello" 3 } { "goodbye" 2 } { "whatever" 5 }
{ "foo" 1 } { "bar" -1 } { "baz" -7 } { "bing" 0 } }
-[
+{
{ { "baz" -7 } { "bar" -1 } { "bing" 0 } { "foo" 1 }
{ "goodbye" 2 } { "hello" 3 } { "whatever" 5 } }
-] [ test-input assoc>pheap pheap>alist ] unit-test
+} [ test-input assoc>pheap pheap>alist ] unit-test
persistent.sequences sequences kernel arrays random namespaces
vectors math math.order ;
-[ 0 ] [ PV{ } length ] unit-test
+{ 0 } [ PV{ } length ] unit-test
-[ 1 ] [ 3 PV{ } ppush length ] unit-test
+{ 1 } [ 3 PV{ } ppush length ] unit-test
-[ 3 ] [ 3 PV{ } ppush first ] unit-test
+{ 3 } [ 3 PV{ } ppush first ] unit-test
-[ PV{ 3 1 3 3 7 } ] [
+{ PV{ 3 1 3 3 7 } } [
PV{ } { 3 1 3 3 7 } [ swap ppush ] each
] unit-test
-[ { 3 1 3 3 7 } ] [
+{ { 3 1 3 3 7 } } [
PV{ } { 3 1 3 3 7 } [ swap ppush ] each >array
] unit-test
[ t ] swap [ iota dup >persistent-vector sequence= ] curry unit-test
] each
-[ ] [ 10000 [ 16 random-bits ] PV{ } replicate-as "1" set ] unit-test
-[ ] [ "1" get >vector "2" set ] unit-test
+{ } [ 10000 [ 16 random-bits ] PV{ } replicate-as "1" set ] unit-test
+{ } [ "1" get >vector "2" set ] unit-test
-[ t ] [
+{ t } [
3000 iota [
drop
16 random-bits 10000 random
[ PV{ } ppop ] [ empty-error? ] must-fail-with
-[ t ] [ PV{ 3 } ppop empty? ] unit-test
+{ t } [ PV{ 3 } ppop empty? ] unit-test
-[ PV{ 3 7 } ] [ PV{ 3 7 6 } ppop ] unit-test
+{ PV{ 3 7 } } [ PV{ 3 7 6 } ppop ] unit-test
-[ PV{ 3 7 6 5 } ] [ 5 PV{ 3 7 6 } ppush ] unit-test
+{ PV{ 3 7 6 5 } } [ 5 PV{ 3 7 6 } ppush ] unit-test
-[ ] [ PV{ } "1" set ] unit-test
-[ ] [ V{ } clone "2" set ] unit-test
+{ } [ PV{ } "1" set ] unit-test
+{ } [ V{ } clone "2" set ] unit-test
: push/pop-test ( vec -- vec' ) 3 swap ppush 3 swap ppush ppop ;
-[ ] [ PV{ } 10000 [ push/pop-test ] times drop ] unit-test
+{ } [ PV{ } 10000 [ push/pop-test ] times drop ] unit-test
-[ PV{ } ] [
+{ PV{ } } [
PV{ }
10000 [ 1 swap ppush ] times
10000 [ ppop ] times
] unit-test
-[ t ] [
+{ t } [
10000 iota >persistent-vector 752 [ ppop ] times dup length iota sequence=
] unit-test
-[ t ] [
+{ t } [
100 iota [
drop
100 random [
USING: random random.dummy tools.test ;
IN: random.dummy.tests
-[ 10 ] [ 10 <random-dummy> random-32* ] unit-test
-[ 100 ] [ 10 <random-dummy> 100 seed-random random-32* ] unit-test
+{ 10 } [ 10 <random-dummy> random-32* ] unit-test
+{ 100 } [ 10 <random-dummy> 100 seed-random random-32* ] unit-test
: check-random ( max -- ? )
[ random 0 ] keep between? ;
-[ t ] [ 100 [ drop 674 check-random ] all-integers? ] unit-test
+{ t } [ 100 [ drop 674 check-random ] all-integers? ] unit-test
: randoms ( -- seq )
100 [ 100 random ] replicate ;
: test-rng ( seed quot -- )
[ <mersenne-twister> ] dip with-random ; inline
-[ f ] [ 1234 [ randoms randoms = ] test-rng ] unit-test
+{ f } [ 1234 [ randoms randoms = ] test-rng ] unit-test
-[ 1333075495 ] [
+{ 1333075495 } [
0 [ 1000 [ drop random-generator get random-32* drop ] each-integer random-generator get random-32* ] test-rng
] unit-test
-[ 1575309035 ] [
+{ 1575309035 } [
0 [ 10000 [ drop random-generator get random-32* drop ] each-integer random-generator get random-32* ] test-rng
] unit-test
-[ 3 ] [ 101 [ 3 random-bytes length ] test-rng ] unit-test
-[ 33 ] [ 101 [ 33 random-bytes length ] test-rng ] unit-test
-[ t ] [ 101 [ 100 random-bits log2 90 > ] test-rng ] unit-test
+{ 3 } [ 101 [ 3 random-bytes length ] test-rng ] unit-test
+{ 33 } [ 101 [ 33 random-bytes length ] test-rng ] unit-test
+{ t } [ 101 [ 100 random-bits log2 90 > ] test-rng ] unit-test
-[ t ]
+{ t }
[
1234 <mersenne-twister>
[ random-32* ] [ 1234 seed-random random-32* ] bi =
IN: random.sfmt.tests
! Period certified by virtue of seed
-[ ] [ 5 <sfmt-19937> drop ] unit-test
+{ } [ 5 <sfmt-19937> drop ] unit-test
-[ 1331696015 ]
+{ 1331696015 }
[ 5 <sfmt-19937> dup generate dup generate uint-array>> first ] unit-test
-[ 1432875926 ]
+{ 1432875926 }
[ 5 <sfmt-19937> random-32* ] unit-test
! Period certified by flipping a bit
-[ ] [ 7 <sfmt-19937> drop ] unit-test
+{ } [ 7 <sfmt-19937> drop ] unit-test
-[ 1674111379 ]
+{ 1674111379 }
[ 7 <sfmt-19937> dup generate dup generate uint-array>> first ] unit-test
-[ 489955657 ]
+{ 489955657 }
[ 7 <sfmt-19937> random-32* ] unit-test
! Test re-seeding SFMT
-[ t ]
+{ t }
[
100 <sfmt-19937>
[ random-32* ]
! Class algebra
-[ f ] [ { 1 2 } <and-class> ] unit-test
-[ T{ or-class f { 1 2 } } ] [ { 1 2 } <or-class> ] unit-test
-[ 3 ] [ { 1 2 } <and-class> 3 2array <or-class> ] unit-test
-[ CHAR: A ] [ CHAR: A LETTER-class <primitive-class> 2array <and-class> ] unit-test
-[ CHAR: A ] [ LETTER-class <primitive-class> CHAR: A 2array <and-class> ] unit-test
-[ T{ primitive-class { class LETTER-class } } ] [ CHAR: A LETTER-class <primitive-class> 2array <or-class> ] unit-test
-[ T{ primitive-class { class LETTER-class } } ] [ LETTER-class <primitive-class> CHAR: A 2array <or-class> ] unit-test
-[ t ] [ { t 1 } <or-class> ] unit-test
-[ t ] [ { 1 t } <or-class> ] unit-test
-[ f ] [ { f 1 } <and-class> ] unit-test
-[ f ] [ { 1 f } <and-class> ] unit-test
-[ 1 ] [ { f 1 } <or-class> ] unit-test
-[ 1 ] [ { 1 f } <or-class> ] unit-test
-[ 1 ] [ { t 1 } <and-class> ] unit-test
-[ 1 ] [ { 1 t } <and-class> ] unit-test
-[ 1 ] [ 1 <not-class> <not-class> ] unit-test
-[ 1 ] [ { 1 1 } <and-class> ] unit-test
-[ 1 ] [ { 1 1 } <or-class> ] unit-test
-[ t ] [ { t t } <or-class> ] unit-test
-[ T{ primitive-class { class letter-class } } ] [ letter-class <primitive-class> dup 2array <and-class> ] unit-test
-[ T{ primitive-class { class letter-class } } ] [ letter-class <primitive-class> dup 2array <or-class> ] unit-test
-[ T{ or-class { seq { 1 2 3 } } } ] [ { 1 2 } <or-class> { 2 3 } <or-class> 2array <or-class> ] unit-test
-[ T{ or-class { seq { 2 3 } } } ] [ { 2 3 } <or-class> 1 <not-class> 2array <and-class> ] unit-test
-[ f ] [ t <not-class> ] unit-test
-[ t ] [ f <not-class> ] unit-test
-[ f ] [ 1 <not-class> 1 t answer ] unit-test
-[ t ] [ { 1 2 } <or-class> <not-class> 1 2 3array <or-class> ] unit-test
-[ f ] [ { 1 2 } <and-class> <not-class> 1 2 3array <and-class> ] unit-test
+{ f } [ { 1 2 } <and-class> ] unit-test
+{ T{ or-class f { 1 2 } } } [ { 1 2 } <or-class> ] unit-test
+{ 3 } [ { 1 2 } <and-class> 3 2array <or-class> ] unit-test
+{ CHAR: A } [ CHAR: A LETTER-class <primitive-class> 2array <and-class> ] unit-test
+{ CHAR: A } [ LETTER-class <primitive-class> CHAR: A 2array <and-class> ] unit-test
+{ T{ primitive-class { class LETTER-class } } } [ CHAR: A LETTER-class <primitive-class> 2array <or-class> ] unit-test
+{ T{ primitive-class { class LETTER-class } } } [ LETTER-class <primitive-class> CHAR: A 2array <or-class> ] unit-test
+{ t } [ { t 1 } <or-class> ] unit-test
+{ t } [ { 1 t } <or-class> ] unit-test
+{ f } [ { f 1 } <and-class> ] unit-test
+{ f } [ { 1 f } <and-class> ] unit-test
+{ 1 } [ { f 1 } <or-class> ] unit-test
+{ 1 } [ { 1 f } <or-class> ] unit-test
+{ 1 } [ { t 1 } <and-class> ] unit-test
+{ 1 } [ { 1 t } <and-class> ] unit-test
+{ 1 } [ 1 <not-class> <not-class> ] unit-test
+{ 1 } [ { 1 1 } <and-class> ] unit-test
+{ 1 } [ { 1 1 } <or-class> ] unit-test
+{ t } [ { t t } <or-class> ] unit-test
+{ T{ primitive-class { class letter-class } } } [ letter-class <primitive-class> dup 2array <and-class> ] unit-test
+{ T{ primitive-class { class letter-class } } } [ letter-class <primitive-class> dup 2array <or-class> ] unit-test
+{ T{ or-class { seq { 1 2 3 } } } } [ { 1 2 } <or-class> { 2 3 } <or-class> 2array <or-class> ] unit-test
+{ T{ or-class { seq { 2 3 } } } } [ { 2 3 } <or-class> 1 <not-class> 2array <and-class> ] unit-test
+{ f } [ t <not-class> ] unit-test
+{ t } [ f <not-class> ] unit-test
+{ f } [ 1 <not-class> 1 t answer ] unit-test
+{ t } [ { 1 2 } <or-class> <not-class> 1 2 3array <or-class> ] unit-test
+{ f } [ { 1 2 } <and-class> <not-class> 1 2 3array <and-class> ] unit-test
! Making classes into nested conditionals
-[ { 1 2 3 4 } ] [ T{ and-class f { 1 T{ not-class f 2 } T{ or-class f { 3 4 } } 2 } } class>questions ] unit-test
-[ { 3 } ] [ { { 3 t } } table>condition ] unit-test
-[ { T{ primitive-class } } ] [ { { 1 t } { 2 T{ primitive-class } } } table>questions ] unit-test
-[ { { 1 t } { 2 t } } ] [ { { 1 t } { 2 T{ primitive-class } } } T{ primitive-class } t assoc-answer ] unit-test
-[ { { 1 t } } ] [ { { 1 t } { 2 T{ primitive-class } } } T{ primitive-class } f assoc-answer ] unit-test
-[ T{ condition f T{ primitive-class } { 1 2 } { 1 } } ] [ { { 1 t } { 2 T{ primitive-class } } } table>condition ] unit-test
+{ { 1 2 3 4 } } [ T{ and-class f { 1 T{ not-class f 2 } T{ or-class f { 3 4 } } 2 } } class>questions ] unit-test
+{ { 3 } } [ { { 3 t } } table>condition ] unit-test
+{ { T{ primitive-class } } } [ { { 1 t } { 2 T{ primitive-class } } } table>questions ] unit-test
+{ { { 1 t } { 2 t } } } [ { { 1 t } { 2 T{ primitive-class } } } T{ primitive-class } t assoc-answer ] unit-test
+{ { { 1 t } } } [ { { 1 t } { 2 T{ primitive-class } } } T{ primitive-class } f assoc-answer ] unit-test
+{ T{ condition f T{ primitive-class } { 1 2 } { 1 } } } [ { { 1 t } { 2 T{ primitive-class } } } table>condition ] unit-test
SYMBOL: foo
SYMBOL: bar
-[ T{ condition f T{ primitive-class f bar } T{ condition f T{ primitive-class f foo } { 1 3 2 } { 1 3 } } T{ condition f T{ primitive-class f foo } { 1 2 } { 1 } } } ] [ { { 1 t } { 3 T{ primitive-class f bar } } { 2 T{ primitive-class f foo } } } table>condition ] unit-test
+{ T{ condition f T{ primitive-class f bar } T{ condition f T{ primitive-class f foo } { 1 3 2 } { 1 3 } } T{ condition f T{ primitive-class f foo } { 1 2 } { 1 } } } } [ { { 1 t } { 3 T{ primitive-class f bar } } { 2 T{ primitive-class f foo } } } table>condition ] unit-test
-[ t ] [ foo <primitive-class> dup t answer ] unit-test
-[ f ] [ foo <primitive-class> dup f answer ] unit-test
-[ T{ primitive-class f foo } ] [ foo <primitive-class> bar <primitive-class> t answer ] unit-test
-[ T{ primitive-class f foo } ] [ foo <primitive-class> bar <primitive-class> f answer ] unit-test
-[ T{ primitive-class f foo } ] [ foo <primitive-class> bar <primitive-class> 2array <and-class> bar <primitive-class> t answer ] unit-test
-[ T{ primitive-class f bar } ] [ foo <primitive-class> bar <primitive-class> 2array <and-class> foo <primitive-class> t answer ] unit-test
-[ f ] [ foo <primitive-class> bar <primitive-class> 2array <and-class> foo <primitive-class> f answer ] unit-test
-[ f ] [ foo <primitive-class> bar <primitive-class> 2array <and-class> bar <primitive-class> f answer ] unit-test
-[ t ] [ foo <primitive-class> bar <primitive-class> 2array <or-class> bar <primitive-class> t answer ] unit-test
-[ T{ primitive-class f foo } ] [ foo <primitive-class> bar <primitive-class> 2array <or-class> bar <primitive-class> f answer ] unit-test
+{ t } [ foo <primitive-class> dup t answer ] unit-test
+{ f } [ foo <primitive-class> dup f answer ] unit-test
+{ T{ primitive-class f foo } } [ foo <primitive-class> bar <primitive-class> t answer ] unit-test
+{ T{ primitive-class f foo } } [ foo <primitive-class> bar <primitive-class> f answer ] unit-test
+{ T{ primitive-class f foo } } [ foo <primitive-class> bar <primitive-class> 2array <and-class> bar <primitive-class> t answer ] unit-test
+{ T{ primitive-class f bar } } [ foo <primitive-class> bar <primitive-class> 2array <and-class> foo <primitive-class> t answer ] unit-test
+{ f } [ foo <primitive-class> bar <primitive-class> 2array <and-class> foo <primitive-class> f answer ] unit-test
+{ f } [ foo <primitive-class> bar <primitive-class> 2array <and-class> bar <primitive-class> f answer ] unit-test
+{ t } [ foo <primitive-class> bar <primitive-class> 2array <or-class> bar <primitive-class> t answer ] unit-test
+{ T{ primitive-class f foo } } [ foo <primitive-class> bar <primitive-class> 2array <or-class> bar <primitive-class> f answer ] unit-test
: strings ( -- regexp )
{ "foo" "bar" "baz" } <any-of> ;
-[ t t t ] [ "foo" "bar" "baz" [ strings matches? ] tri@ ] unit-test
-[ f f f ] [ "food" "ibar" "ba" [ strings matches? ] tri@ ] unit-test
+{ t t t } [ "foo" "bar" "baz" [ strings matches? ] tri@ ] unit-test
+{ f f f } [ "food" "ibar" "ba" [ strings matches? ] tri@ ] unit-test
: conj ( -- regexp )
{ R' .*a' R' b.*' } <and> ;
-[ t ] [ "bljhasflsda" conj matches? ] unit-test
-[ f ] [ "bsdfdfs" conj matches? ] unit-test
-[ f ] [ "fsfa" conj matches? ] unit-test
+{ t } [ "bljhasflsda" conj matches? ] unit-test
+{ f } [ "bsdfdfs" conj matches? ] unit-test
+{ f } [ "fsfa" conj matches? ] unit-test
-[ f ] [ "bljhasflsda" conj <not> matches? ] unit-test
-[ t ] [ "bsdfdfs" conj <not> matches? ] unit-test
-[ t ] [ "fsfa" conj <not> matches? ] unit-test
+{ f } [ "bljhasflsda" conj <not> matches? ] unit-test
+{ t } [ "bsdfdfs" conj <not> matches? ] unit-test
+{ t } [ "fsfa" conj <not> matches? ] unit-test
-[ f f ] [ "" "hi" [ <nothing> matches? ] bi@ ] unit-test
-[ t t ] [ "" "hi" [ <nothing> <not> matches? ] bi@ ] unit-test
+{ f f } [ "" "hi" [ <nothing> matches? ] bi@ ] unit-test
+{ t t } [ "" "hi" [ <nothing> <not> matches? ] bi@ ] unit-test
-[ { t t t f } ] [ { "" "a" "aaaaa" "aab" } [ "a" <literal> <zero-or-more> matches? ] map ] unit-test
-[ { f t t f } ] [ { "" "a" "aaaaa" "aab" } [ "a" <literal> <one-or-more> matches? ] map ] unit-test
-[ { t t f f } ] [ { "" "a" "aaaaa" "aab" } [ "a" <literal> <option> matches? ] map ] unit-test
+{ { t t t f } } [ { "" "a" "aaaaa" "aab" } [ "a" <literal> <zero-or-more> matches? ] map ] unit-test
+{ { f t t f } } [ { "" "a" "aaaaa" "aab" } [ "a" <literal> <one-or-more> matches? ] map ] unit-test
+{ { t t f f } } [ { "" "a" "aaaaa" "aab" } [ "a" <literal> <option> matches? ] map ] unit-test
regexp.classes regexp.negation ;
IN: regexp.minimize.tests
-[ t ] [ 1 2 H{ { { 1 2 } t } } same-partition? ] unit-test
-[ t ] [ 2 1 H{ { { 1 2 } t } } same-partition? ] unit-test
-[ f ] [ 2 3 H{ { { 1 2 } t } } same-partition? ] unit-test
+{ t } [ 1 2 H{ { { 1 2 } t } } same-partition? ] unit-test
+{ t } [ 2 1 H{ { { 1 2 } t } } same-partition? ] unit-test
+{ f } [ 2 3 H{ { { 1 2 } t } } same-partition? ] unit-test
-[ H{ { 1 1 } { 2 1 } { 3 3 } { 4 3 } } ]
+{ H{ { 1 1 } { 2 1 } { 3 3 } { 4 3 } } }
[ { { 1 1 } { 1 2 } { 2 2 } { 3 3 } { 3 4 } { 4 4 } } [ t ] H{ } map>assoc partition>classes ] unit-test
-[ { { 1 2 } { 3 4 } } ] [ H{ { "elephant" 1 } { "tiger" 3 } } H{ { "elephant" 2 } { "tiger" 4 } } assemble-values ] unit-test
+{ { { 1 2 } { 3 4 } } } [ H{ { "elephant" 1 } { "tiger" 3 } } H{ { "elephant" 2 } { "tiger" 4 } } assemble-values ] unit-test
: regexp-states ( string -- n )
parse-regexp ast>dfa transitions>> assoc-size ;
-[ 3 ] [ "ab|ac" regexp-states ] unit-test
-[ 3 ] [ "a(b|c)" regexp-states ] unit-test
-[ 1 ] [ "((aa*)*)*" regexp-states ] unit-test
-[ 1 ] [ "a|((aa*)*)*" regexp-states ] unit-test
-[ 2 ] [ "ab|((aa*)*)*b" regexp-states ] unit-test
-[ 4 ] [ "ab|cd" regexp-states ] unit-test
-[ 1 ] [ "(?i:[a-z]*|[A-Z]*)" regexp-states ] unit-test
+{ 3 } [ "ab|ac" regexp-states ] unit-test
+{ 3 } [ "a(b|c)" regexp-states ] unit-test
+{ 1 } [ "((aa*)*)*" regexp-states ] unit-test
+{ 1 } [ "a|((aa*)*)*" regexp-states ] unit-test
+{ 2 } [ "ab|((aa*)*)*b" regexp-states ] unit-test
+{ 4 } [ "ab|cd" regexp-states ] unit-test
+{ 1 } [ "(?i:[a-z]*|[A-Z]*)" regexp-states ] unit-test
-[
+{
T{ transition-table
{ transitions H{
{ 0 H{ { CHAR: a 1 } { CHAR: b 1 } } }
{ start-state 0 }
{ final-states HS{ 3 } }
}
-] [
+} [
T{ transition-table
{ transitions H{
{ 0 H{ { CHAR: a 1 } { CHAR: b 4 } } }
[ [ ] [ ] while-changes ] must-infer
-[ H{ { T{ or-class f { 2 1 } } 3 } { 4 5 } } ]
+{ H{ { T{ or-class f { 2 1 } } 3 } { 4 5 } } }
[ H{ { 1 3 } { 2 3 } { 4 5 } } combine-state-transitions ] unit-test
USING: tools.test regexp.negation regexp.transition-tables regexp.classes ;
IN: regexp.negation.tests
-[
+{
! R/ |[^a]|.+/
T{ transition-table
{ transitions H{
{ start-state 0 }
{ final-states HS{ 0 -1 } }
}
-] [
+} [
! R/ a/
T{ transition-table
{ transitions H{
: test-array ( -- x )
{ C{ 1.0 2.0 } 3.0 C{ 5.0 6.0 } } <complex-components> ;
-[ 6 ] [ test-array length ] unit-test
+{ 6 } [ test-array length ] unit-test
-[ 1.0 ] [ test-array first ] unit-test
-[ 2.0 ] [ test-array second ] unit-test
-[ 3.0 ] [ test-array third ] unit-test
-[ 0 ] [ test-array fourth ] unit-test
+{ 1.0 } [ test-array first ] unit-test
+{ 2.0 } [ test-array second ] unit-test
+{ 3.0 } [ test-array third ] unit-test
+{ 0 } [ test-array fourth ] unit-test
-[ { 1.0 2.0 3.0 0 5.0 6.0 } ] [ test-array >array ] unit-test
+{ { 1.0 2.0 3.0 0 5.0 6.0 } } [ test-array >array ] unit-test
: odd-length-test-array ( -- x )
float-array{ 1.0 2.0 3.0 4.0 5.0 } clone <complex-sequence> ;
-[ 2 ] [ test-array length ] unit-test
-[ 2 ] [ odd-length-test-array length ] unit-test
+{ 2 } [ test-array length ] unit-test
+{ 2 } [ odd-length-test-array length ] unit-test
-[ C{ 1.0 2.0 } ] [ test-array first ] unit-test
-[ C{ 3.0 4.0 } ] [ test-array second ] unit-test
+{ C{ 1.0 2.0 } } [ test-array first ] unit-test
+{ C{ 3.0 4.0 } } [ test-array second ] unit-test
-[ { C{ 1.0 2.0 } C{ 3.0 4.0 } } ]
+{ { C{ 1.0 2.0 } C{ 3.0 4.0 } } }
[ test-array >array ] unit-test
-[ float-array{ 1.0 2.0 5.0 6.0 } ]
+{ float-array{ 1.0 2.0 5.0 6.0 } }
[ test-array [ C{ 5.0 6.0 } 1 rot set-nth ] [ seq>> ] bi ]
unit-test
-[ float-array{ 7.0 0.0 3.0 4.0 } ]
+{ float-array{ 7.0 0.0 3.0 4.0 } }
[ test-array [ 7.0 0 rot set-nth ] [ seq>> ] bi ]
unit-test
USING: sequences.cords strings tools.test kernel sequences ;
IN: sequences.cords.tests
-[ "hello world" ] [ "hello" " world" cord-append dup like ] unit-test
+{ "hello world" } [ "hello" " world" cord-append dup like ] unit-test
namespaces make sequences ;
IN: sequences.deep.tests
-[ [ "hello" 3 4 swap ] ] [ [ { "hello" V{ 3 4 } } swap ] flatten ] unit-test
+{ [ "hello" 3 4 swap ] } [ [ { "hello" V{ 3 4 } } swap ] flatten ] unit-test
{ "ABC" } [ { { 65 } 66 { { 67 } } } "" flatten-as ] unit-test
-[ "foo" t ] [ { { "foo" } "bar" } [ string? ] (deep-find) ] unit-test
+{ "foo" t } [ { { "foo" } "bar" } [ string? ] (deep-find) ] unit-test
-[ f f ] [ { { "foo" } "bar" } [ number? ] (deep-find) ] unit-test
+{ f f } [ { { "foo" } "bar" } [ number? ] (deep-find) ] unit-test
-[ { { "foo" } "bar" } t ] [ { { "foo" } "bar" } [ array? ] (deep-find) ] unit-test
+{ { { "foo" } "bar" } t } [ { { "foo" } "bar" } [ array? ] (deep-find) ] unit-test
: change-something ( seq -- newseq )
dup array? [ "hi" suffix ] [ "hello" append ] if ;
-[ { { "heyhello" "hihello" } "hihello" } ]
+{ { { "heyhello" "hihello" } "hihello" } }
[ "hey" 1array 1array [ change-something ] deep-map ] unit-test
-[ { { "heyhello" "hihello" } } ]
+{ { { "heyhello" "hihello" } } }
[ "hey" 1array 1array [ change-something ] deep-map! ] unit-test
-[ t ] [ "foo" [ string? ] deep-any? ] unit-test
+{ t } [ "foo" [ string? ] deep-any? ] unit-test
-[ "foo" ] [ "foo" [ string? ] deep-find ] unit-test
+{ "foo" } [ "foo" [ string? ] deep-find ] unit-test
-[ { { 1 2 } 1 2 } ] [ [ { 1 2 } [ , ] deep-each ] { } make ] unit-test
+{ { { 1 2 } 1 2 } } [ [ { 1 2 } [ , ] deep-each ] { } make ] unit-test
-[ t ]
+{ t }
[ { { 1 2 3 } 4 } { { { 1 { { 1 2 3 } 4 } } } 2 } deep-member? ] unit-test
-[ t ]
+{ t }
[ { { 1 2 3 } 4 } { { { 1 2 3 } 4 } 2 } deep-member? ] unit-test
-[ f ]
+{ f }
[ { 1 2 3 4 } { 1 2 3 { 4 } } deep-subseq? ] unit-test
-[ t ]
+{ t }
[ { 1 2 3 4 } { 1 2 3 4 } deep-subseq? ] unit-test
-[ t ]
+{ t }
[ { 1 2 3 4 } { { 1 2 3 4 } } deep-subseq? ] unit-test
{ 3 } [
sequences.generalizations ascii fry math.parser io io.streams.string ;
IN: sequences.generalizations.tests
-[ 1 2 3 4 ] [ { 1 2 3 4 } 4 firstn ] unit-test
-[ { 1 2 3 4 } ] [ 1 2 3 4 { f f f f } [ 4 set-firstn ] keep ] unit-test
+{ 1 2 3 4 } [ { 1 2 3 4 } 4 firstn ] unit-test
+{ { 1 2 3 4 } } [ 1 2 3 4 { f f f f } [ 4 set-firstn ] keep ] unit-test
[ 1 2 3 4 { f f f } [ 4 set-firstn ] keep ] must-fail
-[ ] [ { } 0 firstn ] unit-test
-[ "a" ] [ { "a" } 1 firstn ] unit-test
+{ } [ { } 0 firstn ] unit-test
+{ "a" } [ { "a" } 1 firstn ] unit-test
-[ [ 1 2 ] ] [ 1 2 2 [ ] nsequence ] unit-test
+{ [ 1 2 ] } [ 1 2 2 [ ] nsequence ] unit-test
-[ { 1 2 3 4 } ] [ { 1 } { 2 } { 3 } { 4 } 4 nappend ] unit-test
-[ V{ 1 2 3 4 } ] [ { 1 } { 2 } { 3 } { 4 } 4 V{ } nappend-as ] unit-test
+{ { 1 2 3 4 } } [ { 1 } { 2 } { 3 } { 4 } 4 nappend ] unit-test
+{ V{ 1 2 3 4 } } [ { 1 } { 2 } { 3 } { 4 } 4 V{ } nappend-as ] unit-test
[ 4 nappend ] must-infer
[ 4 { } nappend-as ] must-infer
[ [ 2 - ] [ ] [ 1 - ] tri ] 2 nproduce
[ drop ] 2dip ;
-[ """A1a!
+{ """A1a!
B2b@
C3c#
D4d$
-""" ] [
+""" } [
{ "A" "B" "C" "D" }
{ "1" "2" "3" "4" }
{ "a" "b" "c" "d" }
[ neach-test ] with-string-writer
] unit-test
-[ { "A1a!" "B2b@" "C3c#" "D4d$" } ]
+{ { "A1a!" "B2b@" "C3c#" "D4d$" } }
[
{ "A" "B" "C" "D" }
{ "1" "2" "3" "4" }
nmap-test
] unit-test
-[ [ "A1a!" "B2b@" "C3c#" "D4d$" ] ]
+{ [ "A1a!" "B2b@" "C3c#" "D4d$" ] }
[
{ "A" "B" "C" "D" }
{ "1" "2" "3" "4" }
nmap-as-test
] unit-test
-[
+{
{ "A" "B" "C" "D" }
{ "1" "2" "3" "4" }
{ "a!" "b@" "c#" "d$" }
-] [
+} [
{ "A" "B" "C" "D" }
{ "1" "2" "3" "4" }
{ "a" "b" "c" "d" }
mnmap-3-test
] unit-test
-[
+{
{ "A1" "B2" "C3" "D4" }
{ "a!" "b@" "c#" "d$" }
-] [
+} [
{ "A" "B" "C" "D" }
{ "1" "2" "3" "4" }
{ "a" "b" "c" "d" }
mnmap-2-test
] unit-test
-[
+{
{ "A1" "B2" "C3" "D4" }
[ "a!" "b@" "c#" "d$" ]
-] [
+} [
{ "A" "B" "C" "D" }
{ "1" "2" "3" "4" }
{ "a" "b" "c" "d" }
mnmap-as-test
] unit-test
-[ { "A1a!" "B2b@" "C3c#" "D4d$" } ]
+{ { "A1a!" "B2b@" "C3c#" "D4d$" } }
[
{ "A" "B" "C" "D" }
{ "1" "2" "3" "4" }
mnmap-1-test
] unit-test
-[ """A1a!
+{ """A1a!
B2b@
C3c#
D4d$
-""" ] [
+""" } [
{ "A" "B" "C" "D" }
{ "1" "2" "3" "4" }
{ "a" "b" "c" "d" }
[ mnmap-0-test ] with-string-writer
] unit-test
-[ { 10 8 6 4 2 } B{ 9 7 5 3 1 } ]
+{ { 10 8 6 4 2 } B{ 9 7 5 3 1 } }
[ 10 nproduce-as-test ] unit-test
-[ { 10 8 6 4 2 } { 9 7 5 3 1 } ]
+{ { 10 8 6 4 2 } { 9 7 5 3 1 } }
[ 10 nproduce-test ] unit-test
{ 45 } [
USING: sequences sequences.merged tools.test ;
IN: sequences.merged.tests
-[ 0 { 1 2 } ] [ 0 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test
-[ 0 { 3 4 } ] [ 1 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test
-[ 1 { 1 2 } ] [ 2 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test
-[ 4 ] [ 3 { { 1 2 3 4 } } <merged> nth ] unit-test
+{ 0 { 1 2 } } [ 0 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test
+{ 0 { 3 4 } } [ 1 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test
+{ 1 { 1 2 } } [ 2 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test
+{ 4 } [ 3 { { 1 2 3 4 } } <merged> nth ] unit-test
[ 4 { { 1 2 3 4 } } <merged> nth ] must-fail
-[ 1 ] [ 0 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
-[ 4 ] [ 1 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
-[ 2 ] [ 2 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
-[ 5 ] [ 3 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
-[ 3 ] [ 4 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
-[ 6 ] [ 5 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
+{ 1 } [ 0 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
+{ 4 } [ 1 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
+{ 2 } [ 2 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
+{ 5 } [ 3 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
+{ 3 } [ 4 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
+{ 6 } [ 5 { 1 2 3 } { 4 5 6 } <2merged> nth ] unit-test
-[ 4 ] [ 4 { 1 2 } { 3 4 } { 5 6 } 3merge nth ] unit-test
+{ 4 } [ 4 { 1 2 } { 3 4 } { 5 6 } 3merge nth ] unit-test
-[ "" ] [ "abcdefg" "" 2merge ] unit-test
-[ "a1b2" ] [ "abc" "12" <2merged> "" like ] unit-test
+{ "" } [ "abcdefg" "" 2merge ] unit-test
+{ "a1b2" } [ "abc" "12" <2merged> "" like ] unit-test
accessors ;
IN: sequences.parser.tests
-[ "hello" ]
+{ "hello" }
[ "hello" [ take-rest ] parse-sequence ] unit-test
-[ "hi" " how are you?" ]
+{ "hi" " how are you?" }
[
"hi how are you?"
[ [ [ current blank? ] take-until ] [ take-rest ] bi ] parse-sequence
] unit-test
-[ "foo" ";bar" ]
+{ "foo" ";bar" }
[
"foo;bar" [
[ CHAR: ; take-until-object ] [ take-rest ] bi
] parse-sequence
] unit-test
-[ "foo " "and bar" ]
+{ "foo " "and bar" }
[
"foo and bar" [
[ "and" take-until-sequence ] [ take-rest ] bi
] parse-sequence
] unit-test
-[ "foo " " bar" ]
+{ "foo " " bar" }
[
"foo and bar" [
[ "and" take-until-sequence ]
] parse-sequence
] unit-test
-[ "foo " " bar" ]
+{ "foo " " bar" }
[
"foo and bar" [
[ "and" take-until-sequence* ]
] parse-sequence
] unit-test
-[ { 1 2 } ]
+{ { 1 2 } }
[ { 1 2 3 4 } <sequence-parser> { 3 4 } take-until-sequence ] unit-test
-[ f "aaaa" ]
+{ f "aaaa" }
[
"aaaa" <sequence-parser>
[ "b" take-until-sequence ] [ take-rest ] bi
] unit-test
-[ 6 ]
+{ 6 }
[
" foo " [ skip-whitespace n>> ] parse-sequence
] unit-test
-[ { 1 2 } ]
+{ { 1 2 } }
[ { 1 2 3 } <sequence-parser> [ current 3 = ] take-until ] unit-test
-[ "ab" ]
+{ "ab" }
[ "abcd" <sequence-parser> "ab" take-sequence ] unit-test
-[ f ]
+{ f }
[ "abcd" <sequence-parser> "lol" take-sequence ] unit-test
-[ "ab" ]
+{ "ab" }
[
"abcd" <sequence-parser>
[ "lol" take-sequence drop ] [ "ab" take-sequence ] bi
] unit-test
-[ "" ]
+{ "" }
[ "abcd" <sequence-parser> "" take-sequence ] unit-test
-[ "cd" ]
+{ "cd" }
[ "abcd" <sequence-parser> [ "ab" take-sequence drop ] [ "cd" take-sequence ] bi ] unit-test
-[ f ]
+{ f }
[ "" <sequence-parser> take-rest ] unit-test
-[ f ]
+{ f }
[ "abc" <sequence-parser> dup "abc" take-sequence drop take-rest ] unit-test
-[ f ]
+{ f }
[ "abc" <sequence-parser> "abcdefg" take-sequence ] unit-test
-[ "1234" ]
+{ "1234" }
[ "1234f" <sequence-parser> take-integer ] unit-test
-[ "yes" ]
+{ "yes" }
[
"yes1234f" <sequence-parser>
[ take-integer drop ] [ "yes" take-sequence ] bi
] unit-test
-[ f ] [ "" <sequence-parser> 4 take-n ] unit-test
-[ "abcd" ] [ "abcd" <sequence-parser> 4 take-n ] unit-test
-[ "abcd" "efg" ] [ "abcdefg" <sequence-parser> [ 4 take-n ] [ take-rest ] bi ] unit-test
+{ f } [ "" <sequence-parser> 4 take-n ] unit-test
+{ "abcd" } [ "abcd" <sequence-parser> 4 take-n ] unit-test
+{ "abcd" "efg" } [ "abcdefg" <sequence-parser> [ 4 take-n ] [ take-rest ] bi ] unit-test
-[ f ]
+{ f }
[ "\n" <sequence-parser> take-integer ] unit-test
-[ "\n" ] [ "\n" <sequence-parser> [ ] take-while ] unit-test
-[ f ] [ "\n" <sequence-parser> [ not ] take-while ] unit-test
+{ "\n" } [ "\n" <sequence-parser> [ ] take-while ] unit-test
+{ f } [ "\n" <sequence-parser> [ not ] take-while ] unit-test
IN: sequences.product.tests
-[ { { 0 "a" } { 1 "a" } { 2 "a" } { 0 "b" } { 1 "b" } { 2 "b" } } ]
+{ { { 0 "a" } { 1 "a" } { 2 "a" } { 0 "b" } { 1 "b" } { 2 "b" } } }
[ { { 0 1 2 } { "a" "b" } } <product-sequence> >array ] unit-test
: x ( n s -- sss ) <repetition> concat ;
-[ { "a" "aa" "aaa" "b" "bb" "bbb" } ]
+{ { "a" "aa" "aaa" "b" "bb" "bbb" } }
[ { { 1 2 3 } { "a" "b" } } [ first2 x ] product-map ] unit-test
-[
+{
{
{ 0 "a" t } { 1 "a" t } { 2 "a" t } { 0 "b" t } { 1 "b" t } { 2 "b" t }
{ 0 "a" f } { 1 "a" f } { 2 "a" f } { 0 "b" f } { 1 "b" f } { 2 "b" f }
}
-] [ { { 0 1 2 } { "a" "b" } { t f } } [ ] product-map ] unit-test
+} [ { { 0 1 2 } { "a" "b" } { t f } } [ ] product-map ] unit-test
-[ "a1b1c1a2b2c2" ] [
+{ "a1b1c1a2b2c2" } [
[
{ { "a" "b" "c" } { "1" "2" } }
[ [ % ] each ] product-each
] "" make
] unit-test
-[ { } ] [ { { } { 1 } } [ ] product-map ] unit-test
-[ ] [ { { } { 1 } } [ drop ] product-each ] unit-test
+{ { } } [ { { } { 1 } } [ ] product-map ] unit-test
+{ } [ { { } { 1 } } [ drop ] product-each ] unit-test
sequences.unrolled tools.test ;
IN: sequences.unrolled.tests
-[ { "0" "1" "2" } ] [ { 0 1 2 } 3 [ number>string ] unrolled-map ] unit-test
-[ { "0" "1" "2" } ] [ { 0 1 2 } [ 3 [ number>string ] unrolled-map ] compile-call ] unit-test
+{ { "0" "1" "2" } } [ { 0 1 2 } 3 [ number>string ] unrolled-map ] unit-test
+{ { "0" "1" "2" } } [ { 0 1 2 } [ 3 [ number>string ] unrolled-map ] compile-call ] unit-test
-[ { "0" "1" "2" } ] [ [ { 0 1 2 } 3 [ number>string , ] unrolled-each ] { } make ] unit-test
-[ { "0" "1" "2" } ] [ [ { 0 1 2 } [ 3 [ number>string , ] unrolled-each ] compile-call ] { } make ] unit-test
+{ { "0" "1" "2" } } [ [ { 0 1 2 } 3 [ number>string , ] unrolled-each ] { } make ] unit-test
+{ { "0" "1" "2" } } [ [ { 0 1 2 } [ 3 [ number>string , ] unrolled-each ] compile-call ] { } make ] unit-test
-[ { "a0" "b1" "c2" } ]
+{ { "a0" "b1" "c2" } }
[ [ { "a" "b" "c" } 3 [ number>string append , ] unrolled-each-index ] { } make ] unit-test
-[ { "a0" "b1" "c2" } ]
+{ { "a0" "b1" "c2" } }
[ [ { "a" "b" "c" } [ 3 [ number>string append , ] unrolled-each-index ] compile-call ] { } make ] unit-test
-[ { "aI" "bII" "cIII" } ]
+{ { "aI" "bII" "cIII" } }
[ [ { "a" "b" "c" } { "I" "II" "III" } [ 3 [ append , ] unrolled-2each ] compile-call ] { } make ] unit-test
-[ { "aI" "bII" "cIII" } ]
+{ { "aI" "bII" "cIII" } }
[ { "a" "b" "c" } { "I" "II" "III" } 3 [ append ] unrolled-2map ] unit-test
-[ { "aI" "bII" "cIII" } ]
+{ { "aI" "bII" "cIII" } }
[ { "a" "b" "c" } { "I" "II" "III" } [ 3 [ append ] unrolled-2map ] compile-call ] unit-test
-[ { "a0" "b1" "c2" } ]
+{ { "a0" "b1" "c2" } }
[ { "a" "b" "c" } 3 [ number>string append ] unrolled-map-index ] unit-test
-[ { "a0" "b1" "c2" } ]
+{ { "a0" "b1" "c2" } }
[ { "a" "b" "c" } [ 3 [ number>string append ] unrolled-map-index ] compile-call ] unit-test
[ { 0 1 2 } 4 [ number>string ] unrolled-map ] [ unrolled-bounds-error? ] must-fail-with
[ { 0 1 2 3 } { 0 1 2 } 4 [ number>string append ] unrolled-2map ] [ unrolled-2bounds-error? ] must-fail-with
-[ t ]
+{ t }
[ [ 3 [ number>string ] unrolled-map ] { call } inlined? ] unit-test
-[ t ]
+{ t }
[ [ 3 [ number>string , ] unrolled-each ] { call } inlined? ] unit-test
-[ t ]
+{ t }
[ [ 3 [ number>string append , ] unrolled-each-index ] { call } inlined? ] unit-test
-[ t ]
+{ t }
[ [ 3 [ append , ] unrolled-2each ] { call } inlined? ] unit-test
-[ t ]
+{ t }
[ [ 3 [ append ] unrolled-2map ] { call } inlined? ] unit-test
-[ t ]
+{ t }
[ [ 3 [ number>string append ] unrolled-map-index ] { call } inlined? ] unit-test
USING: sorting.human tools.test sorting.slots sorting ;
IN: sorting.human.tests
-[ { "x1y" "x2" "x10y" } ]
+{ { "x1y" "x2" "x10y" } }
[ { "x1y" "x10y" "x2" } { human<=> } sort-by ] unit-test
-[ { "4dup" "nip" } ]
+{ { "4dup" "nip" } }
[ { "4dup" "nip" } [ human<=> ] sort ] unit-test
-[ { "4dup" "nip" } ]
+{ { "4dup" "nip" } }
[ { "nip" "4dup" } [ human<=> ] sort ] unit-test
-[ { "4dup" "4nip" "5drop" "nip" "nip2" "nipd" } ]
+{ { "4dup" "4nip" "5drop" "nip" "nip2" "nipd" } }
[ { "nip" "4dup" "4nip" "5drop" "nip2" "nipd" } [ human<=> ] sort ] unit-test
IN: sorting.insertion
USING: sorting.insertion sequences kernel tools.test ;
-[ { { 1 1 } { 1 2 } { 2 0 } } ] [ { { 2 0 } { 1 1 } { 1 2 } } dup [ first ] insertion-sort ] unit-test
+{ { { 1 1 } { 1 2 } { 2 0 } } } [ { { 2 0 } { 1 1 } { 1 2 } } dup [ first ] insertion-sort ] unit-test
TUPLE: tuple2 d ;
-[
+{
{
T{ sort-test { a 1 } { b 3 } { c 9 } }
T{ sort-test { a 1 } { b 1 } { c 10 } }
T{ sort-test { a 2 } { b 5 } { c 2 } }
T{ sort-test { a 2 } { b 5 } { c 3 } }
}
-] [
+} [
{
T{ sort-test f 1 3 9 }
T{ sort-test f 1 1 10 }
} { { a>> <=> } { b>> >=< } { c>> <=> } } sort-by
] unit-test
-[
+{
{
T{ sort-test { a 1 } { b 3 } { c 9 } }
T{ sort-test { a 1 } { b 1 } { c 10 } }
T{ sort-test { a 2 } { b 5 } { c 2 } }
T{ sort-test { a 2 } { b 5 } { c 3 } }
}
-] [
+} [
{
T{ sort-test f 1 3 9 }
T{ sort-test f 1 1 10 }
} { { a>> <=> } { b>> >=< } { c>> <=> } } sort-by
] unit-test
-[ { } ]
+{ { } }
[ { } { { a>> <=> } { b>> >=< } { c>> <=> } } sort-by ] unit-test
-[ { } ]
+{ { } }
[ { } { } sort-by ] unit-test
-[
+{
{
T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 1 } } } }
T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 2 } } } }
T{ sort-test { a 6 } { tuple2 T{ tuple2 { d 3 } } } }
T{ sort-test { a 5 } { tuple2 T{ tuple2 { d 4 } } } }
}
-] [
+} [
{
T{ sort-test f 6 f f T{ tuple2 f 1 } }
T{ sort-test f 5 f f T{ tuple2 f 4 } }
] unit-test
-[ { "a" "b" "c" } ] [ { "b" "c" "a" } { <=> <=> } sort-by ] unit-test
-[ { "b" "c" "a" } ] [ { "b" "c" "a" } { } sort-by ] unit-test
+{ { "a" "b" "c" } } [ { "b" "c" "a" } { <=> <=> } sort-by ] unit-test
+{ { "b" "c" "a" } } [ { "b" "c" "a" } { } sort-by ] unit-test
<< "length-test" [ length ] define-sorting >>
-[ { { 1 } { 1 2 3 } { 1 3 2 } { 3 2 1 } } ]
+{ { { 1 } { 1 2 3 } { 1 3 2 } { 3 2 1 } } }
[
{ { 3 2 1 } { 1 2 3 } { 1 3 2 } { 1 } }
{ length-test<=> <=> } sort-by
] unit-test
-[ { { { 0 } 1 } { { 1 } 2 } { { 1 } 1 } { { 3 1 } 2 } } ]
+{ { { { 0 } 1 } { { 1 } 2 } { { 1 } 1 } { { 3 1 } 2 } } }
[
{ { { 3 1 } 2 } { { 1 } 2 } { { 0 } 1 } { { 1 } 1 } }
{ length-test<=> <=> } sort-keys-by
] unit-test
-[ { { 0 { 1 } } { 1 { 1 } } { 3 { 2 4 } } { 1 { 2 0 0 0 } } } ]
+{ { { 0 { 1 } } { 1 { 1 } } { 3 { 2 4 } } { 1 { 2 0 0 0 } } } }
[
{ { 3 { 2 4 } } { 1 { 2 0 0 0 } } { 0 { 1 } } { 1 { 1 } } }
{ length-test<=> <=> } sort-values-by
"on belay"
"for the horde"
} ;
-[
+{
{
"A"
"Another"
"The"
"la vida loca"
}
-] [
+} [
sort-me { title<=> } sort-by
] unit-test
{ { V{ 1 } } } [ { 1 } [ < ] monotonic-split ] unit-test
{ { V{ 1 2 } } } [ { 1 2 } [ < ] monotonic-split ] unit-test
{ { V{ 1 } V{ 2 } } } [ { 1 2 } [ > ] monotonic-split ] unit-test
-[ { V{ 1 } V{ -1 5 } V{ 2 4 } } ]
+{ { V{ 1 } V{ -1 5 } V{ 2 4 } } }
[ { 1 -1 5 2 4 } [ < ] monotonic-split ] unit-test
-[ { V{ 1 1 1 1 } V{ 2 2 } V{ 3 } V{ 4 } V{ 5 } V{ 6 6 6 } } ]
+{ { V{ 1 1 1 1 } V{ 2 2 } V{ 3 } V{ 4 } V{ 5 } V{ 6 6 6 } } }
[ { 1 1 1 1 2 2 3 4 5 6 6 6 } [ = ] monotonic-split ] unit-test
-[ { } ]
+{ { } }
[ { } [ = ] slice monotonic-slice ] unit-test
-[ t ]
+{ t }
[ { 1 } [ = ] slice monotonic-slice [ slice? ] all? ] unit-test
-[ { { 1 } } ]
+{ { { 1 } } }
[ { 1 } [ = ] slice monotonic-slice [ >array ] map ] unit-test
[ { 1 } [ = ] slice monotonic-slice ] must-infer
-[ t ]
+{ t }
[ { 1 1 1 2 2 3 3 4 } [ = ] slice monotonic-slice [ slice? ] all? ] unit-test
-[ { { 1 1 1 } { 2 2 } { 3 3 } { 4 } } ]
+{ { { 1 1 1 } { 2 2 } { 3 3 } { 4 } } }
[ { 1 1 1 2 2 3 3 4 } [ = ] slice monotonic-slice [ >array ] map ] unit-test
-[ { { 3 3 } } ]
+{ { { 3 3 } } }
[ { 3 3 } [ = ] slice monotonic-slice [ >array ] map ] unit-test
-[
+{
{
T{ upward-slice { from 0 } { to 3 } { seq { 1 2 3 2 1 } } }
T{ downward-slice { from 2 } { to 5 } { seq { 1 2 3 2 1 } } }
}
-]
+}
[ { 1 2 3 2 1 } trends ] unit-test
-[
+{
{
T{ upward-slice
{ from 0 }
{ seq { 1 2 3 3 2 1 } }
}
}
-] [ { 1 2 3 3 2 1 } trends ] unit-test
+} [ { 1 2 3 3 2 1 } trends ] unit-test
-[ { { 2 2 } { 3 3 3 3 } { 4 } { 5 } } ]
+{ { { 2 2 } { 3 3 3 3 } { 4 } { 5 } } }
[
{ 2 2 3 3 3 3 4 5 }
[ [ odd? ] same? ] slice monotonic-slice
[ >array ] map
] unit-test
-[
+{
{ { 1 1 1 } { 2 2 2 2 } { 3 3 } }
-] [
+} [
{ 1 1 1 2 2 2 2 3 3 }
[ [ odd? ] same? ] slice monotonic-slice
[ >array ] map
stack-checker.visitor sequences assocs ;
IN: stack-checker.backend.tests
-[ ] [
+{ } [
V{ } clone (meta-d) set
V{ } clone (meta-r) set
V{ } clone literals set
0 inner-d-index set
] unit-test
-[ 0 ] [ 0 ensure-d length ] unit-test
+{ 0 } [ 0 ensure-d length ] unit-test
-[ 2 ] [ 2 ensure-d length ] unit-test
+{ 2 } [ 2 ensure-d length ] unit-test
-[ t ] [ meta-d [ known-values get at input-parameter? ] all? ] unit-test
+{ t } [ meta-d [ known-values get at input-parameter? ] all? ] unit-test
-[ 2 ] [ meta-d length ] unit-test
+{ 2 } [ meta-d length ] unit-test
-[ 3 ] [ 3 ensure-d length ] unit-test
-[ 3 ] [ meta-d length ] unit-test
+{ 3 } [ 3 ensure-d length ] unit-test
+{ 3 } [ meta-d length ] unit-test
-[ 1 ] [ 1 ensure-d length ] unit-test
-[ 3 ] [ meta-d length ] unit-test
+{ 1 } [ 1 ensure-d length ] unit-test
+{ 3 } [ meta-d length ] unit-test
{ } [ 1 consume-d drop ] unit-test
: compose-n-test ( a b c -- x ) 2 \ + compose-n ;
-[ 6 ] [ 1 2 3 compose-n-test ] unit-test
+{ 6 } [ 1 2 3 compose-n-test ] unit-test
TUPLE: color r g b ;
{ 1 3 } [ cleave-test ] must-infer-as
-[ 1 2 3 ] [ 1 2 3 <color> cleave-test ] unit-test
+{ 1 2 3 } [ 1 2 3 <color> cleave-test ] unit-test
-[ 1 2 3 ] [ 1 2 3 <color> \ cleave-test def>> call ] unit-test
+{ 1 2 3 } [ 1 2 3 <color> \ cleave-test def>> call ] unit-test
: 2cleave-test ( a b -- c d e ) { [ 2array ] [ + ] [ - ] } 2cleave ;
-[ { 1 2 } 3 -1 ] [ 1 2 2cleave-test ] unit-test
+{ { 1 2 } 3 -1 } [ 1 2 2cleave-test ] unit-test
-[ { 1 2 } 3 -1 ] [ 1 2 \ 2cleave-test def>> call ] unit-test
+{ { 1 2 } 3 -1 } [ 1 2 \ 2cleave-test def>> call ] unit-test
: spread-test ( a b c -- d e f ) { [ sq ] [ neg ] [ recip ] } spread ;
-[ 16 -3 1/6 ] [ 4 3 6 spread-test ] unit-test
+{ 16 -3 1/6 } [ 4 3 6 spread-test ] unit-test
-[ 16 -3 1/6 ] [ 4 3 6 \ spread-test def>> call ] unit-test
+{ 16 -3 1/6 } [ 4 3 6 \ spread-test def>> call ] unit-test
[ fixnum instance? ] must-infer
: member?-test ( a -- ? ) { 1 2 3 10 7 58 } member? ;
-[ f ] [ 1.0 member?-test ] unit-test
-[ t ] [ \ member?-test def>> first [ member?-test ] all? ] unit-test
+{ f } [ 1.0 member?-test ] unit-test
+{ t } [ \ member?-test def>> first [ member?-test ] all? ] unit-test
! Macro expansion should throw its own type of error
: bad-macro ( -- ) ;
USING: tools.test strings.tables ;
IN: strings.tables.tests
-[ { } ] [ { } format-table ] unit-test
+{ { } } [ { } format-table ] unit-test
-[ { "A BB" "CC D" } ] [ { { "A" "BB" } { "CC" "D" } } format-table ] unit-test
+{ { "A BB" "CC D" } } [ { { "A" "BB" } { "CC" "D" } } format-table ] unit-test
-[ { "A C" "B " "D E" } ] [ { { "A\nB" "C" } { "D" "E" } } format-table ] unit-test
+{ { "A C" "B " "D E" } } [ { { "A\nB" "C" } { "D" "E" } } format-table ] unit-test
-[ { "A B" " C" "D E" } ] [ { { "A" "B\nC" } { "D" "E" } } format-table ] unit-test
+{ { "A B" " C" "D E" } } [ { { "A" "B\nC" } { "D" "E" } } format-table ] unit-test
-[ { "A B" "C D" " E" } ] [ { { "A" "B" } { "C" "D\nE" } } format-table ] unit-test
+{ { "A B" "C D" " E" } } [ { { "A" "B" } { "C" "D\nE" } } format-table ] unit-test
: foo ( -- ) ;
\ foo watch
-[ ] [ foo ] unit-test
+{ } [ foo ] unit-test
! erg's bug
GENERIC: some-generic ( a -- b )
M: integer some-generic 1 + ;
-[ 4 ] [ 3 some-generic ] unit-test
+{ 4 } [ 3 some-generic ] unit-test
-[ ] [ \ some-generic watch ] unit-test
+{ } [ \ some-generic watch ] unit-test
-[ 4 ] [ 3 some-generic ] unit-test
+{ 4 } [ 3 some-generic ] unit-test
-[ ] [ "IN: tools.annotations.tests USE: math M: integer some-generic 1 - ;" eval( -- ) ] unit-test
+{ } [ "IN: tools.annotations.tests USE: math M: integer some-generic 1 - ;" eval( -- ) ] unit-test
-[ 2 ] [ 3 some-generic ] unit-test
+{ 2 } [ 3 some-generic ] unit-test
-[ ] [ \ some-generic reset ] unit-test
+{ } [ \ some-generic reset ] unit-test
-[ 2 ] [ 3 some-generic ] unit-test
+{ 2 } [ 3 some-generic ] unit-test
! slava's bug
GENERIC: another-generic ( a -- b )
\ another-generic watch
-[ ] [ "IN: tools.annotations.tests GENERIC: another-generic ( a -- b )" eval( -- ) ] unit-test
+{ } [ "IN: tools.annotations.tests GENERIC: another-generic ( a -- b )" eval( -- ) ] unit-test
-[ ] [ \ another-generic reset ] unit-test
+{ } [ \ another-generic reset ] unit-test
-[ "" ] [ [ 3 another-generic drop ] with-string-writer ] unit-test
+{ "" } [ [ 3 another-generic drop ] with-string-writer ] unit-test
! reset should do the right thing for generic words
-[ ] [ \ another-generic watch ] unit-test
+{ } [ \ another-generic watch ] unit-test
GENERIC: blah-generic ( a -- b )
M: string blah-generic ;
-[ ] [ M\ string blah-generic watch ] unit-test
+{ } [ M\ string blah-generic watch ] unit-test
-[ "hi" ] [ "hi" blah-generic ] unit-test
+{ "hi" } [ "hi" blah-generic ] unit-test
! See how well watch interacts with optimizations.
GENERIC: my-generic ( a -- b )
: some-code ( -- )
f my-generic drop ;
-[ ] [ some-code ] unit-test
+{ } [ some-code ] unit-test
! Make sure annotations work on primitives
\ gc reset
\ gc watch
-[ f ] [ [ [ gc ] with-error>output ] with-string-writer empty? ] unit-test
+{ f } [ [ [ gc ] with-error>output ] with-string-writer empty? ] unit-test
\ gc reset
M: generic predicate-test ;
-[ f ] [ \ + irrelevant? ] unit-test
-[ t ] [ \ predicate-test "engines" word-prop first irrelevant? ] unit-test
+{ f } [ \ + irrelevant? ] unit-test
+{ t } [ \ predicate-test "engines" word-prop first irrelevant? ] unit-test
GENERIC: foo ( a b -- c )
"vocab:tools/crossref/test/foo.factor" run-file
-[ t ] [ integer \ foo lookup-method \ + usage member? ] unit-test
-[ t ] [ \ foo usage [ pathname? ] any? ] unit-test
+{ t } [ integer \ foo lookup-method \ + usage member? ] unit-test
+{ t } [ \ foo usage [ pathname? ] any? ] unit-test
! Issues with forget
GENERIC: generic-forget-test-1 ( a b -- c )
M: integer generic-forget-test-1 / ;
-[ t ] [
+{ t } [
\ / usage [ word? ] filter
[ name>> "integer=>generic-forget-test-1" = ] any?
] unit-test
-[ ] [
+{ } [
[ \ generic-forget-test-1 forget ] with-compilation-unit
] unit-test
-[ f ] [
+{ f } [
\ / usage [ word? ] filter
[ name>> "integer=>generic-forget-test-1" = ] any?
] unit-test
M: sequence generic-forget-test-2 = ;
-[ t ] [
+{ t } [
\ = usage [ word? ] filter
[ name>> "sequence=>generic-forget-test-2" = ] any?
] unit-test
-[ ] [
+{ } [
[ M\ sequence generic-forget-test-2 forget ] with-compilation-unit
] unit-test
-[ f ] [
+{ f } [
\ = usage [ word? ] filter
[ name>> "sequence=>generic-forget-test-2" = ] any?
] unit-test
[ "no such vocab, fool!" deploy ] [ bad-vocab-name? ] must-fail-with
-[ ] [ "hello-world" shake-and-bake 550000 small-enough? ] unit-test
+{ } [ "hello-world" shake-and-bake 550000 small-enough? ] unit-test
-[ ] [ "sudoku" shake-and-bake 800000 small-enough? ] unit-test
+{ } [ "sudoku" shake-and-bake 800000 small-enough? ] unit-test
! [ ] [ "hello-ui" shake-and-bake 1605000 small-enough? ] unit-test
-[ ] [ "hello-ui" shake-and-bake 2069160 small-enough? ] unit-test
+{ } [ "hello-ui" shake-and-bake 2069160 small-enough? ] unit-test
-[ "math-threads-compiler-io-ui" ] [
+{ "math-threads-compiler-io-ui" } [
"hello-ui" deploy-config [
bootstrap-profile staging-image-name file-name
"." split second
] unit-test
! [ ] [ "maze" shake-and-bake 1520000 small-enough? ] unit-test
-[ ] [ "maze" shake-and-bake 2000000 small-enough? ] unit-test
+{ } [ "maze" shake-and-bake 2000000 small-enough? ] unit-test
! [ ] [ "tetris" shake-and-bake 1734000 small-enough? ] unit-test
-[ ] [ "tetris" shake-and-bake 2186392 small-enough? ] unit-test
+{ } [ "tetris" shake-and-bake 2186392 small-enough? ] unit-test
! [ ] [ "spheres" shake-and-bake 1557000 small-enough? ] unit-test
-[ ] [ "spheres" shake-and-bake 2031096 small-enough? ] unit-test
+{ } [ "spheres" shake-and-bake 2031096 small-enough? ] unit-test
! [ ] [ "terrain" shake-and-bake 2053000 small-enough? ] unit-test
-[ ] [ "terrain" shake-and-bake 2671928 small-enough? ] unit-test
+{ } [ "terrain" shake-and-bake 2671928 small-enough? ] unit-test
! [ ] [ "gpu.demos.raytrace" shake-and-bake 2764000 small-enough? ] unit-test
-[ ] [ "gpu.demos.raytrace" shake-and-bake 3307816 small-enough? ] unit-test
+{ } [ "gpu.demos.raytrace" shake-and-bake 3307816 small-enough? ] unit-test
-[ ] [ "bunny" shake-and-bake 2500000 small-enough? ] unit-test
+{ } [ "bunny" shake-and-bake 2500000 small-enough? ] unit-test
-[ ] [ "gpu.demos.bunny" shake-and-bake 3500000 small-enough? ] unit-test
+{ } [ "gpu.demos.bunny" shake-and-bake 3500000 small-enough? ] unit-test
os macosx? [
[ ] [ "webkit-demo" shake-and-bake 600000 small-enough? ] unit-test
] when
-[ ] [ "benchmark.regex-dna" shake-and-bake 900000 small-enough? ] unit-test
+{ } [ "benchmark.regex-dna" shake-and-bake 900000 small-enough? ] unit-test
{
"tools.deploy.test.1"
] with-scope
"port" set ;
-[ ] [
+{ } [
<dispatcher>
add-quot-responder
"vocab:http/test" <static> >>default
test-httpd
] unit-test
-[ ] [
+{ } [
"tools.deploy.test.5" shake-and-bake
run-temp-image
] unit-test
: add-port ( url -- url' )
>url clone "port" get >>port ;
-[ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test
+{ } [ "http://localhost/quit" add-port http-get 2drop ] unit-test
{
"tools.deploy.test.6"
[ ] [ "tools.deploy.test.14" shake-and-bake run-temp-image ] unit-test
] when
-[ { "a" "b" "c" } ] [
+{ { "a" "b" "c" } } [
"tools.deploy.test.15" shake-and-bake deploy-test-command
{ "a" "b" "c" } append
ascii [ lines ] with-process-reader
rest
] unit-test
-[ ] [ "tools.deploy.test.16" shake-and-bake run-temp-image ] unit-test
+{ } [ "tools.deploy.test.16" shake-and-bake run-temp-image ] unit-test
-[ ] [ "tools.deploy.test.17" shake-and-bake run-temp-image ] unit-test
+{ } [ "tools.deploy.test.17" shake-and-bake run-temp-image ] unit-test
-[ t ] [
+{ t } [
"tools.deploy.test.18" shake-and-bake
deploy-test-command ascii [ readln ] with-process-reader
test-image temp-file =
] unit-test
-[ ] [ "resource:license.txt" "license.txt" temp-file copy-file ] unit-test
+{ } [ "resource:license.txt" "license.txt" temp-file copy-file ] unit-test
-[ ] [ "tools.deploy.test.19" shake-and-bake run-temp-image ] unit-test
+{ } [ "tools.deploy.test.19" shake-and-bake run-temp-image ] unit-test
-[ ] [ "tools.deploy.test.20" shake-and-bake ] unit-test
+{ } [ "tools.deploy.test.20" shake-and-bake ] unit-test
-[ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>Factor</foo>" ]
+{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>Factor</foo>" }
[ deploy-test-command ascii [ readln ] with-process-reader ] unit-test
! [ ] [ "tools.deploy.test.20" drop 1353000 small-enough? ] unit-test
-[ ] [ "tools.deploy.test.20" drop 1363000 small-enough? ] unit-test
+{ } [ "tools.deploy.test.20" drop 1363000 small-enough? ] unit-test
-[ ] [ "tools.deploy.test.21" shake-and-bake ] unit-test
+{ } [ "tools.deploy.test.21" shake-and-bake ] unit-test
-[ "1 2 3" ]
+{ "1 2 3" }
[ deploy-test-command ascii [ readln ] with-process-reader ] unit-test
-[ ] [ "tools.deploy.test.21" drop 1260000 small-enough? ] unit-test
+{ } [ "tools.deploy.test.21" drop 1260000 small-enough? ] unit-test
-[ ] [ "benchmark.ui-panes" shake-and-bake run-temp-image ] unit-test
+{ } [ "benchmark.ui-panes" shake-and-bake run-temp-image ] unit-test
[ [ 3 throw ] leaks. ] must-fail
-[ f ] [ debug-leaks? get-global ] unit-test
+{ f } [ debug-leaks? get-global ] unit-test
-[ ] [ [ ] leaks. ] unit-test
+{ } [ [ ] leaks. ] unit-test
-[ f ] [ debug-leaks? get-global ] unit-test
+{ f } [ debug-leaks? get-global ] unit-test
DEFER: blah
-[ ] [
+{ } [
{
T{ compiler-error
{ error T{ do-not-compile f blah } }
USING: tools.test tools.files strings kernel ;
IN: tools.files.tests
-[ ] [ "" directory. ] unit-test
+{ } [ "" directory. ] unit-test
-[ ] [ file-systems. ] unit-test
+{ } [ file-systems. ] unit-test
USING: tools.hexdump kernel sequences tools.test byte-arrays ;
IN: tools.hexdump.tests
-[ t ] [ B{ } hexdump "Length: 0, 0h\n" = ] unit-test
-[ t ] [ "abcdefghijklmnopqrstuvwxyz" >byte-array hexdump "Length: 26, 1ah\n00000000h: 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 abcdefghijklmnop\n00000010h: 71 72 73 74 75 76 77 78 79 7a qrstuvwxyz\n" = ] unit-test
+{ t } [ B{ } hexdump "Length: 0, 0h\n" = ] unit-test
+{ t } [ "abcdefghijklmnopqrstuvwxyz" >byte-array hexdump "Length: 26, 1ah\n00000000h: 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 abcdefghijklmnop\n00000010h: 71 72 73 74 75 76 77 78 79 7a qrstuvwxyz\n" = ] unit-test
-[ t ] [ 256 iota [ ] B{ } map-as hexdump "Length: 256, 100h\n00000000h: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................\n00000010h: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................\n00000020h: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f !\"#$%&'()*+,-./\n00000030h: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 0123456789:;<=>?\n00000040h: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO\n00000050h: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f PQRSTUVWXYZ[\\]^_\n00000060h: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f `abcdefghijklmno\n00000070h: 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f pqrstuvwxyz{|}~.\n00000080h: 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f ................\n00000090h: 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f ................\n000000a0h: a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af ................\n000000b0h: b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf ................\n000000c0h: c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf ................\n000000d0h: d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df ................\n000000e0h: e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef ................\n000000f0h: f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff ................\n" = ] unit-test
+{ t } [ 256 iota [ ] B{ } map-as hexdump "Length: 256, 100h\n00000000h: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................\n00000010h: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................\n00000020h: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f !\"#$%&'()*+,-./\n00000030h: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 0123456789:;<=>?\n00000040h: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO\n00000050h: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f PQRSTUVWXYZ[\\]^_\n00000060h: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f `abcdefghijklmno\n00000070h: 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f pqrstuvwxyz{|}~.\n00000080h: 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f ................\n00000090h: 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f ................\n000000a0h: a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af ................\n000000b0h: b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf ................\n000000c0h: c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf ................\n000000d0h: d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df ................\n000000e0h: e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef ................\n000000f0h: f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff ................\n" = ] unit-test
-[
- "Length: 3, 3h\n00000000h: 01 02 03 ...\n" ] [ B{ 1 2 3 } hexdump ] unit-test
+{
+ "Length: 3, 3h\n00000000h: 01 02 03 ...\n" } [ B{ 1 2 3 } hexdump ] unit-test
USING: tools.test tools.memory memory arrays ;
IN: tools.memory.tests
-[ ] [ room. ] unit-test
-[ ] [ heap-stats. ] unit-test
-[ t ] [ [ gc gc ] collect-gc-events array? ] unit-test
-[ ] [ gc-events. ] unit-test
-[ ] [ gc-stats. ] unit-test
-[ ] [ gc-summary. ] unit-test
-[ ] [ callback-room. ] unit-test
+{ } [ room. ] unit-test
+{ } [ heap-stats. ] unit-test
+{ t } [ [ gc gc ] collect-gc-events array? ] unit-test
+{ } [ gc-events. ] unit-test
+{ } [ gc-stats. ] unit-test
+{ } [ gc-summary. ] unit-test
+{ } [ callback-room. ] unit-test
{ } [ 10 [ [ 100 [ 1000 random (byte-array) drop ] times compact-gc ] profile ] times ] unit-test
{ } [ 2 [ [ 1 seconds sleep ] profile ] times ] unit-test
-[ ] [ [ 300,000 iota [ sq sq sq ] map drop ] profile flat profile. ] unit-test
-[ ] [ [ 300,000 iota [ sq sq sq ] map drop ] profile top-down profile. ] unit-test
+{ } [ [ 300,000 iota [ sq sq sq ] map drop ] profile flat profile. ] unit-test
+{ } [ [ 300,000 iota [ sq sq sq ] map drop ] profile top-down profile. ] unit-test
(clear-samples)
f raw-profile-data set-global
: undocumented-word ( obj1 obj2 -- obj3 obj4 )
[ >lower ] [ >upper ] bi* ;
-[
+{
"""HELP: undocumented-word
{ $values
{ "obj1" object } { "obj2" object }
}
{ $description "" } ;
"""
-]
+}
[
[ \ undocumented-word (help.) ] with-string-writer
] unit-test
: test-maybe ( obj -- obj/f ) ;
-[ ] [ \ test-maybe (help.) ] unit-test
+{ } [ \ test-maybe (help.) ] unit-test
IN: tools.test.tests
USING: tools.test tools.test.private namespaces kernel sequences ;
-[ 1 ] [
+{ 1 } [
[
[ "OOPS" ] must-fail
] fake-unit-test length
IN: tools.time.tests
USING: tools.time tools.test compiler.test ;
-[ ] [ [ [ ] time ] compile-call ] unit-test
+{ } [ [ [ ] time ] compile-call ] unit-test
USING: tools.trace tools.test tools.continuations kernel math combinators
sequences ;
-[ { 3 2 1 } ] [ { 1 2 3 } [ reverse ] trace ] unit-test
+{ { 3 2 1 } } [ { 1 2 3 } [ reverse ] trace ] unit-test
GENERIC: method-breakpoint-test ( x -- y )
\ method-breakpoint-test don't-step-into
-[ 3 ]
+{ 3 }
[ [ T{ method-breakpoint-tuple } method-breakpoint-test ] trace ] unit-test
: case-breakpoint-test ( -- x )
\ case-breakpoint-test don't-step-into
-[ 6 ] [ [ case-breakpoint-test ] trace ] unit-test
+{ 6 } [ [ case-breakpoint-test ] trace ] unit-test
: call(-breakpoint-test ( -- x )
[ break 1 ] call( -- x ) 2 + ;
\ call(-breakpoint-test don't-step-into
-[ 3 ] [ [ call(-breakpoint-test ] trace ] unit-test
+{ 3 } [ [ call(-breakpoint-test ] trace ] unit-test
tools.continuations accessors words combinators ;
IN: tools.walker.tests
-[ { } ] [
+{ { } } [
[ ] test-walker
] unit-test
-[ { 1 } ] [
+{ { 1 } } [
[ 1 ] test-walker
] unit-test
-[ { 1 2 3 } ] [
+{ { 1 2 3 } } [
[ 1 2 3 ] test-walker
] unit-test
-[ { "Yo" 2 } ] [
+{ { "Yo" 2 } } [
[ 2 [ "Yo" ] dip ] test-walker
] unit-test
-[ { "Yo" 2 3 } ] [
+{ { "Yo" 2 3 } } [
[ 2 [ "Yo" ] dip 3 ] test-walker
] unit-test
-[ { 2 } ] [
+{ { 2 } } [
[ t [ 2 ] [ "hi" ] if ] test-walker
] unit-test
-[ { "hi" } ] [
+{ { "hi" } } [
[ f [ 2 ] [ "hi" ] if ] test-walker
] unit-test
-[ { 4 } ] [
+{ { 4 } } [
[ 2 2 fixnum+ ] test-walker
] unit-test
: foo ( -- x ) 2 2 fixnum+ ;
-[ { 8 } ] [
+{ { 8 } } [
[ foo 4 fixnum+ ] test-walker
] unit-test
-[ { C{ 1 1.5 } { } C{ 1 1.5 } { } } ] [
+{ { C{ 1 1.5 } { } C{ 1 1.5 } { } } } [
[ C{ 1 1.5 } { } 2dup ] test-walker
] unit-test
-[ { t } ] [
+{ { t } } [
[ 5 5 number= ] test-walker
] unit-test
-[ { f } ] [
+{ { f } } [
[ 5 6 number= ] test-walker
] unit-test
-[ { 0 } ] [
+{ { 0 } } [
[ 0 { array-capacity } declare ] test-walker
] unit-test
-[ { f } ] [
+{ { f } } [
[ "XYZ" "XYZ" mismatch ] test-walker
] unit-test
-[ { t } ] [
+{ { t } } [
[ "XYZ" "XYZ" sequence= ] test-walker
] unit-test
-[ { t } ] [
+{ { t } } [
[ "XYZ" "XYZ" = ] test-walker
] unit-test
-[ { f } ] [
+{ { f } } [
[ "XYZ" "XuZ" = ] test-walker
] unit-test
-[ { 4 } ] [
+{ { 4 } } [
[ 2 2 + ] test-walker
] unit-test
-[ { 3 } ] [
+{ { 3 } } [
[ [ 3 "x" set "x" get ] with-scope ] test-walker
] unit-test
-[ { "hi\n" } ] [
+{ { "hi\n" } } [
[ [ "hi" print ] with-string-writer ] test-walker
] unit-test
-[ { "4\n" } ] [
+{ { "4\n" } } [
[ [ 2 2 + number>string print ] with-string-writer ] test-walker
] unit-test
-[ { 1 2 3 } ] [
+{ { 1 2 3 } } [
[ { 1 2 3 } set-datastack ] test-walker
] unit-test
-[ { 6 } ]
+{ { 6 } }
[ [ 3 [ nip continue ] callcc0 2 * ] test-walker ] unit-test
-[ { 6 } ]
+{ { 6 } }
[ [ [ 3 swap continue-with ] callcc1 2 * ] test-walker ] unit-test
-[ { } ]
+{ { } }
[ [ [ ] [ ] recover ] test-walker ] unit-test
-[ { 6 } ]
+{ { 6 } }
[ [ [ 3 throw ] [ 2 * ] recover ] test-walker ] unit-test
-[ { T{ no-method f + nth } } ]
+{ { T{ no-method f + nth } } }
[ [ [ 0 \ + nth ] [ ] recover ] test-walker ] unit-test
-[ { } ] [
+{ { } } [
[ "a" "b" set "c" "d" set [ ] test-walker ] with-scope
] unit-test
\ breakpoint-test don't-step-into
-[ f ] [ \ breakpoint-test optimized? ] unit-test
+{ f } [ \ breakpoint-test optimized? ] unit-test
-[ { 3 } ] [ [ breakpoint-test ] test-walker ] unit-test
+{ { 3 } } [ [ breakpoint-test ] test-walker ] unit-test
GENERIC: method-breakpoint-test ( x -- y )
\ method-breakpoint-test don't-step-into
-[ { 3 } ]
+{ { 3 } }
[ [ T{ method-breakpoint-tuple } method-breakpoint-test ] test-walker ] unit-test
: case-breakpoint-test ( -- x )
\ case-breakpoint-test don't-step-into
-[ { 6 } ] [ [ case-breakpoint-test ] test-walker ] unit-test
+{ { 6 } } [ [ case-breakpoint-test ] test-walker ] unit-test
: call(-breakpoint-test ( -- x )
[ break 1 ] call( -- x ) 2 + ;
\ call(-breakpoint-test don't-step-into
-[ { 3 } ] [ [ call(-breakpoint-test ] test-walker ] unit-test
+{ { 3 } } [ [ call(-breakpoint-test ] test-walker ] unit-test
USING: ui.backend.cocoa.views tools.test kernel math.rectangles
namespaces ;
-[ t ] [
+{ t } [
T{ rect
{ loc { 0 0 } }
{ dim { 1000 1000 } }
IN: ui.baseline-alignment.tests
! Test baseline calculations
-[ 10 0 ] [ 0 10 0 10 combine-metrics ] unit-test
-[ 10 5 ] [ 0 10 5 10 combine-metrics ] unit-test
-[ 15 15 ] [ 30 0 0 0 combine-metrics ] unit-test
-[ 5 30 ] [ 10 0 30 0 combine-metrics ] unit-test
-[ 10 10 ] [ 5 10 10 10 combine-metrics ] unit-test
-[ 15 5 ] [ 20 10 0 10 combine-metrics ] unit-test
-[ 15 40 ] [ 20 10 40 10 combine-metrics ] unit-test
-[ 12 3 ] [ 0 12 3 9 combine-metrics ] unit-test
+{ 10 0 } [ 0 10 0 10 combine-metrics ] unit-test
+{ 10 5 } [ 0 10 5 10 combine-metrics ] unit-test
+{ 15 15 } [ 30 0 0 0 combine-metrics ] unit-test
+{ 5 30 } [ 10 0 30 0 combine-metrics ] unit-test
+{ 10 10 } [ 5 10 10 10 combine-metrics ] unit-test
+{ 15 5 } [ 20 10 0 10 combine-metrics ] unit-test
+{ 15 40 } [ 20 10 40 10 combine-metrics ] unit-test
+{ 12 3 } [ 0 12 3 9 combine-metrics ] unit-test
-[ t ] [ \ baseline \ cap-height [ order ] bi@ set= ] unit-test
+{ t } [ \ baseline \ cap-height [ order ] bi@ set= ] unit-test
USING: ui.commands ui.gestures tools.test help.markup io
io.streams.string system kernel ;
-[ "Press Button 2" ] [ T{ button-down f f 2 } gesture>string ] unit-test
+{ "Press Button 2" } [ T{ button-down f f 2 } gesture>string ] unit-test
: com-test-1 ( -- ) ;
\ com-test-1 H{ } define-command
-[ [ 3 com-test-1 ] ] [ 3 \ com-test-1 command-quot ] unit-test
+{ [ 3 com-test-1 ] } [ 3 \ com-test-1 command-quot ] unit-test
: com-test-2 ( -- ) ;
\ com-test-2 H{ { +nullary+ t } } define-command
-[ [ com-test-2 ] ] [ 3 \ com-test-2 command-quot ] unit-test
+{ [ com-test-2 ] } [ 3 \ com-test-2 command-quot ] unit-test
SYMBOL: testing
: com-foo. ( -- ) ;
-[ "Foo" ] [ \ com-foo. command-name ] unit-test
+{ "Foo" } [ \ com-foo. command-name ] unit-test
USING: tools.test accessors namespaces kernel ui.gadgets
ui.gadgets.borders ui.gadgets.borders.private math.rectangles ;
-[ { 110 210 } ] [ <gadget> { 100 200 } >>dim { 5 5 } <border> pref-dim ] unit-test
+{ { 110 210 } } [ <gadget> { 100 200 } >>dim { 5 5 } <border> pref-dim ] unit-test
-[ ] [ <gadget> { 100 200 } >>dim "g" set ] unit-test
+{ } [ <gadget> { 100 200 } >>dim "g" set ] unit-test
-[ ] [ "g" get { 0 0 } <border> { 100 200 } >>dim "b" set ] unit-test
+{ } [ "g" get { 0 0 } <border> { 100 200 } >>dim "b" set ] unit-test
-[ T{ rect f { 0 0 } { 100 200 } } ] [ "b" get border-child-rect ] unit-test
+{ T{ rect f { 0 0 } { 100 200 } } } [ "b" get border-child-rect ] unit-test
-[ ] [ "g" get { 5 5 } <border> { 210 210 } >>dim "b" set ] unit-test
+{ } [ "g" get { 5 5 } <border> { 210 210 } >>dim "b" set ] unit-test
-[ T{ rect f { 55 5 } { 100 200 } } ] [ "b" get border-child-rect ] unit-test
+{ T{ rect f { 55 5 } { 100 200 } } } [ "b" get border-child-rect ] unit-test
-[ ] [ "b" get { 0 0 } >>align drop ] unit-test
+{ } [ "b" get { 0 0 } >>align drop ] unit-test
-[ { 5 5 } ] [ "b" get { 100 200 } border-loc ] unit-test
+{ { 5 5 } } [ "b" get { 100 200 } border-loc ] unit-test
-[ T{ rect f { 5 5 } { 100 200 } } ] [ "b" get border-child-rect ] unit-test
+{ T{ rect f { 5 5 } { 100 200 } } } [ "b" get border-child-rect ] unit-test
-[ ] [ "b" get { 1 1 } >>fill drop ] unit-test
+{ } [ "b" get { 1 1 } >>fill drop ] unit-test
-[ T{ rect f { 5 5 } { 200 200 } } ] [ "b" get border-child-rect ] unit-test
+{ T{ rect f { 5 5 } { 200 200 } } } [ "b" get border-child-rect ] unit-test
T{ foo-gadget } <toolbar> "t" set
-[ 2 ] [ "t" get children>> length ] unit-test
-[ "Foo A" ] [ "t" get gadget-child gadget-child string>> ] unit-test
+{ 2 } [ "t" get children>> length ] unit-test
+{ "Foo A" } [ "t" get gadget-child gadget-child string>> ] unit-test
-[ ] [
+{ } [
2 <model> {
{ 0 "atheist" }
{ 1 "christian" }
} <radio-buttons> "religion" set
] unit-test
-[ 0 ] [
+{ 0 } [
"religion" get gadget-child value>>
] unit-test
-[ 2 ] [
+{ 2 } [
"religion" get gadget-child control-value
] unit-test
ui.gadgets.line-support sequences ;
IN: ui.gadgets.editors.tests
-[ "foo bar" ] [
+{ "foo bar" } [
<editor> "editor" set
"editor" get [
"foo bar" "editor" get set-editor-string
] with-grafted-gadget
] unit-test
-[ "baz quux" ] [
+{ "baz quux" } [
<editor> "editor" set
"editor" get [
"foo bar\nbaz quux" "editor" get set-editor-string
] with-grafted-gadget
] unit-test
-[ ] [
+{ } [
<editor> "editor" set
"editor" get [
"foo bar\nbaz quux" "editor" get set-editor-string
] with-grafted-gadget
] unit-test
-[ "bar" ] [
+{ "bar" } [
<editor> "editor" set
"editor" get [
"bar\nbaz quux" "editor" get set-editor-string
[ "hello" ] [ "field" get field-model>> value>> ] unit-test
] with-grafted-gadget
-[ "Hello world." ] [ "Hello \n world." join-lines ] unit-test
-[ " Hello world. " ] [ " Hello \n world. " join-lines ] unit-test
-[ " Hello world. Goodbye." ] [ " Hello \n world. \n Goodbye." join-lines ] unit-test
+{ "Hello world." } [ "Hello \n world." join-lines ] unit-test
+{ " Hello world. " } [ " Hello \n world. " join-lines ] unit-test
+{ " Hello world. Goodbye." } [ " Hello \n world. \n Goodbye." join-lines ] unit-test
-[ ] [ <editor> com-join-lines ] unit-test
-[ ] [ <editor> "A" over set-editor-string com-join-lines ] unit-test
-[ "A B" ] [ <editor> "A\nB" over set-editor-string [ com-join-lines ] [ editor-string ] bi ] unit-test
-[ "A B\nC\nD" ] [ <editor> "A\nB\nC\nD" over set-editor-string { 0 0 } over set-caret dup mark>caret [ com-join-lines ] [ editor-string ] bi ] unit-test
-[ "A\nB C\nD" ] [ <editor> "A\nB\nC\nD" over set-editor-string { 1 0 } over set-caret dup mark>caret [ com-join-lines ] [ editor-string ] bi ] unit-test
-[ "A\nB\nC D" ] [ <editor> "A\nB\nC\nD" over set-editor-string { 2 0 } over set-caret dup mark>caret [ com-join-lines ] [ editor-string ] bi ] unit-test
+{ } [ <editor> com-join-lines ] unit-test
+{ } [ <editor> "A" over set-editor-string com-join-lines ] unit-test
+{ "A B" } [ <editor> "A\nB" over set-editor-string [ com-join-lines ] [ editor-string ] bi ] unit-test
+{ "A B\nC\nD" } [ <editor> "A\nB\nC\nD" over set-editor-string { 0 0 } over set-caret dup mark>caret [ com-join-lines ] [ editor-string ] bi ] unit-test
+{ "A\nB C\nD" } [ <editor> "A\nB\nC\nD" over set-editor-string { 1 0 } over set-caret dup mark>caret [ com-join-lines ] [ editor-string ] bi ] unit-test
+{ "A\nB\nC D" } [ <editor> "A\nB\nC\nD" over set-editor-string { 2 0 } over set-caret dup mark>caret [ com-join-lines ] [ editor-string ] bi ] unit-test
-[ 2 ] [ <editor> 20 >>min-rows 20 >>min-cols pref-viewport-dim length ] unit-test
+{ 2 } [ <editor> 20 >>min-rows 20 >>min-cols pref-viewport-dim length ] unit-test
-[ 20 ] [
+{ 20 } [
<editor> 20 >>min-rows 20 >>min-cols
dup pref-viewport-dim >>dim
visible-lines
ui.gadgets.frames ui.gadgets.grids ui.gadgets.labels ;
IN: ui.gadgets.frames.tests
-[ ] [ 3 3 <frame> { 1 1 } >>filled-cell layout ] unit-test
+{ } [ 3 3 <frame> { 1 1 } >>filled-cell layout ] unit-test
-[ { 1000 1000 } ] [
+{ { 1000 1000 } } [
1 1 <frame>
{ 0 0 } >>filled-cell
<gadget> dup "c" set { 0 0 } grid-add
"c" get dim>>
] unit-test
-[ t ] [
+{ t } [
1 2 <frame>
{ 0 0 } >>filled-cell
"Hello world" <label> { 0 0 } grid-add
"dim1" get "dim2" get =
] unit-test
-[ { 5 20 } { 20 20 } ] [
+{ { 5 20 } { 20 20 } } [
2 3 <frame>
{ 0 1 } >>filled-cell
{ 5 5 } >>gap
FROM: namespaces => set ;
IN: ui.gadgets.tests
-[ { 300 300 } ]
+{ { 300 300 } }
[
! c contains b contains a
<gadget> "a" set
"g2" get "g1" get add-gadget drop
"g3" get "g2" get add-gadget drop
-[ { 30 30 } ] [ "g1" get screen-loc ] unit-test
-[ { 30 30 } ] [ "g1" get screen-rect loc>> ] unit-test
-[ { 30 30 } ] [ "g1" get screen-rect dim>> ] unit-test
-[ { 20 20 } ] [ "g2" get screen-loc ] unit-test
-[ { 20 20 } ] [ "g2" get screen-rect loc>> ] unit-test
-[ { 50 180 } ] [ "g2" get screen-rect dim>> ] unit-test
-[ { 0 0 } ] [ "g3" get screen-loc ] unit-test
-[ { 0 0 } ] [ "g3" get screen-rect loc>> ] unit-test
-[ { 100 200 } ] [ "g3" get screen-rect dim>> ] unit-test
+{ { 30 30 } } [ "g1" get screen-loc ] unit-test
+{ { 30 30 } } [ "g1" get screen-rect loc>> ] unit-test
+{ { 30 30 } } [ "g1" get screen-rect dim>> ] unit-test
+{ { 20 20 } } [ "g2" get screen-loc ] unit-test
+{ { 20 20 } } [ "g2" get screen-rect loc>> ] unit-test
+{ { 50 180 } } [ "g2" get screen-rect dim>> ] unit-test
+{ { 0 0 } } [ "g3" get screen-loc ] unit-test
+{ { 0 0 } } [ "g3" get screen-rect loc>> ] unit-test
+{ { 100 200 } } [ "g3" get screen-rect dim>> ] unit-test
<gadget> "g1" set
"g1" get { 300 300 } >>dim drop
"g3" get { 100 100 } >>loc
{ 20 20 } >>dim drop
-[ t ] [ { 30 30 } "g2" get contains-point? ] unit-test
+{ t } [ { 30 30 } "g2" get contains-point? ] unit-test
-[ t ] [ { 30 30 } "g1" get pick-up "g2" get eq? ] unit-test
+{ t } [ { 30 30 } "g1" get pick-up "g2" get eq? ] unit-test
-[ t ] [ { 30 30 } "g1" get pick-up "g2" get eq? ] unit-test
+{ t } [ { 30 30 } "g1" get pick-up "g2" get eq? ] unit-test
-[ t ] [ { 110 110 } "g1" get pick-up "g3" get eq? ] unit-test
+{ t } [ { 110 110 } "g1" get pick-up "g3" get eq? ] unit-test
<gadget> "g4" set
"g2" get "g4" get add-gadget drop
"g4" get { 5 5 } >>loc
{ 1 1 } >>dim drop
-[ t ] [ { 25 25 } "g1" get pick-up "g4" get eq? ] unit-test
+{ t } [ { 25 25 } "g1" get pick-up "g4" get eq? ] unit-test
TUPLE: mock-gadget < gadget graft-called ungraft-called ;
USING: tools.test ui.gadgets.glass ui.gadgets.worlds ui.gadgets
math.rectangles namespaces accessors models sequences arrays ;
-[ ] [
+{ } [
<world-attributes>
<gadget> 1array >>gadgets
<world>
"w" set
] unit-test
-[ ] [ <gadget> "g" set ] unit-test
+{ } [ <gadget> "g" set ] unit-test
-[ ] [ "w" get "g" get { 0 0 } { 100 100 } <rect> show-glass ] unit-test
+{ } [ "w" get "g" get { 0 0 } { 100 100 } <rect> show-glass ] unit-test
-[ ] [ "g" get hide-glass ] unit-test
+{ } [ "g" get hide-glass ] unit-test
-[ f ] [ "g" get parent>> parent>> ] unit-test
+{ f } [ "g" get parent>> parent>> ] unit-test
-[ t ] [ "w" get layers>> empty? ] unit-test
+{ t } [ "w" get layers>> empty? ] unit-test
: 100x100 ( -- gadget ) <gadget> { 100 100 } >>dim ;
-[
+{
{
{ { 0 0 } { 0 101 } }
{ { 0 0 } { 101 0 } }
{ { 0 100 } { 101 100 } }
{ { 100 0 } { 100 101 } }
}
-] [
+} [
100x100 1array
1array
<grid>
compute-grid-lines natural-sort
] unit-test
-[
+{
{
{ { 5 5 } { 5 116 } }
{ { 5 5 } { 116 5 } }
{ { 5 115 } { 116 115 } }
{ { 115 5 } { 115 116 } }
}
-] [
+} [
100x100 1array
1array
<grid>
compute-grid-lines natural-sort
] unit-test
-[
+{
{
{ { 0 0 } { 0 201 } }
{ { 0 0 } { 201 0 } }
{ { 100 0 } { 100 201 } }
{ { 200 0 } { 200 201 } }
}
-] [
+} [
100x100 100x100 2array
100x100 100x100 2array
2array
compute-grid-lines natural-sort
] unit-test
-[
+{
{
{ { 0 0 } { 0 3 } }
{ { 2 0 } { 2 3 } }
{ { 0 0 } { 3 0 } }
{ { 0 2 } { 3 2 } }
}
-] [
+} [
<gadget> { 1 1 } >>dim
1array 1array <grid> { 1 1 } >>gap
dup prefer
ui.gadgets.debug sequences classes ;
IN: ui.gadgets.grids.tests
-[ { 0 0 } ] [ { } <grid> pref-dim ] unit-test
+{ { 0 0 } } [ { } <grid> pref-dim ] unit-test
: 100x100 ( -- gadget ) <gadget> { 100 100 } >>dim ;
: 200x200 ( -- gadget ) <gadget> { 200 200 } >>dim ;
-[ { 100 100 } ] [
+{ { 100 100 } } [
100x100
1array 1array <grid> pref-dim
] unit-test
-[ { 100 100 } ] [
+{ { 100 100 } } [
100x100
1array 1array <grid> pref-dim
] unit-test
-[ { 200 100 } ] [
+{ { 200 100 } } [
100x100
100x100
2array 1array <grid> pref-dim
] unit-test
-[ { 100 200 } ] [
+{ { 100 200 } } [
100x100
100x100
[ 1array ] bi@ 2array <grid> pref-dim
] unit-test
-[ ] [
+{ } [
100x100
100x100
[ 1array ] bi@ 2array <grid> layout
] unit-test
-[ { 230 120 } { 100 100 } { 100 100 } ] [
+{ { 230 120 } { 100 100 } { 100 100 } } [
100x100 dup "a" set
100x100 dup "b" set
2array 1array <grid>
"b" get dim>>
] unit-test
-[ ] [
+{ } [
100x100 dup "a" set
100x100 dup "b" set
100x100 dup "c" set
{ 10 10 } >>gap "g" set
] unit-test
-[ ] [ "g" get prefer ] unit-test
-[ ] [ "g" get layout ] unit-test
+{ } [ "g" get prefer ] unit-test
+{ } [ "g" get layout ] unit-test
-[ { 10 10 } ] [ "a" get loc>> ] unit-test
-[ { 100 100 } ] [ "a" get dim>> ] unit-test
+{ { 10 10 } } [ "a" get loc>> ] unit-test
+{ { 100 100 } } [ "a" get dim>> ] unit-test
-[ { 10 120 } ] [ "b" get loc>> ] unit-test
-[ { 100 100 } ] [ "b" get dim>> ] unit-test
+{ { 10 120 } } [ "b" get loc>> ] unit-test
+{ { 100 100 } } [ "b" get dim>> ] unit-test
-[ { 10 230 } ] [ "c" get loc>> ] unit-test
-[ { 100 100 } ] [ "c" get dim>> ] unit-test
+{ { 10 230 } } [ "c" get loc>> ] unit-test
+{ { 100 100 } } [ "c" get dim>> ] unit-test
5 10 { 10 10 } <baseline-gadget>
10 10 { 10 10 } <baseline-gadget> 2array
1array <grid> f >>fill?
"g" set
-[ ] [ "g" get prefer ] unit-test
+{ } [ "g" get prefer ] unit-test
-[ { 20 15 } ] [ "g" get dim>> ] unit-test
+{ { 20 15 } } [ "g" get dim>> ] unit-test
-[ V{ { 0 5 } { 10 0 } } ] [
+{ V{ { 0 5 } { 10 0 } } } [
"g" get
dup layout
children>> [ loc>> ] map
] unit-test
! children-on logic was insufficient
-[ ] [
+{ } [
100x100 dup "a" set 200x200 2array
100x100 dup "b" set 200x200 2array 2array <grid> f >>fill? "g" set
] unit-test
-[ ] [ "g" get prefer ] unit-test
-[ ] [ "g" get layout ] unit-test
+{ } [ "g" get prefer ] unit-test
+{ } [ "g" get layout ] unit-test
-[ { 0 50 } ] [ "a" get loc>> ] unit-test
-[ { 0 250 } ] [ "b" get loc>> ] unit-test
+{ { 0 50 } } [ "a" get loc>> ] unit-test
+{ { 0 250 } } [ "b" get loc>> ] unit-test
-[ gadget { 200 200 } ]
+{ gadget { 200 200 } }
[ { 120 20 } "g" get pick-up [ class-of ] [ dim>> ] bi ] unit-test
-[ gadget { 200 200 } ]
+{ gadget { 200 200 } }
[ { 120 220 } "g" get pick-up [ class-of ] [ dim>> ] bi ] unit-test
IN: ui.gadgets.labeled.tests
USING: ui.gadgets ui.gadgets.labeled accessors tools.test ;
-[ t ] [ <gadget> "Hey" <labeled-gadget> content>> gadget? ] unit-test
+{ t } [ <gadget> "Hey" <labeled-gadget> content>> gadget? ] unit-test
USING: accessors tools.test ui.gadgets ui.gadgets.labels ;
IN: ui.gadgets.labels.tests
-[ { 119 14 } ] [
+{ { 119 14 } } [
<gadget> { 100 14 } >>dim
<gadget> { 14 14 } >>dim
label-on-right { 5 5 } >>gap
sequences math.rectangles accessors math ;
IN: ui.gadgets.packs.tests
-[ t ] [
+{ t } [
{ 0 0 } { 100 100 } <rect> clip set
<pile>
visible-children [ label? ] all?
] unit-test
-[ { { 10 30 } } ] [
+{ { { 10 30 } } } [
{ { 10 20 } }
{ { 100 30 } }
<gadget> vertical >>orientation
10 10 { 10 10 } <baseline-gadget> add-gadget
"g" set
-[ ] [ "g" get prefer ] unit-test
+{ } [ "g" get prefer ] unit-test
-[ { 20 15 } ] [ "g" get dim>> ] unit-test
+{ { 20 15 } } [ "g" get dim>> ] unit-test
-[ V{ { 0 5 } { 10 0 } } ] [
+{ V{ { 0 5 } { 10 0 } } } [
"g" get
dup layout
children>> [ loc>> ] map
10 10 { 10 10 } <baseline-gadget> add-gadget
"g" set
-[ { 30 20 } ] [ "g" get pref-dim ] unit-test
+{ { 30 20 } } [ "g" get pref-dim ] unit-test
-[ ] [ "g" get layout ] unit-test
+{ } [ "g" get layout ] unit-test
-[ V{ { 0 0 } { 20 5 } } ] [
+{ V{ { 0 0 } { 20 5 } } } [
"g" get children>> [ loc>> ] map
] unit-test
5 5 { 10 10 } <baseline-gadget> add-gadget
"g" set
-[ { 25 15 } ] [ "g" get pref-dim ] unit-test
+{ { 25 15 } } [ "g" get pref-dim ] unit-test
-[ ] [ "g" get prefer ] unit-test
+{ } [ "g" get prefer ] unit-test
-[ ] [ "g" get layout ] unit-test
+{ } [ "g" get layout ] unit-test
-[ V{ { 0 0 } { 15 5 } } ] [
+{ V{ { 0 0 } { 15 5 } } } [
"g" get children>> [ loc>> ] map
] unit-test
30 30 { 10 50 } <baseline-gadget> add-gadget
"g" set
-[ { 30 50 } ] [ "g" get pref-dim ] unit-test
+{ { 30 50 } } [ "g" get pref-dim ] unit-test
-[ ] [ "g" get prefer ] unit-test
+{ } [ "g" get prefer ] unit-test
-[ ] [ "g" get layout ] unit-test
+{ } [ "g" get layout ] unit-test
-[ V{ { 0 5 } { 20 0 } } ] [
+{ V{ { 0 5 } { 20 0 } } } [
"g" get children>> [ loc>> ] map
] unit-test
30 4 { 30 30 } <baseline-gadget> add-gadget
"g" set
-[ { 60 43 } ] [ "g" get pref-dim ] unit-test
+{ { 60 43 } } [ "g" get pref-dim ] unit-test
-[ ] [ "g" get prefer ] unit-test
+{ } [ "g" get prefer ] unit-test
-[ ] [ "g" get layout ] unit-test
+{ } [ "g" get layout ] unit-test
! Baseline alignment without any text gadgets should behave like align=1/2
<shelf> +baseline+ >>align
<gadget> { 30 20 } >>dim add-gadget
"g" set
-[ { 60 30 } ] [ "g" get pref-dim ] unit-test
+{ { 60 30 } } [ "g" get pref-dim ] unit-test
-[ ] [ "g" get prefer ] unit-test
+{ } [ "g" get prefer ] unit-test
-[ ] [ "g" get layout ] unit-test
+{ } [ "g" get layout ] unit-test
-[ V{ { 0 0 } { 30 5 } } ]
+{ V{ { 0 0 } { 30 5 } } }
[ "g" get children>> [ loc>> ] map ] unit-test
<shelf> +baseline+ >>align
10 10 { 10 10 } <baseline-gadget> add-gadget
"g" set
-[ ] [ "g" get prefer ] unit-test
+{ } [ "g" get prefer ] unit-test
-[ ] [ "g" get layout ] unit-test
+{ } [ "g" get layout ] unit-test
-[ V{ { 0 0 } { 30 10 } } ]
+{ V{ { 0 0 } { 30 10 } } }
[ "g" get children>> [ loc>> ] map ] unit-test
<shelf> +baseline+ >>align
10 10 { 10 10 } <baseline-gadget> add-gadget
"g" set
-[ ] [ "g" get prefer ] unit-test
+{ } [ "g" get prefer ] unit-test
-[ ] [ "g" get layout ] unit-test
+{ } [ "g" get layout ] unit-test
-[ V{ { 0 0 } { 30 10 } } ]
+{ V{ { 0 0 } { 30 10 } } }
[ "g" get children>> [ loc>> ] map ] unit-test
<shelf> +baseline+ >>align
12 9 { 15 15 } <baseline-gadget> add-gadget
"g" set
-[ { 39 24 } ] [ "g" get pref-dim ] unit-test
+{ { 39 24 } } [ "g" get pref-dim ] unit-test
: #children ( -- n ) "pane" get children>> length ;
-[ ] [ <pane> "pane" set ] unit-test
+{ } [ <pane> "pane" set ] unit-test
-[ ] [ #children "num-children" set ] unit-test
+{ } [ #children "num-children" set ] unit-test
-[ ] [
+{ } [
"pane" get <pane-stream> [ 100 [ . ] each-integer ] with-output-stream*
] unit-test
-[ t ] [ #children "num-children" get = ] unit-test
+{ t } [ #children "num-children" get = ] unit-test
: test-gadget-text ( quot -- ? )
'[ _ call( -- ) ]
[ make-pane gadget-text dup print "======" print ]
[ with-string-writer dup print ] bi = ;
-[ t ] [ [ "hello" write ] test-gadget-text ] unit-test
-[ t ] [ [ "hello" pprint ] test-gadget-text ] unit-test
-[ t ] [
+{ t } [ [ "hello" write ] test-gadget-text ] unit-test
+{ t } [ [ "hello" pprint ] test-gadget-text ] unit-test
+{ t } [
[
H{ { wrap-margin 100 } } [ "hello" pprint ] with-nesting
] test-gadget-text
] unit-test
-[ t ] [
+{ t } [
[
H{ { wrap-margin 100 } } [
H{ } [
] with-nesting
] test-gadget-text
] unit-test
-[ t ] [ [ [ 1 2 3 ] pprint ] test-gadget-text ] unit-test
-[ t ] [ [ \ + describe ] test-gadget-text ] unit-test
-[ t ] [ [ \ = see ] test-gadget-text ] unit-test
-[ t ] [ [ \ = print-topic ] test-gadget-text ] unit-test
+{ t } [ [ [ 1 2 3 ] pprint ] test-gadget-text ] unit-test
+{ t } [ [ \ + describe ] test-gadget-text ] unit-test
+{ t } [ [ \ = see ] test-gadget-text ] unit-test
+{ t } [ [ \ = print-topic ] test-gadget-text ] unit-test
-[ t ] [
+{ t } [
[
title-style get [
"Hello world" write
] unit-test
-[ t ] [
+{ t } [
[
title-style get [
"Hello world" write
] test-gadget-text
] unit-test
-[ t ] [
+{ t } [
[
title-style get [
title-style get [
] test-gadget-text
] unit-test
-[ t ] [
+{ t } [
[
title-style get [
title-style get [
] test-gadget-text
] unit-test
-[ t ] [
+{ t } [
[
last-element off
\ = >link $title
] test-gadget-text
] unit-test
-[ t ] [
+{ t } [
[
last-element off
\ = >link title-style get [
] test-gadget-text
] unit-test
-[ t ] [
+{ t } [
[ { { "a\n" } } simple-table. ] test-gadget-text
] unit-test
-[ t ] [
+{ t } [
[ { { "a" } } simple-table. "x" write ] test-gadget-text
] unit-test
-[ t ] [
+{ t } [
[ H{ } [ { { "a" } } simple-table. ] with-nesting "x" write ] test-gadget-text
] unit-test
ARTICLE: "test-article-1" "This is a test article"
"Hello world, how are you today." ;
-[ t ] [ [ "test-article-1" $title ] test-gadget-text ] unit-test
+{ t } [ [ "test-article-1" $title ] test-gadget-text ] unit-test
-[ t ] [ [ "test-article-1" print-topic ] test-gadget-text ] unit-test
+{ t } [ [ "test-article-1" print-topic ] test-gadget-text ] unit-test
ARTICLE: "test-article-2" "This is a test article"
"Hello world, how are you today."
{ $table { "a" "b" } { "c" "d" } } ;
-[ t ] [ [ "test-article-2" print-topic ] test-gadget-text ] unit-test
+{ t } [ [ "test-article-2" print-topic ] test-gadget-text ] unit-test
<pane> [ \ = see ] with-pane
<pane> [ \ = print-topic ] with-pane
-[ ] [
+{ } [
\ = <model> [ see ] <pane-control> [ ] with-grafted-gadget
] unit-test
: <test-pane> ( -- foo )
<gadget> pane new-pane ;
-[ t ] [ <test-pane> dup input>> child? ] unit-test
-[ t ] [ <test-pane> dup last-line>> child? ] unit-test
+{ t } [ <test-pane> dup input>> child? ] unit-test
+{ t } [ <test-pane> dup last-line>> child? ] unit-test
<gadget> { 50 20 } >>dim dup "c" set add-gadget
"p" set
-[ { 4 1 } ] [ "p" get wrap-paragraph [ words>> length ] map ] unit-test
+{ { 4 1 } } [ "p" get wrap-paragraph [ words>> length ] map ] unit-test
-[ { 85 50 } ] [ "p" get pref-dim ] unit-test
+{ { 85 50 } } [ "p" get pref-dim ] unit-test
-[ ] [ "p" get prefer ] unit-test
+{ } [ "p" get prefer ] unit-test
-[ ] [ "p" get layout ] unit-test
+{ } [ "p" get layout ] unit-test
-[ { 0 0 } ] [ "a" get loc>> ] unit-test
+{ { 0 0 } } [ "a" get loc>> ] unit-test
-[ { 45 7 } ] [ "b" get loc>> ] unit-test
+{ { 45 7 } } [ "b" get loc>> ] unit-test
-[ { 0 30 } ] [ "c" get loc>> ] unit-test
+{ { 0 30 } } [ "c" get loc>> ] unit-test
100 <paragraph>
15 15 { 40 30 } <baseline-gadget> dup "a" set add-gadget
20 20 { 40 30 } <baseline-gadget> dup "c" set add-gadget
"p" set
-[ { 85 65 } ] [ "p" get pref-dim ] unit-test
+{ { 85 65 } } [ "p" get pref-dim ] unit-test
-[ ] [ "p" get prefer ] unit-test
+{ } [ "p" get prefer ] unit-test
-[ ] [ "p" get layout ] unit-test
+{ } [ "p" get layout ] unit-test
-[ { 0 0 } ] [ "a" get loc>> ] unit-test
+{ { 0 0 } } [ "a" get loc>> ] unit-test
-[ { 45 5 } ] [ "b" get loc>> ] unit-test
+{ { 45 5 } } [ "b" get loc>> ] unit-test
-[ { 0 35 } ] [ "c" get loc>> ] unit-test
+{ { 0 35 } } [ "c" get loc>> ] unit-test
classes.tuple accessors ;
IN: ui.gadgets.presentations.tests
-[ t ] [
+{ t } [
"Hi" \ + <presentation> gadget?
] unit-test
-[ "+" ] [
+{ "+" } [
[
\ + f \ pprint <command-button> dup quot>> call
] with-string-writer
ui.gadgets.scrollers.private ;
IN: ui.gadgets.scrollers.tests
-[ ] [
+{ } [
<gadget> "g" set
"g" get <scroller> "s" set
] unit-test
-[ { 100 200 } ] [
+{ { 100 200 } } [
{ 100 200 } point>rect "g" get scroll>rect
"s" get follows>> loc>>
] unit-test
-[ ] [ "s" get scroll>bottom ] unit-test
-[ t ] [ "s" get follows>> ] unit-test
+{ } [ "s" get scroll>bottom ] unit-test
+{ t } [ "s" get follows>> ] unit-test
-[ ] [
+{ } [
<gadget> dup "g" set
10 1 0 100 1 <range> 20 1 0 100 1 <range> 2array <product>
<viewport> "v" set
[ { 10 20 } ] [ "g" get loc>> vneg ] unit-test
] with-grafted-gadget
-[ ] [
+{ } [
<gadget> { 100 100 } >>dim
dup "g" set <scroller> "s" set
] unit-test
-[ ] [ "s" get { 50 50 } >>dim drop ] unit-test
+{ } [ "s" get { 50 50 } >>dim drop ] unit-test
-[ ] [ "s" get layout ] unit-test
+{ } [ "s" get layout ] unit-test
"s" get [
[ { 31 31 } ] [ "s" get viewport>> dim>> ] unit-test
dup layout
"s" set
-[ t ] [
+{ t } [
10 iota [
drop
"g2" get scroll>gadget
] map [ { 0 0 } = ] all?
] unit-test
-[ ] [ "Hi" <label> dup "l" set <scroller> "s" set ] unit-test
+{ } [ "Hi" <label> dup "l" set <scroller> "s" set ] unit-test
-[ t ] [ "l" get find-scroller "s" get eq? ] unit-test
-[ t ] [ "l" get dup find-scroller viewport>> swap child? ] unit-test
-[ t ] [ "l" get find-scroller* "s" get eq? ] unit-test
-[ f ] [ "s" get viewport>> find-scroller* ] unit-test
-[ t ] [ "s" get { 1 0 } grid-child slider? ] unit-test
-[ f ] [ "s" get { 1 0 } grid-child find-scroller* ] unit-test
+{ t } [ "l" get find-scroller "s" get eq? ] unit-test
+{ t } [ "l" get dup find-scroller viewport>> swap child? ] unit-test
+{ t } [ "l" get find-scroller* "s" get eq? ] unit-test
+{ f } [ "s" get viewport>> find-scroller* ] unit-test
+{ t } [ "s" get { 1 0 } grid-child slider? ] unit-test
+{ f } [ "s" get { 1 0 } grid-child find-scroller* ] unit-test
-[ ] [
+{ } [
"Click Me" [ [ scroll>gadget ] [ unparent ] bi ] <border-button>
[ <pile> swap add-gadget <scroller> ] keep
dup quot>> call
layout
] unit-test
-[ t ] [
+{ t } [
<gadget> { 200 200 } >>dim
[ [ scroll>gadget ] [ unparent ] bi ] <border-button>
dup
[ [ second ] <search-table> ] must-infer
-[ t ] [ f <model> trivial-renderer [ second ] <search-table> pref-dim pair? ] unit-test
+{ t } [ f <model> trivial-renderer [ second ] <search-table> pref-dim pair? ] unit-test
IN: ui.gadgets.slots.tests
USING: assocs ui.gadgets.slots tools.test refs ;
-[ t ] [ [ ] [ ] { { 1 1 } { 2 2 } { 3 3 } } 2 <value-ref> <slot-editor> slot-editor? ] unit-test
+{ t } [ [ ] [ ] { { 1 1 } { 2 2 } { 3 3 } } 2 <value-ref> <slot-editor> slot-editor? ] unit-test
{ "Don" "Stewart" }
} <model> test-renderer <table> ;
-[ ] [
+{ } [
test-table "table" set
] unit-test
-[ ] [
+{ } [
"table" get <scroller> "scroller" set
] unit-test
-[ { "Justin" "Timberlake" } { "Britney" "Spears" } ] [
+{ { "Justin" "Timberlake" } { "Britney" "Spears" } } [
test-table t >>selection-required? dup [
{
[ 1 select-row ]
: test-table-2 ( -- table )
{ 1 2 f } <model> silly-renderer <table> ;
-[ f f ] [
+{ f f } [
test-table dup [
selected-row
] with-grafted-gadget
math.rectangles accessors sequences namespaces ;
IN: ui.gadgets.tracks.tests
-[ { 100 100 } ] [
+{ { 100 100 } } [
vertical <track>
<gadget> { 100 100 } >>dim 1 track-add
pref-dim
] unit-test
-[ { 100 110 } ] [
+{ { 100 110 } } [
vertical <track>
<gadget> { 10 10 } >>dim f track-add
<gadget> { 100 100 } >>dim 1 track-add
pref-dim
] unit-test
-[ { 10 10 } ] [
+{ { 10 10 } } [
vertical <track>
<gadget> { 10 10 } >>dim 1 track-add
<gadget> { 10 10 } >>dim 0 track-add
pref-dim
] unit-test
-[ { 10 30 } ] [
+{ { 10 30 } } [
vertical <track>
<gadget> { 10 10 } >>dim f track-add
<gadget> { 10 10 } >>dim f track-add
pref-dim
] unit-test
-[ { 10 40 } ] [
+{ { 10 40 } } [
vertical <track>
{ 5 5 } >>gap
<gadget> { 10 10 } >>dim f track-add
pref-dim
] unit-test
-[ V{ { 10 10 } { 10 80 } { 10 10 } } ] [
+{ V{ { 10 10 } { 10 80 } { 10 10 } } } [
vertical <track>
0 >>fill
<gadget> { 10 10 } >>dim f track-add
[ layout ] [ children>> [ dim>> ] map ] bi
] unit-test
-[ ] [
+{ } [
vertical <track>
0 >>fill
<gadget> { 10 10 } >>dim f track-add
"track" set
] unit-test
-[ V{ { 10 10 } { 10 35 } { 10 10 } { 10 35 } { 10 10 } } ]
+{ V{ { 10 10 } { 10 35 } { 10 10 } { 10 35 } { 10 10 } } }
[ "track" get [ layout ] [ children>> [ dim>> ] map ] bi ] unit-test
-[ V{ { 10 10 } { 10 80 } { 10 10 } } ] [
+{ V{ { 10 10 } { 10 80 } { 10 10 } } } [
"g1" get unparent
"g2" get unparent
"track" get [ layout ] [ children>> [ dim>> ] map ] bi
] unit-test
-[ 3 ] [ "track" get sizes>> length ] unit-test
+{ 3 } [ "track" get sizes>> length ] unit-test
: <test-world> ( gadget -- world )
<world-attributes> "Hi" >>title swap 1array >>gadgets <world> ;
-[ ] [
+{ } [
"g1" get <test-world> "w" set
] unit-test
-[ ] [ "g1" get request-focus ] unit-test
+{ } [ "g1" get request-focus ] unit-test
-[ t ] [ "w" get focus>> "g1" get eq? ] unit-test
+{ t } [ "w" get focus>> "g1" get eq? ] unit-test
<gadget> "g1" set
<gadget> "g2" set
"g2" get "g1" get add-gadget drop
-[ ] [
+{ } [
"g2" get <test-world> "w" set
] unit-test
-[ ] [ "g1" get request-focus ] unit-test
+{ } [ "g1" get request-focus ] unit-test
-[ t ] [ "w" get focus>> "g2" get eq? ] unit-test
-[ t ] [ "g2" get focus>> "g1" get eq? ] unit-test
-[ f ] [ "g1" get focus>> ] unit-test
+{ t } [ "w" get focus>> "g2" get eq? ] unit-test
+{ t } [ "g2" get focus>> "g1" get eq? ] unit-test
+{ f } [ "g1" get focus>> ] unit-test
<gadget> "g1" set
<gadget> "g2" set
"g3" get "g1" get add-gadget drop
"g3" get "g2" get add-gadget drop
-[ ] [
+{ } [
"g3" get <test-world> "w" set
] unit-test
-[ ] [ "g1" get request-focus ] unit-test
-[ ] [ "g2" get unparent ] unit-test
-[ t ] [ "g3" get focus>> "g1" get eq? ] unit-test
+{ } [ "g1" get request-focus ] unit-test
+{ } [ "g2" get unparent ] unit-test
+{ t } [ "g3" get focus>> "g1" get eq? ] unit-test
-[ t ] [ <gadget> dup <test-world> focusable-child eq? ] unit-test
+{ t } [ <gadget> dup <test-world> focusable-child eq? ] unit-test
TUPLE: focusing < gadget ;
<focus-test> "f" set
-[ ] [ "f" get <test-world> request-focus ] unit-test
+{ } [ "f" get <test-world> request-focus ] unit-test
-[ t ] [ "f" get focus>> "f" get gadget-child eq? ] unit-test
+{ t } [ "f" get focus>> "f" get gadget-child eq? ] unit-test
-[ t ] [ "f" get gadget-child focusing? ] unit-test
+{ t } [ "f" get gadget-child focusing? ] unit-test
[ drop t ] \ my-pprint [ ] f operation boa "op" set
-[ [ 3 my-pprint ] ] [
+{ [ 3 my-pprint ] } [
3 "op" get command>> command-quot
] unit-test
-[ "3" ] [ [ 3 "op" get invoke-command ] with-string-writer ] unit-test
+{ "3" } [ [ 3 "op" get invoke-command ] with-string-writer ] unit-test
[ drop t ] \ my-pprint [ editor-string ] f operation boa
"op" set
-[ "\"4\"" ] [
+{ "\"4\"" } [
[
"4" <editor> [ set-editor-string ] keep
"op" get invoke-command
] with-string-writer
] unit-test
-[ ] [
+{ } [
[ { $operations \ + } print-element ] with-string-writer drop
] unit-test
SPECIALIZED-ARRAY: float
IN: ui.pens.gradient.tests
-[
+{
float-array{
0.0
0.0
100.0
100.0
}
-] [
+} [
{ 1 0 } { 100 100 } { COLOR: red COLOR: green COLOR: blue }
gradient-vertices
] unit-test
sequences ;
IN: ui.text.tests
-[ t ] [ 0 sans-serif-font "aaa" offset>x zero? ] unit-test
-[ t ] [ 1 sans-serif-font "aaa" offset>x 0.0 > ] unit-test
-[ t ] [ 3 sans-serif-font "aaa" offset>x 0.0 > ] unit-test
-[ t ] [ 1 monospace-font "a" offset>x 0.0 > ] unit-test
-[ 0 ] [ 0 sans-serif-font "aaa" x>offset ] unit-test
-[ 3 ] [ 100 sans-serif-font "aaa" x>offset ] unit-test
-[ 0 ] [ 0 sans-serif-font "" x>offset ] unit-test
+{ t } [ 0 sans-serif-font "aaa" offset>x zero? ] unit-test
+{ t } [ 1 sans-serif-font "aaa" offset>x 0.0 > ] unit-test
+{ t } [ 3 sans-serif-font "aaa" offset>x 0.0 > ] unit-test
+{ t } [ 1 monospace-font "a" offset>x 0.0 > ] unit-test
+{ 0 } [ 0 sans-serif-font "aaa" x>offset ] unit-test
+{ 3 } [ 100 sans-serif-font "aaa" x>offset ] unit-test
+{ 0 } [ 0 sans-serif-font "" x>offset ] unit-test
-[ t ] [
+{ t } [
sans-serif-font "aaa" line-metrics
[ [ ascent>> ] [ descent>> ] bi + ] [ height>> ] bi =
] unit-test
-[ f ] [ sans-serif-font "\0a" text-dim first zero? ] unit-test
-[ t ] [ sans-serif-font "" text-dim first zero? ] unit-test
+{ f } [ sans-serif-font "\0a" text-dim first zero? ] unit-test
+{ t } [ sans-serif-font "" text-dim first zero? ] unit-test
-[ f ] [ sans-serif-font font-metrics height>> zero? ] unit-test
+{ f } [ sans-serif-font font-metrics height>> zero? ] unit-test
-[ t ] [ serif-font "Hello world" string>image [ image? ] [ pair? ] bi* and ] unit-test
+{ t } [ serif-font "Hello world" string>image [ image? ] [ pair? ] bi* and ] unit-test
IN: ui.tools.browser.tests
USING: tools.test ui.gadgets.debug ui.tools.browser math ;
-[ ] [ \ + <browser-gadget> [ ] with-grafted-gadget ] unit-test
+{ } [ \ + <browser-gadget> [ ] with-grafted-gadget ] unit-test
"history" get add-history
-[ t ] [ "history" get back>> empty? ] unit-test
-[ t ] [ "history" get forward>> empty? ] unit-test
+{ t } [ "history" get back>> empty? ] unit-test
+{ t } [ "history" get forward>> empty? ] unit-test
"history" get add-history
3 "history" get owner>> set-history-value
-[ t ] [ "history" get back>> empty? ] unit-test
-[ t ] [ "history" get forward>> empty? ] unit-test
+{ t } [ "history" get back>> empty? ] unit-test
+{ t } [ "history" get forward>> empty? ] unit-test
"history" get add-history
4 "history" get owner>> set-history-value
-[ f ] [ "history" get back>> empty? ] unit-test
-[ t ] [ "history" get forward>> empty? ] unit-test
+{ f } [ "history" get back>> empty? ] unit-test
+{ t } [ "history" get forward>> empty? ] unit-test
"history" get go-back
-[ 3 ] [ "history" get owner>> history-value ] unit-test
+{ 3 } [ "history" get owner>> history-value ] unit-test
-[ t ] [ "history" get back>> empty? ] unit-test
-[ f ] [ "history" get forward>> empty? ] unit-test
+{ t } [ "history" get back>> empty? ] unit-test
+{ f } [ "history" get forward>> empty? ] unit-test
"history" get go-forward
-[ 4 ] [ "history" get owner>> history-value ] unit-test
+{ 4 } [ "history" get owner>> history-value ] unit-test
-[ f ] [ "history" get back>> empty? ] unit-test
-[ t ] [ "history" get forward>> empty? ] unit-test
+{ f } [ "history" get back>> empty? ] unit-test
+{ t } [ "history" get forward>> empty? ] unit-test
IN: ui.tools.inspector.tests
USING: tools.test ui.tools.inspector math models ;
-[ ] [ \ + <model> <inspector-gadget> com-edit-slot ] unit-test
+{ } [ \ + <model> <inspector-gadget> com-edit-slot ] unit-test
IN: ui.tools.listener.history.tests
-[ ] [ <document> "d" set ] unit-test
-[ ] [ "d" get <history> "h" set ] unit-test
+{ } [ <document> "d" set ] unit-test
+{ } [ "d" get <history> "h" set ] unit-test
-[ ] [ "1" "d" get set-doc-string ] unit-test
-[ T{ input f "1" } ] [ "h" get history-add ] unit-test
+{ } [ "1" "d" get set-doc-string ] unit-test
+{ T{ input f "1" } } [ "h" get history-add ] unit-test
-[ ] [ "2" "d" get set-doc-string ] unit-test
-[ T{ input f "2" } ] [ "h" get history-add ] unit-test
+{ } [ "2" "d" get set-doc-string ] unit-test
+{ T{ input f "2" } } [ "h" get history-add ] unit-test
-[ ] [ "3" "d" get set-doc-string ] unit-test
-[ T{ input f "3" } ] [ "h" get history-add ] unit-test
+{ } [ "3" "d" get set-doc-string ] unit-test
+{ T{ input f "3" } } [ "h" get history-add ] unit-test
-[ ] [ "" "d" get set-doc-string ] unit-test
+{ } [ "" "d" get set-doc-string ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
-[ "3" ] [ "d" get doc-string ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
+{ "3" } [ "d" get doc-string ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
-[ "2" ] [ "d" get doc-string ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
+{ "2" } [ "d" get doc-string ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
-[ "1" ] [ "d" get doc-string ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
+{ "1" } [ "d" get doc-string ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
-[ "1" ] [ "d" get doc-string ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
+{ "1" } [ "d" get doc-string ] unit-test
-[ ] [ "h" get history-recall-next ] unit-test
-[ "2" ] [ "d" get doc-string ] unit-test
+{ } [ "h" get history-recall-next ] unit-test
+{ "2" } [ "d" get doc-string ] unit-test
-[ ] [ "22" "d" get set-doc-string ] unit-test
+{ } [ "22" "d" get set-doc-string ] unit-test
-[ ] [ "h" get history-recall-next ] unit-test
-[ "3" ] [ "d" get doc-string ] unit-test
+{ } [ "h" get history-recall-next ] unit-test
+{ "3" } [ "d" get doc-string ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
-[ "22" ] [ "d" get doc-string ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
+{ "22" } [ "d" get doc-string ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
-[ "1" ] [ "d" get doc-string ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
+{ "1" } [ "d" get doc-string ] unit-test
-[ ] [ "222" "d" get set-doc-string ] unit-test
-[ T{ input f "222" } ] [ "h" get history-add ] unit-test
+{ } [ "222" "d" get set-doc-string ] unit-test
+{ T{ input f "222" } } [ "h" get history-add ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
-[ "22" ] [ "d" get doc-string ] unit-test
+{ "22" } [ "d" get doc-string ] unit-test
-[ ] [ <document> "d" set ] unit-test
-[ ] [ "d" get <history> "h" set ] unit-test
+{ } [ <document> "d" set ] unit-test
+{ } [ "d" get <history> "h" set ] unit-test
-[ ] [ "aaa" "d" get set-doc-string ] unit-test
-[ T{ input f "aaa" } ] [ "h" get history-add ] unit-test
+{ } [ "aaa" "d" get set-doc-string ] unit-test
+{ T{ input f "aaa" } } [ "h" get history-add ] unit-test
-[ ] [ "" "d" get set-doc-string ] unit-test
-[ T{ input f "" } ] [ "h" get history-add ] unit-test
-[ T{ input f "" } ] [ "h" get history-add ] unit-test
-[ ] [ " " "d" get set-doc-string ] unit-test
-[ ] [ "h" get history-recall-previous ] unit-test
+{ } [ "" "d" get set-doc-string ] unit-test
+{ T{ input f "" } } [ "h" get history-add ] unit-test
+{ T{ input f "" } } [ "h" get history-add ] unit-test
+{ } [ " " "d" get set-doc-string ] unit-test
+{ } [ "h" get history-recall-previous ] unit-test
-[ 1 ] [
+{ 1 } [
"abc" <document> [ set-doc-string ] [ <history> ] bi
[ history-add drop ]
[ history-add drop ]
] with-interactive-vocabs
! Hang
-[ ] [ <interactor> <pane> <pane-stream> >>output "interactor" set ] unit-test
+{ } [ <interactor> <pane> <pane-stream> >>output "interactor" set ] unit-test
-[ ] [ [ "interactor" get stream-read-quot drop ] "A" spawn drop ] unit-test
+{ } [ [ "interactor" get stream-read-quot drop ] "A" spawn drop ] unit-test
-[ ] [ [ "interactor" get stream-read-quot drop ] "B" spawn drop ] unit-test
+{ } [ [ "interactor" get stream-read-quot drop ] "B" spawn drop ] unit-test
-[ ] [ 1 seconds sleep ] unit-test
+{ } [ 1 seconds sleep ] unit-test
-[ ] [ "interactor" get interactor-eof ] unit-test
+{ } [ "interactor" get interactor-eof ] unit-test
-[ ] [ <interactor> <pane> <pane-stream> >>output "interactor" set ] unit-test
+{ } [ <interactor> <pane> <pane-stream> >>output "interactor" set ] unit-test
CONSTANT: text "Hello world.\nThis is a test."
-[ ] [ text "interactor" get set-editor-string ] unit-test
+{ } [ text "interactor" get set-editor-string ] unit-test
-[ ] [ <promise> "promise" set ] unit-test
+{ } [ <promise> "promise" set ] unit-test
-[ ] [
+{ } [
[
"interactor" get register-self
"interactor" get stream-contents "promise" get fulfill
] in-thread
] unit-test
-[ ] [ 100 milliseconds sleep ] unit-test
+{ } [ 100 milliseconds sleep ] unit-test
-[ ] [ "interactor" get evaluate-input ] unit-test
+{ } [ "interactor" get evaluate-input ] unit-test
-[ ] [ 100 milliseconds sleep ] unit-test
+{ } [ 100 milliseconds sleep ] unit-test
-[ ] [ "interactor" get interactor-eof ] unit-test
+{ } [ "interactor" get interactor-eof ] unit-test
-[ t ] [ "promise" get 2 seconds ?promise-timeout text = ] unit-test
+{ t } [ "promise" get 2 seconds ?promise-timeout text = ] unit-test
-[ ] [ <interactor> <pane> <pane-stream> >>output "interactor" set ] unit-test
+{ } [ <interactor> <pane> <pane-stream> >>output "interactor" set ] unit-test
-[ ] [ text "interactor" get set-editor-string ] unit-test
+{ } [ text "interactor" get set-editor-string ] unit-test
-[ ] [ <promise> "promise" set ] unit-test
+{ } [ <promise> "promise" set ] unit-test
-[ ] [
+{ } [
[
"interactor" get register-self
"interactor" get stream-read1 "promise" get fulfill
] in-thread
] unit-test
-[ ] [ 100 milliseconds sleep ] unit-test
+{ } [ 100 milliseconds sleep ] unit-test
-[ ] [ "interactor" get evaluate-input ] unit-test
+{ } [ "interactor" get evaluate-input ] unit-test
-[ CHAR: H ] [ "promise" get 2 seconds ?promise-timeout ] unit-test
+{ CHAR: H } [ "promise" get 2 seconds ?promise-timeout ] unit-test
-[ ] [ <listener-gadget> [ ] with-grafted-gadget ] unit-test
+{ } [ <listener-gadget> [ ] with-grafted-gadget ] unit-test
-[ ] [ <listener-gadget> "listener" set ] unit-test
+{ } [ <listener-gadget> "listener" set ] unit-test
"listener" get [
<interactor> <pane> <pane-stream> >>output "i" set
[ ] [ "listener" get com-end ] unit-test
] with-grafted-gadget
-[ ] [ \ + <interactor> manifest>> use-if-necessary ] unit-test
+{ } [ \ + <interactor> manifest>> use-if-necessary ] unit-test
-[ ] [ <listener-gadget> "l" set ] unit-test
-[ ] [ "l" get com-scroll-up ] unit-test
-[ ] [ "l" get com-scroll-down ] unit-test
+{ } [ <listener-gadget> "l" set ] unit-test
+{ } [ "l" get com-scroll-up ] unit-test
+{ } [ "l" get com-scroll-down ] unit-test
: gadgets-in-range ( frompath topath gadget -- seq )
gadget-subtree flatten-tree ;
-[ { "a" "b" "c" "d" } ] [
+{ { "a" "b" "c" "d" } } [
{ 0 } { } { "a" "b" "c" "d" } gadgets-in-range
] unit-test
-[ { "a" "b" } ] [
+{ { "a" "b" } } [
{ } { 1 } { "a" "b" "c" "d" } gadgets-in-range
] unit-test
-[ { "a" } ] [
+{ { "a" } } [
{ 0 } { 0 } { "a" "b" "c" "d" } gadgets-in-range
] unit-test
-[ { "a" "b" "c" } ] [
+{ { "a" "b" "c" } } [
{ 0 } { 2 } { "a" "b" "c" "d" } gadgets-in-range
] unit-test
-[ { "a" "b" "c" "d" } ] [
+{ { "a" "b" "c" "d" } } [
{ 0 } { 3 } { "a" "b" "c" "d" } gadgets-in-range
] unit-test
-[ { "a" "b" "c" "d" } ] [
+{ { "a" "b" "c" "d" } } [
{ 0 0 } { 0 3 } { { "a" "b" "c" "d" } } gadgets-in-range
] unit-test
-[ { "b" "c" "d" "e" } ] [
+{ { "b" "c" "d" "e" } } [
{ 0 1 } { 1 } { { "a" "b" "c" "d" } "e" } gadgets-in-range
] unit-test
-[ { "b" "c" "d" "e" "f" } ] [
+{ { "b" "c" "d" "e" "f" } } [
{ 0 1 } { 1 1 } { { "a" "b" "c" "d" } { "e" "f" "g" } } gadgets-in-range
] unit-test
-[ { "b" "c" "d" { "e" "f" "g" } "h" "i" } ] [
+{ { "b" "c" "d" { "e" "f" "g" } "h" "i" } } [
{ 0 1 } { 2 1 } { { "a" "b" "c" "d" } { "e" "f" "g" } { "h" "i" } } gadgets-in-range
] unit-test
-[ { "b" "c" "d" { "e" "f" "g" } "h" } ] [
+{ { "b" "c" "d" { "e" "f" "g" } "h" } } [
{ 0 1 } { 2 0 0 } { { "a" "b" "c" "d" } { "e" "f" "g" } { { "h" "i" } "j" } } gadgets-in-range
] unit-test
-[ { "b" "c" "d" { "e" "f" "g" } "h" "i" } ] [
+{ { "b" "c" "d" { "e" "f" "g" } "h" "i" } } [
{ 0 1 } { 2 0 1 } { { "a" "b" "c" "d" } { "e" "f" "g" } { { "h" "i" } "j" } } gadgets-in-range
] unit-test
strings quotations math.parser locals ;
IN: unicode.breaks.tests
-[ "\u001112\u001161\u0011abA\u000300a\r\r\n" ]
+{ "\u001112\u001161\u0011abA\u000300a\r\r\n" }
[ "\r\n\raA\u000300\u001112\u001161\u0011ab" string-reverse ] unit-test
-[ "dcba" ] [ "abcd" string-reverse ] unit-test
-[ 3 ] [ "\u001112\u001161\u0011abA\u000300a"
+{ "dcba" } [ "abcd" string-reverse ] unit-test
+{ 3 } [ "\u001112\u001161\u0011abA\u000300a"
dup last-grapheme head last-grapheme ] unit-test
-[ 3 ] [ 2 "hello" first-grapheme-from ] unit-test
-[ 1 ] [ 2 "hello" last-grapheme-from ] unit-test
+{ 3 } [ 2 "hello" first-grapheme-from ] unit-test
+{ 1 } [ 2 "hello" last-grapheme-from ] unit-test
-[ 4 ] [ 2 "what am I saying" first-word-from ] unit-test
-[ 0 ] [ 2 "what am I saying" last-word-from ] unit-test
-[ 16 ] [ 11 "what am I saying" first-word-from ] unit-test
-[ 10 ] [ 11 "what am I saying" last-word-from ] unit-test
+{ 4 } [ 2 "what am I saying" first-word-from ] unit-test
+{ 0 } [ 2 "what am I saying" last-word-from ] unit-test
+{ 16 } [ 11 "what am I saying" first-word-from ] unit-test
+{ 10 } [ 11 "what am I saying" last-word-from ] unit-test
: grapheme-break-test ( -- filename )
"vocab:unicode/breaks/GraphemeBreakTest.txt" ;
grapheme-break-test parse-test-file [ >graphemes ] test
word-break-test parse-test-file [ >words ] test
-[ { t f t t f t } ] [ 6 iota [ "as df" word-break-at? ] map ] unit-test
+{ { t f t t f t } } [ 6 iota [ "as df" word-break-at? ] map ] unit-test
unicode.case.private ;
IN: unicode.case.tests
-[ "Hello How Are You? I'm Good" ] [ "hEllo how ARE yOU? I'm good" >title ] unit-test
-[ "FUSS" ] [ "Fu\u0000DF" >upper ] unit-test
-[ "\u0003C3a\u0003C2 \u0003C3\u0003C2 \u0003C3a\u0003C2" ] [ "\u0003A3A\u0003A3 \u0003A3\u0003A3 \u0003A3A\u0003A3" >lower ] unit-test
-[ t ] [ "hello how are you?" lower? ] unit-test
+{ "Hello How Are You? I'm Good" } [ "hEllo how ARE yOU? I'm good" >title ] unit-test
+{ "FUSS" } [ "Fu\u0000DF" >upper ] unit-test
+{ "\u0003C3a\u0003C2 \u0003C3\u0003C2 \u0003C3a\u0003C2" } [ "\u0003A3A\u0003A3 \u0003A3\u0003A3 \u0003A3A\u0003A3" >lower ] unit-test
+{ t } [ "hello how are you?" lower? ] unit-test
[
[ f ] [ locale get i-dot? ] unit-test
[ f ] [ locale get lithuanian? ] unit-test
! [ "I\u000300" ] [ "i\u000307\u000300" >title ] unit-test
] with-scope
-[ t ] [ "asdf" lower? ] unit-test
-[ f ] [ "asdF" lower? ] unit-test
+{ t } [ "asdf" lower? ] unit-test
+{ f } [ "asdF" lower? ] unit-test
-[ t ] [ "ASDF" upper? ] unit-test
-[ f ] [ "ASDf" upper? ] unit-test
+{ t } [ "ASDF" upper? ] unit-test
+{ f } [ "ASDf" upper? ] unit-test
USING: tools.test kernel unicode.categories words sequences unicode.data ;
IN: unicode.categories.tests
-[ { f f t t f t t f f t } ] [ CHAR: A {
+{ { f f t t f t t f f t } } [ CHAR: A {
blank? letter? LETTER? Letter? digit?
printable? alpha? control? uncased? character?
} [ execute ] with map ] unit-test
-[ "Nd" ] [ CHAR: 3 category ] unit-test
-[ "Lo" ] [ 0x3400 category ] unit-test
-[ "Lo" ] [ 0x3450 category ] unit-test
-[ "Lo" ] [ 0x4DB5 category ] unit-test
-[ "Cs" ] [ 0xDD00 category ] unit-test
-[ t ] [ CHAR: \t blank? ] unit-test
-[ t ] [ CHAR: \s blank? ] unit-test
-[ t ] [ CHAR: \r blank? ] unit-test
-[ t ] [ CHAR: \n blank? ] unit-test
-[ f ] [ CHAR: a blank? ] unit-test
+{ "Nd" } [ CHAR: 3 category ] unit-test
+{ "Lo" } [ 0x3400 category ] unit-test
+{ "Lo" } [ 0x3450 category ] unit-test
+{ "Lo" } [ 0x4DB5 category ] unit-test
+{ "Cs" } [ 0xDD00 category ] unit-test
+{ t } [ CHAR: \t blank? ] unit-test
+{ t } [ CHAR: \s blank? ] unit-test
+{ t } [ CHAR: \r blank? ] unit-test
+{ t } [ CHAR: \n blank? ] unit-test
+{ f } [ CHAR: a blank? ] unit-test
[ execute( a b -- ? ) ] 2with map
first4 ;
-[ f f f f ] [ "hello" "hi" test-equality ] unit-test
-[ t f f f ] [ "hello" "h\u0000e9llo" test-equality ] unit-test
-[ t t f f ] [ "hello" "HELLO" test-equality ] unit-test
-[ t t t f ] [ "hello" "h e l l o." test-equality ] unit-test
-[ t t t t ] [ "hello" "\0hello\0" test-equality ] unit-test
-[ { "good bye" "goodbye" "hello" "HELLO" } ]
+{ f f f f } [ "hello" "hi" test-equality ] unit-test
+{ t f f f } [ "hello" "h\u0000e9llo" test-equality ] unit-test
+{ t t f f } [ "hello" "HELLO" test-equality ] unit-test
+{ t t t f } [ "hello" "h e l l o." test-equality ] unit-test
+{ t t t t } [ "hello" "\0hello\0" test-equality ] unit-test
+{ { "good bye" "goodbye" "hello" "HELLO" } }
[ { "HELLO" "goodbye" "good bye" "hello" } sort-strings ]
unit-test
locals math quotations assocs combinators unicode.normalize.private ;
IN: unicode.normalize.tests
-[ "ab\u000323\u000302cd" ] [ "ab\u000302" "\u000323cd" string-append ] unit-test
+{ "ab\u000323\u000302cd" } [ "ab\u000302" "\u000323cd" string-append ] unit-test
-[ "ab\u00064b\u000347\u00034e\u00034d\u000346" ] [ "ab\u000346\u000347\u00064b\u00034e\u00034d" dup reorder ] unit-test
-[ "hello" "hello" ] [ "hello" [ nfd ] keep nfkd ] unit-test
-[ "\u00FB012\u002075\u00017F\u000323\u000307" "fi25s\u000323\u000307" ]
+{ "ab\u00064b\u000347\u00034e\u00034d\u000346" } [ "ab\u000346\u000347\u00064b\u00034e\u00034d" dup reorder ] unit-test
+{ "hello" "hello" } [ "hello" [ nfd ] keep nfkd ] unit-test
+{ "\u00FB012\u002075\u00017F\u000323\u000307" "fi25s\u000323\u000307" }
[ "\u00FB012\u002075\u001E9B\u000323" [ nfd ] keep nfkd ] unit-test
-[ "\u001E69" "s\u000323\u000307" ] [ "\u001E69" [ nfc ] keep nfd ] unit-test
-[ "\u001E0D\u000307" ] [ "\u001E0B\u000323" nfc ] unit-test
+{ "\u001E69" "s\u000323\u000307" } [ "\u001E69" [ nfc ] keep nfd ] unit-test
+{ "\u001E0D\u000307" } [ "\u001E0B\u000323" nfc ] unit-test
-[ 54620 ] [ 4370 4449 4523 jamo>hangul ] unit-test
-[ 4370 4449 4523 ] [ 54620 hangul>jamo first3 ] unit-test
-[ t ] [ 54620 hangul? ] unit-test
-[ f ] [ 0 hangul? ] unit-test
-[ "\u001112\u001161\u0011ab" ] [ "\u00d55c" nfd ] unit-test
-[ "\u00d55c" ] [ "\u001112\u001161\u0011ab" nfc ] unit-test
+{ 54620 } [ 4370 4449 4523 jamo>hangul ] unit-test
+{ 4370 4449 4523 } [ 54620 hangul>jamo first3 ] unit-test
+{ t } [ 54620 hangul? ] unit-test
+{ f } [ 0 hangul? ] unit-test
+{ "\u001112\u001161\u0011ab" } [ "\u00d55c" nfd ] unit-test
+{ "\u00d55c" } [ "\u001112\u001161\u0011ab" nfc ] unit-test
: parse-test ( -- tests )
"vocab:unicode/normalize/NormalizationTest.txt" data
USING: unicode.script tools.test ;
-[ "Latin" ] [ CHAR: a script-of ] unit-test
-[ "Common" ] [ 0 script-of ] unit-test
+{ "Latin" } [ CHAR: a script-of ] unit-test
+{ "Common" } [ 0 script-of ] unit-test
sequences tools.test unix.ffi unix.utilities ;
IN: unix.ffi.tests
-[ 80 ] [ "http" f getservbyname port>> ntohs ] unit-test
+{ 80 } [ "http" f getservbyname port>> ntohs ] unit-test
! Aliases seem unreliable. Leave this as an example but don't rely
! on aliases working.
-[ ] [
+{ } [
"http" f getservbyname aliases>> utf8 alien>strings drop
] unit-test
-[ "http" ] [ 80 htons f getservbyport name>> ] unit-test
+{ "http" } [ 80 htons f getservbyport name>> ] unit-test
USING: kernel math sequences strings tools.test unix.groups ;
IN: unix.groups.tests
-[ ] [ all-groups drop ] unit-test
+{ } [ all-groups drop ] unit-test
-[ t ] [ real-group-name string? ] unit-test
-[ t ] [ effective-group-name string? ] unit-test
+{ t } [ real-group-name string? ] unit-test
+{ t } [ effective-group-name string? ] unit-test
-[ t ] [ real-group-id integer? ] unit-test
-[ t ] [ effective-group-id integer? ] unit-test
+{ t } [ real-group-id integer? ] unit-test
+{ t } [ effective-group-id integer? ] unit-test
-[ ] [ real-group-id set-real-group ] unit-test
-[ ] [ effective-group-id set-effective-group ] unit-test
+{ } [ real-group-id set-real-group ] unit-test
+{ } [ effective-group-id set-effective-group ] unit-test
-[ ] [ real-group-name [ ] with-real-group ] unit-test
-[ ] [ real-group-id [ ] with-real-group ] unit-test
+{ } [ real-group-name [ ] with-real-group ] unit-test
+{ } [ real-group-id [ ] with-real-group ] unit-test
-[ ] [ effective-group-name [ ] with-effective-group ] unit-test
-[ ] [ effective-group-id [ ] with-effective-group ] unit-test
+{ } [ effective-group-name [ ] with-effective-group ] unit-test
+{ } [ effective-group-id [ ] with-effective-group ] unit-test
-[ ] [ [ ] with-group-cache ] unit-test
+{ } [ [ ] with-group-cache ] unit-test
-[ ] [ real-group-id group-name drop ] unit-test
+{ } [ real-group-id group-name drop ] unit-test
-[ "888888888888888" ] [ 888888888888888 group-name ] unit-test
-[ f ] [ "please-oh-please-don't-have-a-group-named-this123lalala" group-struct ] unit-test
-[ f ] [ "please-oh-please-don't-have-a-group-named-this123lalala" group-exists? ] unit-test
+{ "888888888888888" } [ 888888888888888 group-name ] unit-test
+{ f } [ "please-oh-please-don't-have-a-group-named-this123lalala" group-struct ] unit-test
+{ f } [ "please-oh-please-don't-have-a-group-named-this123lalala" group-exists? ] unit-test
[ "please-oh-please-don't-have-a-group-named-this123lalala" ?group-id ] must-fail
-[ 3 ] [ f [ 3 ] with-effective-group ] unit-test
-[ 3 ] [ f [ 3 ] with-real-group ] unit-test
+{ 3 } [ f [ 3 ] with-effective-group ] unit-test
+{ 3 } [ f [ 3 ] with-real-group ] unit-test
-[ f ]
+{ f }
[ all-groups drop all-groups empty? ] unit-test
-[ f ]
+{ f }
[ all-group-names drop all-group-names empty? ] unit-test
{ f }
] [ test-sigusr1-handler SIGUSR1 remove-signal-handler ] [ ] cleanup
-[ 0 ] [
+{ 0 } [
sigusr1-count get-global
SIGUSR1 raise drop
0.5 seconds sleep
USING: tools.test unix.users kernel strings math sequences ;
IN: unix.users.tests
-[ ] [ all-users drop ] unit-test
+{ } [ all-users drop ] unit-test
-[ t ] [ real-user-name string? ] unit-test
-[ t ] [ effective-user-name string? ] unit-test
+{ t } [ real-user-name string? ] unit-test
+{ t } [ effective-user-name string? ] unit-test
-[ t ] [ real-user-id integer? ] unit-test
-[ t ] [ effective-user-id integer? ] unit-test
+{ t } [ real-user-id integer? ] unit-test
+{ t } [ effective-user-id integer? ] unit-test
-[ ] [ real-user-id set-real-user ] unit-test
-[ ] [ effective-user-id set-effective-user ] unit-test
+{ } [ real-user-id set-real-user ] unit-test
+{ } [ effective-user-id set-effective-user ] unit-test
-[ ] [ real-user-name [ ] with-real-user ] unit-test
-[ ] [ real-user-id [ ] with-real-user ] unit-test
+{ } [ real-user-name [ ] with-real-user ] unit-test
+{ } [ real-user-id [ ] with-real-user ] unit-test
-[ ] [ effective-user-name [ ] with-effective-user ] unit-test
-[ ] [ effective-user-id [ ] with-effective-user ] unit-test
+{ } [ effective-user-name [ ] with-effective-user ] unit-test
+{ } [ effective-user-id [ ] with-effective-user ] unit-test
-[ ] [ [ ] with-user-cache ] unit-test
+{ } [ [ ] with-user-cache ] unit-test
-[ "9999999999999999999" ] [ 9999999999999999999 user-name ] unit-test
+{ "9999999999999999999" } [ 9999999999999999999 user-name ] unit-test
-[ f ] [ 89898989898989898989898989898 user-passwd ] unit-test
+{ f } [ 89898989898989898989898989898 user-passwd ] unit-test
-[ f ] [ "thisusershouldnotexistabcdefg12345asdfasdfasdfasdfasdfasdfasdf" user-id ] unit-test
-[ f ] [ "thisusershouldnotexistabcdefg12345asdfasdfasdfasdfasdfasdfasdf" user-exists? ] unit-test
+{ f } [ "thisusershouldnotexistabcdefg12345asdfasdfasdfasdfasdfasdfasdf" user-id ] unit-test
+{ f } [ "thisusershouldnotexistabcdefg12345asdfasdfasdfasdfasdfasdfasdf" user-exists? ] unit-test
[ "thisusershouldnotexistabcdefg12345asdfasdfasdfasdfasdfasdfasdf" ?user-id ] must-fail
-[ 3 ] [ f [ 3 ] with-effective-user ] unit-test
-[ 3 ] [ f [ 3 ] with-real-user ] unit-test
+{ 3 } [ f [ 3 ] with-effective-user ] unit-test
+{ 3 } [ f [ 3 ] with-real-user ] unit-test
-[ f ]
+{ f }
[ all-users drop all-users empty? ] unit-test
-[ f ]
+{ f }
[ all-user-names drop all-user-names empty? ] unit-test
IN: urls.encoding.tests
USING: urls.encoding tools.test arrays kernel assocs present accessors ;
-[ "~hello world" ] [ "%7ehello world" url-decode ] unit-test
-[ "" ] [ "%XX%XX%XX" url-decode ] unit-test
-[ "" ] [ "%XX%XX%X" url-decode ] unit-test
+{ "~hello world" } [ "%7ehello world" url-decode ] unit-test
+{ "" } [ "%XX%XX%XX" url-decode ] unit-test
+{ "" } [ "%XX%XX%X" url-decode ] unit-test
-[ "hello world" ] [ "hello%20world" url-decode ] unit-test
-[ " ! " ] [ "%20%21%20" url-decode ] unit-test
-[ "hello world" ] [ "hello world%" url-decode ] unit-test
-[ "hello world" ] [ "hello world%x" url-decode ] unit-test
-[ "hello%20world" ] [ "hello world" url-encode ] unit-test
+{ "hello world" } [ "hello%20world" url-decode ] unit-test
+{ " ! " } [ "%20%21%20" url-decode ] unit-test
+{ "hello world" } [ "hello world%" url-decode ] unit-test
+{ "hello world" } [ "hello world%x" url-decode ] unit-test
+{ "hello%20world" } [ "hello world" url-encode ] unit-test
-[ "~foo" ] [ "~foo" url-encode ] unit-test
-[ "~foo" ] [ "~foo" url-encode-full ] unit-test
+{ "~foo" } [ "~foo" url-encode ] unit-test
+{ "~foo" } [ "~foo" url-encode-full ] unit-test
-[ ":foo" ] [ ":foo" url-encode ] unit-test
-[ "%3Afoo" ] [ ":foo" url-encode-full ] unit-test
+{ ":foo" } [ ":foo" url-encode ] unit-test
+{ "%3Afoo" } [ ":foo" url-encode-full ] unit-test
-[ "hello world" ] [ "hello+world" query-decode ] unit-test
+{ "hello world" } [ "hello+world" query-decode ] unit-test
-[ "\u001234hi\u002045" ] [ "\u001234hi\u002045" url-encode url-decode ] unit-test
+{ "\u001234hi\u002045" } [ "\u001234hi\u002045" url-encode url-decode ] unit-test
-[ "a=b&a=c" ] [ { { "a" { "b" "c" } } } assoc>query ] unit-test
+{ "a=b&a=c" } [ { { "a" { "b" "c" } } } assoc>query ] unit-test
-[ H{ { "a" "b" } } ] [ "a=b" query>assoc ] unit-test
+{ H{ { "a" "b" } } } [ "a=b" query>assoc ] unit-test
-[ H{ { "a" { "b" "c" } } } ] [ "a=b&a=c" query>assoc ] unit-test
+{ H{ { "a" { "b" "c" } } } } [ "a=b&a=c" query>assoc ] unit-test
-[ H{ { "a" { "b" "c" } } } ] [ "a=b;a=c" query>assoc ] unit-test
+{ H{ { "a" { "b" "c" } } } } [ "a=b;a=c" query>assoc ] unit-test
-[ H{ { "text" "hello world" } } ] [ "text=hello+world" query>assoc ] unit-test
+{ H{ { "text" "hello world" } } } [ "text=hello+world" query>assoc ] unit-test
-[ "foo=%3A" ] [ { { "foo" ":" } } assoc>query ] unit-test
+{ "foo=%3A" } [ { { "foo" ":" } } assoc>query ] unit-test
-[ "a=3" ] [ { { "a" 3 } } assoc>query ] unit-test
+{ "a=3" } [ { { "a" 3 } } assoc>query ] unit-test
-[ "a" ] [ { { "a" f } } assoc>query ] unit-test
+{ "a" } [ { { "a" f } } assoc>query ] unit-test
-[ H{ { "a" f } } ] [ "a" query>assoc ] unit-test
+{ H{ { "a" f } } } [ "a" query>assoc ] unit-test
IN: vocabs.files.tests
USING: tools.test vocabs.files vocabs arrays grouping ;
-[ t ] [
+{ t } [
"kernel" vocab-files
"kernel" lookup-vocab vocab-files
"kernel" <vocab-link> vocab-files
USING: sorting tools.test vocabs.metadata.resources ;
IN: vocabs.metadata.resources.tests
-[ { "bar" "bas" "foo" } ]
+{ { "bar" "bas" "foo" } }
[ "vocabs.metadata.resources.test.1" vocab-resource-files natural-sort ] unit-test
-[ { "bar.wtf" "foo.wtf" } ]
+{ { "bar.wtf" "foo.wtf" } }
[ "vocabs.metadata.resources.test.2" vocab-resource-files natural-sort ] unit-test
-[ {
+{ {
"resource-dir"
"resource-dir/bar"
"resource-dir/bas"
"resource-dir/bas/zang"
"resource-dir/bas/zim"
"resource-dir/foo"
-} ] [ "vocabs.metadata.resources.test.3" vocab-resource-files natural-sort ] unit-test
+} } [ "vocabs.metadata.resources.test.3" vocab-resource-files natural-sort ] unit-test
<< manifest get pprint-manifest >>""" ;
-[
+{
"""USING: kernel namespaces vocabs.parser vocabs.prettyprint ;"""
-]
+}
[ [ manifest-test-1 eval( -- ) ] with-string-writer ] unit-test
: manifest-test-2 ( -- string )
<< manifest get pprint-manifest >>""" ;
-[
+{
"""USING: kernel namespaces vocabs.parser vocabs.prettyprint ;
IN: vocabs.prettyprint.tests"""
-]
+}
[ [ manifest-test-2 eval( -- ) ] with-string-writer ] unit-test
: manifest-test-3 ( -- string )
<< manifest get pprint-manifest >>""" ;
-[
+{
"""USING: kernel namespaces vocabs.parser vocabs.prettyprint ;
FROM: math => + - ;
QUALIFIED: system
QUALIFIED-WITH: assocs a
EXCLUDE: parser => run-file ;
IN: vocabs.prettyprint.tests"""
-]
+}
[ [ manifest-test-3 eval( -- ) ] with-string-writer ] unit-test
-[
+{
"""USING: alien.c-types alien.syntax byte-arrays io
io.encodings.binary io.encodings.string io.encodings.utf8
io.streams.byte-array kernel sequences system system-info unix ;"""
-] [
+} [
[
{
"alien.c-types"
USING: tools.test vocabs.refresh.monitor io.pathnames ;
IN: vocabs.refresh.monitor.tests
-[ "kernel" ] [ "core/kernel/kernel.factor" path>vocab ] unit-test
-[ "kernel" ] [ "core/kernel/" path>vocab ] unit-test
-[ "kernel" ] [ "core/kernel/" resource-path path>vocab ] unit-test
+{ "kernel" } [ "core/kernel/kernel.factor" path>vocab ] unit-test
+{ "kernel" } [ "core/kernel/" path>vocab ] unit-test
+{ "kernel" } [ "core/kernel/" resource-path path>vocab ] unit-test
IN: vocabs.refresh.tests
USING: vocabs.refresh tools.test continuations namespaces ;
-[ ] [
+{ } [
changed-vocabs get-global
f changed-vocabs set-global
[ t ] [ "kernel" changed-vocab-by-name? ] unit-test
USING: kernel tools.test wrap.strings ;
IN: wrap.strings.tests
-[
+{
"""This is a
long piece
of text
that we
wish to
word wrap."""
-] [
+} [
"""This is a long piece of text that we wish to word wrap.""" 10
wrap-string
] unit-test
-[
+{
""" This is a
long piece
of text
that we
wish to
word wrap."""
-] [
+} [
"""This is a long piece of text that we wish to word wrap.""" 12
" " wrap-indented-string
] unit-test
[ " " wrap-indented-string ] [ 2 wrap-indented-string ] 2bi =
] unit-test
-[ "this text\nhas lots of\nspaces" ]
+{ "this text\nhas lots of\nspaces" }
[ "this text has lots of spaces" 12 wrap-string ] unit-test
-[ "hello\nhow\nare\nyou\ntoday?" ]
+{ "hello\nhow\nare\nyou\ntoday?" }
[ "hello how are you today?" 3 wrap-string ] unit-test
-[ "aaa\nbb cc\nddddd" ] [ "aaa bb cc ddddd" 6 wrap-string ] unit-test
-[ "aaa\nbb ccc\ndddddd" ] [ "aaa bb ccc dddddd" 6 wrap-string ] unit-test
-[ "aaa bb\ncccc\nddddd" ] [ "aaa bb cccc ddddd" 6 wrap-string ] unit-test
-[ "aaa bb\nccccccc\nddddddd" ] [ "aaa bb ccccccc ddddddd" 6 wrap-string ] unit-test
+{ "aaa\nbb cc\nddddd" } [ "aaa bb cc ddddd" 6 wrap-string ] unit-test
+{ "aaa\nbb ccc\ndddddd" } [ "aaa bb ccc dddddd" 6 wrap-string ] unit-test
+{ "aaa bb\ncccc\nddddd" } [ "aaa bb cccc ddddd" 6 wrap-string ] unit-test
+{ "aaa bb\nccccccc\nddddddd" } [ "aaa bb ccccccc ddddddd" 6 wrap-string ] unit-test
-[ "a b c d e f\ng h" ] [ "a b c d e f g h" 11 wrap-string ] unit-test
+{ "a b c d e f\ng h" } [ "a b c d e f g h" 11 wrap-string ] unit-test
-[ "" ] [ "" 10 wrap-string ] unit-test
-[ "Hello" ] [ "\nHello\n" 10 wrap-string ] unit-test
+{ "" } [ "" 10 wrap-string ] unit-test
+{ "Hello" } [ "\nHello\n" 10 wrap-string ] unit-test
{ " > > > " } [ "" 70 " > > > " wrap-indented-string ] unit-test
USING: tools.test wrap.words sequences ;
IN: wrap.words.tests
-[
+{
{
{
T{ word f 1 10 f }
T{ word f 5 10 f }
}
}
-] [
+} [
{
T{ word f 1 10 f }
T{ word f 2 10 f }
} 35 35 wrap-words [ { } like ] map
] unit-test
-[
+{
{
{
T{ word f 1 10 f }
T{ word f 5 10 f }
}
}
-] [
+} [
{
T{ word f 1 10 f }
T{ word f 2 10 f }
} 35 35 wrap-words [ { } like ] map
] unit-test
-[
+{
{
{
T{ word f 1 10 t }
T{ word f 5 10 f }
}
}
-] [
+} [
{
T{ word f 1 10 t }
T{ word f 1 10 f }
: calc-arith ( string -- n )
string>xml first-child-tag calculate ;
-[ 32 ] [
+{ 32 } [
"<math><times><add><number>1</number><number>3</number></add><neg><number>-8</number></neg></times></math>"
calc-arith
] unit-test
XML-NS: foo http://blah.com
-[ T{ name { main "bling" } { url "http://blah.com" } } ] [ "bling" foo ] unit-test
+{ T{ name { main "bling" } { url "http://blah.com" } } } [ "bling" foo ] unit-test
! XML literals
-[ "a" "c" { "a" "c" f } ] [
+{ "a" "c" { "a" "c" f } } [
"<?xml version='1.0'?><x><-a-><b val=<-c->/><-></x>"
string>doc
[ second var>> ]
[ extract-variables ] tri
] unit-test
-[ """<?xml version="1.0" encoding="UTF-8"?>
+{ """<?xml version="1.0" encoding="UTF-8"?>
<x>
one
<b val="two"/>
y
<foo/>
-</x>""" ] [
+</x>""" } [
[let "one" :> a "two" :> c "y" :> x [XML <-x-> <foo/> XML] :> d
<XML
<x> <-a-> <b val=<-c->/> <-d-> </x>
]
] unit-test
-[ """<?xml version="1.0" encoding="UTF-8"?>
+{ """<?xml version="1.0" encoding="UTF-8"?>
<doc>
<item>
one
<item>
three
</item>
-</doc>""" ] [
+</doc>""" } [
"one two three" " " split
[ [XML <item><-></item> XML] ] map
<XML <doc><-></doc> XML> pprint-xml>string
] unit-test
-[ """<?xml version="1.0" encoding="UTF-8"?>
-<x number="3" url="http://factorcode.org/" string="hello" word="drop"/>""" ]
+{ """<?xml version="1.0" encoding="UTF-8"?>
+<x number="3" url="http://factorcode.org/" string="hello" word="drop"/>""" }
[ 3 f "http://factorcode.org/" "hello" \ drop
<XML <x number=<-> false=<-> url=<-> string=<-> word=<->/> XML>
pprint-xml>string ] unit-test
-[ "<x>3</x>" ] [ 3 [XML <x><-></x> XML] xml>string ] unit-test
-[ "<x></x>" ] [ f [XML <x><-></x> XML] xml>string ] unit-test
+{ "<x>3</x>" } [ 3 [XML <x><-></x> XML] xml>string ] unit-test
+{ "<x></x>" } [ f [XML <x><-></x> XML] xml>string ] unit-test
[ [XML <-> XML] ] must-infer
[ [XML <foo><-></foo> <bar val=<->/> XML] ] must-infer
-[ xml-chunk ] [ [ [XML <foo/> XML] ] first class-of ] unit-test
-[ xml ] [ [ <XML <foo/> XML> ] first class-of ] unit-test
-[ xml-chunk ] [ [ [XML <foo val=<->/> XML] ] third class-of ] unit-test
-[ xml ] [ [ <XML <foo val=<->/> XML> ] third class-of ] unit-test
-[ 1 ] [ [ [XML <foo/> XML] ] length ] unit-test
-[ 1 ] [ [ <XML <foo/> XML> ] length ] unit-test
+{ xml-chunk } [ [ [XML <foo/> XML] ] first class-of ] unit-test
+{ xml } [ [ <XML <foo/> XML> ] first class-of ] unit-test
+{ xml-chunk } [ [ [XML <foo val=<->/> XML] ] third class-of ] unit-test
+{ xml } [ [ <XML <foo val=<->/> XML> ] third class-of ] unit-test
+{ 1 } [ [ [XML <foo/> XML] ] length ] unit-test
+{ 1 } [ [ <XML <foo/> XML> ] length ] unit-test
-[ "" ] [ [XML XML] concat ] unit-test
+{ "" } [ [XML XML] concat ] unit-test
-[ "foo" ] [ [XML <a>foo</a> XML] [ [XML <a><-></a> XML] ] undo ] unit-test
-[ "foo" ] [ [XML <a bar='foo'/> XML] [ [XML <a bar=<-> /> XML] ] undo ] unit-test
-[ "foo" "baz" ] [ [XML <a bar='foo'>baz</a> XML] [ [XML <a bar=<->><-></a> XML] ] undo ] unit-test
+{ "foo" } [ [XML <a>foo</a> XML] [ [XML <a><-></a> XML] ] undo ] unit-test
+{ "foo" } [ [XML <a bar='foo'/> XML] [ [XML <a bar=<-> /> XML] ] undo ] unit-test
+{ "foo" "baz" } [ [XML <a bar='foo'>baz</a> XML] [ [XML <a bar=<->><-></a> XML] ] undo ] unit-test
: dispatch ( xml -- string )
{
{ [ [XML <b val=<->/> XML] ] [ "bno" prepend ] }
} switch ;
-[ "apple" ] [ [XML <a>pple</a> XML] dispatch ] unit-test
-[ "banana" ] [ [XML <b>anana</b> XML] dispatch ] unit-test
-[ "byes" ] [ [XML <b val="yes"/> XML] dispatch ] unit-test
-[ "bnowhere" ] [ [XML <b val="where"/> XML] dispatch ] unit-test
-[ "baboon" ] [ [XML <b val="something">aboon</b> XML] dispatch ] unit-test
-[ "apple" ] [ <XML <a>pple</a> XML> dispatch ] unit-test
-[ "apple" ] [ <XML <a>pple</a> XML> body>> dispatch ] unit-test
+{ "apple" } [ [XML <a>pple</a> XML] dispatch ] unit-test
+{ "banana" } [ [XML <b>anana</b> XML] dispatch ] unit-test
+{ "byes" } [ [XML <b val="yes"/> XML] dispatch ] unit-test
+{ "bnowhere" } [ [XML <b val="where"/> XML] dispatch ] unit-test
+{ "baboon" } [ [XML <b val="something">aboon</b> XML] dispatch ] unit-test
+{ "apple" } [ <XML <a>pple</a> XML> dispatch ] unit-test
+{ "apple" } [ <XML <a>pple</a> XML> body>> dispatch ] unit-test
: dispatch-doc ( xml -- string )
{
{ [ <XML <b val=<->/> XML> ] [ "bno" prepend ] }
} switch ;
-[ "apple" ] [ <XML <a>pple</a> XML> dispatch-doc ] unit-test
-[ "apple" ] [ [XML <a>pple</a> XML] dispatch-doc ] unit-test
-[ "apple" ] [ <XML <a>pple</a> XML> body>> dispatch-doc ] unit-test
+{ "apple" } [ <XML <a>pple</a> XML> dispatch-doc ] unit-test
+{ "apple" } [ [XML <a>pple</a> XML] dispatch-doc ] unit-test
+{ "apple" } [ <XML <a>pple</a> XML> body>> dispatch-doc ] unit-test
! Make sure nested XML documents interpolate correctly
{
USING: xml xml.traversal tools.test xml.data sequences arrays kernel ;
IN: xml.traversal.tests
-[ "bar" ] [ "<foo>bar</foo>" string>xml children>string ] unit-test
+{ "bar" } [ "<foo>bar</foo>" string>xml children>string ] unit-test
-[ "" ] [ "<foo></foo>" string>xml children>string ] unit-test
+{ "" } [ "<foo></foo>" string>xml children>string ] unit-test
-[ "" ] [ "<foo/>" string>xml children>string ] unit-test
+{ "" } [ "<foo/>" string>xml children>string ] unit-test
-[ "bar qux" ] [ "<foo>bar <baz>qux</baz></foo>" string>xml deep-children>string ] unit-test
+{ "bar qux" } [ "<foo>bar <baz>qux</baz></foo>" string>xml deep-children>string ] unit-test
-[ "blah" ] [ "<foo attr='blah'/>" string>xml-chunk "foo" deep-tag-named "attr" attr ] unit-test
+{ "blah" } [ "<foo attr='blah'/>" string>xml-chunk "foo" deep-tag-named "attr" attr ] unit-test
-[ { "blah" } ] [ "<foo attr='blah'/>" string>xml-chunk "foo" deep-tags-named [ "attr" attr ] map ] unit-test
+{ { "blah" } } [ "<foo attr='blah'/>" string>xml-chunk "foo" deep-tags-named [ "attr" attr ] map ] unit-test
-[ "blah" ] [ "<foo attr='blah'/>" string>xml "foo" deep-tag-named "attr" attr ] unit-test
+{ "blah" } [ "<foo attr='blah'/>" string>xml "foo" deep-tag-named "attr" attr ] unit-test
-[ { "blah" } ] [ "<foo attr='blah'/>" string>xml "foo" deep-tags-named [ "attr" attr ] map ] unit-test
+{ { "blah" } } [ "<foo attr='blah'/>" string>xml "foo" deep-tags-named [ "attr" attr ] map ] unit-test
-[ { "blah" } ] [ "<foo><bar attr='blah'/></foo>" string>xml "blah" "attr" tags-with-attr [ "attr" attr ] map ] unit-test
-[ { "blah" } ] [ "bar" { { "attr" "blah" } } f <tag> 1array "blah" "attr" tags-with-attr [ "attr" attr ] map ] unit-test
+{ { "blah" } } [ "<foo><bar attr='blah'/></foo>" string>xml "blah" "attr" tags-with-attr [ "attr" attr ] map ] unit-test
+{ { "blah" } } [ "bar" { { "attr" "blah" } } f <tag> 1array "blah" "attr" tags-with-attr [ "attr" attr ] map ] unit-test
-[ { "http://hub.example.com" "http://alt.example.com" } ] [ "<head><link rel='alternate' href='http://alt.example.com'/><link rel='hub' href='http://hub.example.com'/></head>" string>xml-chunk "head" tag-named [ "link" "hub" "rel" tag-named-with-attr ] [ "link" "alternate" "rel" tag-named-with-attr ] bi [ "href" attr ] bi@ 2array ] unit-test
+{ { "http://hub.example.com" "http://alt.example.com" } } [ "<head><link rel='alternate' href='http://alt.example.com'/><link rel='hub' href='http://hub.example.com'/></head>" string>xml-chunk "head" tag-named [ "link" "hub" "rel" tag-named-with-attr ] [ "link" "alternate" "rel" tag-named-with-attr ] bi [ "href" attr ] bi@ 2array ] unit-test
! Add a test for pprint-xml with sensitive-tags
-[ "foo" ] [ T{ name { main "foo" } } name>string ] unit-test
-[ "foo" ] [ T{ name { space "" } { main "foo" } } name>string ] unit-test
-[ "ns:foo" ] [ T{ name { space "ns" } { main "foo" } } name>string ] unit-test
+{ "foo" } [ T{ name { main "foo" } } name>string ] unit-test
+{ "foo" } [ T{ name { space "" } { main "foo" } } name>string ] unit-test
+{ "ns:foo" } [ T{ name { space "ns" } { main "foo" } } name>string ] unit-test
: reprints-as ( to from -- )
[ ] [ string>xml xml>string ] bi-curry* unit-test ;
]>
<x>&foo;</x>""" pprint-reprints-as
-[ t ] [ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\" >" dup string>xml-chunk xml>string = ] unit-test
-[ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a b=\"c\"/>" ]
+{ t } [ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\" >" dup string>xml-chunk xml>string = ] unit-test
+{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a b=\"c\"/>" }
[ "<a b='c'/>" string>xml xml>string ] unit-test
-[ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>bar baz</foo>" ]
+{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>bar baz</foo>" }
[ "<foo>bar</foo>" string>xml [ " baz" append ] map xml>string ] unit-test
-[ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<foo>\n bar\n</foo>" ]
+{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<foo>\n bar\n</foo>" }
[ "<foo> bar </foo>" string>xml pprint-xml>string ] unit-test
-[ "<foo'>" ] [ "<foo'>" <unescaped> xml>string ] unit-test
+{ "<foo'>" } [ "<foo'>" <unescaped> xml>string ] unit-test
: test-file ( -- path )
"test.xml" temp-file ;
-[ ] [
+{ } [
"<?xml version='1.0' encoding='UTF-16BE'?><x/>" string>xml test-file utf8 [ write-xml ] with-file-writer
] unit-test
-[ "x" ] [ test-file file>xml body>> name>> main>> ] unit-test
-[ ] [ test-file delete-file ] unit-test
+{ "x" } [ test-file file>xml body>> name>> main>> ] unit-test
+{ } [ test-file delete-file ] unit-test
-[ ] [
+{ } [
{ 1 2 3 4 } [
[ number>string ] [ sq number>string ] bi
[XML <tr><td><-></td><td><-></td></tr> XML]
USING: xmode.catalog tools.test hashtables assocs
kernel sequences io ;
-[ t ] [ modes hashtable? ] unit-test
+{ t } [ modes hashtable? ] unit-test
-[ ] [
+{ } [
modes keys [
dup print flush load-mode drop reset-modes
] each
tools.test multiline splitting memoize
kernel io.streams.string xml.writer ;
-[ ] [ \ (load-mode) reset-memoized ] unit-test
+{ } [ \ (load-mode) reset-memoized ] unit-test
-[ ] [
+{ } [
"""<style type="text/css" media="screen" >
* {margin:0; padding:0; border:0;}"""
string-lines "html" htmlize-lines drop
] unit-test
-[ ] [
+{ } [
"test.c"
"""int x = "hi";
/* a comment */""" <string-reader> htmlize-stream
write-xml
] unit-test
-[ "<span class=\"MARKUP\">: foo</span> <span class=\"MARKUP\">;</span>" ] [
+{ "<span class=\"MARKUP\">: foo</span> <span class=\"MARKUP\">;</span>" } [
{ ": foo ;" } "factor" htmlize-lines xml>string
] unit-test
-[ ":foo" ] [
+{ ":foo" } [
{ ":foo" } "factor" htmlize-lines xml>string
] unit-test
{ "size_t" KEYWORD3 }
} assoc-union! drop
-[ 3 ] [ "k" get assoc-size ] unit-test
-[ KEYWORD1 ] [ "int" "k" get at ] unit-test
-[ "_" ] [ "k" get keyword-map-no-word-sep* >string ] unit-test
-[ ] [ LITERAL1 "x-y" "k" get set-at ] unit-test
-[ "-_" ] [ "k" get keyword-map-no-word-sep* >string ] unit-test
+{ 3 } [ "k" get assoc-size ] unit-test
+{ KEYWORD1 } [ "int" "k" get at ] unit-test
+{ "_" } [ "k" get keyword-map-no-word-sep* >string ] unit-test
+{ } [ LITERAL1 "x-y" "k" get set-at ] unit-test
+{ "-_" } [ "k" get keyword-map-no-word-sep* >string ] unit-test
t <keyword-map> dup "k" set
{
{ "BAZ" KEYWORD3 }
} assoc-union! drop
-[ KEYWORD1 ] [ "fOo" "k" get at ] unit-test
+{ KEYWORD1 } [ "fOo" "k" get at ] unit-test
-[ KEYWORD2 ] [ "BBAR" "k" get at ] unit-test
+{ KEYWORD2 } [ "BBAR" "k" get at ] unit-test
-[ KEYWORD3 ] [ "baz" "k" get at ] unit-test
+{ KEYWORD3 } [ "baz" "k" get at ] unit-test
xmode.marker tools.test kernel ;
IN: xmode.marker.tests
-[
+{
{
T{ token f "int" KEYWORD3 }
T{ token f " " f }
T{ token f "x" f }
}
-] [ f "int x" "c" load-mode tokenize-line nip ] unit-test
+} [ f "int x" "c" load-mode tokenize-line nip ] unit-test
-[
+{
{
T{ token f "\"" LITERAL1 }
T{ token f "hello\\\"" LITERAL1 }
T{ token f "world" LITERAL1 }
T{ token f "\"" LITERAL1 }
}
-] [ f "\"hello\\\" world\"" "c" load-mode tokenize-line nip ] unit-test
+} [ f "\"hello\\\" world\"" "c" load-mode tokenize-line nip ] unit-test
-[
+{
{
T{ token f "\"" LITERAL1 }
T{ token f "hello\\\ world" LITERAL1 }
T{ token f "\"" LITERAL1 }
}
-] [ f "\"hello\\\ world\"" "c" load-mode tokenize-line nip ] unit-test
+} [ f "\"hello\\\ world\"" "c" load-mode tokenize-line nip ] unit-test
-[
+{
{
T{ token f "int" KEYWORD3 }
T{ token f " " f }
T{ token f "x" f }
}
-] [ f "int x" "java" load-mode tokenize-line nip ] unit-test
+} [ f "int x" "java" load-mode tokenize-line nip ] unit-test
-[
+{
{
T{ token f "//" COMMENT2 }
T{ token f " " COMMENT2 }
T{ token f " " COMMENT2 }
T{ token f "world" COMMENT2 }
}
-] [ f "// hello world" "java" load-mode tokenize-line nip ] unit-test
+} [ f "// hello world" "java" load-mode tokenize-line nip ] unit-test
-[
+{
{
T{ token f "hello" f }
T{ token f " " f }
T{ token f "world" f }
T{ token f ":" f }
}
-] [ f "hello world:" "java" load-mode tokenize-line nip ] unit-test
+} [ f "hello world:" "java" load-mode tokenize-line nip ] unit-test
-[
+{
{
T{ token f "hello_world" LABEL }
T{ token f ":" OPERATOR }
}
-] [ f "hello_world:" "java" load-mode tokenize-line nip ] unit-test
+} [ f "hello_world:" "java" load-mode tokenize-line nip ] unit-test
-[
+{
{
T{ token f "\t" f }
T{ token f "hello_world" LABEL }
T{ token f ":" OPERATOR }
}
-] [ f "\thello_world:" "java" load-mode tokenize-line nip ] unit-test
+} [ f "\thello_world:" "java" load-mode tokenize-line nip ] unit-test
-[
+{
{
T{ token f "<!" KEYWORD2 }
T{ token f "ELEMENT" KEYWORD2 }
T{ token f " " KEYWORD2 }
T{ token f ">" KEYWORD2 }
}
-] [
+} [
f "<!ELEMENT %hello; >" "xml" load-mode tokenize-line nip
] unit-test
-[
+{
{
T{ token f "<!" KEYWORD2 }
T{ token f "ELEMENT" KEYWORD2 }
T{ token f " " KEYWORD2 }
T{ token f ">" KEYWORD2 }
}
-] [
+} [
f "<!ELEMENT %hello-world; >" "xml" load-mode tokenize-line nip
] unit-test
-[
+{
{
T{ token f "$" KEYWORD2 }
T{ token f "FOO" KEYWORD2 }
}
-] [
+} [
f "$FOO" "shellscript" load-mode tokenize-line nip
] unit-test
-[
+{
{
T{ token f "AND" KEYWORD1 }
}
-] [
+} [
f "AND" "pascal" load-mode tokenize-line nip
] unit-test
-[
+{
{
T{ token f "Comment {" COMMENT1 }
T{ token f "XXX" COMMENT1 }
T{ token f "}" COMMENT1 }
}
-] [
+} [
f "Comment {XXX}" "rebol" load-mode tokenize-line nip
] unit-test
-[
+{
-] [
+} [
f "font:75%/1.6em \"Lucida Grande\", \"Lucida Sans Unicode\", verdana, geneva, sans-serif;" "css" load-mode tokenize-line 2drop
] unit-test
-[
+{
{
T{ token f "<" MARKUP }
T{ token f "aaa" MARKUP }
T{ token f ">" MARKUP }
}
-] [ f "<aaa>" "html" load-mode tokenize-line nip ] unit-test
+} [ f "<aaa>" "html" load-mode tokenize-line nip ] unit-test
IN: xmode.rules.tests
USING: xmode.rules tools.test ;
-[ { 1 2 3 } ] [ f { 1 2 3 } ?push-all ] unit-test
-[ { 1 2 3 } ] [ { 1 2 3 } f ?push-all ] unit-test
-[ V{ 1 2 3 4 5 } ] [ { 1 2 3 } { 4 5 } ?push-all ] unit-test
+{ { 1 2 3 } } [ f { 1 2 3 } ?push-all ] unit-test
+{ { 1 2 3 } } [ { 1 2 3 } f ?push-all ] unit-test
+{ V{ 1 2 3 4 5 } } [ { 1 2 3 } { 4 5 } ?push-all ] unit-test
USING: 99-bottles io.streams.string tools.test ;
IN: 99-bottles.tests
-[
+{
"""99 bottles of beer on the wall, 99 bottles of beer.
Take one down, pass it around, 98 bottles of beer on the wall.
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
"""
-]
+}
[ [ 99-bottles ] with-string-writer ] unit-test
SPECIALIZED-ARRAYS: int float float-4 uchar-16 ;
IN: alien.data.map.tests
-[ float-array{ 1.0 1.0 3.0 3.0 5.0 5.0 } ]
+{ float-array{ 1.0 1.0 3.0 3.0 5.0 5.0 } }
[
int-array{ 1 3 5 } [ dup ] data-map( int -- float[2] )
float cast-array
] unit-test
-[
+{
float-4-array{
float-4{ 0.0 0.0 0.0 0.0 }
float-4{ 1.0 1.0 1.0 1.0 }
float-4{ 2.0 2.0 2.0 2.0 }
}
-] [
+} [
3 iota [ float-4-with ] data-map( object -- float-4 )
float-4 cast-array
] unit-test
-[
+{
float-4-array{
float-4{ 0.0 1.0 2.0 3.0 }
float-4{ 4.0 5.0 6.0 7.0 }
float-4{ 8.0 9.0 10.0 11.0 }
}
-] [
+} [
12 iota [ float-4-boa ] data-map( object[4] -- float-4 )
float-4 cast-array
] unit-test
-[ float-array{ 1.0 1.0 3.0 3.0 5.0 5.0 0.0 0.0 } ]
+{ float-array{ 1.0 1.0 3.0 3.0 5.0 5.0 0.0 0.0 } }
[
int-array{ 1 3 5 } float-array{ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 }
[ dup ] data-map!( int -- float[2] )
: float-pixels>byte-pixels ( floats -- bytes )
1.0 0.0 float-pixels>byte-pixels* ;
-[
+{
B{
127 191 255 63
255 25 51 76
76 51 229 127
25 255 255 255
}
-] [
+} [
float-array{
0.5 0.75 1.0 0.25
1.0 0.1 0.2 0.3
} 1.0 0.0 float-pixels>byte-pixels-locals
] unit-test
-[
+{
B{
127 191 255 63
255 25 51 76
76 51 229 127
25 255 255 255
}
-] [
+} [
float-array{
0.5 0.75 1.0 0.25
1.0 0.1 0.2 0.3
} float-pixels>byte-pixels
] unit-test
-[
+{
B{
127 191 255 63
255 25 51 76
76 51 229 127
25 255 255 255
}
-] [
+} [
float-array{
0.5 0.75 1.0 0.25
1.0 0.1 0.2 0.3
[ vmerge-transpose vmerge-transpose ]
data-map( uchar-16 uchar-16 uchar-16 uchar-16 -- uchar-16[plane-count] ) ;
-[
+{
B{
1 10 11 15
2 20 22 25
15 150 165 155
16 160 176 165
}
-] [
+} [
B{ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 }
B{ 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 }
B{ 11 22 33 44 55 66 77 88 99 110 121 132 143 154 165 176 }
[ 0.0 1.0 1.0 ] dip /f <range>
[ ] data-map( object -- float ) ;
-[ float-array{ 0.0 0.5 1.0 } ]
+{ float-array{ 0.0 0.5 1.0 } }
[ 2 data-map-compiler-bug-test float cast-array ]
unit-test
: invoke-test-thingy-ptr-callback ( thingy -- n )
test-thingy-ptr-callback int { void* } cdecl alien-indirect ;
-[ t f ] [
+{ t f } [
[ 5 <thingy> <alien-handle> &release-alien-handle [ alien-handle? ] keep ] with-destructors
alien-handle?
] unit-test
-[ t f ] [
+{ t f } [
[ 5 <thingy> <alien-handle-ptr> &release-alien-handle-ptr [ alien-handle-ptr? ] keep ] with-destructors
alien-handle-ptr?
] unit-test
-[ 6 ] [
+{ 6 } [
[
5 <thingy> <alien-handle> &release-alien-handle
invoke-test-thingy-callback
] with-destructors
] unit-test
-[ 6 ] [
+{ 6 } [
[
5 <thingy> <alien-handle-ptr> &release-alien-handle-ptr
invoke-test-thingy-ptr-callback
!TODO return 5
f ;
-[ t ] [
+{ t } [
NOTEs {
[ length 1 = ]
[ first string>> file-name "annotations-tests.factor" = ]
} 1&&
] unit-test
-[ t ] [
+{ t } [
BROKENs { [ \ four swap member? ] [ \ three swap member? ] } 1&&
] unit-test
-[ t ] [ TODOs \ five swap member? ] unit-test
+{ t } [ TODOs \ five swap member? ] unit-test
USING: accessors arrays.shaped kernel tools.test math ;
IN: arrays.shaped.tests
-[ t ] [
+{ t } [
{ 5 5 } increasing
{
{ 0 1 2 3 4 }
} >shaped-array =
] unit-test
-[ { 5 5 } ] [
+{ { 5 5 } } [
{
{ 0 1 2 3 4 }
{ 5 6 7 8 9 }
} >shaped-array shape>>
] unit-test
-[ { 5 5 } ] [
+{ { 5 5 } } [
{
{ 0 1 2 3 4 }
{ 5 6 7 8 9 }
! Error on 0, negative shapes
-[
+{
sa{ { 1 3 3 } { 4 1 3 } { 4 4 1 } }
-] [
+} [
{ 3 3 } 2 strict-lower
[ drop 3 ] map-strict-upper
[ drop 1 ] map-diagonal
USING: asn1 asn1.ldap io io.streams.string tools.test ;
-[ 6 ] [
+{ 6 } [
"\u000002\u000001\u000006" [ asn-syntax read-ber ] with-string-reader
] unit-test
-[ "testing" ] [
+{ "testing" } [
"\u000004\u000007testing" [ asn-syntax read-ber ] with-string-reader
] unit-test
-[ { 1 { 3 "Administrator" "ad_is_bogus" } } ] [
+{ { 1 { 3 "Administrator" "ad_is_bogus" } } } [
"0$\u000002\u000001\u000001`\u00001f\u000002\u000001\u000003\u000004\rAdministrator\u000080\u00000bad_is_bogus"
[ asn-syntax read-ber ] with-string-reader
] unit-test
{ H{ { 2 1 } { 4 3 } } } [ H{ { 1 2 } { 3 4 } } assoc-invert ] unit-test
-[ H{ { "a" V{ 2 5 } } { "b" V{ 3 } } { "c" V{ 10 } } } ]
+{ H{ { "a" V{ 2 5 } } { "b" V{ 3 } } { "c" V{ 10 } } } }
[
{ H{ { "a" 2 } { "b" 3 } } H{ { "a" 5 } { "c" 10 } } }
[ ] [ assoc-merge ] map-reduce
USING: backtrack math tools.test ;
cut-amb
-[ 1 ] [ { 1 2 } amb ] unit-test
-[ V{ { 1 2 } } ] [ [ { 1 2 } ] bag-of ] unit-test
-[ V{ 1 2 } ] [ [ { 1 2 } amb ] bag-of ] unit-test
+{ 1 } [ { 1 2 } amb ] unit-test
+{ V{ { 1 2 } } } [ [ { 1 2 } ] bag-of ] unit-test
+{ V{ 1 2 } } [ [ { 1 2 } amb ] bag-of ] unit-test
[ cut-amb { } amb ] must-fail
[ fail ] must-fail
-[ V{ 1 10 2 20 } ] [ [ { 1 2 } amb { 1 10 } amb * ] bag-of ] unit-test
-[ V{ 7 -1 } ] [ [ 3 4 { + - } amb-execute ] bag-of ] unit-test
-[ "foo" t ] [ [ "foo" t ] [ "bar" ] if-amb ] unit-test
-[ "bar" f ] [ [ "foo" f ] [ "bar" ] if-amb ] unit-test
-[ "bar" f ] [ [ "foo" fail ] [ "bar" ] if-amb ] unit-test
+{ V{ 1 10 2 20 } } [ [ { 1 2 } amb { 1 10 } amb * ] bag-of ] unit-test
+{ V{ 7 -1 } } [ [ 3 4 { + - } amb-execute ] bag-of ] unit-test
+{ "foo" t } [ [ "foo" t ] [ "bar" ] if-amb ] unit-test
+{ "bar" f } [ [ "foo" f ] [ "bar" ] if-amb ] unit-test
+{ "bar" f } [ [ "foo" fail ] [ "bar" ] if-amb ] unit-test
] unit-test
] with-variable
-[ 6781 ] [
+{ 6781 } [
"..." 0.07 1 2007 4 10 <date> 4398.50 open-account
2007 10 26 <date> 2000 "..." <transaction> 1array inserting-transactions
2008 4 10 <date> process-to-date dup balance>> swap unpaid-interest>> + round >integer
io.streams.string kernel tools.test splitting ;
IN: benchmark.regex-dna.tests
-[ t ] [
+{ t } [
"resource:extra/benchmark/regex-dna/regex-dna-test-in.txt"
[ regex-dna ] with-string-writer
"resource:extra/benchmark/regex-dna/regex-dna-test-out.txt"
USING: benchmark.reverse-complement checksums checksums.md5 io.files
io.files.temp kernel tools.test ;
-[ "c071aa7e007a9770b2fb4304f55a17e5" ] [
+{ "c071aa7e007a9770b2fb4304f55a17e5" } [
"resource:extra/benchmark/reverse-complement/reverse-complement-test-in.txt"
"reverse-complement-test-out.txt" temp-file
[ reverse-complement ] keep md5 checksum-file hex-string
math random sequences tools.test ;
IN: bloom-filters.tests
-[ { 200 5 } ] [ { 100 7 } { 200 5 } smaller-second ] unit-test
-[ { 200 5 } ] [ { 200 5 } { 100 7 } smaller-second ] unit-test
+{ { 200 5 } } [ { 100 7 } { 200 5 } smaller-second ] unit-test
+{ { 200 5 } } [ { 200 5 } { 100 7 } smaller-second ] unit-test
! The sizing information was generated using the subroutine
! calculate_shortest_filter_length from
! http://www.perl.com/pub/a/2004/04/08/bloom_filters.html.
! Test bloom-filter creation
-[ 47965 ] [ 7 0.01 5000 bits-to-satisfy-error-rate ] unit-test
-[ 7 47965 ] [ 0.01 5000 size-bloom-filter ] unit-test
-[ 7 ] [ 0.01 5000 <bloom-filter> #hashes>> ] unit-test
-[ 47965 ] [ 0.01 5000 <bloom-filter> bits>> length ] unit-test
-[ 5000 ] [ 0.01 5000 <bloom-filter> capacity>> ] unit-test
-[ 0 ] [ 0.01 5000 <bloom-filter> count>> ] unit-test
+{ 47965 } [ 7 0.01 5000 bits-to-satisfy-error-rate ] unit-test
+{ 7 47965 } [ 0.01 5000 size-bloom-filter ] unit-test
+{ 7 } [ 0.01 5000 <bloom-filter> #hashes>> ] unit-test
+{ 47965 } [ 0.01 5000 <bloom-filter> bits>> length ] unit-test
+{ 5000 } [ 0.01 5000 <bloom-filter> capacity>> ] unit-test
+{ 0 } [ 0.01 5000 <bloom-filter> count>> ] unit-test
! Should return the fewest hashes to satisfy the bits requested, not the most.
-[ 32 ] [ 4 0.05 5 bits-to-satisfy-error-rate ] unit-test
-[ 32 ] [ 5 0.05 5 bits-to-satisfy-error-rate ] unit-test
-[ 4 32 ] [ 0.05 5 size-bloom-filter ] unit-test
+{ 32 } [ 4 0.05 5 bits-to-satisfy-error-rate ] unit-test
+{ 32 } [ 5 0.05 5 bits-to-satisfy-error-rate ] unit-test
+{ 4 32 } [ 0.05 5 size-bloom-filter ] unit-test
! This is a lot of bits.
[ 0.00000001 max-array-capacity size-bloom-filter ] [ invalid-size? ] must-fail-with
! Should not generate bignum hash codes. Enhanced double hashing may generate a
! lot of hash codes, and it's better to do this earlier than later.
-[ t ] [ 10000 iota [ double-hashcodes [ fixnum? ] both? ] map [ ] all? ] unit-test
+{ t } [ 10000 iota [ double-hashcodes [ fixnum? ] both? ] map [ ] all? ] unit-test
: empty-bloom-filter ( -- bloom-filter )
0.01 2000 <bloom-filter> ;
-[ 1 ] [ empty-bloom-filter dup increment-count count>> ] unit-test
+{ 1 } [ empty-bloom-filter dup increment-count count>> ] unit-test
: basic-insert-test-setup ( -- bloom-filter )
1 empty-bloom-filter [ bloom-filter-insert ] keep ;
! Basic tests that insert does something
-[ t ] [ basic-insert-test-setup bits>> [ ] any? ] unit-test
-[ 1 ] [ basic-insert-test-setup count>> ] unit-test
+{ t } [ basic-insert-test-setup bits>> [ ] any? ] unit-test
+{ 1 } [ basic-insert-test-setup count>> ] unit-test
: non-empty-bloom-filter ( -- bloom-filter )
1000 iota
[ [ bloom-filter-insert ] curry each ] keep ;
! Should find what we put in there.
-[ t ] [ 2000 iota
+{ t } [ 2000 iota
full-bloom-filter
[ bloom-filter-member? ] curry map
[ ] all?
] unit-test
! We shouldn't have more than 0.01 false-positive rate.
-[ t ] [ 1000 iota [ drop most-positive-fixnum random 1000 + ] map
+{ t } [ 1000 iota [ drop most-positive-fixnum random 1000 + ] map
full-bloom-filter
[ bloom-filter-member? ] curry map
[ ] count
USING: tools.test boyer-moore ;
IN: boyer-moore.tests
-[ 0 ] [ "qwerty" "" search ] unit-test
-[ 0 ] [ "" "" search ] unit-test
-[ f ] [ "qw" "qwerty" search ] unit-test
-[ 3 ] [ "qwerty" "r" search ] unit-test
-[ 8 ] [ "qwerasdfqwer" 2 "qwe" search-from ] unit-test
+{ 0 } [ "qwerty" "" search ] unit-test
+{ 0 } [ "" "" search ] unit-test
+{ f } [ "qw" "qwerty" search ] unit-test
+{ 3 } [ "qwerty" "r" search ] unit-test
+{ 8 } [ "qwerasdfqwer" 2 "qwe" search-from ] unit-test
: turnaround ( value -- value )
assoc>bv binary [ H{ } clone stream>assoc ] with-byte-reader ;
-[ H{ { "a" "a string" } } ] [ H{ { "a" "a string" } } turnaround ] unit-test
+{ H{ { "a" "a string" } } } [ H{ { "a" "a string" } } turnaround ] unit-test
-[ H{ { "a" "a string" } { "b" H{ { "a" "アップルからの最新のニュースや情報を読む" } } } } ]
+{ H{ { "a" "a string" } { "b" H{ { "a" "アップルからの最新のニュースや情報を読む" } } } } }
[ H{ { "a" "a string" } { "b" H{ { "a" "アップルからの最新のニュースや情報を読む" } } } } turnaround ] unit-test
-[ H{ { "a list" { 1 2.234 "hello world" } } } ]
+{ H{ { "a list" { 1 2.234 "hello world" } } } }
[ H{ { "a list" { 1 2.234 "hello world" } } } turnaround ] unit-test
-[ H{ { "a quotation" [ 1 2 + ] } } ]
+{ H{ { "a quotation" [ 1 2 + ] } } }
[ H{ { "a quotation" [ 1 2 + ] } } turnaround ] unit-test
-[ H{ { "ref" T{ dbref f "a" "b" "c" } } } ]
+{ H{ { "ref" T{ dbref f "a" "b" "c" } } } }
[ H{ { "ref" T{ dbref f "a" "b" "c" } } } turnaround ] unit-test
-[ H{ { "a date" T{ timestamp { year 2009 }
+{ H{ { "a date" T{ timestamp { year 2009 }
{ month 7 }
{ day 11 }
{ hour 9 }
{ minute 8 }
{ second 40+77/1000 } } } }
-]
+}
[ H{ { "a date" T{ timestamp { year 2009 }
{ month 7 }
{ day 11 }
{ gmt-offset T{ duration { hour 2 } } } } } } turnaround
] unit-test
-[ H{ { "nested" H{ { "a" "a string" } { "b" H{ { "a" "a string" } } } } }
+{ H{ { "nested" H{ { "a" "a string" } { "b" H{ { "a" "a string" } } } } }
{ "ref" T{ dbref f "a" "b" "c" } }
{ "array" H{ { "a list" { 1 2.234 "hello world" } } } }
{ "quot" [ 1 2 + ] } }
-]
+}
[ H{ { "nested" H{ { "a" "a string" } { "b" H{ { "a" "a string" } } } } }
{ "ref" T{ dbref f "a" "b" "c" } }
{ "array" H{ { "a list" { 1 2.234 "hello world" } } } }
USING: build-support sequences tools.test ;
IN: build-support.tests
-[ f ] [ factor.sh-make-target empty? ] unit-test
+{ f } [ factor.sh-make-target empty? ] unit-test
USING: accessors c.lexer kernel sequences.parser tools.test ;
IN: c.lexer.tests
-[ 36 ]
+{ 36 }
[
" //jofiejoe\n //eoieow\n/*asdf*/\n "
<sequence-parser> skip-whitespace/comments n>>
] unit-test
-[ f "33asdf" ]
+{ f "33asdf" }
[ "33asdf" <sequence-parser> [ take-c-identifier ] [ take-rest ] bi ] unit-test
-[ "asdf" ]
+{ "asdf" }
[ "asdf" <sequence-parser> take-c-identifier ] unit-test
-[ "_asdf" ]
+{ "_asdf" }
[ "_asdf" <sequence-parser> take-c-identifier ] unit-test
-[ "_asdf400" ]
+{ "_asdf400" }
[ "_asdf400" <sequence-parser> take-c-identifier ] unit-test
-[ "asdfasdf" ] [
+{ "asdfasdf" } [
"/*asdfasdf*/" <sequence-parser> take-c-comment
] unit-test
-[ "k" ] [
+{ "k" } [
"/*asdfasdf*/k" <sequence-parser> [ take-c-comment drop ] [ take-rest ] bi
] unit-test
-[ "omg" ] [
+{ "omg" } [
"//asdfasdf\nomg" <sequence-parser>
[ take-c++-comment drop ] [ take-rest ] bi
] unit-test
-[ "omg" ] [
+{ "omg" } [
"omg" <sequence-parser>
[ take-c++-comment drop ] [ take-rest ] bi
] unit-test
-[ "/*asdfasdf" ] [
+{ "/*asdfasdf" } [
"/*asdfasdf" <sequence-parser> [ take-c-comment drop ] [ take-rest ] bi
] unit-test
-[ "asdf" "eoieoei" ] [
+{ "asdf" "eoieoei" } [
"//asdf\neoieoei" <sequence-parser>
[ take-c++-comment ] [ take-rest ] bi
] unit-test
-[ f ]
+{ f }
[
"\"abc\" asdf" <sequence-parser>
[ CHAR: \ CHAR: " take-quoted-string drop ] [ "asdf" take-sequence ] bi
] unit-test
-[ "abc\\\"def" ]
+{ "abc\\\"def" }
[
"\"abc\\\"def\" asdf" <sequence-parser>
CHAR: \ CHAR: " take-quoted-string
] unit-test
-[ "asdf" ]
+{ "asdf" }
[
"\"abc\" asdf" <sequence-parser>
[ CHAR: \ CHAR: " take-quoted-string drop ]
[ skip-whitespace "asdf" take-sequence ] bi
] unit-test
-[ f ]
+{ f }
[
"\"abc asdf" <sequence-parser>
CHAR: \ CHAR: " take-quoted-string
] unit-test
-[ "\"abc" ]
+{ "\"abc" }
[
"\"abc asdf" <sequence-parser>
[ CHAR: \ CHAR: " take-quoted-string drop ]
[ "\"abc" take-sequence ] bi
] unit-test
-[ "c" ]
+{ "c" }
[ "c" <sequence-parser> take-token ] unit-test
-[ f ]
+{ f }
[ "" <sequence-parser> take-token ] unit-test
-[ "abcd e \\\"f g" ]
+{ "abcd e \\\"f g" }
[ "\"abcd e \\\"f g\"" <sequence-parser> CHAR: \ CHAR: " take-token* ] unit-test
-[ "123" ]
+{ "123" }
[ "123jjj" <sequence-parser> take-c-integer ] unit-test
-[ "123uLL" ]
+{ "123uLL" }
[ "123uLL" <sequence-parser> take-c-integer ] unit-test
-[ "123ull" ]
+{ "123ull" }
[ "123ull" <sequence-parser> take-c-integer ] unit-test
-[ "123u" ]
+{ "123u" }
[ "123u" <sequence-parser> take-c-integer ] unit-test
[ "vocab:c/tests/test1/test1.c" start-preprocess-file ]
[ include-nested-too-deeply? ] must-fail-with
-[ "yo\n\n\n\nyo4\n" ]
+{ "yo\n\n\n\nyo4\n" }
[ "vocab:c/tests/test2/test2.c" start-preprocess-file nip ] unit-test
(*
[ "\"BOO\"" = ] must-fail-with
*)
-[ V{ "\"omg\"" "\"lol\"" } ]
+{ V{ "\"omg\"" "\"lol\"" } }
[ "vocab:c/tests/test4/test4.c" start-preprocess-file drop warnings>> ] unit-test
tools.test ;
IN: calendar.holidays.canada.tests
-[ ] [ 2009 canada holidays drop ] unit-test
+{ } [ 2009 canada holidays drop ] unit-test
tools.test ;
IN: calendar.holidays.us.tests
-[ 10 ] [ 2009 us-federal holidays length ] unit-test
+{ 10 } [ 2009 us-federal holidays length ] unit-test
USING: cgi cgi.private kernel tools.test ;
-[ t ] [ H{ } "" (query-string) = ] unit-test
+{ t } [ H{ } "" (query-string) = ] unit-test
-[ t ] [ H{ { "a" { "1" } } { "b" { "2" } } }
+{ t } [ H{ { "a" { "1" } } { "b" { "2" } } }
"a=1&b=2" (query-string) = ] unit-test
-[ t ] [ H{ { "a" { "1" } } { "b" { "2" "3" } } }
+{ t } [ H{ { "a" { "1" } } { "b" { "2" "3" } } }
"a=1&b=2&b=3" (query-string) = ] unit-test
-[ t ] [ "text/html" (content-type)
+{ t } [ "text/html" (content-type)
[ H{ } = ] [ "text/html" = ] bi* and ] unit-test
-[ t ] [ "text/html; charset=utf-8" (content-type)
+{ t } [ "text/html; charset=utf-8" (content-type)
[ H{ { "charset" { "utf-8" } } } = ]
[ "text/html" = ] bi* and ] unit-test
SPECIALIZED-ARRAY: foo
VECTORED-STRUCT: foo
-[
+{
T{ vectored-foo
{ x int-array{ 0 1 0 0 } }
{ y float-array{ 0.0 2.0 0.0 0.0 } }
{ z ushort-array{ 0 3 0 0 } }
{ w ushort-array{ 0 4 0 0 } }
}
-] [ S{ foo f 1 2.0 3 4 } 4 <vectored-foo> [ set-second ] keep ] unit-test
+} [ S{ foo f 1 2.0 3 4 } 4 <vectored-foo> [ set-second ] keep ] unit-test
-[
+{
T{ vectored-foo
{ x int-array{ 0 1 2 3 } }
{ y float-array{ 0.0 0.5 1.0 1.5 } }
{ z ushort-array{ 10 20 30 40 } }
{ w ushort-array{ 15 25 35 45 } }
}
-] [
+} [
foo-array{
S{ foo { x 0 } { y 0.0 } { z 10 } { w 15 } }
S{ foo { x 1 } { y 0.5 } { z 20 } { w 25 } }
} struct-transpose
] unit-test
-[
+{
foo-array{
S{ foo { x 0 } { y 0.0 } { z 10 } { w 15 } }
S{ foo { x 1 } { y 0.5 } { z 20 } { w 25 } }
S{ foo { x 2 } { y 1.0 } { z 30 } { w 35 } }
S{ foo { x 3 } { y 1.5 } { z 40 } { w 45 } }
}
-] [
+} [
T{ vectored-foo
{ x int-array{ 0 1 2 3 } }
{ y float-array{ 0.0 0.5 1.0 1.5 } }
} struct-transpose
] unit-test
-[ 30 ] [
+{ 30 } [
T{ vectored-foo
{ x int-array{ 0 1 2 3 } }
{ y float-array{ 0.0 0.5 1.0 1.5 } }
} third z>>
] unit-test
-[ S{ foo { x 2 } { y 1.0 } { z 30 } { w 35 } } ] [
+{ S{ foo { x 2 } { y 1.0 } { z 30 } { w 35 } } } [
T{ vectored-foo
{ x int-array{ 0 1 2 3 } }
{ y float-array{ 0.0 0.5 1.0 1.5 } }
} third vectored-element>
] unit-test
-[ ] [
+{ } [
[
foo specialized-array-vocab forget-vocab
] with-compilation-unit
: <resource> ( pathname -- resource ) f swap resource boa ;
-[ t ] [ "foo" <resource> "bar" >>pathname changed?>> ] unit-test
-[ f ] [ "foo" <resource> [ 123 >>pathname ] [ drop ] recover changed?>> ] unit-test
+{ t } [ "foo" <resource> "bar" >>pathname changed?>> ] unit-test
+{ f } [ "foo" <resource> [ 123 >>pathname ] [ drop ] recover changed?>> ] unit-test
USING: code-arrays locals math tools.test ;
IN: code-arrays.tests
-[ { 1 2 9 } ] [ {{ 1 2 3 sq }} ] unit-test
-[ { 1 2 { 9 } } ] [ {{ 1 2 {{ 3 sq }} }} ] unit-test
+{ { 1 2 9 } } [ {{ 1 2 3 sq }} ] unit-test
+{ { 1 2 { 9 } } } [ {{ 1 2 {{ 3 sq }} }} ] unit-test
-[ H{ { 9 3 } { 4 1 } } ] [ H{{ {{ 3 sq 3 }} {{ 2 sq 1 }} }} ] unit-test
+{ H{ { 9 3 } { 4 1 } } } [ H{{ {{ 3 sq 3 }} {{ 2 sq 1 }} }} ] unit-test
:: local-code-arrays ( -- seq ) {{ 1 2 3 + }} ;
-[ { 1 5 } ] [ local-code-arrays ] unit-test
+{ { 1 5 } } [ local-code-arrays ] unit-test
{ "a b c d" }
[ "a" "b" "c" "d" [ " " glue ] thrice ] unit-test
-[ { "negative" 0 "positive" } ] [
+{ { "negative" 0 "positive" } } [
{ -1 0 1 } [
{
{ [ 0 > ] [ "positive" ] }
{ 3 1 } [ 1 2 [ + ] keepd ] unit-test
-[ "1" "123" ] [ "1" "123" [ length ] [ > ] swap-when ] unit-test
-[ "123" "1" ] [ "1" "123" [ length ] [ < ] swap-when ] unit-test
+{ "1" "123" } [ "1" "123" [ length ] [ > ] swap-when ] unit-test
+{ "123" "1" } [ "1" "123" [ length ] [ < ] swap-when ] unit-test
0 get instructions>> ;
! Folding constants together
-[
+{
V{
T{ ##load-reference f 0 0.0 }
T{ ##load-reference f 1 -0.0 }
}
-] [
+} [
V{
T{ ##load-reference f 0 0.0 }
T{ ##load-reference f 1 -0.0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-reference f 0 0.0 }
T{ ##copy f 1 0 any-rep }
}
-] [
+} [
V{
T{ ##load-reference f 0 0.0 }
T{ ##load-reference f 1 0.0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-reference f 0 t }
T{ ##copy f 1 0 any-rep }
}
-] [
+} [
V{
T{ ##load-reference f 0 t }
T{ ##load-reference f 1 t }
] when
! Double compare elimination
-[
+{
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
T{ ##copy f 6 4 any-rep }
T{ ##replace f 4 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 1 D 1 }
T{ ##compare-imm f 2 1 16 cc= }
T{ ##copy f 3 2 any-rep }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 1 }
T{ ##compare-imm f 2 1 16 cc= }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
T{ ##copy f 6 4 any-rep }
T{ ##replace f 4 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
T{ ##compare-integer f 6 2 1 cc/<= }
T{ ##replace f 6 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 1 }
T{ ##peek f 2 D 2 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 1 D 1 }
T{ ##compare-integer-imm f 2 1 100 cc<= }
T{ ##compare-integer-imm f 3 1 100 cc/<= }
T{ ##replace f 3 D 0 }
}
-] [
+} [
V{
T{ ##peek f 1 D 1 }
T{ ##compare-integer-imm f 2 1 100 cc<= }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 8 D 0 }
T{ ##peek f 9 D -1 }
T{ ##compare-float-unordered f 14 8 9 cc/< }
T{ ##replace f 14 D 0 }
}
-] [
+} [
V{
T{ ##peek f 8 D 0 }
T{ ##peek f 9 D -1 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
T{ ##compare f 33 29 30 cc= }
T{ ##compare-branch f 29 30 cc= }
}
-] [
+} [
V{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
T{ ##compare-integer f 33 29 30 cc<= }
T{ ##compare-integer-branch f 29 30 cc<= }
}
-] [
+} [
V{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
T{ ##test f 33 29 30 cc= }
T{ ##test-branch f 29 30 cc= }
}
-] [
+} [
V{
T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 29 D -1 }
T{ ##test-imm f 33 29 30 cc= }
T{ ##test-imm-branch f 29 30 cc= }
}
-] [
+} [
V{
T{ ##peek f 29 D -1 }
T{ ##test-imm f 33 29 30 cc= }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 1 D -1 }
T{ ##test-vector f 2 1 f float-4-rep vcc-any }
T{ ##test-vector-branch f 1 f float-4-rep vcc-any }
}
-] [
+} [
V{
T{ ##peek f 1 D -1 }
T{ ##test-vector f 2 1 f float-4-rep vcc-any }
] when
! Immediate operand fusion
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##add-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##add-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##add-imm f 2 0 -100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##sub f 1 0 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##mul-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##mul-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##shl-imm f 2 1 3 }
}
-] [
+} [
V{
T{ ##peek f 1 D 0 }
T{ ##mul-imm f 2 1 8 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
T{ ##neg f 2 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
T{ ##neg f 2 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
T{ ##neg f 2 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
T{ ##neg f 2 0 }
T{ ##copy f 3 0 any-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##neg f 1 0 }
T{ ##copy f 2 0 any-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##neg f 1 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##not f 1 0 }
T{ ##copy f 2 0 any-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##not f 1 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##and-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##and-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##or-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##or-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##xor-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##xor-imm f 2 0 100 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-imm f 2 0 100 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm f 2 0 100 cc<= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
] unit-test
] unless
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm f 2 0 100 cc>= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm-branch f 0 100 cc<= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm-branch f 0 100 cc>= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
] unit-test
! Compare folding
-[
+{
V{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 200 }
T{ ##load-reference f 3 t }
}
-] [
+} [
V{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 200 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 200 }
T{ ##load-reference f 3 f }
}
-] [
+} [
V{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 200 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##load-integer f 1 100 }
T{ ##load-reference f 2 f }
}
-] [
+} [
V{
T{ ##load-integer f 1 100 }
T{ ##compare-integer-imm f 2 1 123 cc= }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##load-integer f 1 10 }
T{ ##load-integer f 2 20 }
T{ ##load-reference f 3 f }
}
-] [
+} [
V{
T{ ##load-integer f 1 10 }
T{ ##load-integer f 2 20 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##load-reference f 3 t }
}
-] [
+} [
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##load-reference f 3 t }
}
-] [
+} [
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 10 }
T{ ##load-integer f 2 20 }
T{ ##load-reference f 3 f }
}
-] [
+} [
V{
T{ ##load-integer f 1 10 }
T{ ##load-integer f 2 20 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 f }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc< }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##load-reference f 2 f }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc<= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 f }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc> }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc>= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 f }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc/= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer f 1 0 0 cc= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 10 }
T{ ##load-reference f 2 t }
}
-] [
+} [
V{
T{ ##load-integer f 1 10 }
T{ ##compare-imm f 2 1 10 cc= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 10 }
T{ ##load-reference f 2 f }
}
-] [
+} [
V{
T{ ##load-integer f 1 10 }
T{ ##compare-imm f 2 1 20 cc= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 10 }
T{ ##load-reference f 2 t }
}
-] [
+} [
V{
T{ ##load-integer f 1 10 }
T{ ##compare-imm f 2 1 100 cc/= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 10 }
T{ ##load-reference f 2 f }
}
-] [
+} [
V{
T{ ##load-integer f 1 10 }
T{ ##compare-imm f 2 1 10 cc/= }
] unit-test
] when
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare f 1 0 0 cc= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 f }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare f 1 0 0 cc/= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 12 }
T{ ##load-reference f 3 t }
}
-] [
+} [
V{
T{ ##load-integer f 1 12 }
T{ ##test-imm f 3 1 13 cc/= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 15 }
T{ ##load-reference f 3 f }
}
-] [
+} [
V{
T{ ##load-integer f 1 15 }
T{ ##test-imm f 3 1 16 cc/= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 12 }
T{ ##load-reference f 3 f }
}
-] [
+} [
V{
T{ ##load-integer f 1 12 }
T{ ##test-imm f 3 1 13 cc= }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 15 }
T{ ##load-reference f 3 t }
}
-] [
+} [
V{
T{ ##load-integer f 1 15 }
T{ ##test-imm f 3 1 16 cc= }
] unit-test
! Rewriting a ##test of an ##and into a ##test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##and f 2 0 1 }
T{ ##test f 3 0 1 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##and-imm f 2 0 12 }
T{ ##test-imm f 3 0 12 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##and-imm f 2 0 12 }
] unit-test
! Rewriting ##test into ##test-imm
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm f 2 0 10 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm f 2 0 10 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
} value-number-bb trim-temps
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm-branch f 0 10 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm-branch f 0 10 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
T{ ##test-imm-branch f 0 10 cc= }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 10 }
] when
! Reassociation
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##add-imm f 4 0 150 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##add-imm f 4 0 150 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##add-imm f 4 0 50 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##add-imm f 4 0 -150 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##mul-imm f 4 0 5000 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##mul-imm f 4 0 5000 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##and-imm f 4 0 32 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##and-imm f 4 0 32 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##or-imm f 4 0 118 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##or-imm f 4 0 118 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##xor-imm f 4 0 86 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
T{ ##load-integer f 3 50 }
T{ ##xor-imm f 4 0 86 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 100 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 10 }
T{ ##shl-imm f 2 0 21 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 10 }
T{ ##shl-imm f 2 1 $[ cell-bits 1 - ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 1 0 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 10 }
T{ ##sar-imm f 2 0 21 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 10 }
T{ ##sar-imm f 2 1 $[ cell-bits 1 - ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 1 0 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
T{ ##shr-imm f 2 0 21 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
T{ ##shr-imm f 2 1 $[ cell-bits 1 - ] }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
T{ ##sar-imm f 2 1 11 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 1 0 10 }
! Distributive law
2 \ vreg-counter set-global
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 10 }
T{ ##add-imm f 2 3 40 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 10 }
T{ ##add-imm f 2 4 30 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 -10 }
T{ ##add-imm f 2 5 -40 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##sub-imm f 1 0 10 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 1 0 -10 }
T{ ##add-imm f 2 6 -30 }
T{ ##replace f 2 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##sub-imm f 1 0 10 }
] unit-test
! Simplification
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##copy f 3 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##copy f 3 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##copy f 3 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##and-imm f 1 0 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##and-imm f 1 0 -1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##and f 1 0 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##or-imm f 1 0 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -1 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##or-imm f 1 0 -1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##or f 1 0 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##xor-imm f 1 0 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##not f 1 0 }
T{ ##replace f 1 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##xor-imm f 1 0 -1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##xor f 1 0 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##mul-imm f 2 0 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##shl-imm f 2 0 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##shr-imm f 2 0 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##sar-imm f 2 0 0 }
] unit-test
! Constant folding
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 3 }
T{ ##load-integer f 3 4 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 3 }
T{ ##load-integer f 3 -2 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
T{ ##load-integer f 2 3 }
T{ ##load-integer f 3 6 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
T{ ##load-integer f 2 1 }
T{ ##load-integer f 3 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
T{ ##load-integer f 2 1 }
T{ ##load-integer f 3 3 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
T{ ##load-integer f 2 3 }
T{ ##load-integer f 3 1 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 2 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 3 8 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
] unit-test
] when
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -8 }
T{ ##load-integer f 3 -4 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 -8 }
] unless
] when
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 -1 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 -2 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 1 1 }
] unit-test
! ##tagged>integer constant folding
-[
+{
V{
T{ ##load-reference f 1 f }
T{ ##load-integer f 2 $[ \ f type-number ] }
T{ ##copy f 3 2 any-rep }
}
-] [
+} [
V{
T{ ##load-reference f 1 f }
T{ ##tagged>integer f 2 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 1 100 }
T{ ##load-integer f 2 $[ 100 tag-fixnum ] }
T{ ##load-integer f 3 $[ 100 tag-fixnum 1 + ] }
}
-] [
+} [
V{
T{ ##load-integer f 1 100 }
T{ ##tagged>integer f 2 1 }
] unit-test
! Alien boxing and unboxing
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##box-alien f 1 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##box-alien f 1 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##box-alien f 1 0 }
T{ ##copy f 2 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##box-alien f 1 0 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 0 }
T{ ##copy f 1 0 any-rep }
T{ ##replace f 0 D 0 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 0 }
3 vreg-counter set-global
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 16 }
T{ ##unbox-any-c-ptr f 4 0 }
T{ ##add-imm f 3 4 16 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 16 }
4 vreg-counter set-global
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##box-alien f 0 1 }
T{ ##copy f 5 1 any-rep }
T{ ##add-imm f 4 5 16 }
}
-] [
+} [
V{
T{ ##peek f 1 D 0 }
T{ ##box-alien f 0 1 }
3 vreg-counter set-global
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 0 }
T{ ##copy f 3 0 any-rep }
T{ ##replace f 0 D 1 }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##load-integer f 2 0 }
] unit-test
! Various SIMD simplifications
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##vector>scalar f 1 0 float-4-rep }
T{ ##copy f 2 0 any-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##vector>scalar f 1 0 float-4-rep }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##copy f 1 0 any-rep }
}
-] [
+} [
V{
T{ ##shuffle-vector-imm f 1 0 { 0 1 2 3 } float-4-rep }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
T{ ##shuffle-vector-imm f 2 0 { 0 2 3 1 } float-4-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
T{ ##shuffle-vector-imm f 2 1 { 1 0 } double-2-rep }
}
-] [
+} [
V{
T{ ##shuffle-vector-imm f 1 0 { 1 2 3 0 } float-4-rep }
T{ ##shuffle-vector-imm f 2 1 { 1 0 } double-2-rep }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 0 55 }
T{ ##load-reference f 1 B{ 55 0 0 0 55 0 0 0 55 0 0 0 55 0 0 0 } }
T{ ##load-reference f 2 B{ 55 0 0 0 55 0 0 0 55 0 0 0 55 0 0 0 } }
}
-] [
+} [
V{
T{ ##load-integer f 0 55 }
T{ ##scalar>vector f 1 0 int-4-rep }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 1 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
T{ ##load-reference f 2 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
}
-] [
+} [
V{
T{ ##load-reference f 0 1.25 }
T{ ##scalar>vector f 1 0 float-4-rep }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 1 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
T{ ##load-reference f 2 B{ 0 0 160 63 0 0 160 63 0 0 160 63 0 0 160 63 } }
}
-] [
+} [
V{
T{ ##load-reference f 0 1.25 }
T{ ##scalar>vector f 1 0 float-4-rep }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 0 55 }
T{ ##load-reference f 1 B{ 55 0 55 0 55 0 55 0 55 0 55 0 55 0 55 0 } }
T{ ##load-reference f 2 B{ 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 } }
T{ ##load-reference f 3 B{ 0 55 0 55 0 55 0 55 0 55 0 55 0 55 0 55 } }
}
-] [
+} [
V{
T{ ##load-integer f 0 55 }
T{ ##scalar>vector f 1 0 short-8-rep }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 2 3.75 }
T{ ##load-reference f 4 B{ 0 0 0 0 0 0 244 63 0 0 0 0 0 0 14 64 } }
}
-] [
+} [
V{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 2 3.75 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 0 125 }
T{ ##load-integer f 2 375 }
T{ ##load-reference f 4 B{ 125 0 0 0 0 0 0 0 119 1 0 0 0 0 0 0 } }
}
-] [
+} [
V{
T{ ##load-integer f 0 125 }
T{ ##load-integer f 2 375 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 1 2.50 }
T{ ##load-reference f 3 5.00 }
T{ ##load-reference f 4 B{ 0 0 160 63 0 0 32 64 0 0 112 64 0 0 160 64 } }
}
-] [
+} [
V{
T{ ##load-reference f 0 1.25 }
T{ ##load-reference f 1 2.50 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##load-integer f 0 125 }
T{ ##load-integer f 1 250 }
T{ ##load-integer f 3 500 }
T{ ##load-reference f 4 B{ 125 0 0 0 250 0 0 0 119 1 0 0 244 1 0 0 } }
}
-] [
+} [
V{
T{ ##load-integer f 0 125 }
T{ ##load-integer f 1 250 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##zero-vector f 2 float-4-rep }
}
-] [
+} [
V{
T{ ##xor-vector f 2 1 1 float-4-rep }
} value-number-bb
! NOT x AND y => x ANDN y
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##xor-vector f 4 0 3 float-4-rep }
T{ ##andn-vector f 5 0 1 float-4-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##not-vector f 4 0 float-4-rep }
T{ ##andn-vector f 5 0 1 float-4-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
! x AND NOT y => y ANDN x
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##xor-vector f 4 0 3 float-4-rep }
T{ ##andn-vector f 5 0 1 float-4-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##not-vector f 4 0 float-4-rep }
T{ ##andn-vector f 5 0 1 float-4-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
! NOT x ANDN y => x AND y
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##xor-vector f 4 0 3 float-4-rep }
T{ ##and-vector f 5 0 1 float-4-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##not-vector f 4 0 float-4-rep }
T{ ##and-vector f 5 0 1 float-4-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
! AND <=> ANDN
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##and-vector f 6 0 2 float-4-rep }
T{ ##or-vector f 7 5 6 float-4-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##and-vector f 6 0 2 float-4-rep }
T{ ##or-vector f 7 5 6 float-4-rep }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
value-numbering
0 get [ instructions>> ] [ successors>> first number>> 1 - ] bi ;
-[
+{
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##branch }
}
1
-] [
+} [
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##branch }
}
0
-] [
+} [
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##branch }
}
0
-] [
+} [
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
T{ ##branch }
}
1
-] [
+} [
V{
T{ ##load-integer f 1 1 }
T{ ##load-integer f 2 2 }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
1
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc< }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
0
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc<= }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
1
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc> }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
0
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc>= }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
0
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc= }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##branch }
}
1
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare-integer-branch f 0 0 cc/= }
} test-branch-folding
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##load-reference f 1 t }
T{ ##branch }
}
0
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##compare f 1 0 0 cc<= }
test-diamond
-[ ] [
+{ } [
0 get block>cfg {
[ cfg set ]
[ value-numbering ]
} cleave
] unit-test
-[ 1 ] [ 1 get successors>> length ] unit-test
+{ 1 } [ 1 get successors>> length ] unit-test
-[ t ] [ 1 get successors>> first 3 get eq? ] unit-test
+{ t } [ 1 get successors>> first 3 get eq? ] unit-test
-[ 2 ] [ 4 get instructions>> length ] unit-test
+{ 2 } [ 4 get instructions>> length ] unit-test
V{
T{ ##peek f 0 D 0 }
test-diamond
-[ ] [ 0 get block>cfg value-numbering ] unit-test
+{ } [ 0 get block>cfg value-numbering ] unit-test
-[ t ] [ 1 get successors>> first 3 get eq? ] unit-test
+{ t } [ 1 get successors>> first 3 get eq? ] unit-test
-[ t ] [ 3 get instructions>> first ##copy? ] unit-test
+{ t } [ 3 get instructions>> first ##copy? ] unit-test
V{ T{ ##prologue } T{ ##branch } } 0 test-bb
2 3 edge
4 5 edge
-[ ] [
+{ } [
0 get block>cfg
dup value-numbering eliminate-dead-code
] unit-test
-[ f ] [ 1 get instructions>> [ ##peek? ] any? ] unit-test
+{ f } [ 1 get instructions>> [ ##peek? ] any? ] unit-test
! Slot addressing optimization
cpu x86? [
! Alien addressing optimization
! Base offset fusion on ##load/store-memory-imm
-[
+{
V{
T{ ##peek f 1 D 0 }
T{ ##tagged>integer f 2 1 }
T{ ##add-imm f 3 2 10 }
T{ ##load-memory-imm f 4 2 10 int-rep c:uchar }
}
-] [
+} [
V{
T{ ##peek f 1 D 0 }
T{ ##tagged>integer f 2 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##add-imm f 4 3 10 }
T{ ##store-memory-imm f 2 3 10 int-rep c:uchar }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
] unit-test
! Displacement fusion on ##load/store-memory-imm
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##add f 4 2 3 }
T{ ##load-memory f 5 2 3 0 0 int-rep c:uchar }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
} value-number-bb
] unit-test
-[
+{
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
T{ ##add f 4 2 3 }
T{ ##store-memory f 5 2 3 0 0 int-rep c:uchar }
}
-] [
+} [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
! Displacement offset fusion should not occur on
! ##load/store-memory with non-zero scale
-[ ] [
+{ } [
V{
T{ ##peek f 0 D 0 }
T{ ##peek f 1 D 1 }
test-diamond
-[ ] [ 0 get block>cfg value-numbering ] unit-test
+{ } [ 0 get block>cfg value-numbering ] unit-test
! First ##load-integer cannot be turned into a ##copy because
! the canonical leader for the value 100 is unavailable, but
! the rest should still be redundant.
-[ t ] [ 4 get instructions>> first ##load-integer? ] unit-test
-[ 1 ] [ 4 get instructions>> [ ##load-integer? ] count ] unit-test
+{ t } [ 4 get instructions>> first ##load-integer? ] unit-test
+{ 1 } [ 4 get instructions>> [ ##load-integer? ] count ] unit-test
! Global optimization
V{ T{ ##prologue } T{ ##branch } } 0 test-bb
3 2 edge
4 5 edge
-[ ] [ 0 get block>cfg dup value-numbering eliminate-dead-code ] unit-test
+{ } [ 0 get block>cfg dup value-numbering eliminate-dead-code ] unit-test
-[ 1 ] [ 1 get instructions>> [ ##load-integer? ] count ] unit-test
-[ 1 ] [ 2 get instructions>> [ ##phi? ] count ] unit-test
-[ t ] [ 2 get instructions>> last ##compare-integer-imm-branch? ] unit-test
-[ f ] [ 3 get instructions>> [ ##load-integer? ] any? ] unit-test
-[ 1 ] [ 3 get instructions>> [ ##add-imm? ] count ] unit-test
+{ 1 } [ 1 get instructions>> [ ##load-integer? ] count ] unit-test
+{ 1 } [ 2 get instructions>> [ ##phi? ] count ] unit-test
+{ t } [ 2 get instructions>> last ##compare-integer-imm-branch? ] unit-test
+{ f } [ 3 get instructions>> [ ##load-integer? ] any? ] unit-test
+{ 1 } [ 3 get instructions>> [ ##add-imm? ] count ] unit-test
IN: compiler.graphviz.tests
USING: compiler.graphviz io.files kernel tools.test ;
-[ t ] [ [ [ 1 ] [ 2 ] if ] render-cfg exists? ] unit-test
-[ t ] [ [ [ 1 ] [ 2 ] if ] render-dom exists? ] unit-test
-[ t ] [ [ [ 1 ] [ 2 ] if ] render-call-graph exists? ] unit-test
+{ t } [ [ [ 1 ] [ 2 ] if ] render-cfg exists? ] unit-test
+{ t } [ [ [ 1 ] [ 2 ] if ] render-dom exists? ] unit-test
+{ t } [ [ [ 1 ] [ 2 ] if ] render-call-graph exists? ] unit-test
SYMBOL: AAPL
-[ t ] [
+{ t } [
AAPL 1234 <stock-spread>
{
[ stock>> AAPL eq? ]
CONSTRUCTOR: <ct4> ct4 ( a b c d -- obj ) ;
-[ 1000 ] [ 1000 <ct1> a>> ] unit-test
-[ 0 ] [ 0 0 <ct2> a>> ] unit-test
-[ 0 ] [ 0 0 0 <ct3> a>> ] unit-test
-[ 0 ] [ 0 0 0 0 <ct4> a>> ] unit-test
+{ 1000 } [ 1000 <ct1> a>> ] unit-test
+{ 0 } [ 0 0 <ct2> a>> ] unit-test
+{ 0 } [ 0 0 0 <ct3> a>> ] unit-test
+{ 0 } [ 0 0 0 0 <ct4> a>> ] unit-test
TUPLE: monster
2dup +
{ "name" "hp" "max-hp" "computed" } \ b-monster slots>boa ;
-[ 20 ] [ "Norm" 10 10 <a-monster> computed>> ] unit-test
-[ 18 ] [ "Norm" 10 10 <a-monster> stop>> ] unit-test
+{ 20 } [ "Norm" 10 10 <a-monster> computed>> ] unit-test
+{ 18 } [ "Norm" 10 10 <a-monster> stop>> ] unit-test
-[ 22 ] [ "Phil" 11 11 <b-monster> computed>> ] unit-test
-[ 18 ] [ "Phil" 11 11 <b-monster> stop>> ] unit-test
+{ 22 } [ "Phil" 11 11 <b-monster> computed>> ] unit-test
+{ 18 } [ "Phil" 11 11 <b-monster> stop>> ] unit-test
[
"""USE: constructors
IN: contributors.tests
USING: contributors tools.test ;
-[ ] [ contributors ] unit-test
+{ } [ contributors ] unit-test
CONSTANT: plaintext HEX{ 32 43 f6 a8 88 5a 30 8d 31 31 98 a2 e0 37 07 34 }
CONSTANT: key HEX{ 2b 7e 15 16 28 ae d2 a6 ab f7 15 88 09 cf 4f 3c }
-[ {
+{ {
0x00 0x01 0x02 0x04 0x08 0x10
0x20 0x40 0x80 0x1b 0x36
-} ] [ rcon ] unit-test
+} } [ rcon ] unit-test
-[ {
+{ {
0xc66363a5 0xf87c7c84 0xee777799 0xf67b7b8d 0xfff2f20d 0xd66b6bbd 0xde6f6fb1 0x91c5c554
0x60303050 0x02010103 0xce6767a9 0x562b2b7d 0xe7fefe19 0xb5d7d762 0x4dababe6 0xec76769a
0x8fcaca45 0x1f82829d 0x89c9c940 0xfa7d7d87 0xeffafa15 0xb25959eb 0x8e4747c9 0xfbf0f00b
0x9b9bb62d 0x1e1e223c 0x87879215 0xe9e920c9 0xcece4987 0x5555ffaa 0x28287850 0xdfdf7aa5
0x8c8c8f03 0xa1a1f859 0x89898009 0x0d0d171a 0xbfbfda65 0xe6e631d7 0x4242c684 0x6868b8d0
0x4141c382 0x9999b029 0x2d2d775a 0x0f0f111e 0xb0b0cb7b 0x5454fca8 0xbbbbd66d 0x16163a2c
-} ] [ t-table ] unit-test
+} } [ t-table ] unit-test
#! NOT TESTED:
#! ui32
#! set-t
#! set-d
-[ { 0x01020304 0x02030401 0x03040102 0x04010203 } ] [
+{ { 0x01020304 0x02030401 0x03040102 0x04010203 } } [
{ 0x01010101 0x02020202 0x03030303 0x04040404 } shift-rows
] unit-test
-[ { 0x01010101 0x02020202 0x03030303 0x04040404 } ] [
+{ { 0x01010101 0x02020202 0x03030303 0x04040404 } } [
{ 0x01020304 0x02030401 0x03040102 0x04010203 } unshift-rows
] unit-test
-[ 0x02030401 ] [ 0x01020304 rotword ] unit-test
+{ 0x02030401 } [ 0x01020304 rotword ] unit-test
-[
+{
V{ 729683222 682545830 2885096840 164581180 2700803607 2287217841
597899577 711751173 4072838642 2056698179 1496678522 1935275647
1031817085 1192689214 505642564 1836746811 4014253377 2823969663
2225491890 1319558223 3939660577 3045964498 824964448 2139957551
2893506291 435870753 684796225 1465647214 3491035560 3387827593
3779005640 3059944614 }
-] [
+} [
HEX{ 2b 7e 15 16 28 ae d2 a6 ab f7 15 88 09 cf 4f 3c } #! AES-128 key expansion test vector from FIPS-197 (appendix)
10 (expand-enc-key)
] unit-test
-[ 0x046681e5 ] [ 0x088df419 ui32> t-transform ] unit-test
+{ 0x046681e5 } [ 0x088df419 ui32> t-transform ] unit-test
-[ V{
+{ V{
0x3925841d
0x02dc09fb
0xdc118597
0x196a0b32
}
-] [
+} [
key plaintext aes-encrypt-block bytes>words
] unit-test
-[ t ] [
+{ t } [
sbox [ dup inv-sbox nth sbox nth = ] all?
] unit-test
USING: crypto.barrett kernel math namespaces tools.test ;
IN: crypto.barrett.tests
-[ 0x1f63edfb7e838622c7412eafaf0439cf0cdf3aae8bdd09e2de69b509a53883a83560d5ce50ea039e4 ] [ 0x827c67f31b2b46afa49ed95d7f7a3011e5875f7052d4c55437ce726d3c6ce0dc9c445fda63b6dc4e 16 barrett-mu ] unit-test
+{ 0x1f63edfb7e838622c7412eafaf0439cf0cdf3aae8bdd09e2de69b509a53883a83560d5ce50ea039e4 } [ 0x827c67f31b2b46afa49ed95d7f7a3011e5875f7052d4c55437ce726d3c6ce0dc9c445fda63b6dc4e 16 barrett-mu ] unit-test
IN: crypto.passwd-md5.tests
-[ "$1$npUpD5oQ$1.X7uXR2QG0FzPifVeZ2o1" ]
+{ "$1$npUpD5oQ$1.X7uXR2QG0FzPifVeZ2o1" }
[ "$1$" "npUpD5oQ" "factor" passwd-md5 ] unit-test
-[ "$1$Kilak4kR$wlEr5Dv5DcdqPjKjQtt430" ]
+{ "$1$Kilak4kR$wlEr5Dv5DcdqPjKjQtt430" }
[
"$1$"
"Kilak4kR"
USING: kernel math namespaces crypto.rsa tools.test ;
IN: crypto.rsa.tests
-[ 123456789 ] [ 128 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
-[ 123456789 ] [ 129 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
-[ 123456789 ] [ 130 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
-[ 123 ] [ 3233 2753 17 <rsa> 123 over rsa-encrypt swap rsa-decrypt ] unit-test
+{ 123456789 } [ 128 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
+{ 123456789 } [ 129 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
+{ 123456789 } [ 130 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
+{ 123 } [ 3233 2753 17 <rsa> 123 over rsa-encrypt swap rsa-decrypt ] unit-test
[ "" "asdf" dupd xor-crypt xor-crypt ] [ T{ empty-xor-key } = ] must-fail-with
! a xor a = 0
-[ "\0\0\0\0\0\0\0" ] [ "abcdefg" dup xor-crypt ] unit-test
+{ "\0\0\0\0\0\0\0" } [ "abcdefg" dup xor-crypt ] unit-test
-[ { 15 15 15 15 } ] [ { 10 10 10 10 } { 5 5 5 5 } xor-crypt ] unit-test
+{ { 15 15 15 15 } } [ { 10 10 10 10 } { 5 5 5 5 } xor-crypt ] unit-test
-[ "asdf" ] [ "asdf" "key" [ xor-crypt ] [ xor-crypt ] bi >string ] unit-test
-[ "" ] [ "" "key" xor-crypt >string ] unit-test
-[ "a longer message...!" ] [
+{ "asdf" } [ "asdf" "key" [ xor-crypt ] [ xor-crypt ] bi >string ] unit-test
+{ "" } [ "" "key" xor-crypt >string ] unit-test
+{ "a longer message...!" } [
"a longer message...!"
"." [ xor-crypt ] [ xor-crypt ] bi >string
] unit-test
-[ "a longer message...!" ] [
+{ "a longer message...!" } [
"a longer message...!"
"a very long key, longer than the message even."
[ xor-crypt ] [ xor-crypt ] bi >string
USING: kernel ctags tools.test io.backend sequences arrays prettyprint ;
IN: ctags.tests
-[ t ] [
+{ t } [
91
{ if { "resource:extra/unix/unix.factor" 91 } } ctag-lineno =
] unit-test
-[ t ] [
+{ t } [
"resource:extra/unix/unix.factor"
{ if { "resource:extra/unix/unix.factor" 91 } } ctag-path =
] unit-test
-[ t ] [
+{ t } [
\ if
{ if { "resource:extra/unix/unix.factor" 91 } } ctag-word =
] unit-test
-[ t ] [
+{ t } [
"if\t" "resource:extra/unix/unix.factor" normalize-path "\t91" 3append
{ if { "resource:extra/unix/unix.factor" 91 } } ctag =
] unit-test
-[ t ] [
+{ t } [
"if\t" "resource:extra/unix/unix.factor" normalize-path "\t91" 3append 1array
{ { if { "resource:extra/unix/unix.factor" 91 } } } ctag-strings =
] unit-test
IN: ctags.etags.tests
! etag-at
-[ t ]
+{ t }
[
V{ }
"path" H{ } clone etag-at =
] unit-test
-[ t ]
+{ t }
[
V{ if { "path" 1 } }
"path" H{ { "path" V{ if { "path" 1 } } } } etag-at =
] unit-test
! etag-vector
-[ t ]
+{ t }
[
V{ }
{ if { "path" 1 } } H{ } clone etag-vector =
] unit-test
-[ t ]
+{ t }
[
V{ if { "path" 1 } }
{ if { "path" 1 } }
] unit-test
! etag-pair
-[ t ]
+{ t }
[
{ if 28 }
{ if { "resource:core/kernel/kernel.factor" 28 } } etag-pair =
] unit-test
! etag-add
-[ t ]
+{ t }
[
H{ { "path" V{ { if 1 } } } }
{ if { "path" 1 } } H{ } clone [ etag-add ] keep =
] unit-test
! etag-hash
-[ t ]
+{ t }
[
H{ { "path" V{ { if 1 } } } }
{ { if { "path" 1 } } } etag-hash =
] unit-test
! line-bytes (note that for each line implicit \n is counted)
-[ t ]
+{ t }
[
17
{ "1234567890" "12345" } 2 lines>bytes =
] unit-test
! etag
-[ t ]
+{ t }
[
"if\7f2,11"
{ "1234567890" "12345" } { if 2 } etag =
USING: cuda.devices tools.test ;
IN: cuda.devices.tests
-[ 1 5 100 ] [ 5 20 100 10 (distribute-jobs) ] unit-test
-[ 2 5 100 ] [ 10 20 100 10 (distribute-jobs) ] unit-test
-[ 2 5 100 ] [ 10 20 200 5 (distribute-jobs) ] unit-test
-[ 2 5 100 ] [ 10 20 300 6 (distribute-jobs) ] unit-test
-[ 2 6 120 ] [ 11 20 300 6 (distribute-jobs) ] unit-test
-[ 1 10 200 ] [ 10 20 200 10 (distribute-jobs) ] unit-test
-[ 1 10 0 ] [ 10 0 200 10 (distribute-jobs) ] unit-test
-[ 2 5 0 ] [ 10 0 200 9 (distribute-jobs) ] unit-test
+{ 1 5 100 } [ 5 20 100 10 (distribute-jobs) ] unit-test
+{ 2 5 100 } [ 10 20 100 10 (distribute-jobs) ] unit-test
+{ 2 5 100 } [ 10 20 200 5 (distribute-jobs) ] unit-test
+{ 2 5 100 } [ 10 20 300 6 (distribute-jobs) ] unit-test
+{ 2 6 120 } [ 11 20 300 6 (distribute-jobs) ] unit-test
+{ 1 10 200 } [ 10 20 200 10 (distribute-jobs) ] unit-test
+{ 1 10 0 } [ 10 0 200 10 (distribute-jobs) ] unit-test
+{ 2 5 0 } [ 10 0 200 9 (distribute-jobs) ] unit-test
USING: cuda.ptx io.streams.string tools.test ;
IN: cuda.ptx.tests
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20, .texmode_independent
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } { texmode .texmode_independent } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_11, map_f64_to_f32
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_11, map_f64_to_f32, .texmode_independent
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
.global .f32 foo[9000];
.extern .align 16 .shared .v4.f32 bar[];
{
ret;
}
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ "a" ] [ [ "a" write-ptx-operand ] with-string-writer ] unit-test
-[ "2" ] [ [ 2 write-ptx-operand ] with-string-writer ] unit-test
-[ "0d4000000000000000" ] [ [ 2.0 write-ptx-operand ] with-string-writer ] unit-test
-[ "!a" ] [ [ T{ ptx-negation f "a" } write-ptx-operand ] with-string-writer ] unit-test
-[ "{a, b, c, d}" ] [ [ T{ ptx-vector f { "a" "b" "c" "d" } } write-ptx-operand ] with-string-writer ] unit-test
-[ "[a]" ] [ [ T{ ptx-indirect f "a" 0 } write-ptx-operand ] with-string-writer ] unit-test
-[ "[a+1]" ] [ [ T{ ptx-indirect f "a" 1 } write-ptx-operand ] with-string-writer ] unit-test
-[ "[a-1]" ] [ [ T{ ptx-indirect f "a" -1 } write-ptx-operand ] with-string-writer ] unit-test
-[ "a[1]" ] [ [ T{ ptx-element f "a" 1 } write-ptx-operand ] with-string-writer ] unit-test
-[ "{a, b[2], 3, 0d4000000000000000}" ] [ [ T{ ptx-vector f { "a" T{ ptx-element f "b" 2 } 3 2.0 } } write-ptx-operand ] with-string-writer ] unit-test
+{ "a" } [ [ "a" write-ptx-operand ] with-string-writer ] unit-test
+{ "2" } [ [ 2 write-ptx-operand ] with-string-writer ] unit-test
+{ "0d4000000000000000" } [ [ 2.0 write-ptx-operand ] with-string-writer ] unit-test
+{ "!a" } [ [ T{ ptx-negation f "a" } write-ptx-operand ] with-string-writer ] unit-test
+{ "{a, b, c, d}" } [ [ T{ ptx-vector f { "a" "b" "c" "d" } } write-ptx-operand ] with-string-writer ] unit-test
+{ "[a]" } [ [ T{ ptx-indirect f "a" 0 } write-ptx-operand ] with-string-writer ] unit-test
+{ "[a+1]" } [ [ T{ ptx-indirect f "a" 1 } write-ptx-operand ] with-string-writer ] unit-test
+{ "[a-1]" } [ [ T{ ptx-indirect f "a" -1 } write-ptx-operand ] with-string-writer ] unit-test
+{ "a[1]" } [ [ T{ ptx-element f "a" 1 } write-ptx-operand ] with-string-writer ] unit-test
+{ "{a, b[2], 3, 0d4000000000000000}" } [ [ T{ ptx-vector f { "a" T{ ptx-element f "b" 2 } 3 2.0 } } write-ptx-operand ] with-string-writer ] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
abs.s32 a, b;
@p abs.s32 a, b;
@!p abs.s32 a, b;
foo: abs.s32 a, b;
abs.ftz.f32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
add.s32 a, b, c;
add.cc.s32 a, b, c;
add.ftz.sat.f32 a, b, c;
add.rz.sat.f32 a, b, c;
add.rz.ftz.sat.f32 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
addc.s32 a, b, c;
addc.cc.s32 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
and.b32 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
atom.and.u32 a, [b], c;
atom.global.or.u32 a, [b], c;
atom.shared.cas.u32 a, [b], c, d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
bar.arrive a, b;
bar.red.popc.u32 a, b, d;
bar.red.popc.u32 a, b, c, !d;
bar.sync a;
bar.sync a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
bfe.u32 a, b, c, d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
bfi.u32 a, b, c, d, e;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
bfind.u32 a, b;
bfind.shiftamt.u32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
bra foo;
bra.uni bar;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
brev.b32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
brkpt;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
call foo;
call.uni foo;
call (a), foo, (b, c, d);
call (a[2]), foo, (b, c, d[3]);
call foo, (b, c, d);
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
clz.b32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
cnot.b32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
copysign.f64 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
cos.approx.f32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
cvt.f32.s32 a, b;
cvt.s32.f32 a, b;
cvt.sat.f32.f64 a, b;
cvt.ftz.sat.f32.f64 a, b;
cvt.rp.ftz.sat.f32.f64 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
cvta.global.u64 a, b;
cvta.shared.u64 a, b;
cvta.to.shared.u64 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
div.u32 a, b, c;
div.approx.f32 a, b, c;
div.rz.ftz.f32 a, b, c;
div.f64 a, b, c;
div.rz.f64 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
ex2.approx.f32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
exit;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
fma.f32 a, b, c, d;
fma.sat.f32 a, b, c, d;
fma.ftz.sat.f32 a, b, c, d;
fma.rz.sat.f32 a, b, c, d;
fma.rz.ftz.sat.f32 a, b, c, d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
isspacep.shared a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
ld.u32 a, [b];
ld.v2.u32 a, [b];
ld.lu.u32 a, [b];
ld.const.lu.u32 a, [b];
ld.volatile.const[5].u32 a, [b];
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
ldu.u32 a, [b];
ldu.v2.u32 a, [b];
ldu.lu.u32 a, [b];
ldu.const.lu.u32 a, [b];
ldu.volatile.const[5].u32 a, [b];
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
lg2.approx.f32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
mad.s32 a, b, c, d;
mad.lo.s32 a, b, c, d;
mad.ftz.sat.f32 a, b, c, d;
mad.rz.sat.f32 a, b, c, d;
mad.rz.ftz.sat.f32 a, b, c, d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
mad24.s32 a, b, c, d;
mad24.lo.s32 a, b, c, d;
mad24.sat.s32 a, b, c, d;
mad24.hi.sat.s32 a, b, c, d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
neg.s32 a, b;
neg.f32 a, b;
neg.ftz.f32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
not.b32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
or.b32 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
pmevent a;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
popc.b64 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
prefetch.L1 [a];
prefetch.local.L2 [a];
prefetchu.L1 [a];
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
prmt.b32 a, b, c, d;
prmt.b32.f4e a, b, c, d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
rcp.approx.f32 a, b;
rcp.approx.ftz.f32 a, b;
rcp.rz.ftz.f32 a, b;
rcp.f64 a, b;
rcp.rz.f64 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
red.and.u32 [a], b;
red.global.and.u32 [a], b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
rsqrt.approx.f32 a, b;
rsqrt.approx.ftz.f32 a, b;
rsqrt.approx.f64 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
rsqrt.approx.f32 a, b;
rsqrt.approx.ftz.f32 a, b;
rsqrt.approx.f64 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
sad.u32 a, b, c, d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
selp.u32 a, b, c, d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
set.gt.u32.s32 a, b, c;
set.gt.ftz.u32.f32 a, b, c;
set.gt.and.ftz.u32.f32 a, b, c, d;
set.gt.and.ftz.u32.f32 a, b, c, !d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
setp.gt.s32 a, b, c;
setp.gt.s32 a|z, b, c;
setp.gt.ftz.f32 a, b, c;
setp.gt.and.ftz.f32 a, b, c, d;
setp.gt.and.ftz.f32 a, b, c, !d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
shl.b32 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
shr.b32 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
sin.approx.f32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
slct.f32.s32 a, b, c, d;
slct.ftz.f32.s32 a, b, c, d;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
sqrt.approx.f32 a, b;
sqrt.approx.ftz.f32 a, b;
sqrt.rz.ftz.f32 a, b;
sqrt.f64 a, b;
sqrt.rz.f64 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
st.u32 [a], b;
st.v2.u32 [a], b;
st.lu.u32 [a], b;
st.local.lu.u32 [a], b;
st.volatile.local.u32 [a], b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
sub.s32 a, b, c;
sub.cc.s32 a, b, c;
sub.ftz.sat.f32 a, b, c;
sub.rz.sat.f32 a, b, c;
sub.rz.ftz.sat.f32 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
subc.s32 a, b, c;
subc.cc.s32 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
testp.finite.f32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
trap;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
vote.all.pred a, b;
vote.all.pred a, !b;
vote.ballot.b32 a, b;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
} ptx>string
] unit-test
-[ """ .version 2.0
+{ """ .version 2.0
.target sm_20
xor.b32 a, b, c;
-""" ] [
+""" } [
T{ ptx
{ version "2.0" }
{ target T{ ptx-target { arch sm_20 } } }
FROM: cursors => each map assoc-each assoc>map ;
IN: cursors.tests
-[ { 1 2 3 4 } ] [
+{ { 1 2 3 4 } } [
[ T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> , ] -each ]
{ } make
] unit-test
-[ T{ linear-cursor f 3 1 } ] [
+{ T{ linear-cursor f 3 1 } } [
T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> 3 mod zero? ] -find
] unit-test
-[ T{ linear-cursor f 5 1 } ] [
+{ T{ linear-cursor f 5 1 } } [
T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> 6 = ] -find
] unit-test
-[ { 1 3 } ] [
+{ { 1 3 } } [
[ T{ linear-cursor f 1 2 } T{ linear-cursor f 5 2 } [ value>> , ] -each ]
{ } make
] unit-test
-[ B{ 1 2 3 4 5 } ] [ [ { 1 2 3 4 5 } [ , ] each ] B{ } make ] unit-test
-[ B{ } ] [ [ { } [ , ] each ] B{ } make ] unit-test
-[ { 2 4 6 8 10 } ] [ { 1 2 3 4 5 } [ 2 * ] map ] unit-test
+{ B{ 1 2 3 4 5 } } [ [ { 1 2 3 4 5 } [ , ] each ] B{ } make ] unit-test
+{ B{ } } [ [ { } [ , ] each ] B{ } make ] unit-test
+{ { 2 4 6 8 10 } } [ { 1 2 3 4 5 } [ 2 * ] map ] unit-test
-[ { "roses: lutefisk" "tulips: lox" } ]
+{ { "roses: lutefisk" "tulips: lox" } }
[
[
H{ { "roses" "lutefisk" } { "tulips" "lox" } }
] { } make natural-sort
] unit-test
-[ { "roses: lutefisk" "tulips: lox" } ]
+{ { "roses: lutefisk" "tulips: lox" } }
[
H{ { "roses" "lutefisk" } { "tulips" "lox" } }
[ ": " glue ] { } assoc>map natural-sort
: compile-test-assoc>map ( xs -- ys )
[ ": " glue ] { } assoc>map ;
-[ B{ 1 2 3 4 5 } ] [ [ { 1 2 3 4 5 } compile-test-each ] B{ } make ] unit-test
-[ { 2 4 6 8 10 } ] [ { 1 2 3 4 5 } compile-test-map ] unit-test
+{ B{ 1 2 3 4 5 } } [ [ { 1 2 3 4 5 } compile-test-each ] B{ } make ] unit-test
+{ { 2 4 6 8 10 } } [ { 1 2 3 4 5 } compile-test-map ] unit-test
-[ { "roses: lutefisk" "tulips: lox" } ]
+{ { "roses: lutefisk" "tulips: lox" } }
[
[ H{ { "roses" "lutefisk" } { "tulips" "lox" } } compile-test-assoc-each ]
{ } make natural-sort
] unit-test
-[ { "roses: lutefisk" "tulips: lox" } ]
+{ { "roses: lutefisk" "tulips: lox" } }
[
H{ { "roses" "lutefisk" } { "tulips" "lox" } } compile-test-assoc>map
natural-sort
sequences tools.test kernel.private ;
IN: decimals.tests
-[ t ] [
+{ t } [
D: 12.34 D: 00012.34000 =
] unit-test
: test-decimal-op ( quot1 quot2 -- ? )
[ random-test-decimal random-test-decimal ] 2dip (test-decimal-op) ; inline
-[ t ] [ 1000 [ drop [ D+ ] [ + ] test-decimal-op ] all-integers? ] unit-test
-[ t ] [ 1000 [ drop [ D- ] [ - ] test-decimal-op ] all-integers? ] unit-test
-[ t ] [ 1000 [ drop [ D* ] [ * ] test-decimal-op ] all-integers? ] unit-test
-[ t ] [
+{ t } [ 1000 [ drop [ D+ ] [ + ] test-decimal-op ] all-integers? ] unit-test
+{ t } [ 1000 [ drop [ D- ] [ - ] test-decimal-op ] all-integers? ] unit-test
+{ t } [ 1000 [ drop [ D* ] [ * ] test-decimal-op ] all-integers? ] unit-test
+{ t } [
1000 [
drop
[ [ 100 D/ ] [ /f ] test-decimal-op ]
] all-integers?
] unit-test
-[ t ] [
+{ t } [
{ D: 0. D: .0 D: 0.0 D: 00.00 D: . } all-equal?
] unit-test
-[ t ] [ T{ decimal f 90 0 } T{ decimal f 9 1 } = ] unit-test
+{ t } [ T{ decimal f 90 0 } T{ decimal f 9 1 } = ] unit-test
-[ t ] [ D: 1 D: 2 before? ] unit-test
-[ f ] [ D: 2 D: 2 before? ] unit-test
-[ f ] [ D: 3 D: 2 before? ] unit-test
-[ f ] [ D: -1 D: -2 before? ] unit-test
-[ f ] [ D: -2 D: -2 before? ] unit-test
-[ t ] [ D: -3 D: -2 before? ] unit-test
-[ t ] [ D: .5 D: 0 D: 1.0 between? ] unit-test
+{ t } [ D: 1 D: 2 before? ] unit-test
+{ f } [ D: 2 D: 2 before? ] unit-test
+{ f } [ D: 3 D: 2 before? ] unit-test
+{ f } [ D: -1 D: -2 before? ] unit-test
+{ f } [ D: -2 D: -2 before? ] unit-test
+{ t } [ D: -3 D: -2 before? ] unit-test
+{ t } [ D: .5 D: 0 D: 1.0 between? ] unit-test
DESCRIPTIVE: divide ( num denom -- fraction ) / ;
-[ 3 ] [ 9 3 divide ] unit-test
+{ 3 } [ 9 3 divide ] unit-test
-[
+{
T{ descriptive-error f
{ { "num" 3 } { "denom" 0 } }
T{ division-by-zero f 3 }
divide
}
-] [
+} [
[ 3 0 divide ] [ ] recover
] unit-test
-[ "USING: descriptive math ;\nIN: descriptive.tests\nDESCRIPTIVE: divide ( num denom -- fraction ) / ;\n" ]
+{ "USING: descriptive math ;\nIN: descriptive.tests\nDESCRIPTIVE: divide ( num denom -- fraction ) / ;\n" }
[ \ divide [ see ] with-string-writer ] unit-test
DESCRIPTIVE:: divide* ( num denom -- fraction ) num denom / ;
-[ 3 ] [ 9 3 divide* ] unit-test
+{ 3 } [ 9 3 divide* ] unit-test
-[
+{
T{ descriptive-error f
{ { "num" 3 } { "denom" 0 } }
T{ division-by-zero f 3 }
divide*
}
-] [ [ 3 0 divide* ] [ ] recover ] unit-test
+} [ [ 3 0 divide* ] [ ] recover ] unit-test
-[ "USING: descriptive math ;\nIN: descriptive.tests\nDESCRIPTIVE:: divide* ( num denom -- fraction ) num denom / ;\n" ] [ \ divide* [ see ] with-string-writer ] unit-test
+{ "USING: descriptive math ;\nIN: descriptive.tests\nDESCRIPTIVE:: divide* ( num denom -- fraction ) num denom / ;\n" } [ \ divide* [ see ] with-string-writer ] unit-test
{ { "one" "three" } { "one" "four" } { "two" "three" } { "two" "one" } { "three" "four" } }
[ first2 pick add-edge ] each ;
-[ 5 ] [ test-digraph topological-sort length ] unit-test
+{ 5 } [ test-digraph topological-sort length ] unit-test
IN: enigma.tests
-[ t ] [ <reflector> natural-sort 26 iota sequence= ] unit-test
+{ t } [ <reflector> natural-sort 26 iota sequence= ] unit-test
-[ "" ] [ "" 4 <enigma> encode ] unit-test
+{ "" } [ "" 4 <enigma> encode ] unit-test
-[ "hello, world" ] [
+{ "hello, world" } [
"hello, world" 4 <enigma> [ encode ] keep reset-cogs encode
] unit-test
namespaces sequences tools.test ;
IN: euler.b-rep.tests
-[ double-4{ 0.0 0.0 -1.0 0.0 } ]
+{ double-4{ 0.0 0.0 -1.0 0.0 } }
[ valid-cube-b-rep edges>> first face-normal ] unit-test
-[ double-4{ 0.0 0.0 -1.0 0.0 } -1.0 ]
+{ double-4{ 0.0 0.0 -1.0 0.0 } -1.0 }
[ valid-cube-b-rep edges>> first face-plane ] unit-test
-[ t ] [ 0 multi-ringed-face-cube-b-rep faces>> nth base-face? ] unit-test
-[ t ] [ 5 multi-ringed-face-cube-b-rep faces>> nth base-face? ] unit-test
-[ f ] [ 6 multi-ringed-face-cube-b-rep faces>> nth base-face? ] unit-test
+{ t } [ 0 multi-ringed-face-cube-b-rep faces>> nth base-face? ] unit-test
+{ t } [ 5 multi-ringed-face-cube-b-rep faces>> nth base-face? ] unit-test
+{ f } [ 6 multi-ringed-face-cube-b-rep faces>> nth base-face? ] unit-test
:: mock-face ( p0 p1 p2 -- edge )
b-edge new vertex new p0 >>position >>vertex :> e0
e0 ;
-[
+{
double-4{
0x1.279a74590331dp-1
0x1.279a74590331dp-1
0.0
}
-0x1.bb67ae8584cabp1
-] [
+} [
double-4{ 1 0 5 0 }
double-4{ 0 1 5 0 }
double-4{ 0 0 6 0 } mock-face face-plane
[ t V{ f } f ] [ pop-sharpness sharpness-stack get get-sharpness ] unit-test
] with-variable
-[ t ] [ valid-cube-b-rep [ edges>> first ] keep is-valid-edge? ] unit-test
-[ f ] [ b-edge new valid-cube-b-rep is-valid-edge? ] unit-test
+{ t } [ valid-cube-b-rep [ edges>> first ] keep is-valid-edge? ] unit-test
+{ f } [ b-edge new valid-cube-b-rep is-valid-edge? ] unit-test
-[ t ] [
+{ t } [
valid-cube-b-rep edges>>
[ [ 0 swap nth ] [ 1 swap nth ] bi connecting-edge ]
[ 0 swap nth ] bi eq?
] unit-test
-[ t ] [
+{ t } [
valid-cube-b-rep edges>>
[ [ 1 swap nth ] [ 0 swap nth ] bi connecting-edge ]
[ 6 swap nth ] bi eq?
] unit-test
-[ t ] [
+{ t } [
valid-cube-b-rep edges>>
[ [ 0 swap nth ] [ 3 swap nth ] bi connecting-edge ]
[ 21 swap nth ] bi eq?
] unit-test
-[ f ] [
+{ f } [
valid-cube-b-rep edges>>
[ 0 swap nth ] [ 2 swap nth ] bi connecting-edge
] unit-test
-[ double-4{ 0 0 -1 0 } ] [
+{ double-4{ 0 0 -1 0 } } [
[
{ double-4{ 0 0 0 0 } double-4{ 0 1 0 0 } double-4{ 0 2 0 0 } double-4{ 1 1 0 0 } }
smooth-smooth polygon>double-face face-normal
: triangle-vx-positions ( triangles -- positions )
[ [ position>> ] { } map-as ] { } map-as ;
-[
+{
{
{
double-4{ 1.0 1.0 -1.0 0.0 }
double-4{ 1.0 -1.0 -1.0 0.0 }
}
}
-] [ valid-cube-b-rep faces>> first triangulate-face triangle-vx-positions ] unit-test
+} [ valid-cube-b-rep faces>> first triangulate-face triangle-vx-positions ] unit-test
-[ { } ] [ degenerate-incomplete-face faces>> first triangulate-face triangle-vx-positions ] unit-test
-[ {
+{ { } } [ degenerate-incomplete-face faces>> first triangulate-face triangle-vx-positions ] unit-test
+{ {
{
double-4{ 1.0 1.0 0.0 0.0 }
double-4{ -1.0 -1.0 0.0 0.0 }
double-4{ 1.0 1.0 0.0 0.0 }
double-4{ 1.0 -1.0 0.0 0.0 }
}
-} ] [ partially-degenerate-second-face faces>> second triangulate-face triangle-vx-positions ] unit-test
+} } [ partially-degenerate-second-face faces>> second triangulate-face triangle-vx-positions ] unit-test
-[
+{
{
{
double-4{ -1.0 1.0 0.0 0.0 }
double-4{ 1.0 1.0 0.0 0.0 }
}
}
-] [
+} [
[ "vocab:gml/examples/torus.gml" run-gml-file ] make-gml nip
faces>> first triangulate-face triangle-vx-positions
] unit-test
IN: euler.modeling.tests
! polygon>double-face
-[ ] [
+{ } [
[
{ { -1 -1 0 } { 1 -1 0 } { 1 1 0 } { -1 1 0 } }
smooth-smooth polygon>double-face
] unit-test
! extrude-simple
-[ ] [
+{ } [
[
{ { -1 -1 0 } { 1 -1 0 } { 1 1 0 } }
smooth-smooth polygon>double-face
] unit-test
! project-pt-line
-[ { 0 1 0 } ] [ { 0 0 0 } { 0 1 0 } { 1 1 0 } project-pt-line ] unit-test
-[ { 0 1 0 } ] [ { 0 0 0 } { 1 1 0 } { 0 1 0 } project-pt-line ] unit-test
-[ { 0 1 0 } ] [ { 0 0 0 } { 2 1 0 } { 1 1 0 } project-pt-line ] unit-test
-[ { -1 1 0 } ] [ { -1 0 0 } { 2 1 0 } { 1 1 0 } project-pt-line ] unit-test
-[ { 1/2 1/2 0 } ] [ { 0 0 0 } { 0 1 0 } { 1 0 0 } project-pt-line ] unit-test
+{ { 0 1 0 } } [ { 0 0 0 } { 0 1 0 } { 1 1 0 } project-pt-line ] unit-test
+{ { 0 1 0 } } [ { 0 0 0 } { 1 1 0 } { 0 1 0 } project-pt-line ] unit-test
+{ { 0 1 0 } } [ { 0 0 0 } { 2 1 0 } { 1 1 0 } project-pt-line ] unit-test
+{ { -1 1 0 } } [ { -1 0 0 } { 2 1 0 } { 1 1 0 } project-pt-line ] unit-test
+{ { 1/2 1/2 0 } } [ { 0 0 0 } { 0 1 0 } { 1 0 0 } project-pt-line ] unit-test
! project-pt-plane
-[ { 0 0 1 } ] [ { 0 0 0 } { 0 0 1 } { 0 0 1 } -1 project-pt-plane ] unit-test
-[ { 0 0 -1 } ] [ { 0 0 0 } { 0 0 1 } { 0 0 1 } 1 project-pt-plane ] unit-test
-[ { 0 0 3 } ] [ { 0 0 0 } { 0 0 1 } { 0 0 1 } -3 project-pt-plane ] unit-test
-[ { 0 0 3 } ] [ { 0 0 0 } { 0 0 1 } { 0 0 -1 } 3 project-pt-plane ] unit-test
-[ { 0 0 1 } ] [ { 0 0 0 } { 0 0 1 } { 0 1 1 } -1 project-pt-plane ] unit-test
+{ { 0 0 1 } } [ { 0 0 0 } { 0 0 1 } { 0 0 1 } -1 project-pt-plane ] unit-test
+{ { 0 0 -1 } } [ { 0 0 0 } { 0 0 1 } { 0 0 1 } 1 project-pt-plane ] unit-test
+{ { 0 0 3 } } [ { 0 0 0 } { 0 0 1 } { 0 0 1 } -3 project-pt-plane ] unit-test
+{ { 0 0 3 } } [ { 0 0 0 } { 0 0 1 } { 0 0 -1 } 3 project-pt-plane ] unit-test
+{ { 0 0 1 } } [ { 0 0 0 } { 0 0 1 } { 0 1 1 } -1 project-pt-plane ] unit-test
-[ { 0 2/3 1/3 } ] [ { 0 0 0 } { 0 2 1 } { 0 1 1 } -1 project-pt-plane ] unit-test
+{ { 0 2/3 1/3 } } [ { 0 0 0 } { 0 2 1 } { 0 1 1 } -1 project-pt-plane ] unit-test
-[ { 0 0 1 } ] [ { 0 0 0 } { 0 0 1/2 } { 0 0 1 } -1 project-pt-plane ] unit-test
-[ { 0 1 1 } ] [ { 0 0 0 } { 0 1/2 1/2 } { 0 0 1 } -1 project-pt-plane ] unit-test
+{ { 0 0 1 } } [ { 0 0 0 } { 0 0 1/2 } { 0 0 1 } -1 project-pt-plane ] unit-test
+{ { 0 1 1 } } [ { 0 0 0 } { 0 1/2 1/2 } { 0 0 1 } -1 project-pt-plane ] unit-test
FROM: euler.b-rep => has-rings? ;
IN: euler.operators.tests
-[ t ] [ [ ] make-b-rep b-rep? ] unit-test
+{ t } [ [ ] make-b-rep b-rep? ] unit-test
-[ ] [
+{ } [
[
{ 1 0 0 }
{ 0 1 0 }
] make-b-rep check-b-rep
] unit-test
-[ ] [
+{ } [
[
{ 1 0 0 }
{ 0 1 0 }
] make-b-rep
] [ edges-not-incident? ] must-fail-with
-[ ] [
+{ } [
[
0
1
] make-b-rep check-b-rep
] unit-test
-[ ] [
+{ } [
[
{ 1 0 0 }
{ 0 1 0 }
] make-b-rep assert-empty-b-rep
] unit-test
-[ ] [
+{ } [
[
{ 1 2 3 } smooth-smooth polygon>double-face
dup face-cw opposite-edge>>
] make-b-rep check-b-rep
] unit-test
-[ ] [
+{ } [
[
{ 1 2 3 4 } smooth-smooth polygon>double-face
[ face-ccw opposite-edge>> ]
] make-b-rep check-b-rep
] unit-test
-[ ] [
+{ } [
[
{ 1 0 0 }
{ 0 1 0 }
] make-b-rep
] [ edges-in-different-faces? ] must-fail-with
-[ ] [
+{ } [
[
{ 1 0 0 }
{ 0 1 0 }
] make-b-rep check-b-rep
] unit-test
-[ ] [
+{ } [
[
{ 1 2 3 4 } smooth-smooth polygon>double-face
{ 5 6 7 8 } smooth-smooth polygon>double-face
] make-b-rep check-b-rep
] unit-test
-[
+{
{ 0 1 0 }
{ 1 0 0 }
{ 1 2 1 }
{ 2 1 1 }
-] [
+} [
[
{ 1 0 0 }
{ 0 1 0 }
] make-b-rep check-b-rep
] unit-test
-[
+{
{
{ 2 1 1 }
{ 1 2 1 }
{ 1 1 2 }
}
-] [
+} [
[
{ { 1 0 0 } { 0 1 0 } { 0 0 1 } } smooth-smooth polygon>double-face
[ { 1 1 1 } move-f ]
] unit-test
! Make sure we update the face's edge when killing an edge
-[ ] [
+{ } [
[
{ 1 2 3 4 } smooth-smooth polygon>double-face
kill-ev
] make-b-rep check-b-rep
] unit-test
-[ ] [
+{ } [
[
{ 1 2 3 4 } smooth-smooth polygon>double-face
face-ccw kill-ev
] make-b-rep check-b-rep
] unit-test
-[ ] [
+{ } [
[
{ 1 2 3 4 } smooth-smooth polygon>double-face
face-ccw face-ccw kill-ev
] make-b-rep check-b-rep
] unit-test
-[ ] [
+{ } [
[
{ 1 2 3 4 } smooth-smooth polygon>double-face
face-ccw face-ccw face-ccw kill-ev
IN: flip-text.tests
-[
+{
"068Ɫ95ᔭƐᄅ⇂zʎxʍʌnʇsɹbdouɯʃʞɾᴉɥᵷɟǝpɔqɐZ⅄XMΛՈ⊥SᴚΌԀONW⅂KᒋIH⅁ℲƎᗡϽ𐐒∀"
-] [
+} [
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
flip-text
] unit-test
-[
+{
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
-] [
+} [
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
flip-text flip-text
] unit-test
connect-cube-edges
-[ 0 1 ]
+{ 0 1 }
[ cube-edges first edge-vertices ] unit-test
-[ { 0 0 0 } ]
+{ { 0 0 0 } }
[ cube-edges first vertex-edges [ vertex>> ] map ] unit-test
-[ 3 ]
+{ 3 }
[ cube-edges first vertex-valence ] unit-test
-[ { 0 1 3 2 } ]
+{ { 0 1 3 2 } }
[ cube-edges first face-edges [ vertex>> ] map ] unit-test
-[ 4 ]
+{ 4 }
[ cube-edges first face-sides ] unit-test
-[ { 1 4 2 } ]
+{ { 1 4 2 } }
[ cube-edges first vertex-neighbors ] unit-test
-[ { 3 5 6 } ]
+{ { 3 5 6 } }
[ cube-edges first vertex-diagonals ] unit-test
-[ { 1 4 3 5 } ]
+{ { 1 4 3 5 } }
[ cube-edges first face-neighbors ] unit-test
USING: game.models.util tools.test make accessors kernel ;
IN: game.models.util.tests
-[ V{ 1 2 3 4 } ] [
+{ V{ 1 2 3 4 } } [
[ 1 , 1 , 2 , 3 , 3 , 4 , ]
V{ } V{ } H{ } <indexed-seq> make
dseq>>
] unit-test
-[ V{ 0 0 1 2 2 3 } ] [
+{ V{ 0 0 1 2 2 3 } } [
[ 1 , 1 , 2 , 3 , 3 , 4 , ]
V{ } V{ } H{ } <indexed-seq> make
iseq>>
test.db reader >>role [ ] with-gdbm
] [ gdbm-file-open-error = ] must-fail-with
-[ f ] [ [ "foo" exists? ] with-test.db ] unit-test
+{ f } [ [ "foo" exists? ] with-test.db ] unit-test
-[ ] [ [ "foo" 41 insert ] with-test.db ] unit-test
+{ } [ [ "foo" 41 insert ] with-test.db ] unit-test
[
db-path [ "foo" 42 insert ] with-gdbm-writer
] [ gdbm-cannot-replace = ] must-fail-with
-[ ]
+{ }
[
[
"foo" 42 replace
] with-test.db
] unit-test
-[ 42 t ] [ db-path [ "foo" fetch* ] with-gdbm-reader ] unit-test
+{ 42 t } [ db-path [ "foo" fetch* ] with-gdbm-reader ] unit-test
-[ f f ] [ [ "unknown" fetch* ] with-test.db ] unit-test
+{ f f } [ [ "unknown" fetch* ] with-test.db ] unit-test
[
[
] with-test.db
] [ gdbm-option-already-set = ] must-fail-with
-[ t ]
+{ t }
[
V{ } [ [ 2array append ] each-record ] with-test.db
V{ "foo" "bar" "baz" 42 43 44 } set=
] unit-test
-[ f ]
+{ f }
[
test.db newdb >>role [ "foo" exists? ] with-gdbm
] unit-test
IN: gml.tests
USING: accessors combinators gml tools.test kernel sequences euler.b-rep ;
-[ ] [ [ "vocab:gml/test-core.gml" run-gml-file ] make-gml 2drop ] unit-test
+{ } [ [ "vocab:gml/test-core.gml" run-gml-file ] make-gml 2drop ] unit-test
-[ ] [ [ "vocab:gml/test-coremath.gml" run-gml-file ] make-gml 2drop ] unit-test
+{ } [ [ "vocab:gml/test-coremath.gml" run-gml-file ] make-gml 2drop ] unit-test
-[ ] [ [ "vocab:gml/test-geometry.gml" run-gml-file ] make-gml 2drop ] unit-test
+{ } [ [ "vocab:gml/test-geometry.gml" run-gml-file ] make-gml 2drop ] unit-test
-[ ] [
+{ } [
[ "vocab:gml/examples/cube.gml" run-gml-file ] make-gml nip
{
[ check-b-rep ]
} cleave
] unit-test
-[ ] [
+{ } [
[ "vocab:gml/examples/torus.gml" run-gml-file ] make-gml nip
{
[ check-b-rep ]
} cleave
] unit-test
-[ ] [
+{ } [
[ "vocab:gml/examples/mobius.gml" run-gml-file ] make-gml nip
{
[ check-b-rep ]
USING: gml.viewer math.vectors.simd.cords tools.test ;
IN: gml.viewer.tests
-[ {
+{ {
double-4{ 0 0 0 0 }
double-4{ 1 1 1 1 }
-} ] [ { double-4{ 0 0 0 0 } { double-4{ 1 1 1 1 } 2 } 3 } selected-vectors ] unit-test
+} } [ { double-4{ 0 0 0 0 } { double-4{ 1 1 1 1 } 2 } 3 } selected-vectors ] unit-test
UNIFORM-TUPLE: array-of-struct-containing-array-of-texture
{ "threads" array-of-textures 2 } ;
-[ 1 ] [ texture-uniform uniform-type-texture-units ] unit-test
-[ 0 ] [ float-uniform uniform-type-texture-units ] unit-test
-[ 2 ] [ two-textures uniform-type-texture-units ] unit-test
-[ 3 ] [ inherited-textures uniform-type-texture-units ] unit-test
-[ 6 ] [ array-of-textures uniform-type-texture-units ] unit-test
-[ 2 ] [ struct-containing-texture uniform-type-texture-units ] unit-test
-[ 9 ] [ array-of-struct-containing-texture uniform-type-texture-units ] unit-test
-[ 12 ] [ array-of-struct-containing-array-of-texture uniform-type-texture-units ] unit-test
+{ 1 } [ texture-uniform uniform-type-texture-units ] unit-test
+{ 0 } [ float-uniform uniform-type-texture-units ] unit-test
+{ 2 } [ two-textures uniform-type-texture-units ] unit-test
+{ 3 } [ inherited-textures uniform-type-texture-units ] unit-test
+{ 6 } [ array-of-textures uniform-type-texture-units ] unit-test
+{ 2 } [ struct-containing-texture uniform-type-texture-units ] unit-test
+{ 9 } [ array-of-struct-containing-texture uniform-type-texture-units ] unit-test
+{ 12 } [ array-of-struct-containing-array-of-texture uniform-type-texture-units ] unit-test
-[ { [ ] } ] [ texture-uniform f uniform-texture-accessors ] unit-test
+{ { [ ] } } [ texture-uniform f uniform-texture-accessors ] unit-test
-[ { } ] [ float-uniform f uniform-texture-accessors ] unit-test
+{ { } } [ float-uniform f uniform-texture-accessors ] unit-test
-[ { [ argyle>> ] [ tweed>> ] } ] [ two-textures f uniform-texture-accessors ] unit-test
+{ { [ argyle>> ] [ tweed>> ] } } [ two-textures f uniform-texture-accessors ] unit-test
-[ { [ argyle>> ] [ tweed>> ] [ paisley>> ] } ]
+{ { [ argyle>> ] [ tweed>> ] [ paisley>> ] } }
[ inherited-textures f uniform-texture-accessors ] unit-test
-[ {
+{ {
[ argyle>> ]
[ tweed>> ]
[ plaids>> {
[ 2 swap nth ]
[ 3 swap nth ]
} ]
-} ] [ array-of-textures f uniform-texture-accessors ] unit-test
+} } [ array-of-textures f uniform-texture-accessors ] unit-test
-[ {
+{ {
[ threads>> {
[ argyle>> ]
[ tweed>> ]
} ]
-} ] [ struct-containing-texture f uniform-texture-accessors ] unit-test
+} } [ struct-containing-texture f uniform-texture-accessors ] unit-test
-[ {
+{ {
[ threads>> {
[ 0 swap nth {
[ argyle>> ]
[ paisley>> ]
} ]
} ]
-} ] [ array-of-struct-containing-texture f uniform-texture-accessors ] unit-test
+} } [ array-of-struct-containing-texture f uniform-texture-accessors ] unit-test
-[ {
+{ {
[ threads>> {
[ 0 swap nth {
[ argyle>> ]
} ]
} ]
} ]
-} ] [ array-of-struct-containing-array-of-texture f uniform-texture-accessors ] unit-test
+} } [ array-of-struct-containing-array-of-texture f uniform-texture-accessors ] unit-test
-[ [
+{ [
nip {
[ argyle>> 0 (bind-texture-unit) ]
[ tweed>> 1 (bind-texture-unit) ]
[ 3 swap nth 5 (bind-texture-unit) ]
} cleave ]
} cleave
-] ] [ array-of-textures [bind-uniform-textures] ] unit-test
+] } [ array-of-textures [bind-uniform-textures] ] unit-test
USING: multiline gpu.shaders gpu.shaders.private tools.test ;
IN: gpu.shaders.tests
-[ """ERROR: foo.factor:20: Bad command or filename
+{ """ERROR: foo.factor:20: Bad command or filename
INFO: foo.factor:30: The operation completed successfully
-NOT:A:LOG:LINE""" ]
+NOT:A:LOG:LINE""" }
[ T{ shader { filename "foo.factor" } { line 19 } }
"""ERROR: 0:1: Bad command or filename
INFO: 0:11: The operation completed successfully
specialized-arrays tools.test ;
SPECIALIZED-ARRAY: float
-[
+{
float-array{
0.0 0.0 0.0 1.0
0.0 0.0 0.5 1.0
1.0 0.0 0.5 1.0
1.0 0.0 1.0 1.0
}
-] [ { 2 2 } vertex-array float cast-array ] unit-test
+} [ { 2 2 } vertex-array float cast-array ] unit-test
IN: hash-sets.numbers.tests
-[ t ] [ 1.5 NHS{ 3/2 } in? ] unit-test
+{ t } [ 1.5 NHS{ 3/2 } in? ] unit-test
-[ NHS{ 3/2 } ] [
+{ NHS{ 3/2 } } [
1.5 NHS{ 3/2 } [ adjoin ] keep
] unit-test
-[ t ] [
+{ t } [
NHS{ } clone 1.5 over adjoin
3/2 swap in?
] unit-test
-[ { 1.5 } ] [ NHS{ 1.5 } members ] unit-test
+{ { 1.5 } } [ NHS{ 1.5 } members ] unit-test
USING: accessors sequences tools.test hashcash ;
-[ t ] [ "foo@bar.com" mint check-stamp ] unit-test
+{ t } [ "foo@bar.com" mint check-stamp ] unit-test
-[ t ] [
+{ t } [
<hashcash>
"foo@bar.com" >>resource
16 >>bits
mint* check-stamp ] unit-test
-[ t ] [
+{ t } [
"1:20:040927:mertz@gnosis.cx::odVZhQMP:7ca28" check-stamp
] unit-test
-[ 8 ] [ 8 salt length ] unit-test
+{ 8 } [ 8 salt length ] unit-test
IN: hashtables.numbers.tests
-[ 1000 ] [ 3/2 NH{ { 1.5 1000 } } at ] unit-test
+{ 1000 } [ 3/2 NH{ { 1.5 1000 } } at ] unit-test
-[ 1001 ] [
+{ 1001 } [
1001 1.5 NH{ { 3/2 1000 } }
[ set-at ] [ at ] 2bi
] unit-test
-[ 1001 ] [
+{ 1001 } [
NH{ } clone 1001 1.5 pick set-at
3/2 of
] unit-test
-[ { { 1.0 1000 } } ] [ NH{ { 1.0 1000 } } >alist ] unit-test
+{ { { 1.0 1000 } } } [ NH{ { 1.0 1000 } } >alist ] unit-test
IN: html.elements.tests
USING: tools.test html.elements io.streams.string ;
-[ "<a href='h&o'>" ]
+{ "<a href='h&o'>" }
[ [ <a "h&o" =href a> ] with-string-writer ] unit-test
USING: html.parser html.parser.analyzer kernel math sequences tools.test ;
IN: html.parser.analyzer.tests
-[ 0 3 ]
+{ 0 3 }
[ 1 { 3 5 7 9 11 } [ odd? ] find-nth ] unit-test
-[ 2 7 ]
+{ 2 7 }
[ 3 { 3 5 7 9 11 } [ odd? ] find-nth ] unit-test
-[ 3 9 ]
+{ 3 9 }
[ 3 1 { 3 5 7 9 11 } [ odd? ] find-nth-from ] unit-test
-[ 4 11 ]
+{ 4 11 }
[ 1 { 3 5 7 9 11 } [ odd? ] find-last-nth ] unit-test
-[ 2 7 ]
+{ 2 7 }
[ 3 { 3 5 7 9 11 } [ odd? ] find-last-nth ] unit-test
-[ 0 3 ]
+{ 0 3 }
[ 1 2 { 3 5 7 9 11 } [ odd? ] find-last-nth-from ] unit-test
[ 0 { 3 5 7 9 11 } [ odd? ] find-last-nth ]
[ undefined-find-nth? ] must-fail-with
-[ V{
+{ V{
T{ tag f text f "foo" f }
}
-] [
+} [
"<html><head><title>foo</title></head></html>" parse-html
"title" find-between-first
] unit-test
-[ V{
+{ V{
T{ tag f "p" H{ } f f }
T{ tag f text f "para" f }
T{ tag f "p" H{ } f t }
}
-] [
+} [
"<body><div><p>para</p></div></body>" parse-html "div" find-between-first
] unit-test
-[ V{
+{ V{
T{ tag f "div" H{ { "class" "foo" } } f f }
T{ tag f "p" H{ } f f }
T{ tag f text f "para" f }
T{ tag f "p" H{ } f t }
T{ tag f "div" H{ } f t }
}
-] [
+} [
"<body><div class=\"foo\"><p>para</p></div></body>" parse-html
"foo" find-by-class-between
] unit-test
-[ V{
+{ V{
T{ tag f "div" H{ { "class" "foo" } } f f }
T{ tag f "div" H{ } f f }
T{ tag f "p" H{ } f f }
T{ tag f "div" H{ } f t }
T{ tag f "div" H{ } f t }
}
-] [
+} [
"<body><div class=\"foo\"><div><p>para</p></div></div></body>" parse-html
"foo" find-by-class-between
] unit-test
-[ t ] [
+{ t } [
T{ tag { name "f" } { attributes H{ { "class" "a b c" } } } }
{ "a" "b" "c" } [ html-class? ] with all?
] unit-test
-[
+{
V{
T{ tag
{ name "div" }
}
T{ tag { name "div" } { attributes H{ } } { closing? t } }
}
-] [ "<div class=\"foo and more\"></div>" parse-html
+} [ "<div class=\"foo and more\"></div>" parse-html
"foo" find-by-class-between
] unit-test
-[
+{
0
T{ tag { name "div" } { attributes H{ { "class" "foo bar" } } } }
-] [
+} [
"<div class=\"foo bar\"></div>" parse-html "bar" find-by-class
] unit-test
USING: html.parser kernel tools.test ;
IN: html.parser.tests
-[
+{
V{ T{ tag f "html" H{ } f f } }
-] [ "<html>" parse-html ] unit-test
+} [ "<html>" parse-html ] unit-test
-[
+{
V{ T{ tag f "html" H{ } f t } }
-] [ "</html>" parse-html ] unit-test
+} [ "</html>" parse-html ] unit-test
-[
+{
V{ T{ tag f "a" H{ { "href" "http://factorcode.org/" } } f f } }
-] [ "<a href=\"http://factorcode.org/\">" parse-html ] unit-test
+} [ "<a href=\"http://factorcode.org/\">" parse-html ] unit-test
-[
+{
V{ T{ tag f "a" H{ { "href" "http://factorcode.org/" } } f f } }
-] [ "<a href = \"http://factorcode.org/\" >" parse-html ] unit-test
+} [ "<a href = \"http://factorcode.org/\" >" parse-html ] unit-test
-[
+{
V{
T{
tag
f
}
}
-] [ "<a foo=\"bar's\" baz='\"quux\"' >" parse-html ] unit-test
+} [ "<a foo=\"bar's\" baz='\"quux\"' >" parse-html ] unit-test
-[
+{
V{
T{ tag f "a"
H{
{ "baz" "quux" }
} f f }
}
-] [ "<a href = \"http://factorcode.org/\" foo = bar baz='quux'a=pirsqd >" parse-html ] unit-test
+} [ "<a href = \"http://factorcode.org/\" foo = bar baz='quux'a=pirsqd >" parse-html ] unit-test
-[
+{
V{
T{ tag f "a"
H{
{ "nofollow" "nofollow" }
} f f }
}
-] [ "<a href = \"http://factorcode.org/\" nofollow foo = bar baz='quux'a=pirsqd >" parse-html ] unit-test
+} [ "<a href = \"http://factorcode.org/\" nofollow foo = bar baz='quux'a=pirsqd >" parse-html ] unit-test
-[
+{
V{
T{ tag f "html" H{ } f f }
T{ tag f "head" H{ } f f }
T{ tag f "head" H{ } f t }
T{ tag f "html" H{ } f t }
}
-] [ "<html<head</head</html" parse-html ] unit-test
+} [ "<html<head</head</html" parse-html ] unit-test
-[
+{
V{
T{ tag f "head" H{ } f f }
T{ tag f "title" H{ } f f }
T{ tag f "title" H{ } f t }
T{ tag f "head" H{ } f t }
}
-] [ "<head<title>Spagna</title></head" parse-html ] unit-test
+} [ "<head<title>Spagna</title></head" parse-html ] unit-test
-[
+{
V{
T{ tag
{ name dtd }
}
}
}
-]
+}
[
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Draft//EN\">"
parse-html
] unit-test
-[
+{
V{
T{ tag { name comment } { text "comment" } }
}
-] [
+} [
"<!--comment-->" parse-html
] unit-test
tools.test ;
IN: html.parser.printer.tests
-[
+{
" "
-] [
+} [
[ 5 #indentations set 2 tab-width set tabs >string ] with-scope
] unit-test
-[
+{
" rel='nofollow' href='http://www.google.com'"
-] [
+} [
H{ { "href" "http://www.google.com" } { "rel" "nofollow" } }
[ print-attributes ] with-string-writer
] unit-test
-[
+{
"<p>\n Sup dude!\n <br>\n</p>\n"
-] [
+} [
"<p>Sup dude!<br></p>" parse-html [ prettyprint-html ] with-string-writer
] unit-test
! Wrongly nested tags
-[
+{
"<div>\n <p>\n Sup dude!\n <br>\n </div>\n</p>\n"
-] [
+} [
"<div><p>Sup dude!<br></div></p>" parse-html
[ prettyprint-html ] with-string-writer
] unit-test
strings tools.test html.parser.utils quoting ;
IN: html.parser.utils.tests
-[ "'Rome'" ] [ "Rome" single-quote ] unit-test
-[ "\"Roma\"" ] [ "Roma" double-quote ] unit-test
-[ "'Firenze'" ] [ "Firenze" quote ] unit-test
-[ "\"Caesar's\"" ] [ "Caesar's" quote ] unit-test
-[ "'Italy'" ] [ "Italy" ?quote ] unit-test
-[ "'Italy'" ] [ "'Italy'" ?quote ] unit-test
-[ "\"Italy\"" ] [ "\"Italy\"" ?quote ] unit-test
-[ "Italy" ] [ "Italy" unquote ] unit-test
-[ "Italy" ] [ "'Italy'" unquote ] unit-test
-[ "Italy" ] [ "\"Italy\"" unquote ] unit-test
+{ "'Rome'" } [ "Rome" single-quote ] unit-test
+{ "\"Roma\"" } [ "Roma" double-quote ] unit-test
+{ "'Firenze'" } [ "Firenze" quote ] unit-test
+{ "\"Caesar's\"" } [ "Caesar's" quote ] unit-test
+{ "'Italy'" } [ "Italy" ?quote ] unit-test
+{ "'Italy'" } [ "'Italy'" ?quote ] unit-test
+{ "\"Italy\"" } [ "\"Italy\"" ?quote ] unit-test
+{ "Italy" } [ "Italy" unquote ] unit-test
+{ "Italy" } [ "'Italy'" unquote ] unit-test
+{ "Italy" } [ "\"Italy\"" unquote ] unit-test
[ genre ]
} cleave ;
-[
+{
"BLAH"
"ARTIST"
"ALBUM"
"2009"
"COMMENT"
"Bluegrass"
-] [ "vocab:id3/tests/blah.mp3" mp3>id3 id3-params ] unit-test
+} [ "vocab:id3/tests/blah.mp3" mp3>id3 id3-params ] unit-test
-[
+{
"Anthem of the Trinity"
"Terry Riley"
"Shri Camel"
f
f
"Classical"
-] [ "vocab:id3/tests/blah2.mp3" mp3>id3 id3-params ] unit-test
+} [ "vocab:id3/tests/blah2.mp3" mp3>id3 id3-params ] unit-test
-[
+{
"Stormy Weather"
"Frank Sinatra"
"Night and Day Frank Sinatra"
f
"eng, AG# 08E1C12E"
"Big Band"
-] [ "vocab:id3/tests/blah3.mp3" mp3>id3 id3-params ] unit-test
+} [ "vocab:id3/tests/blah3.mp3" mp3>id3 id3-params ] unit-test
-[ t ]
+{ t }
[ 10000 iota [ synchsafe>sequence sequence>synchsafe ] map [ < ] monotonic? ] unit-test
: declared-num-colors ( gif -- n ) flags>> 3 bits 1 + 2^ ;
: actual-num-colors ( gif -- n ) global-color-table>> length ;
-[ 2 ] [ monochrome.gif actual-num-colors ] unit-test
-[ 2 ] [ monochrome.gif declared-num-colors ] unit-test
+{ 2 } [ monochrome.gif actual-num-colors ] unit-test
+{ 2 } [ monochrome.gif declared-num-colors ] unit-test
-[ 16 ] [ circle.gif actual-num-colors ] unit-test
-[ 16 ] [ circle.gif declared-num-colors ] unit-test
+{ 16 } [ circle.gif actual-num-colors ] unit-test
+{ 16 } [ circle.gif declared-num-colors ] unit-test
-[ 256 ] [ checkmark.gif actual-num-colors ] unit-test
-[ 256 ] [ checkmark.gif declared-num-colors ] unit-test
+{ 256 } [ checkmark.gif actual-num-colors ] unit-test
+{ 256 } [ checkmark.gif declared-num-colors ] unit-test
: >index-stream ( gif -- seq )
[ compressed-bytes>> ]
[ image-descriptor>> first-code-size>> ] bi
gif-lzw-uncompress ;
-[
+{
BV{
0 0 0 0 0 0
1 0 0 0 0 1
1 0 1 1 0 1
1 0 0 0 0 1
}
-] [ monochrome.gif >index-stream ] unit-test
+} [ monochrome.gif >index-stream ] unit-test
-[
+{
BV{
0 1
1 0
}
-] [ alpha.gif >index-stream ] unit-test
+} [ alpha.gif >index-stream ] unit-test
dup (gen-image) <image> swap >>bitmap swap >>dim
RGB >>component-order ubyte-components >>component-type ;
-[ ] [ { 50 50 } gen-image "s" set ] unit-test
-[ ] [ "s" get <image-gadget> "ig" set ] unit-test
+{ } [ { 50 50 } gen-image "s" set ] unit-test
+{ } [ "s" get <image-gadget> "ig" set ] unit-test
"ig" get [
[ t ] [ "ig" get image-gadget-texture single-texture? ] unit-test
] with-grafted-gadget
-[ ] [ "s" get <model> "m" set ] unit-test
-[ ] [ { 150 150 } gen-image "s1" set ] unit-test
-[ ] [ "m" get <image-control> "ic" set ] unit-test
+{ } [ "s" get <model> "m" set ] unit-test
+{ } [ { 150 150 } gen-image "s1" set ] unit-test
+{ } [ "m" get <image-control> "ic" set ] unit-test
"ic" get [
[ t ] [ "ic" get image-gadget-texture single-texture? ] unit-test
[ { 50 50 } ] [ "ic" get texture>> texture-size ] unit-test
base-folder "/" my-uuid "/" _
] "" append-outputs-as ;
-[ t ] [
+{ t } [
get-test-host <imap4ssl> [ duplex-stream? ] with-disposal
] unit-test
-[ t ] [
+{ t } [
get-test-host <imap4ssl> [ capabilities ] with-stream
{ "IMAP4rev1" "UNSELECT" "IDLE" "NAMESPACE" "QUOTA" } swap subset?
] unit-test
-[ "NO" ] [
+{ "NO" } [
[ get-test-host <imap4ssl> [ "dont@exist.com" "foo" login ] with-stream ]
[ ind>> ] recover
] unit-test
-[ "BAD" ] [
+{ "BAD" } [
[ get-test-host <imap4ssl> [ f f login ] with-stream ] [ ind>> ] recover
] unit-test
] imap-test
-[ ] [ \ imap-settings get-global [ ] with-imap-settings ] unit-test
+{ } [ \ imap-settings get-global [ ] with-imap-settings ] unit-test
! Newly created and then selected folder is empty.
[ 0 { } ] [
] imap-test
! Internal date parsing
-[ "Mon, 19 Aug 2013 23:16:36 GMT" ] [
+{ "Mon, 19 Aug 2013 23:16:36 GMT" } [
"19-Aug-2013 23:16:36 +0000" internal-date>timestamp timestamp>rfc822
] unit-test
-[ "19-Aug-2014 23:16:36 GMT" ] [
+{ "19-Aug-2014 23:16:36 GMT" } [
"Mon, 19 Aug 2014 23:16:36 GMT" rfc822>timestamp timestamp>internal-date
] unit-test
tools.test ;
IN: infix.tests
-[ 0 ] [ [infix 0 infix] ] unit-test
-[ 0.5 ] [ [infix 3.0/6 infix] ] unit-test
-[ 1+2/3 ] [ [infix 5/3 infix] ] unit-test
-[ 3 ] [ [infix 2*7%3+1 infix] ] unit-test
-[ 1419857 ] [ [infix 17**5 infix] ] unit-test
-[ 1 ] [ [infix 2-
+{ 0 } [ [infix 0 infix] ] unit-test
+{ 0.5 } [ [infix 3.0/6 infix] ] unit-test
+{ 1+2/3 } [ [infix 5/3 infix] ] unit-test
+{ 3 } [ [infix 2*7%3+1 infix] ] unit-test
+{ 1419857 } [ [infix 17**5 infix] ] unit-test
+{ 1 } [ [infix 2-
1
-5*
0 infix] ] unit-test
-[ 0.0 ] [ [infix sin(0) infix] ] unit-test
-[ 10 ] [ [infix lcm(2,5) infix] ] unit-test
-[ 1.0 ] [ [infix +cos(-0*+3) infix] ] unit-test
+{ 0.0 } [ [infix sin(0) infix] ] unit-test
+{ 10 } [ [infix lcm(2,5) infix] ] unit-test
+{ 1.0 } [ [infix +cos(-0*+3) infix] ] unit-test
-[ f ] [ 2 \ gcd check-word ] unit-test ! multiple return values
-[ f ] [ 1 \ drop check-word ] unit-test ! no return value
-[ f ] [ 1 \ lcm check-word ] unit-test ! takes 2 args
+{ f } [ 2 \ gcd check-word ] unit-test ! multiple return values
+{ f } [ 1 \ drop check-word ] unit-test ! no return value
+{ f } [ 1 \ lcm check-word ] unit-test ! takes 2 args
: qux ( -- x ) 2 ;
-[ t ] [ 0 \ qux check-word ] unit-test
-[ 8 ] [ [infix qux()*3+2 infix] ] unit-test
+{ t } [ 0 \ qux check-word ] unit-test
+{ 8 } [ [infix qux()*3+2 infix] ] unit-test
: foobar ( x -- y ) 1 + ;
-[ t ] [ 1 \ foobar check-word ] unit-test
-[ 4 ] [ [infix foobar(3*5%12) infix] ] unit-test
+{ t } [ 1 \ foobar check-word ] unit-test
+{ 4 } [ [infix foobar(3*5%12) infix] ] unit-test
: stupid_function ( x x x x x -- y ) + + + + ;
-[ t ] [ 5 \ stupid_function check-word ] unit-test
-[ 10 ] [ [infix stupid_function (0, 1, 2, 3, 4) infix] ] unit-test
-
-[ -1 ] [ [let 1 :> a [infix -a infix] ] ] unit-test
-
-[ CHAR: f ] [ [let "foo" :> s [infix s[0] infix] ] ] unit-test
-[ CHAR: r ] [ [let "bar" :> s [infix s[-1] infix] ] ] unit-test
-[ "foo" ] [ [let "foobar" :> s [infix s[0:3] infix] ] ] unit-test
-[ "foo" ] [ [let "foobar" :> s [infix s[:3] infix] ] ] unit-test
-[ "bar" ] [ [let "foobar" :> s [infix s[-3:] infix] ] ] unit-test
-[ "boof" ] [ [let "foobar" :> s [infix s[-3::-1] infix] ] ] unit-test
-[ "foobar" ] [ [let "foobar" :> s [infix s[:] infix] ] ] unit-test
-[ "foa" ] [ [let "foobar" :> s [infix s[::2] infix] ] ] unit-test
-[ "bar" ] [ [let "foobar" :> s [infix s[-3:100] infix] ] ] unit-test
-[ "foobar" ] [ [let "foobar" :> s [infix s[-100:100] infix] ] ] unit-test
-[ "olh" ] [ [let "hello" :> s [infix s[4::-2] infix] ] ] unit-test
-[ "rb" ] [ [let "foobar" :> s [infix s[:1:-2] infix] ] ] unit-test
-[ "foa" ] [ [let "foobar" :> s [infix s[:-1:2] infix] ] ] unit-test
-[ "rbo" ] [ [let "foobar" :> s [infix s[::-2] infix] ] ] unit-test
-[ "rbo" ] [ [let "foobar" :> s [infix s[:0:-2] infix] ] ] unit-test
-[ "rb" ] [ [let "foobar" :> s [infix s[:-5:-2] infix] ] ] unit-test
+{ t } [ 5 \ stupid_function check-word ] unit-test
+{ 10 } [ [infix stupid_function (0, 1, 2, 3, 4) infix] ] unit-test
+
+{ -1 } [ [let 1 :> a [infix -a infix] ] ] unit-test
+
+{ CHAR: f } [ [let "foo" :> s [infix s[0] infix] ] ] unit-test
+{ CHAR: r } [ [let "bar" :> s [infix s[-1] infix] ] ] unit-test
+{ "foo" } [ [let "foobar" :> s [infix s[0:3] infix] ] ] unit-test
+{ "foo" } [ [let "foobar" :> s [infix s[:3] infix] ] ] unit-test
+{ "bar" } [ [let "foobar" :> s [infix s[-3:] infix] ] ] unit-test
+{ "boof" } [ [let "foobar" :> s [infix s[-3::-1] infix] ] ] unit-test
+{ "foobar" } [ [let "foobar" :> s [infix s[:] infix] ] ] unit-test
+{ "foa" } [ [let "foobar" :> s [infix s[::2] infix] ] ] unit-test
+{ "bar" } [ [let "foobar" :> s [infix s[-3:100] infix] ] ] unit-test
+{ "foobar" } [ [let "foobar" :> s [infix s[-100:100] infix] ] ] unit-test
+{ "olh" } [ [let "hello" :> s [infix s[4::-2] infix] ] ] unit-test
+{ "rb" } [ [let "foobar" :> s [infix s[:1:-2] infix] ] ] unit-test
+{ "foa" } [ [let "foobar" :> s [infix s[:-1:2] infix] ] ] unit-test
+{ "rbo" } [ [let "foobar" :> s [infix s[::-2] infix] ] ] unit-test
+{ "rbo" } [ [let "foobar" :> s [infix s[:0:-2] infix] ] ] unit-test
+{ "rb" } [ [let "foobar" :> s [infix s[:-5:-2] infix] ] ] unit-test
INFIX:: foo ( x y -- z ) x**2-abs(y);
USING: infix.ast infix.parser infix.tokenizer tools.test ;
IN: infix.parser.tests
-[ T{ ast-number { value 1 } } ] [ "1" build-infix-ast ] unit-test
-[ T{ ast-negation f T{ ast-number { value 1 } } } ]
+{ T{ ast-number { value 1 } } } [ "1" build-infix-ast ] unit-test
+{ T{ ast-negation f T{ ast-number { value 1 } } } }
[ "-1" build-infix-ast ] unit-test
-[ T{ ast-op
+{ T{ ast-op
{ left
T{ ast-op
{ left T{ ast-number { value 1 } } }
}
{ right T{ ast-number { value 4 } } }
{ op "+" }
-} ] [ "1+2+4" build-infix-ast ] unit-test
+} } [ "1+2+4" build-infix-ast ] unit-test
-[ T{ ast-op
+{ T{ ast-op
{ left T{ ast-number { value 1 } } }
{ right
T{ ast-op
}
}
{ op "+" }
-} ] [ "1+2*3" build-infix-ast ] unit-test
+} } [ "1+2*3" build-infix-ast ] unit-test
-[ T{ ast-op
+{ T{ ast-op
{ left T{ ast-number { value 1 } } }
{ right T{ ast-number { value 2 } } }
{ op "+" }
-} ] [ "(1+2)" build-infix-ast ] unit-test
+} } [ "(1+2)" build-infix-ast ] unit-test
-[ T{ ast-local { name "foo" } } ] [ "foo" build-infix-ast ] unit-test
+{ T{ ast-local { name "foo" } } } [ "foo" build-infix-ast ] unit-test
[ "-" build-infix-ast ] must-fail
-[ T{ ast-function
+{ T{ ast-function
{ name "foo" }
{ arguments
V{
}
}
}
-} ] [ "foo (1+ 2,2%3) " build-infix-ast ] unit-test
+} } [ "foo (1+ 2,2%3) " build-infix-ast ] unit-test
-[ T{ ast-op
+{ T{ ast-op
{ left
T{ ast-op
{ left
}
{ right T{ ast-number { value 2 } } }
{ op "/" }
-} ] [ "(bar() + baz[2/ 3+4 ] )/2" build-infix-ast ] unit-test
+} } [ "(bar() + baz[2/ 3+4 ] )/2" build-infix-ast ] unit-test
-[ T{ ast-op
+{ T{ ast-op
{ left T{ ast-number { value 1 } } }
{ right
T{ ast-op
}
}
{ op "+" }
-} ] [ "1\n+\n2\r/\t3" build-infix-ast ] unit-test
+} } [ "1\n+\n2\r/\t3" build-infix-ast ] unit-test
-[ T{ ast-negation
+{ T{ ast-negation
{ term
T{ ast-function
{ name "foo" }
}
}
}
-} ] [ "-foo(+2,-3)" build-infix-ast ] unit-test
+} } [ "-foo(+2,-3)" build-infix-ast ] unit-test
-[ T{ ast-array
+{ T{ ast-array
{ name "arr" }
{ index
T{ ast-op
{ op "/" }
}
}
-} ] [ "+arr[-(foo(2)+-1)/3]" build-infix-ast ] unit-test
+} } [ "+arr[-(foo(2)+-1)/3]" build-infix-ast ] unit-test
[ "foo bar baz" build-infix-ast ] must-fail
[ "1+2/4+" build-infix-ast ] must-fail
USING: infix.ast infix.tokenizer tools.test ;
IN: infix.tokenizer.tests
-[ V{ T{ ast-number f 1 } } ] [ "1" tokenize-infix ] unit-test
-[ V{ T{ ast-number f 1.02 } CHAR: * T{ ast-number f 3 } } ] [ "1.02*3" tokenize-infix ] unit-test
-[ V{ T{ ast-number f 3 } CHAR: / CHAR: ( T{ ast-number f 3 } CHAR: + T{ ast-number f 4 } CHAR: ) } ]
+{ V{ T{ ast-number f 1 } } } [ "1" tokenize-infix ] unit-test
+{ V{ T{ ast-number f 1.02 } CHAR: * T{ ast-number f 3 } } } [ "1.02*3" tokenize-infix ] unit-test
+{ V{ T{ ast-number f 3 } CHAR: / CHAR: ( T{ ast-number f 3 } CHAR: + T{ ast-number f 4 } CHAR: ) } }
[ "3/(3+4)" tokenize-infix ] unit-test
-[ V{ "foo" CHAR: ( "x" CHAR: , "y" CHAR: , "z" CHAR: ) } ] [ "foo(x,y,z)" tokenize-infix ] unit-test
-[ V{ "arr" CHAR: [ "x" CHAR: + T{ ast-number f 3 } CHAR: ] } ]
+{ V{ "foo" CHAR: ( "x" CHAR: , "y" CHAR: , "z" CHAR: ) } } [ "foo(x,y,z)" tokenize-infix ] unit-test
+{ V{ "arr" CHAR: [ "x" CHAR: + T{ ast-number f 3 } CHAR: ] } }
[ "arr[x+3]" tokenize-infix ] unit-test
[ "1.0.4" tokenize-infix ] must-fail
-[ V{ CHAR: + CHAR: ] T{ ast-number f 3.4 } CHAR: , "bar" } ]
+{ V{ CHAR: + CHAR: ] T{ ast-number f 3.4 } CHAR: , "bar" } }
[ "+]3.4,bar" tokenize-infix ] unit-test
-[ V{ "baz_34c" } ] [ "baz_34c" tokenize-infix ] unit-test
-[ V{ T{ ast-number f 34 } "c_baz" } ] [ "34c_baz" tokenize-infix ] unit-test
-[ V{ CHAR: ( T{ ast-number f 1 } CHAR: + T{ ast-number f 2 } CHAR: ) } ]
+{ V{ "baz_34c" } } [ "baz_34c" tokenize-infix ] unit-test
+{ V{ T{ ast-number f 34 } "c_baz" } } [ "34c_baz" tokenize-infix ] unit-test
+{ V{ CHAR: ( T{ ast-number f 1 } CHAR: + T{ ast-number f 2 } CHAR: ) } }
[ "(1+2)" tokenize-infix ] unit-test
-[ V{ T{ ast-number f 1 } CHAR: + T{ ast-number f 2 } CHAR: / T{ ast-number f 3 } } ]
+{ V{ T{ ast-number f 1 } CHAR: + T{ ast-number f 2 } CHAR: / T{ ast-number f 3 } } }
[ "1\n+\r2\t/ 3" tokenize-infix ] unit-test
IN: ini-file.tests
-[ H{ } ] [ "" string>ini ] unit-test
+{ H{ } } [ "" string>ini ] unit-test
-[ H{ { "section" H{ } } } ] [ "[section]" string>ini ] unit-test
+{ H{ { "section" H{ } } } } [ "[section]" string>ini ] unit-test
-[ H{ { "section" H{ } } } ] [ "[\"section\" ]" string>ini ] unit-test
+{ H{ { "section" H{ } } } } [ "[\"section\" ]" string>ini ] unit-test
-[ H{ { " some name with spaces " H{ } } } ]
+{ H{ { " some name with spaces " H{ } } } }
[ "[ \" some name with spaces \"]" string>ini ] unit-test
-[ H{ { "[]" H{ } } } ] [ "[\\[\\]]" string>ini ] unit-test
+{ H{ { "[]" H{ } } } } [ "[\\[\\]]" string>ini ] unit-test
-[ H{ { "foo" "bar" } } ] [ "foo=bar" string>ini ] unit-test
+{ H{ { "foo" "bar" } } } [ "foo=bar" string>ini ] unit-test
-[ H{ { "foo" "bar" } { "baz" "quz" } } ]
+{ H{ { "foo" "bar" } { "baz" "quz" } } }
[ "foo=bar\nbaz= quz" string>ini ] unit-test
-[ H{ { "section" H{ { "foo" "abc def" } } } } ]
+{ H{ { "section" H{ { "foo" "abc def" } } } } }
[
"""
[section]
""" string>ini
] unit-test
-[ H{ { "section" H{ { "foo" "abc def" } } } } ]
+{ H{ { "section" H{ { "foo" "abc def" } } } } }
[
"""
[section]
""" string>ini
] unit-test
-[ H{ { "section" H{ { "foo" "abc def" } } } } ]
+{ H{ { "section" H{ { "foo" "abc def" } } } } }
[
"""
[section]
""" string>ini
] unit-test
-[ H{ { "section" H{ { "foo" "abc def" } } } } ]
+{ H{ { "section" H{ { "foo" "abc def" } } } } }
[
"""
[section] foo = "abc def"
""" string>ini
] unit-test
-[ H{ { "section" H{ { "foo" "abc def" } } } } ]
+{ H{ { "section" H{ { "foo" "abc def" } } } } }
[
"""
[section] foo = abc \\
""" string>ini
] unit-test
-[ H{ { "section" H{ { "foo" "" } } } } ]
+{ H{ { "section" H{ { "foo" "" } } } } }
[
"""
[section]
""" string>ini
] unit-test
-[ H{ { "section" H{ { "foo" "" } } } } ]
+{ H{ { "section" H{ { "foo" "" } } } } }
[
"""
[section]
""" string>ini
] unit-test
-[ H{ { "" H{ { "" "" } } } } ]
+{ H{ { "" H{ { "" "" } } } } }
[
"""
[]
""" string>ini
] unit-test
-[ H{ { "owner" H{ { "name" "John Doe" }
+{ H{ { "owner" H{ { "name" "John Doe" }
{ "organization" "Acme Widgets Inc." } } }
{ "database" H{ { "server" "192.0.2.62" }
{ "port" "143" }
- { "file" "payroll.dat" } } } } ]
+ { "file" "payroll.dat" } } } } }
[
"""
; last modified 1 April 2001 by John Doe
""" string>ini
] unit-test
-[ H{ { "a long section name"
- H{ { "a long key name" "a long value name" } } } } ]
+{ H{ { "a long section name"
+ H{ { "a long key name" "a long value name" } } } } }
[
"""
[a long section name ]
""" string>ini
] unit-test
-[ H{ { "key with \n esc\ape \r codes \""
- "value with \t esc\ape codes" } } ]
+{ H{ { "key with \n esc\ape \r codes \""
+ "value with \t esc\ape codes" } } }
[
"""
key with \\n esc\\ape \\r codes \\\" = value with \\t esc\\ape codes
] unit-test
-[ """key with \\n esc\\ape \\r codes \\\"=value with \\t esc\\ape codes\n""" ]
+{ """key with \\n esc\\ape \\r codes \\\"=value with \\t esc\\ape codes\n""" }
[
H{ { "key with \n esc\ape \r codes \""
"value with \t esc\ape codes" } } ini>string
USING: tools.test io.binary.fast ;
IN: io.binary.fast.tests
-[ 0x0102 ] [ B{ 01 02 } 2be> ] unit-test
-[ 0x01020304 ] [ B{ 01 02 03 04 } 4be> ] unit-test
-[ 0x0102030405060708 ] [ B{ 01 02 03 04 05 06 07 08 } 8be> ] unit-test
+{ 0x0102 } [ B{ 01 02 } 2be> ] unit-test
+{ 0x01020304 } [ B{ 01 02 03 04 } 4be> ] unit-test
+{ 0x0102030405060708 } [ B{ 01 02 03 04 05 06 07 08 } 8be> ] unit-test
-[ 0x0102 ] [ B{ 02 01 } 2le> ] unit-test
-[ 0x01020304 ] [ B{ 04 03 02 01 } 4le> ] unit-test
-[ 0x0102030405060708 ] [ B{ 08 07 06 05 04 03 02 01 } 8le> ] unit-test
+{ 0x0102 } [ B{ 02 01 } 2le> ] unit-test
+{ 0x01020304 } [ B{ 04 03 02 01 } 4le> ] unit-test
+{ 0x0102030405060708 } [ B{ 08 07 06 05 04 03 02 01 } 8le> ] unit-test
{ 0x04030201 } [ B{ 1 2 3 4 } signed-le> ] unit-test
{ 0x01020304 } [ B{ 1 2 3 4 } signed-be> ] unit-test
IN: io.encodings.detect.tests
! UTF encodings with BOMs
-[ utf16be ] [ HEX{ FEFF 0031 0032 0033 } detect-byte-array ] unit-test
-[ utf16le ] [ HEX{ FFFE 3100 3200 3300 } detect-byte-array ] unit-test
-[ utf32be ] [ HEX{ 0000FEFF 00000031 00000032 00000033 } detect-byte-array ] unit-test
-[ utf32le ] [ HEX{ FFFE0000 31000000 32000000 33000000 } detect-byte-array ] unit-test
-[ utf8 ] [ HEX{ EF BB BF 31 32 33 } detect-byte-array ] unit-test
+{ utf16be } [ HEX{ FEFF 0031 0032 0033 } detect-byte-array ] unit-test
+{ utf16le } [ HEX{ FFFE 3100 3200 3300 } detect-byte-array ] unit-test
+{ utf32be } [ HEX{ 0000FEFF 00000031 00000032 00000033 } detect-byte-array ] unit-test
+{ utf32le } [ HEX{ FFFE0000 31000000 32000000 33000000 } detect-byte-array ] unit-test
+{ utf8 } [ HEX{ EF BB BF 31 32 33 } detect-byte-array ] unit-test
! XML prolog
-[ utf8 ]
+{ utf8 }
[ """<?xml version="1.0"?>""" >byte-array detect-byte-array ]
unit-test
-[ utf8 ]
+{ utf8 }
[ """<?xml version="1.0" encoding="UTF-8"?>""" >byte-array detect-byte-array ]
unit-test
-[ latin1 ]
+{ latin1 }
[ """<?xml version='1.0' encoding='ISO-8859-1'?>""" >byte-array detect-byte-array ]
unit-test
-[ latin1 ]
+{ latin1 }
[ """<?xml version='1.0' encoding="ISO-8859-1" """ >byte-array detect-byte-array ]
unit-test
! Default to utf8 if decoding succeeds and there are no nulls
-[ utf8 ] [ HEX{ } detect-byte-array ] unit-test
-[ utf8 ] [ HEX{ 31 32 33 } detect-byte-array ] unit-test
-[ utf8 ] [ HEX{ 31 32 C2 A0 33 } detect-byte-array ] unit-test
-[ latin1 ] [ HEX{ 31 32 A0 33 } detect-byte-array ] unit-test
-[ koi8-r ] [
+{ utf8 } [ HEX{ } detect-byte-array ] unit-test
+{ utf8 } [ HEX{ 31 32 33 } detect-byte-array ] unit-test
+{ utf8 } [ HEX{ 31 32 C2 A0 33 } detect-byte-array ] unit-test
+{ latin1 } [ HEX{ 31 32 A0 33 } detect-byte-array ] unit-test
+{ koi8-r } [
koi8-r default-8bit-encoding [
HEX{ 31 32 A0 33 } detect-byte-array
] with-variable
] unit-test
-[ binary ] [ HEX{ 31 32 33 C2 A0 00 } detect-byte-array ] unit-test
-[ binary ] [ HEX{ 31 32 33 C2 A0 00 30 } detect-byte-array ] unit-test
+{ binary } [ HEX{ 31 32 33 C2 A0 00 } detect-byte-array ] unit-test
+{ binary } [ HEX{ 31 32 33 C2 A0 00 30 } detect-byte-array ] unit-test
namespaces sequences strings tools.test ;
IN: io.streams.peek.tests
-[ CHAR: a ]
+{ CHAR: a }
[ "abc" <string-reader> <peek-stream> stream-read1 ] unit-test
-[ CHAR: a ]
+{ CHAR: a }
[ "abc" <string-reader> <peek-stream> stream-peek1 ] unit-test
-[ f ]
+{ f }
[ "" <string-reader> <peek-stream> stream-peek1 ] unit-test
-[ CHAR: a ]
+{ CHAR: a }
[ "abc" <string-reader> <peek-stream> stream-peek1 ] unit-test
-[ "ab" 99 ]
+{ "ab" 99 }
[ "abc" <string-reader> <peek-stream> "c" swap stream-read-until ] unit-test
-[ "ab" f ]
+{ "ab" f }
[ "ab" <string-reader> <peek-stream> "c" swap stream-read-until ] unit-test
-[ CHAR: a ]
+{ CHAR: a }
[
"abc" <string-reader> <peek-stream>
[ stream-peek1 drop ]
[ stream-peek1 ] bi
] unit-test
-[ "ab" ]
+{ "ab" }
[
"abc" <string-reader> <peek-stream>
2 swap stream-peek
] unit-test
-[ "ab" ]
+{ "ab" }
[
"abc" <string-reader> <peek-stream>
2 over stream-peek drop
2 swap stream-peek
] unit-test
-[
+{
{
B{ 97 98 99 100 }
B{ 97 98 99 100 101 102 }
B{ 105 106 107 108 109 110 111 112 }
B{ 105 106 107 108 109 110 111 112 113 114 }
}
-] [
+} [
[
"abcdefghijklmnopqrstuvwxyz" >byte-array binary <byte-reader> <peek-stream>
4 over stream-peek ,
] { } make
] unit-test
-[
+{
{
"abcd"
"abcdef"
"ijklmnop"
"ijklmnopqr"
}
-]
+}
[
[
"abcdefghijklmnopqrstuvwxyz" >byte-array ascii <byte-reader> <peek-stream>
] { } make
] unit-test
-[
+{
{
B{ 0 1 2 3 }
B{ 0 1 2 3 4 5 }
B{ 8 9 10 11 12 13 14 15 }
B{ 8 9 10 11 12 13 14 15 16 17 }
}
-]
+}
[
[
[
USING: jamshred.oint tools.test ;
IN: jamshred.oint-tests
-[ { 0 -1 -1 } ] [ { 0 1 -1 } { 0 -1 0 } reflect ] unit-test
-[ { 0 1 0 } ] [ { 1 1 0 } { 1 0 0 } proj-perp ] unit-test
-[ { 1 0 0 } ] [ { 1 1 0 } { 0 1 0 } proj-perp ] unit-test
-[ { 1/2 -1/2 0 } ] [ { 1 0 0 } { 1 1 0 } proj-perp ] unit-test
-[ { -1/2 1/2 0 } ] [ { 0 1 0 } { 1 1 0 } proj-perp ] unit-test
+{ { 0 -1 -1 } } [ { 0 1 -1 } { 0 -1 0 } reflect ] unit-test
+{ { 0 1 0 } } [ { 1 1 0 } { 1 0 0 } proj-perp ] unit-test
+{ { 1 0 0 } } [ { 1 1 0 } { 0 1 0 } proj-perp ] unit-test
+{ { 1/2 -1/2 0 } } [ { 1 0 0 } { 1 1 0 } proj-perp ] unit-test
+{ { -1/2 1/2 0 } } [ { 0 1 0 } { 1 1 0 } proj-perp ] unit-test
: test-segment-oint ( -- oint )
{ 0 0 0 } { 0 0 -1 } { 0 1 0 } { -1 0 0 } <oint> ;
-[ { -1 0 0 } ] [ test-segment-oint { 1 0 0 } vector-to-centre ] unit-test
-[ { 1 0 0 } ] [ test-segment-oint { -1 0 0 } vector-to-centre ] unit-test
-[ { 0 -1 0 } ] [ test-segment-oint { 0 1 0 } vector-to-centre ] unit-test
-[ { 0 1 0 } ] [ test-segment-oint { 0 -1 0 } vector-to-centre ] unit-test
-[ { -1 0 0 } ] [ test-segment-oint { 1 0 -1 } vector-to-centre ] unit-test
-[ { 1 0 0 } ] [ test-segment-oint { -1 0 -1 } vector-to-centre ] unit-test
-[ { 0 -1 0 } ] [ test-segment-oint { 0 1 -1 } vector-to-centre ] unit-test
-[ { 0 1 0 } ] [ test-segment-oint { 0 -1 -1 } vector-to-centre ] unit-test
+{ { -1 0 0 } } [ test-segment-oint { 1 0 0 } vector-to-centre ] unit-test
+{ { 1 0 0 } } [ test-segment-oint { -1 0 0 } vector-to-centre ] unit-test
+{ { 0 -1 0 } } [ test-segment-oint { 0 1 0 } vector-to-centre ] unit-test
+{ { 0 1 0 } } [ test-segment-oint { 0 -1 0 } vector-to-centre ] unit-test
+{ { -1 0 0 } } [ test-segment-oint { 1 0 -1 } vector-to-centre ] unit-test
+{ { 1 0 0 } } [ test-segment-oint { -1 0 -1 } vector-to-centre ] unit-test
+{ { 0 -1 0 } } [ test-segment-oint { 0 1 -1 } vector-to-centre ] unit-test
+{ { 0 1 0 } } [ test-segment-oint { 0 -1 -1 } vector-to-centre ] unit-test
: simplest-straight-ahead ( -- oint segment )
{ 0 0 0 } { 0 0 -1 } { 0 1 0 } { -1 0 0 } <oint>
initial-segment ;
-[ { 0.0 0.0 0.0 } ] [ simplest-straight-ahead sideways-heading ] unit-test
-[ { 0.0 0.0 0.0 } ] [ simplest-straight-ahead sideways-relative-location ] unit-test
+{ { 0.0 0.0 0.0 } } [ simplest-straight-ahead sideways-heading ] unit-test
+{ { 0.0 0.0 0.0 } } [ simplest-straight-ahead sideways-relative-location ] unit-test
: simple-collision-up ( -- oint segment )
{ 0 0 0 } { 0 1 0 } { 0 0 1 } { -1 0 0 } <oint>
initial-segment ;
-[ { 0.0 1.0 0.0 } ] [ simple-collision-up sideways-heading ] unit-test
-[ { 0.0 0.0 0.0 } ] [ simple-collision-up sideways-relative-location ] unit-test
-[ { 0.0 1.0 0.0 } ]
+{ { 0.0 1.0 0.0 } } [ simple-collision-up sideways-heading ] unit-test
+{ { 0.0 0.0 0.0 } } [ simple-collision-up sideways-relative-location ] unit-test
+{ { 0.0 1.0 0.0 } }
[ simple-collision-up collision-vector 0 0 0 3array v+ ] unit-test
USING: koszul tools.test kernel sequences assocs namespaces ;
IN: koszul.tests
-[
+{
{ V{ { } } V{ { 1 } } V{ { 2 3 } { 7 8 } } V{ { 4 5 6 } } }
-] [
+} [
{ { 1 } { 2 3 } { 4 5 6 } { 7 8 } { } } graded
] unit-test
SYMBOLS: x1 x2 x3 x4 x5 x6 z1 z2 ;
-[ H{ { { x1 } 3 } } ] [ x1 3 wedge ] unit-test
+{ H{ { { x1 } 3 } } } [ x1 3 wedge ] unit-test
-[ H{ { { x1 } 3 } { { x2 } 4 } } ]
+{ H{ { { x1 } 3 } { { x2 } 4 } } }
[ x1 3 wedge x2 4 wedge alt+ ] unit-test
x1 x2 wedge z1 d=
x3 x4 wedge z2 d=
-[ H{ { { x1 x2 z2 } 1 } { { x3 x4 z1 } -1 } } ]
+{ H{ { { x1 x2 z2 } 1 } { { x3 x4 z1 } -1 } } }
[ z1 z2 wedge d ] unit-test
! Unimodular example
y z wedge x d=
z x wedge y d=
-[ { 1 0 0 1 } ] [ { x y z } graded-betti ] unit-test
+{ { 1 0 0 1 } } [ { x y z } graded-betti ] unit-test
! Solvable example
boundaries get clear-assoc
x y wedge y d=
-[ { 1 1 0 } ] [ { x y } graded-betti ] unit-test
+{ { 1 1 0 } } [ { x y } graded-betti ] unit-test
! Nilpotent example
boundaries get clear-assoc
x1 x2 wedge x3 x4 wedge alt+ z d=
-[ { 1 4 5 5 4 1 } ]
+{ { 1 4 5 5 4 1 } }
[ { x1 x2 x3 x4 z } graded-betti ] unit-test
-[ { { 1 4 5 0 0 } { 0 0 5 4 1 } } ]
+{ { { 1 4 5 0 0 } { 0 0 5 4 1 } } }
[ { x1 x2 x3 x4 } { z } bigraded-betti ] unit-test
! Free 2-step on 4 generators
x2 x4 wedge e24 d=
x3 x4 wedge e34 d=
-[ { 1 4 20 56 84 90 84 56 20 4 1 } ]
+{ { 1 4 20 56 84 90 84 56 20 4 1 } }
[ { x1 x2 x3 x4 e12 e13 e14 e23 e24 e34 } graded-betti ]
unit-test
! Make sure this works
-[ ] [ e12 d alt. ] unit-test
+{ } [ e12 d alt. ] unit-test
-[ ] [
+{ } [
{ x1 x2 x3 x4 x5 x6 } { w z }
bigraded-laplacian-kernel bigraded-basis.
] unit-test
! Don't write code like this
: lint1 ( obj -- ) [ "hi" print ] [ ] if ; ! when
-[ { { lint1 { [ [ ] if ] } } } ] [ \ lint1 lint-word ] unit-test
+{ { { lint1 { [ [ ] if ] } } } } [ \ lint1 lint-word ] unit-test
! : lint2 ( a b -- b a b ) dup -rot ; ! tuck
: lint3 ( seq -- seq ) [ 0 swap nth 1 + ] map ;
-[ { { lint3 { [ 0 swap nth ] } } } ] [ \ lint3 lint-word ] unit-test
+{ { { lint3 { [ 0 swap nth ] } } } } [ \ lint3 lint-word ] unit-test
! See http://factorcode.org/license.txt for BSD license.
USING: alien.llvm io.pathnames llvm.invoker llvm.reader tools.test ;
-[ 3 ] [
+{ 3 } [
<< "resource:extra/llvm/reader/add.bc" install-bc >> 1 2 add
] unit-test
! See http://factorcode.org/license.txt for BSD license.
USING: destructors llvm.jit llvm.wrappers tools.test ;
-[ ] [ "test" <module> "test" add-module "test" remove-module ] unit-test
+{ } [ "test" <module> "test" add-module "test" remove-module ] unit-test
! See http://factorcode.org/license.txt for BSD license.
USING: kernel llvm.types sequences tools.test ;
-[ T{ integer f 32 } ] [ " i32 " parse-type ] unit-test
-[ float ] [ " float " parse-type ] unit-test
-[ T{ pointer f f x86_fp80 } ] [ " x86_fp80 * " parse-type ] unit-test
-[ T{ vector f f 4 T{ integer f 32 } } ] [ " < 4 x i32 > " parse-type ] unit-test
-[ T{ struct f f { float double } f } ] [ TYPE: { float , double } ; ] unit-test
-[ T{ array f f 0 float } ] [ TYPE: [ 0 x float ] ; ] unit-test
+{ T{ integer f 32 } } [ " i32 " parse-type ] unit-test
+{ float } [ " float " parse-type ] unit-test
+{ T{ pointer f f x86_fp80 } } [ " x86_fp80 * " parse-type ] unit-test
+{ T{ vector f f 4 T{ integer f 32 } } } [ " < 4 x i32 > " parse-type ] unit-test
+{ T{ struct f f { float double } f } } [ TYPE: { float , double } ; ] unit-test
+{ T{ array f f 0 float } } [ TYPE: [ 0 x float ] ; ] unit-test
-[ label void metadata ]
+{ label void metadata }
[ [ " label " " void " " metadata " ] [ parse-type ] each ] unit-test
-[ T{ function f f float { float float } t } ]
+{ T{ function f f float { float float } t } }
[ TYPE: float ( float , float , ... ) ; ] unit-test
-[ T{ struct f f { float TYPE: i32 (i32)* ; } t } ]
+{ T{ struct f f { float TYPE: i32 (i32)* ; } t } }
[ TYPE: < { float, i32 (i32)* } > ; ] unit-test
-[ t ] [ TYPE: i32 ; TYPE: i32 ; [ >tref ] same? ] unit-test
-[ t ] [ TYPE: i32 * ; TYPE: i32 * ; [ >tref ] same? ] unit-test
+{ t } [ TYPE: i32 ; TYPE: i32 ; [ >tref ] same? ] unit-test
+{ t } [ TYPE: i32 * ; TYPE: i32 * ; [ >tref ] same? ] unit-test
-[ TYPE: i32 ; ] [ TYPE: i32 ; >tref tref> ] unit-test
-[ TYPE: float ; ] [ TYPE: float ; >tref tref> ] unit-test
-[ TYPE: double ; ] [ TYPE: double ; >tref tref> ] unit-test
-[ TYPE: x86_fp80 ; ] [ TYPE: x86_fp80 ; >tref tref> ] unit-test
-[ TYPE: fp128 ; ] [ TYPE: fp128 ; >tref tref> ] unit-test
-[ TYPE: ppc_fp128 ; ] [ TYPE: ppc_fp128 ; >tref tref> ] unit-test
-[ TYPE: opaque ; ] [ TYPE: opaque ; >tref tref> ] unit-test
-[ TYPE: label ; ] [ TYPE: label ; >tref tref> ] unit-test
-[ TYPE: void ; ] [ TYPE: void ; >tref tref> ] unit-test
-[ TYPE: i32* ; ] [ TYPE: i32* ; >tref tref> ] unit-test
-[ TYPE: < 2 x i32 > ; ] [ TYPE: < 2 x i32 > ; >tref tref> ] unit-test
-[ TYPE: [ 0 x i32 ] ; ] [ TYPE: [ 0 x i32 ] ; >tref tref> ] unit-test
-[ TYPE: { i32, i32 } ; ] [ TYPE: { i32, i32 } ; >tref tref> ] unit-test
-[ TYPE: < { i32, i32 } > ; ] [ TYPE: < { i32, i32 } > ; >tref tref> ] unit-test
-[ TYPE: i32 ( i32 ) ; ] [ TYPE: i32 ( i32 ) ; >tref tref> ] unit-test
-[ TYPE: \1* ; ] [ TYPE: \1* ; >tref tref> ] unit-test
-[ TYPE: { i32, \2* } ; ] [ TYPE: { i32, \2* } ; >tref tref> ] unit-test
+{ TYPE: i32 ; } [ TYPE: i32 ; >tref tref> ] unit-test
+{ TYPE: float ; } [ TYPE: float ; >tref tref> ] unit-test
+{ TYPE: double ; } [ TYPE: double ; >tref tref> ] unit-test
+{ TYPE: x86_fp80 ; } [ TYPE: x86_fp80 ; >tref tref> ] unit-test
+{ TYPE: fp128 ; } [ TYPE: fp128 ; >tref tref> ] unit-test
+{ TYPE: ppc_fp128 ; } [ TYPE: ppc_fp128 ; >tref tref> ] unit-test
+{ TYPE: opaque ; } [ TYPE: opaque ; >tref tref> ] unit-test
+{ TYPE: label ; } [ TYPE: label ; >tref tref> ] unit-test
+{ TYPE: void ; } [ TYPE: void ; >tref tref> ] unit-test
+{ TYPE: i32* ; } [ TYPE: i32* ; >tref tref> ] unit-test
+{ TYPE: < 2 x i32 > ; } [ TYPE: < 2 x i32 > ; >tref tref> ] unit-test
+{ TYPE: [ 0 x i32 ] ; } [ TYPE: [ 0 x i32 ] ; >tref tref> ] unit-test
+{ TYPE: { i32, i32 } ; } [ TYPE: { i32, i32 } ; >tref tref> ] unit-test
+{ TYPE: < { i32, i32 } > ; } [ TYPE: < { i32, i32 } > ; >tref tref> ] unit-test
+{ TYPE: i32 ( i32 ) ; } [ TYPE: i32 ( i32 ) ; >tref tref> ] unit-test
+{ TYPE: \1* ; } [ TYPE: \1* ; >tref tref> ] unit-test
+{ TYPE: { i32, \2* } ; } [ TYPE: { i32, \2* } ; >tref tref> ] unit-test
! See http://factorcode.org/license.txt for BSD license.
USING: destructors kernel llvm.wrappers sequences tools.test vocabs ;
-[ ] [ "test" <module> dispose ] unit-test
-[ ] [ "test" <module> <provider> dispose ] unit-test
-[ ] [ "llvm.jit" vocabs member? [ "test" <module> <provider> <engine> dispose ] unless ] unit-test
+{ } [ "test" <module> dispose ] unit-test
+{ } [ "test" <module> <provider> dispose ] unit-test
+{ } [ "llvm.jit" vocabs member? [ "test" <module> <provider> <engine> dispose ] unless ] unit-test
math.vectors ;
IN: machine-learning.rebalancing.tests
-[ t ] [
+{ t } [
{ 1 1 1 2 } [ [ number>text ] map ] [ ] bi
100,000 balance-labels nip
histogram values first2 - abs 3,000 <
] unit-test
-[ t ] [
+{ t } [
{ 1 1 1 2 } [ [ number>text ] map ] [ ] bi
{ 1/10 9/10 } 100,000 skew-labels nip
histogram values { 10,000 90,000 } -.05 v~
namespaces sequences system tools.test ;
IN: mason.child.tests
-[ { "nmake" "/f" "nmakefile" "x86-32" } ] [
+{ { "nmake" "/f" "nmakefile" "x86-32" } } [
H{
{ target-os windows }
{ target-cpu x86.32 }
} [ mason-child-make-cmd ] with-variables
] unit-test
-[ { "make" "macosx-x86-32" } ] [
+{ { "make" "macosx-x86-32" } } [
H{
{ target-os macosx }
{ target-cpu x86.32 }
[ [ "Hi" print ] [ drop 3 ] [ 4 ] recover-else ] must-infer
-[ 4 ] [ [ "Hi" print ] [ drop 3 ] [ 4 ] recover-else ] unit-test
+{ 4 } [ [ "Hi" print ] [ drop 3 ] [ 4 ] recover-else ] unit-test
-[ 3 ] [ [ "Hi" throw ] [ drop 3 ] [ 4 ] recover-else ] unit-test
+{ 3 } [ [ "Hi" throw ] [ drop 3 ] [ 4 ] recover-else ] unit-test
-[ "A" ] [
+{ "A" } [
{
{ [ 3 throw ] [ { "X" "Y" "Z" "A" } nth ] }
[ "B" ]
} recover-cond
] unit-test
-[ "B" ] [
+{ "B" } [
{
{ [ ] [ ] }
[ "B" ]
namespaces calendar tools.test io.files
io.files.temp io.encodings.utf8 sequences ;
-[ "00:01:02" ] [ 62,000,000,000 nanos>time ] unit-test
+{ "00:01:02" } [ 62,000,000,000 nanos>time ] unit-test
-[ t ] [
+{ t } [
[
"/home/bobby/builds" builds-dir set
T{ timestamp
"/home/bobby/builds/2008-09-11-12-23" head?
] unit-test
-[ ] [ "empty-test" temp-file utf8 [ ] with-file-writer ] unit-test
+{ } [ "empty-test" temp-file utf8 [ ] with-file-writer ] unit-test
[ "empty-test" temp-file eval-file ] must-fail
-[ ] [ "eval-file-test" temp-file utf8 [ { 1 2 3 } . ] with-file-writer ] unit-test
+{ } [ "eval-file-test" temp-file utf8 [ { 1 2 3 } . ] with-file-writer ] unit-test
-[ { 1 2 3 } ] [ "eval-file-test" temp-file eval-file ] unit-test
+{ { 1 2 3 } } [ "eval-file-test" temp-file eval-file ] unit-test
USING: mason.email mason.common mason.config namespaces
tools.test system ;
-[ "mason on linux-x86-64: 12345 -- error" ] [
+{ "mason on linux-x86-64: 12345 -- error" } [
[
linux target-os set
x86.64 target-cpu set
strings system ;
IN: mason.platform.tests
-[ t ] [ platform string? ] unit-test
+{ t } [ platform string? ] unit-test
[
linux target-os set
USING: mason.release.branch mason.config tools.test namespaces
system ;
-[ { "git" "push" "-f" "joe@blah.com:/my/git" "master:clean-linux-x86-32" } ] [
+{ { "git" "push" "-f" "joe@blah.com:/my/git" "master:clean-linux-x86-32" } } [
[
"joe" branch-username set
"blah.com" branch-host set
] with-scope
] unit-test
-[ { "scp" "boot.windows-x86.64.image" "joe@blah.com:/stuff/clean/windows-x86-64" } ] [
+{ { "scp" "boot.windows-x86.64.image" "joe@blah.com:/stuff/clean/windows-x86-64" } } [
[
"scp" scp-command set
"joe" image-username set
math.constants math.functions ;
IN: math.affine-transforms.tests
-[ { 7.25 4.25 } ] [
+{ { 7.25 4.25 } } [
{ 0.75 0.75 } { 0.75 -0.75 } { 5.0 5.0 } <affine-transform>
{ 1.0 2.0 } a.v
] unit-test
-[ -1.125 ] [
+{ -1.125 } [
{ 0.75 0.75 } { 0.75 -0.75 } { 5.0 5.0 } <affine-transform>
|a|
] unit-test
a.
] unit-test
-[ t ] [
+{ t } [
{ 0.01 0.02 } { 0.03 0.04 } { 0.05 0.06 } <affine-transform>
{ 0.011 0.021 } { 0.031 0.041 } { 0.051 0.061 } <affine-transform> 0.01 a~
] unit-test
CONSTANT: eps .00000001
-[ t ] [ -9000000000000000000000000000000000000000000 gamma 1/0. = ] unit-test
-[ t ] [ -1.5 gamma 2.363271801207344 eps ~ ] unit-test
-[ t ] [ -1 gamma 1/0. = ] unit-test
-[ t ] [ -0.5 gamma -3.544907701811 eps ~ ] unit-test
-[ t ] [ 0 gamma 1/0. = ] unit-test
-[ t ] [ .5 gamma 1.772453850905479 eps ~ ] unit-test
-[ t ] [ 1 gamma 1 eps ~ ] unit-test
-[ t ] [ 2 gamma 1 eps ~ ] unit-test
-[ t ] [ 3 gamma 2 eps ~ ] unit-test
-[ t ] [ 11 gamma 3628800.000015679 eps ~ ] unit-test
-[ t ] [ 90000000000000000000000000000000000000000000 gamma 1/0. = ] unit-test
+{ t } [ -9000000000000000000000000000000000000000000 gamma 1/0. = ] unit-test
+{ t } [ -1.5 gamma 2.363271801207344 eps ~ ] unit-test
+{ t } [ -1 gamma 1/0. = ] unit-test
+{ t } [ -0.5 gamma -3.544907701811 eps ~ ] unit-test
+{ t } [ 0 gamma 1/0. = ] unit-test
+{ t } [ .5 gamma 1.772453850905479 eps ~ ] unit-test
+{ t } [ 1 gamma 1 eps ~ ] unit-test
+{ t } [ 2 gamma 1 eps ~ ] unit-test
+{ t } [ 3 gamma 2 eps ~ ] unit-test
+{ t } [ 11 gamma 3628800.000015679 eps ~ ] unit-test
+{ t } [ 90000000000000000000000000000000000000000000 gamma 1/0. = ] unit-test
! some fun identities
-[ t ] [ 2/3 gamma 2 pi * 3 sqrt 1/3 gamma * / eps ~ ] unit-test
-[ t ] [ 3/4 gamma 2 sqrt pi * 1/4 gamma / eps ~ ] unit-test
-[ t ] [ 4/5 gamma 2 5 sqrt / 2 + sqrt pi * 1/5 gamma / eps ~ ] unit-test
-[ t ] [ 3/5 gamma 2 2 5 sqrt / - sqrt pi * 2/5 gamma / eps ~ ] unit-test
-[ t ] [ -90000000000000000000000000000000000000000000 gammaln 1/0. = ] unit-test
-[ t ] [ -1.5 gammaln 1/0. = ] unit-test
-[ t ] [ -1 gammaln 1/0. = ] unit-test
-[ t ] [ -0.5 gammaln 1/0. = ] unit-test
+{ t } [ 2/3 gamma 2 pi * 3 sqrt 1/3 gamma * / eps ~ ] unit-test
+{ t } [ 3/4 gamma 2 sqrt pi * 1/4 gamma / eps ~ ] unit-test
+{ t } [ 4/5 gamma 2 5 sqrt / 2 + sqrt pi * 1/5 gamma / eps ~ ] unit-test
+{ t } [ 3/5 gamma 2 2 5 sqrt / - sqrt pi * 2/5 gamma / eps ~ ] unit-test
+{ t } [ -90000000000000000000000000000000000000000000 gammaln 1/0. = ] unit-test
+{ t } [ -1.5 gammaln 1/0. = ] unit-test
+{ t } [ -1 gammaln 1/0. = ] unit-test
+{ t } [ -0.5 gammaln 1/0. = ] unit-test
! [ t ] [ 0 gammaln 1/0. = ] unit-test
-[ t ] [ .5 gammaln 0.572364942924679 eps ~ ] unit-test
-[ t ] [ 1 gammaln 0 eps ~ ] unit-test
-[ t ] [ 2 gammaln 1.110223024625157e-16 eps ~ ] unit-test
-[ t ] [ 3 gammaln 0.6931471805599456 eps ~ ] unit-test
-[ t ] [ 11 gammaln 15.10441257307984 eps ~ ] unit-test
-[ t ] [ 9000000000000000000000000000000000000000000 gammaln 8.811521863477754e44 eps ~ ] unit-test
+{ t } [ .5 gammaln 0.572364942924679 eps ~ ] unit-test
+{ t } [ 1 gammaln 0 eps ~ ] unit-test
+{ t } [ 2 gammaln 1.110223024625157e-16 eps ~ ] unit-test
+{ t } [ 3 gammaln 0.6931471805599456 eps ~ ] unit-test
+{ t } [ 11 gammaln 15.10441257307984 eps ~ ] unit-test
+{ t } [ 9000000000000000000000000000000000000000000 gammaln 8.811521863477754e44 eps ~ ] unit-test
IN: math.approx.tests
-[ { 3 3 13/4 16/5 19/6 22/7 } ]
+{ { 3 3 13/4 16/5 19/6 22/7 } }
[
pi double>ratio
{ 1/2 1/4 1/8 1/16 1/32 1/64 }
[ approximate ] with map
] unit-test
-[ { -3 -3 -13/4 -16/5 -19/6 -22/7 } ]
+{ { -3 -3 -13/4 -16/5 -19/6 -22/7 } }
[
pi double>ratio neg
{ 1/2 1/4 1/8 1/16 1/32 1/64 }
! clone
-[ smatrix{
+{ smatrix{
{ 1.0 2.0 3.0 }
{ 4.0 5.0 6.0 }
{ 7.0 8.0 9.0 }
-} ] [
+} } [
smatrix{
{ 1.0 2.0 3.0 }
{ 4.0 5.0 6.0 }
{ 7.0 8.0 9.0 }
} clone
] unit-test
-[ f ] [
+{ f } [
smatrix{
{ 1.0 2.0 3.0 }
{ 4.0 5.0 6.0 }
} dup clone eq?
] unit-test
-[ dmatrix{
+{ dmatrix{
{ 1.0 2.0 3.0 }
{ 4.0 5.0 6.0 }
{ 7.0 8.0 9.0 }
-} ] [
+} } [
dmatrix{
{ 1.0 2.0 3.0 }
{ 4.0 5.0 6.0 }
{ 7.0 8.0 9.0 }
} clone
] unit-test
-[ f ] [
+{ f } [
dmatrix{
{ 1.0 2.0 3.0 }
{ 4.0 5.0 6.0 }
} dup clone eq?
] unit-test
-[ cmatrix{
+{ cmatrix{
{ C{ 1.0 1.0 } 2.0 3.0 }
{ 4.0 C{ 5.0 2.0 } 6.0 }
{ 7.0 8.0 C{ 9.0 3.0 } }
-} ] [
+} } [
cmatrix{
{ C{ 1.0 1.0 } 2.0 3.0 }
{ 4.0 C{ 5.0 2.0 } 6.0 }
{ 7.0 8.0 C{ 9.0 3.0 } }
} clone
] unit-test
-[ f ] [
+{ f } [
cmatrix{
{ C{ 1.0 1.0 } 2.0 3.0 }
{ 4.0 C{ 5.0 2.0 } 6.0 }
} dup clone eq?
] unit-test
-[ zmatrix{
+{ zmatrix{
{ C{ 1.0 1.0 } 2.0 3.0 }
{ 4.0 C{ 5.0 2.0 } 6.0 }
{ 7.0 8.0 C{ 9.0 3.0 } }
-} ] [
+} } [
zmatrix{
{ C{ 1.0 1.0 } 2.0 3.0 }
{ 4.0 C{ 5.0 2.0 } 6.0 }
{ 7.0 8.0 C{ 9.0 3.0 } }
} clone
] unit-test
-[ f ] [
+{ f } [
zmatrix{
{ C{ 1.0 1.0 } 2.0 3.0 }
{ 4.0 C{ 5.0 2.0 } 6.0 }
! M.V
-[ svector{ 3.0 1.0 6.0 } ] [
+{ svector{ 3.0 1.0 6.0 } } [
smatrix{
{ 0.0 1.0 0.0 1.0 }
{ -1.0 0.0 0.0 2.0 }
svector{ 1.0 2.0 3.0 1.0 }
M.V
] unit-test
-[ svector{ -2.0 1.0 3.0 14.0 } ] [
+{ svector{ -2.0 1.0 3.0 14.0 } } [
smatrix{
{ 0.0 1.0 0.0 1.0 }
{ -1.0 0.0 0.0 2.0 }
M.V
] unit-test
-[ dvector{ 3.0 1.0 6.0 } ] [
+{ dvector{ 3.0 1.0 6.0 } } [
dmatrix{
{ 0.0 1.0 0.0 1.0 }
{ -1.0 0.0 0.0 2.0 }
dvector{ 1.0 2.0 3.0 1.0 }
M.V
] unit-test
-[ dvector{ -2.0 1.0 3.0 14.0 } ] [
+{ dvector{ -2.0 1.0 3.0 14.0 } } [
dmatrix{
{ 0.0 1.0 0.0 1.0 }
{ -1.0 0.0 0.0 2.0 }
M.V
] unit-test
-[ cvector{ 3.0 C{ 1.0 2.0 } 6.0 } ] [
+{ cvector{ 3.0 C{ 1.0 2.0 } 6.0 } } [
cmatrix{
{ 0.0 1.0 0.0 1.0 }
{ -1.0 C{ 0.0 1.0 } 0.0 2.0 }
cvector{ 1.0 2.0 3.0 1.0 }
M.V
] unit-test
-[ cvector{ -2.0 C{ 1.0 2.0 } 3.0 14.0 } ] [
+{ cvector{ -2.0 C{ 1.0 2.0 } 3.0 14.0 } } [
cmatrix{
{ 0.0 1.0 0.0 1.0 }
{ -1.0 C{ 0.0 1.0 } 0.0 2.0 }
M.V
] unit-test
-[ zvector{ 3.0 C{ 1.0 2.0 } 6.0 } ] [
+{ zvector{ 3.0 C{ 1.0 2.0 } 6.0 } } [
zmatrix{
{ 0.0 1.0 0.0 1.0 }
{ -1.0 C{ 0.0 1.0 } 0.0 2.0 }
zvector{ 1.0 2.0 3.0 1.0 }
M.V
] unit-test
-[ zvector{ -2.0 C{ 1.0 2.0 } 3.0 14.0 } ] [
+{ zvector{ -2.0 C{ 1.0 2.0 } 3.0 14.0 } } [
zmatrix{
{ 0.0 1.0 0.0 1.0 }
{ -1.0 C{ 0.0 1.0 } 0.0 2.0 }
! V(*)
-[ smatrix{
+{ smatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 4.0 6.0 8.0 }
{ 3.0 6.0 9.0 12.0 }
-} ] [
+} } [
svector{ 1.0 2.0 3.0 } svector{ 1.0 2.0 3.0 4.0 } V(*)
] unit-test
-[ dmatrix{
+{ dmatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 4.0 6.0 8.0 }
{ 3.0 6.0 9.0 12.0 }
-} ] [
+} } [
dvector{ 1.0 2.0 3.0 } dvector{ 1.0 2.0 3.0 4.0 } V(*)
] unit-test
-[ cmatrix{
+{ cmatrix{
{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 }
{ 2.0 4.0 C{ 6.0 -6.0 } 8.0 }
{ C{ 3.0 3.0 } C{ 6.0 6.0 } 18.0 C{ 12.0 12.0 } }
-} ] [
+} } [
cvector{ 1.0 2.0 C{ 3.0 3.0 } } cvector{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 } V(*)
] unit-test
-[ zmatrix{
+{ zmatrix{
{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 }
{ 2.0 4.0 C{ 6.0 -6.0 } 8.0 }
{ C{ 3.0 3.0 } C{ 6.0 6.0 } 18.0 C{ 12.0 12.0 } }
-} ] [
+} } [
zvector{ 1.0 2.0 C{ 3.0 3.0 } } zvector{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 } V(*)
] unit-test
! M.
-[ smatrix{
+{ smatrix{
{ 1.0 0.0 0.0 4.0 0.0 }
{ 0.0 0.0 -3.0 0.0 0.0 }
{ 0.0 4.0 0.0 0.0 10.0 }
{ 0.0 0.0 0.0 0.0 0.0 }
-} ] [
+} } [
smatrix{
{ 1.0 0.0 0.0 }
{ 0.0 0.0 -1.0 }
} M.
] unit-test
-[ smatrix{
+{ smatrix{
{ 1.0 0.0 0.0 0.0 }
{ 0.0 0.0 4.0 0.0 }
{ 0.0 -3.0 0.0 0.0 }
{ 4.0 0.0 0.0 0.0 }
{ 0.0 0.0 10.0 0.0 }
-} ] [
+} } [
smatrix{
{ 1.0 0.0 0.0 4.0 0.0 }
{ 0.0 2.0 0.0 0.0 5.0 }
} Mtranspose M.
] unit-test
-[ dmatrix{
+{ dmatrix{
{ 1.0 0.0 0.0 4.0 0.0 }
{ 0.0 0.0 -3.0 0.0 0.0 }
{ 0.0 4.0 0.0 0.0 10.0 }
{ 0.0 0.0 0.0 0.0 0.0 }
-} ] [
+} } [
dmatrix{
{ 1.0 0.0 0.0 }
{ 0.0 0.0 -1.0 }
} M.
] unit-test
-[ dmatrix{
+{ dmatrix{
{ 1.0 0.0 0.0 0.0 }
{ 0.0 0.0 4.0 0.0 }
{ 0.0 -3.0 0.0 0.0 }
{ 4.0 0.0 0.0 0.0 }
{ 0.0 0.0 10.0 0.0 }
-} ] [
+} } [
dmatrix{
{ 1.0 0.0 0.0 4.0 0.0 }
{ 0.0 2.0 0.0 0.0 5.0 }
} Mtranspose M.
] unit-test
-[ cmatrix{
+{ cmatrix{
{ 1.0 0.0 0.0 4.0 0.0 }
{ 0.0 0.0 -3.0 0.0 0.0 }
{ 0.0 C{ 4.0 -4.0 } 0.0 0.0 10.0 }
{ 0.0 0.0 0.0 0.0 0.0 }
-} ] [
+} } [
cmatrix{
{ 1.0 0.0 0.0 }
{ 0.0 0.0 -1.0 }
} M.
] unit-test
-[ cmatrix{
+{ cmatrix{
{ 1.0 0.0 0.0 0.0 }
{ 0.0 0.0 C{ 4.0 -4.0 } 0.0 }
{ 0.0 -3.0 0.0 0.0 }
{ 4.0 0.0 0.0 0.0 }
{ 0.0 0.0 10.0 0.0 }
-} ] [
+} } [
cmatrix{
{ 1.0 0.0 0.0 4.0 0.0 }
{ 0.0 C{ 2.0 -2.0 } 0.0 0.0 5.0 }
} Mtranspose M.
] unit-test
-[ zmatrix{
+{ zmatrix{
{ 1.0 0.0 0.0 4.0 0.0 }
{ 0.0 0.0 -3.0 0.0 0.0 }
{ 0.0 C{ 4.0 -4.0 } 0.0 0.0 10.0 }
{ 0.0 0.0 0.0 0.0 0.0 }
-} ] [
+} } [
zmatrix{
{ 1.0 0.0 0.0 }
{ 0.0 0.0 -1.0 }
} M.
] unit-test
-[ zmatrix{
+{ zmatrix{
{ 1.0 0.0 0.0 0.0 }
{ 0.0 0.0 C{ 4.0 -4.0 } 0.0 }
{ 0.0 -3.0 0.0 0.0 }
{ 4.0 0.0 0.0 0.0 }
{ 0.0 0.0 10.0 0.0 }
-} ] [
+} } [
zmatrix{
{ 1.0 0.0 0.0 4.0 0.0 }
{ 0.0 C{ 2.0 -2.0 } 0.0 0.0 5.0 }
! n*M
-[ smatrix{
+{ smatrix{
{ 2.0 0.0 }
{ 0.0 2.0 }
-} ] [
+} } [
2.0 smatrix{
{ 1.0 0.0 }
{ 0.0 1.0 }
} n*M
] unit-test
-[ dmatrix{
+{ dmatrix{
{ 2.0 0.0 }
{ 0.0 2.0 }
-} ] [
+} } [
2.0 dmatrix{
{ 1.0 0.0 }
{ 0.0 1.0 }
} n*M
] unit-test
-[ cmatrix{
+{ cmatrix{
{ C{ 2.0 1.0 } 0.0 }
{ 0.0 C{ -1.0 2.0 } }
-} ] [
+} } [
C{ 2.0 1.0 } cmatrix{
{ 1.0 0.0 }
{ 0.0 C{ 0.0 1.0 } }
} n*M
] unit-test
-[ zmatrix{
+{ zmatrix{
{ C{ 2.0 1.0 } 0.0 }
{ 0.0 C{ -1.0 2.0 } }
-} ] [
+} } [
C{ 2.0 1.0 } zmatrix{
{ 1.0 0.0 }
{ 0.0 C{ 0.0 1.0 } }
! Mrows, Mcols
-[ svector{ 3.0 3.0 3.0 } ] [
+{ svector{ 3.0 3.0 3.0 } } [
2 smatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mcols nth
] unit-test
-[ svector{ 3.0 2.0 3.0 4.0 } ] [
+{ svector{ 3.0 2.0 3.0 4.0 } } [
2 smatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mrows nth
] unit-test
-[ 3 ] [
+{ 3 } [
smatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mrows length
] unit-test
-[ 4 ] [
+{ 4 } [
smatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mcols length
] unit-test
-[ svector{ 3.0 3.0 3.0 } ] [
+{ svector{ 3.0 3.0 3.0 } } [
2 smatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mtranspose Mrows nth
] unit-test
-[ svector{ 3.0 2.0 3.0 4.0 } ] [
+{ svector{ 3.0 2.0 3.0 4.0 } } [
2 smatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mtranspose Mcols nth
] unit-test
-[ 3 ] [
+{ 3 } [
smatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mtranspose Mcols length
] unit-test
-[ 4 ] [
+{ 4 } [
smatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
} Mtranspose Mrows length
] unit-test
-[ dvector{ 3.0 3.0 3.0 } ] [
+{ dvector{ 3.0 3.0 3.0 } } [
2 dmatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mcols nth
] unit-test
-[ dvector{ 3.0 2.0 3.0 4.0 } ] [
+{ dvector{ 3.0 2.0 3.0 4.0 } } [
2 dmatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mrows nth
] unit-test
-[ 3 ] [
+{ 3 } [
dmatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mrows length
] unit-test
-[ 4 ] [
+{ 4 } [
dmatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mcols length
] unit-test
-[ dvector{ 3.0 3.0 3.0 } ] [
+{ dvector{ 3.0 3.0 3.0 } } [
2 dmatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mtranspose Mrows nth
] unit-test
-[ dvector{ 3.0 2.0 3.0 4.0 } ] [
+{ dvector{ 3.0 2.0 3.0 4.0 } } [
2 dmatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mtranspose Mcols nth
] unit-test
-[ 3 ] [
+{ 3 } [
dmatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
{ 3.0 2.0 3.0 4.0 }
} Mtranspose Mcols length
] unit-test
-[ 4 ] [
+{ 4 } [
dmatrix{
{ 1.0 2.0 3.0 4.0 }
{ 2.0 2.0 3.0 4.0 }
} Mtranspose Mrows length
] unit-test
-[ cvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } ] [
+{ cvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
2 cmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mcols nth
] unit-test
-[ cvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } ] [
+{ cvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
2 cmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mrows nth
] unit-test
-[ 3 ] [
+{ 3 } [
cmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mrows length
] unit-test
-[ 4 ] [
+{ 4 } [
cmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mcols length
] unit-test
-[ cvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } ] [
+{ cvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
2 cmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mtranspose Mrows nth
] unit-test
-[ cvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } ] [
+{ cvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
2 cmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mtranspose Mcols nth
] unit-test
-[ 3 ] [
+{ 3 } [
cmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mtranspose Mcols length
] unit-test
-[ 4 ] [
+{ 4 } [
cmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
} Mtranspose Mrows length
] unit-test
-[ zvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } ] [
+{ zvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
2 zmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mcols nth
] unit-test
-[ zvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } ] [
+{ zvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
2 zmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mrows nth
] unit-test
-[ 3 ] [
+{ 3 } [
zmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mrows length
] unit-test
-[ 4 ] [
+{ 4 } [
zmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mcols length
] unit-test
-[ zvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } ] [
+{ zvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
2 zmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mtranspose Mrows nth
] unit-test
-[ zvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } ] [
+{ zvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
2 zmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mtranspose Mcols nth
] unit-test
-[ 3 ] [
+{ 3 } [
zmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
} Mtranspose Mcols length
] unit-test
-[ 4 ] [
+{ 4 } [
zmatrix{
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
! Msub
-[ smatrix{
+{ smatrix{
{ 3.0 2.0 1.0 }
{ 0.0 1.0 0.0 }
-} ] [
+} } [
smatrix{
{ 0.0 1.0 2.0 3.0 2.0 }
{ 1.0 0.0 3.0 2.0 1.0 }
} 1 2 2 3 Msub
] unit-test
-[ smatrix{
+{ smatrix{
{ 3.0 0.0 }
{ 2.0 1.0 }
{ 1.0 0.0 }
-} ] [
+} } [
smatrix{
{ 0.0 1.0 2.0 3.0 2.0 }
{ 1.0 0.0 3.0 2.0 1.0 }
} Mtranspose 2 1 3 2 Msub
] unit-test
-[ dmatrix{
+{ dmatrix{
{ 3.0 2.0 1.0 }
{ 0.0 1.0 0.0 }
-} ] [
+} } [
dmatrix{
{ 0.0 1.0 2.0 3.0 2.0 }
{ 1.0 0.0 3.0 2.0 1.0 }
} 1 2 2 3 Msub
] unit-test
-[ dmatrix{
+{ dmatrix{
{ 3.0 0.0 }
{ 2.0 1.0 }
{ 1.0 0.0 }
-} ] [
+} } [
dmatrix{
{ 0.0 1.0 2.0 3.0 2.0 }
{ 1.0 0.0 3.0 2.0 1.0 }
} Mtranspose 2 1 3 2 Msub
] unit-test
-[ cmatrix{
+{ cmatrix{
{ C{ 3.0 3.0 } 2.0 1.0 }
{ 0.0 1.0 0.0 }
-} ] [
+} } [
cmatrix{
{ 0.0 1.0 2.0 3.0 2.0 }
{ 1.0 0.0 C{ 3.0 3.0 } 2.0 1.0 }
} 1 2 2 3 Msub
] unit-test
-[ cmatrix{
+{ cmatrix{
{ C{ 3.0 3.0 } 0.0 }
{ 2.0 1.0 }
{ 1.0 0.0 }
-} ] [
+} } [
cmatrix{
{ 0.0 1.0 2.0 3.0 2.0 }
{ 1.0 0.0 C{ 3.0 3.0 } 2.0 1.0 }
} Mtranspose 2 1 3 2 Msub
] unit-test
-[ zmatrix{
+{ zmatrix{
{ C{ 3.0 3.0 } 2.0 1.0 }
{ 0.0 1.0 0.0 }
-} ] [
+} } [
zmatrix{
{ 0.0 1.0 2.0 3.0 2.0 }
{ 1.0 0.0 C{ 3.0 3.0 } 2.0 1.0 }
} 1 2 2 3 Msub
] unit-test
-[ zmatrix{
+{ zmatrix{
{ C{ 3.0 3.0 } 0.0 }
{ 2.0 1.0 }
{ 1.0 0.0 }
-} ] [
+} } [
zmatrix{
{ 0.0 1.0 2.0 3.0 2.0 }
{ 1.0 0.0 C{ 3.0 3.0 } 2.0 1.0 }
! clone
-[ svector{ 1.0 2.0 3.0 } ] [ svector{ 1.0 2.0 3.0 } clone ] unit-test
-[ f ] [ svector{ 1.0 2.0 3.0 } dup clone eq? ] unit-test
-[ dvector{ 1.0 2.0 3.0 } ] [ dvector{ 1.0 2.0 3.0 } clone ] unit-test
-[ f ] [ dvector{ 1.0 2.0 3.0 } dup clone eq? ] unit-test
-[ cvector{ 1.0 C{ 2.0 3.0 } 4.0 } ] [ cvector{ 1.0 C{ 2.0 3.0 } 4.0 } clone ] unit-test
-[ f ] [ cvector{ 1.0 C{ 2.0 3.0 } 4.0 } dup clone eq? ] unit-test
-[ zvector{ 1.0 C{ 2.0 3.0 } 4.0 } ] [ zvector{ 1.0 C{ 2.0 3.0 } 4.0 } clone ] unit-test
-[ f ] [ zvector{ 1.0 C{ 2.0 3.0 } 4.0 } dup clone eq? ] unit-test
+{ svector{ 1.0 2.0 3.0 } } [ svector{ 1.0 2.0 3.0 } clone ] unit-test
+{ f } [ svector{ 1.0 2.0 3.0 } dup clone eq? ] unit-test
+{ dvector{ 1.0 2.0 3.0 } } [ dvector{ 1.0 2.0 3.0 } clone ] unit-test
+{ f } [ dvector{ 1.0 2.0 3.0 } dup clone eq? ] unit-test
+{ cvector{ 1.0 C{ 2.0 3.0 } 4.0 } } [ cvector{ 1.0 C{ 2.0 3.0 } 4.0 } clone ] unit-test
+{ f } [ cvector{ 1.0 C{ 2.0 3.0 } 4.0 } dup clone eq? ] unit-test
+{ zvector{ 1.0 C{ 2.0 3.0 } 4.0 } } [ zvector{ 1.0 C{ 2.0 3.0 } 4.0 } clone ] unit-test
+{ f } [ zvector{ 1.0 C{ 2.0 3.0 } 4.0 } dup clone eq? ] unit-test
! nth
-[ 1.0 ] [ 2 svector{ 3.0 2.0 1.0 } nth ] unit-test
-[ 1.0 ] [ 2 dvector{ 3.0 2.0 1.0 } nth ] unit-test
+{ 1.0 } [ 2 svector{ 3.0 2.0 1.0 } nth ] unit-test
+{ 1.0 } [ 2 dvector{ 3.0 2.0 1.0 } nth ] unit-test
-[ C{ 1.0 2.0 } ]
+{ C{ 1.0 2.0 } }
[ 2 cvector{ C{ -3.0 -2.0 } C{ -1.0 0.0 } C{ 1.0 2.0 } } nth ] unit-test
-[ C{ 1.0 2.0 } ]
+{ C{ 1.0 2.0 } }
[ 2 zvector{ C{ -3.0 -2.0 } C{ -1.0 0.0 } C{ 1.0 2.0 } } nth ] unit-test
! set-nth
-[ svector{ 3.0 2.0 0.0 } ] [ 0.0 2 svector{ 3.0 2.0 1.0 } [ set-nth ] keep ] unit-test
-[ dvector{ 3.0 2.0 0.0 } ] [ 0.0 2 dvector{ 3.0 2.0 1.0 } [ set-nth ] keep ] unit-test
+{ svector{ 3.0 2.0 0.0 } } [ 0.0 2 svector{ 3.0 2.0 1.0 } [ set-nth ] keep ] unit-test
+{ dvector{ 3.0 2.0 0.0 } } [ 0.0 2 dvector{ 3.0 2.0 1.0 } [ set-nth ] keep ] unit-test
-[ cvector{ C{ -3.0 -2.0 } C{ -1.0 0.0 } C{ 3.0 4.0 } } ] [
+{ cvector{ C{ -3.0 -2.0 } C{ -1.0 0.0 } C{ 3.0 4.0 } } } [
C{ 3.0 4.0 } 2
cvector{ C{ -3.0 -2.0 } C{ -1.0 0.0 } C{ 1.0 2.0 } }
[ set-nth ] keep
] unit-test
-[ zvector{ C{ -3.0 -2.0 } C{ -1.0 0.0 } C{ 3.0 4.0 } } ] [
+{ zvector{ C{ -3.0 -2.0 } C{ -1.0 0.0 } C{ 3.0 4.0 } } } [
C{ 3.0 4.0 } 2
zvector{ C{ -3.0 -2.0 } C{ -1.0 0.0 } C{ 1.0 2.0 } }
[ set-nth ] keep
! V+
-[ svector{ 11.0 22.0 } ] [ svector{ 1.0 2.0 } svector{ 10.0 20.0 } V+ ] unit-test
-[ dvector{ 11.0 22.0 } ] [ dvector{ 1.0 2.0 } dvector{ 10.0 20.0 } V+ ] unit-test
+{ svector{ 11.0 22.0 } } [ svector{ 1.0 2.0 } svector{ 10.0 20.0 } V+ ] unit-test
+{ dvector{ 11.0 22.0 } } [ dvector{ 1.0 2.0 } dvector{ 10.0 20.0 } V+ ] unit-test
-[ cvector{ 11.0 C{ 22.0 33.0 } } ]
+{ cvector{ 11.0 C{ 22.0 33.0 } } }
[ cvector{ 1.0 C{ 2.0 3.0 } } cvector{ 10.0 C{ 20.0 30.0 } } V+ ]
unit-test
-[ zvector{ 11.0 C{ 22.0 33.0 } } ]
+{ zvector{ 11.0 C{ 22.0 33.0 } } }
[ zvector{ 1.0 C{ 2.0 3.0 } } zvector{ 10.0 C{ 20.0 30.0 } } V+ ]
unit-test
! V-
-[ svector{ 9.0 18.0 } ] [ svector{ 10.0 20.0 } svector{ 1.0 2.0 } V- ] unit-test
-[ dvector{ 9.0 18.0 } ] [ dvector{ 10.0 20.0 } dvector{ 1.0 2.0 } V- ] unit-test
+{ svector{ 9.0 18.0 } } [ svector{ 10.0 20.0 } svector{ 1.0 2.0 } V- ] unit-test
+{ dvector{ 9.0 18.0 } } [ dvector{ 10.0 20.0 } dvector{ 1.0 2.0 } V- ] unit-test
-[ cvector{ 9.0 C{ 18.0 27.0 } } ]
+{ cvector{ 9.0 C{ 18.0 27.0 } } }
[ cvector{ 10.0 C{ 20.0 30.0 } } cvector{ 1.0 C{ 2.0 3.0 } } V- ]
unit-test
-[ zvector{ 9.0 C{ 18.0 27.0 } } ]
+{ zvector{ 9.0 C{ 18.0 27.0 } } }
[ zvector{ 10.0 C{ 20.0 30.0 } } zvector{ 1.0 C{ 2.0 3.0 } } V- ]
unit-test
! Vneg
-[ svector{ 1.0 -2.0 } ] [ svector{ -1.0 2.0 } Vneg ] unit-test
-[ dvector{ 1.0 -2.0 } ] [ dvector{ -1.0 2.0 } Vneg ] unit-test
+{ svector{ 1.0 -2.0 } } [ svector{ -1.0 2.0 } Vneg ] unit-test
+{ dvector{ 1.0 -2.0 } } [ dvector{ -1.0 2.0 } Vneg ] unit-test
-[ cvector{ 1.0 C{ -2.0 3.0 } } ] [ cvector{ -1.0 C{ 2.0 -3.0 } } Vneg ] unit-test
-[ zvector{ 1.0 C{ -2.0 3.0 } } ] [ zvector{ -1.0 C{ 2.0 -3.0 } } Vneg ] unit-test
+{ cvector{ 1.0 C{ -2.0 3.0 } } } [ cvector{ -1.0 C{ 2.0 -3.0 } } Vneg ] unit-test
+{ zvector{ 1.0 C{ -2.0 3.0 } } } [ zvector{ -1.0 C{ 2.0 -3.0 } } Vneg ] unit-test
! n*V
-[ svector{ 100.0 200.0 } ] [ 10.0 svector{ 10.0 20.0 } n*V ] unit-test
-[ dvector{ 100.0 200.0 } ] [ 10.0 dvector{ 10.0 20.0 } n*V ] unit-test
+{ svector{ 100.0 200.0 } } [ 10.0 svector{ 10.0 20.0 } n*V ] unit-test
+{ dvector{ 100.0 200.0 } } [ 10.0 dvector{ 10.0 20.0 } n*V ] unit-test
-[ cvector{ C{ 20.0 4.0 } C{ 8.0 12.0 } } ]
+{ cvector{ C{ 20.0 4.0 } C{ 8.0 12.0 } } }
[ C{ 10.0 2.0 } cvector{ 2.0 C{ 1.0 1.0 } } n*V ]
unit-test
-[ zvector{ C{ 20.0 4.0 } C{ 8.0 12.0 } } ]
+{ zvector{ C{ 20.0 4.0 } C{ 8.0 12.0 } } }
[ C{ 10.0 2.0 } zvector{ 2.0 C{ 1.0 1.0 } } n*V ]
unit-test
! V*n
-[ svector{ 100.0 200.0 } ] [ svector{ 10.0 20.0 } 10.0 V*n ] unit-test
-[ dvector{ 100.0 200.0 } ] [ dvector{ 10.0 20.0 } 10.0 V*n ] unit-test
+{ svector{ 100.0 200.0 } } [ svector{ 10.0 20.0 } 10.0 V*n ] unit-test
+{ dvector{ 100.0 200.0 } } [ dvector{ 10.0 20.0 } 10.0 V*n ] unit-test
-[ cvector{ C{ 20.0 4.0 } C{ 8.0 12.0 } } ]
+{ cvector{ C{ 20.0 4.0 } C{ 8.0 12.0 } } }
[ cvector{ 2.0 C{ 1.0 1.0 } } C{ 10.0 2.0 } V*n ]
unit-test
-[ zvector{ C{ 20.0 4.0 } C{ 8.0 12.0 } } ]
+{ zvector{ C{ 20.0 4.0 } C{ 8.0 12.0 } } }
[ zvector{ 2.0 C{ 1.0 1.0 } } C{ 10.0 2.0 } V*n ]
unit-test
! V/n
-[ svector{ 1.0 2.0 } ] [ svector{ 4.0 8.0 } 4.0 V/n ] unit-test
-[ dvector{ 1.0 2.0 } ] [ dvector{ 4.0 8.0 } 4.0 V/n ] unit-test
+{ svector{ 1.0 2.0 } } [ svector{ 4.0 8.0 } 4.0 V/n ] unit-test
+{ dvector{ 1.0 2.0 } } [ dvector{ 4.0 8.0 } 4.0 V/n ] unit-test
-[ cvector{ C{ 0.0 -4.0 } 1.0 } ]
+{ cvector{ C{ 0.0 -4.0 } 1.0 } }
[ cvector{ C{ 4.0 -4.0 } C{ 1.0 1.0 } } C{ 1.0 1.0 } V/n ]
unit-test
-[ zvector{ C{ 0.0 -4.0 } 1.0 } ]
+{ zvector{ C{ 0.0 -4.0 } 1.0 } }
[ zvector{ C{ 4.0 -4.0 } C{ 1.0 1.0 } } C{ 1.0 1.0 } V/n ]
unit-test
! V.
-[ 7.0 ] [ svector{ 1.0 2.5 } svector{ 2.0 2.0 } V. ] unit-test
-[ 7.0 ] [ dvector{ 1.0 2.5 } dvector{ 2.0 2.0 } V. ] unit-test
-[ C{ 7.0 7.0 } ] [ cvector{ C{ 1.0 1.0 } 2.5 } cvector{ 2.0 C{ 2.0 2.0 } } V. ] unit-test
-[ C{ 7.0 7.0 } ] [ zvector{ C{ 1.0 1.0 } 2.5 } zvector{ 2.0 C{ 2.0 2.0 } } V. ] unit-test
+{ 7.0 } [ svector{ 1.0 2.5 } svector{ 2.0 2.0 } V. ] unit-test
+{ 7.0 } [ dvector{ 1.0 2.5 } dvector{ 2.0 2.0 } V. ] unit-test
+{ C{ 7.0 7.0 } } [ cvector{ C{ 1.0 1.0 } 2.5 } cvector{ 2.0 C{ 2.0 2.0 } } V. ] unit-test
+{ C{ 7.0 7.0 } } [ zvector{ C{ 1.0 1.0 } 2.5 } zvector{ 2.0 C{ 2.0 2.0 } } V. ] unit-test
! V.conj
-[ C{ 7.0 3.0 } ] [ cvector{ C{ 1.0 1.0 } 2.5 } cvector{ 2.0 C{ 2.0 2.0 } } V.conj ] unit-test
-[ C{ 7.0 3.0 } ] [ zvector{ C{ 1.0 1.0 } 2.5 } zvector{ 2.0 C{ 2.0 2.0 } } V.conj ] unit-test
+{ C{ 7.0 3.0 } } [ cvector{ C{ 1.0 1.0 } 2.5 } cvector{ 2.0 C{ 2.0 2.0 } } V.conj ] unit-test
+{ C{ 7.0 3.0 } } [ zvector{ C{ 1.0 1.0 } 2.5 } zvector{ 2.0 C{ 2.0 2.0 } } V.conj ] unit-test
! Vnorm
-[ t ] [ svector{ 3.0 4.0 } Vnorm 5.0 0.000001 ~ ] unit-test
-[ t ] [ dvector{ 3.0 4.0 } Vnorm 5.0 0.000001 ~ ] unit-test
+{ t } [ svector{ 3.0 4.0 } Vnorm 5.0 0.000001 ~ ] unit-test
+{ t } [ dvector{ 3.0 4.0 } Vnorm 5.0 0.000001 ~ ] unit-test
-[ t ] [ cvector{ C{ 3.0 4.0 } 12.0 } Vnorm 13.0 0.000001 ~ ] unit-test
-[ t ] [ zvector{ C{ 3.0 4.0 } 12.0 } Vnorm 13.0 0.000001 ~ ] unit-test
+{ t } [ cvector{ C{ 3.0 4.0 } 12.0 } Vnorm 13.0 0.000001 ~ ] unit-test
+{ t } [ zvector{ C{ 3.0 4.0 } 12.0 } Vnorm 13.0 0.000001 ~ ] unit-test
! Vasum
-[ 6.0 ] [ svector{ 1.0 2.0 -3.0 } Vasum ] unit-test
-[ 6.0 ] [ dvector{ 1.0 2.0 -3.0 } Vasum ] unit-test
+{ 6.0 } [ svector{ 1.0 2.0 -3.0 } Vasum ] unit-test
+{ 6.0 } [ dvector{ 1.0 2.0 -3.0 } Vasum ] unit-test
-[ 15.0 ] [ cvector{ 1.0 C{ -2.0 3.0 } C{ 4.0 -5.0 } } Vasum ] unit-test
-[ 15.0 ] [ zvector{ 1.0 C{ -2.0 3.0 } C{ 4.0 -5.0 } } Vasum ] unit-test
+{ 15.0 } [ cvector{ 1.0 C{ -2.0 3.0 } C{ 4.0 -5.0 } } Vasum ] unit-test
+{ 15.0 } [ zvector{ 1.0 C{ -2.0 3.0 } C{ 4.0 -5.0 } } Vasum ] unit-test
! Vswap
-[ svector{ 2.0 2.0 } svector{ 1.0 1.0 } ]
+{ svector{ 2.0 2.0 } svector{ 1.0 1.0 } }
[ svector{ 1.0 1.0 } svector{ 2.0 2.0 } Vswap ]
unit-test
-[ dvector{ 2.0 2.0 } dvector{ 1.0 1.0 } ]
+{ dvector{ 2.0 2.0 } dvector{ 1.0 1.0 } }
[ dvector{ 1.0 1.0 } dvector{ 2.0 2.0 } Vswap ]
unit-test
-[ cvector{ 2.0 C{ 2.0 2.0 } } cvector{ C{ 1.0 1.0 } 1.0 } ]
+{ cvector{ 2.0 C{ 2.0 2.0 } } cvector{ C{ 1.0 1.0 } 1.0 } }
[ cvector{ C{ 1.0 1.0 } 1.0 } cvector{ 2.0 C{ 2.0 2.0 } } Vswap ]
unit-test
-[ zvector{ 2.0 C{ 2.0 2.0 } } zvector{ C{ 1.0 1.0 } 1.0 } ]
+{ zvector{ 2.0 C{ 2.0 2.0 } } zvector{ C{ 1.0 1.0 } 1.0 } }
[ zvector{ C{ 1.0 1.0 } 1.0 } zvector{ 2.0 C{ 2.0 2.0 } } Vswap ]
unit-test
! Viamax
-[ 3 ] [ svector{ 1.0 -5.0 4.0 -6.0 -1.0 } Viamax ] unit-test
-[ 3 ] [ dvector{ 1.0 -5.0 4.0 -6.0 -1.0 } Viamax ] unit-test
-[ 0 ] [ cvector{ C{ 2.0 -5.0 } 4.0 -6.0 -1.0 } Viamax ] unit-test
-[ 0 ] [ zvector{ C{ 2.0 -5.0 } 4.0 -6.0 -1.0 } Viamax ] unit-test
+{ 3 } [ svector{ 1.0 -5.0 4.0 -6.0 -1.0 } Viamax ] unit-test
+{ 3 } [ dvector{ 1.0 -5.0 4.0 -6.0 -1.0 } Viamax ] unit-test
+{ 0 } [ cvector{ C{ 2.0 -5.0 } 4.0 -6.0 -1.0 } Viamax ] unit-test
+{ 0 } [ zvector{ C{ 2.0 -5.0 } 4.0 -6.0 -1.0 } Viamax ] unit-test
! Vamax
-[ -6.0 ] [ svector{ 1.0 -5.0 4.0 -6.0 -1.0 } Vamax ] unit-test
-[ -6.0 ] [ dvector{ 1.0 -5.0 4.0 -6.0 -1.0 } Vamax ] unit-test
-[ C{ 2.0 -5.0 } ] [ cvector{ C{ 2.0 -5.0 } 4.0 -6.0 -1.0 } Vamax ] unit-test
-[ C{ 2.0 -5.0 } ] [ zvector{ C{ 2.0 -5.0 } 4.0 -6.0 -1.0 } Vamax ] unit-test
+{ -6.0 } [ svector{ 1.0 -5.0 4.0 -6.0 -1.0 } Vamax ] unit-test
+{ -6.0 } [ dvector{ 1.0 -5.0 4.0 -6.0 -1.0 } Vamax ] unit-test
+{ C{ 2.0 -5.0 } } [ cvector{ C{ 2.0 -5.0 } 4.0 -6.0 -1.0 } Vamax ] unit-test
+{ C{ 2.0 -5.0 } } [ zvector{ C{ 2.0 -5.0 } 4.0 -6.0 -1.0 } Vamax ] unit-test
! Vsub
-[ svector{ -5.0 4.0 -6.0 } ] [ svector{ 1.0 -5.0 4.0 -6.0 -1.0 } 1 3 Vsub ] unit-test
-[ dvector{ -5.0 4.0 -6.0 } ] [ dvector{ 1.0 -5.0 4.0 -6.0 -1.0 } 1 3 Vsub ] unit-test
-[ cvector{ -5.0 C{ 4.0 3.0 } -6.0 } ] [ cvector{ 1.0 -5.0 C{ 4.0 3.0 } -6.0 -1.0 } 1 3 Vsub ] unit-test
-[ zvector{ -5.0 C{ 4.0 3.0 } -6.0 } ] [ zvector{ 1.0 -5.0 C{ 4.0 3.0 } -6.0 -1.0 } 1 3 Vsub ] unit-test
+{ svector{ -5.0 4.0 -6.0 } } [ svector{ 1.0 -5.0 4.0 -6.0 -1.0 } 1 3 Vsub ] unit-test
+{ dvector{ -5.0 4.0 -6.0 } } [ dvector{ 1.0 -5.0 4.0 -6.0 -1.0 } 1 3 Vsub ] unit-test
+{ cvector{ -5.0 C{ 4.0 3.0 } -6.0 } } [ cvector{ 1.0 -5.0 C{ 4.0 3.0 } -6.0 -1.0 } 1 3 Vsub ] unit-test
+{ zvector{ -5.0 C{ 4.0 3.0 } -6.0 } } [ zvector{ 1.0 -5.0 C{ 4.0 3.0 } -6.0 -1.0 } 1 3 Vsub ] unit-test
USING: kernel math math.combinators tools.test ;
IN: math.combinators.tests
-[ 0 ] [ -3 [ drop 0 ] when-negative ] unit-test
-[ -2 ] [ -3 [ 1 + ] when-negative ] unit-test
-[ 2 ] [ 2 [ 0 ] when-negative ] unit-test
+{ 0 } [ -3 [ drop 0 ] when-negative ] unit-test
+{ -2 } [ -3 [ 1 + ] when-negative ] unit-test
+{ 2 } [ 2 [ 0 ] when-negative ] unit-test
-[ 0 ] [ 3 [ drop 0 ] when-positive ] unit-test
-[ 4 ] [ 3 [ 1 + ] when-positive ] unit-test
-[ -2 ] [ -2 [ 0 ] when-positive ] unit-test
+{ 0 } [ 3 [ drop 0 ] when-positive ] unit-test
+{ 4 } [ 3 [ 1 + ] when-positive ] unit-test
+{ -2 } [ -2 [ 0 ] when-positive ] unit-test
IN: math.compare.tests
-[ -1 ] [ -1 5 absmin ] unit-test
-[ -1 ] [ -1 -5 absmin ] unit-test
+{ -1 } [ -1 5 absmin ] unit-test
+{ -1 } [ -1 -5 absmin ] unit-test
-[ -5 ] [ 1 -5 absmax ] unit-test
-[ 5 ] [ 1 5 absmax ] unit-test
+{ -5 } [ 1 -5 absmax ] unit-test
+{ 5 } [ 1 5 absmax ] unit-test
-[ 0 ] [ -1 -3 posmax ] unit-test
-[ 1 ] [ 1 -3 posmax ] unit-test
-[ 3 ] [ -1 3 posmax ] unit-test
+{ 0 } [ -1 -3 posmax ] unit-test
+{ 1 } [ 1 -3 posmax ] unit-test
+{ 3 } [ -1 3 posmax ] unit-test
-[ 0 ] [ 1 3 negmin ] unit-test
-[ -3 ] [ 1 -3 negmin ] unit-test
-[ -1 ] [ -1 3 negmin ] unit-test
+{ 0 } [ 1 3 negmin ] unit-test
+{ -3 } [ 1 -3 negmin ] unit-test
+{ -1 } [ -1 3 negmin ] unit-test
-[ 1 ] [ 1 2 [ ] min-by ] unit-test
-[ 1 ] [ 2 1 [ ] min-by ] unit-test
-[ 42.0 ] [ 42.0 1/0. [ ] min-by ] unit-test
-[ 42.0 ] [ 1/0. 42.0 [ ] min-by ] unit-test
-[ 2 ] [ 1 2 [ ] max-by ] unit-test
-[ 2 ] [ 2 1 [ ] max-by ] unit-test
-[ 1/0. ] [ 42.0 1/0. [ ] max-by ] unit-test
-[ 1/0. ] [ 1/0. 42.0 [ ] max-by ] unit-test
-[ "12345" ] [ "123" "12345" [ length ] max-by ] unit-test
-[ "123" ] [ "123" "12345" [ length ] min-by ] unit-test
+{ 1 } [ 1 2 [ ] min-by ] unit-test
+{ 1 } [ 2 1 [ ] min-by ] unit-test
+{ 42.0 } [ 42.0 1/0. [ ] min-by ] unit-test
+{ 42.0 } [ 1/0. 42.0 [ ] min-by ] unit-test
+{ 2 } [ 1 2 [ ] max-by ] unit-test
+{ 2 } [ 2 1 [ ] max-by ] unit-test
+{ 1/0. } [ 42.0 1/0. [ ] max-by ] unit-test
+{ 1/0. } [ 1/0. 42.0 [ ] max-by ] unit-test
+{ "12345" } [ "123" "12345" [ length ] max-by ] unit-test
+{ "123" } [ "123" "12345" [ length ] min-by ] unit-test
USING: kernel math.constants math.continued-fractions tools.test ;
-[ V{ 2 2.0 } ] [ V{ 2.5 } dup next-approx ] unit-test
-[ V{ 2 2 } ] [ V{ 2.5 } dup next-approx dup next-approx ] unit-test
+{ V{ 2 2.0 } } [ V{ 2.5 } dup next-approx ] unit-test
+{ V{ 2 2 } } [ V{ 2.5 } dup next-approx dup next-approx ] unit-test
-[ 5/2 ] [ V{ 2 2.1 } >ratio ] unit-test
-[ 5/2 ] [ V{ 2 1.9 } >ratio ] unit-test
-[ 5/2 ] [ V{ 2 2.0 } >ratio ] unit-test
-[ 5/2 ] [ V{ 2 2 } >ratio ] unit-test
+{ 5/2 } [ V{ 2 2.1 } >ratio ] unit-test
+{ 5/2 } [ V{ 2 1.9 } >ratio ] unit-test
+{ 5/2 } [ V{ 2 2.0 } >ratio ] unit-test
+{ 5/2 } [ V{ 2 2 } >ratio ] unit-test
-[ 3 ] [ 1 pi approx ] unit-test
-[ 22/7 ] [ 0.1 pi approx ] unit-test
-[ 355/113 ] [ 0.00001 pi approx ] unit-test
+{ 3 } [ 1 pi approx ] unit-test
+{ 22/7 } [ 0.1 pi approx ] unit-test
+{ 355/113 } [ 0.00001 pi approx ] unit-test
-[ 2 ] [ 1 2 approx ] unit-test
-[ 2 ] [ 0.1 2 approx ] unit-test
-[ 2 ] [ 0.00001 2 approx ] unit-test
+{ 2 } [ 1 2 approx ] unit-test
+{ 2 } [ 0.1 2 approx ] unit-test
+{ 2 } [ 0.00001 2 approx ] unit-test
-[ 3 ] [ 1 2.5 approx ] unit-test
-[ 5/2 ] [ 0.1 2.5 approx ] unit-test
-[ 5/2 ] [ 0.0001 2.5 approx ] unit-test
+{ 3 } [ 1 2.5 approx ] unit-test
+{ 5/2 } [ 0.1 2.5 approx ] unit-test
+{ 5/2 } [ 0.0001 2.5 approx ] unit-test
math.constants ;
IN: math.dual.tests
-[ 0.0 1.0 ] [ 0 1 <dual> dsin unpack-dual ] unit-test
-[ 1.0 0.0 ] [ 0 1 <dual> dcos unpack-dual ] unit-test
-[ 3 5 ] [ 1 5 <dual> 2 d+ unpack-dual ] unit-test
-[ 0 -1 ] [ 1 5 <dual> 1 6 <dual> d- unpack-dual ] unit-test
-[ 2 1 ] [ 2 3 <dual> 1 -1 <dual> d* unpack-dual ] unit-test
-[ 1/2 -1/4 ] [ 2 1 <dual> 1 swap d/ unpack-dual ] unit-test
-[ 2 ] [ 1 1 <dual> 2 d^ epsilon-part>> ] unit-test
-[ 2.0 .25 ] [ 4 1 <dual> dsqrt unpack-dual ] unit-test
-[ 2 -1 ] [ -2 1 <dual> dabs unpack-dual ] unit-test
-[ -2 -1 ] [ 2 1 <dual> dneg unpack-dual ] unit-test
+{ 0.0 1.0 } [ 0 1 <dual> dsin unpack-dual ] unit-test
+{ 1.0 0.0 } [ 0 1 <dual> dcos unpack-dual ] unit-test
+{ 3 5 } [ 1 5 <dual> 2 d+ unpack-dual ] unit-test
+{ 0 -1 } [ 1 5 <dual> 1 6 <dual> d- unpack-dual ] unit-test
+{ 2 1 } [ 2 3 <dual> 1 -1 <dual> d* unpack-dual ] unit-test
+{ 1/2 -1/4 } [ 2 1 <dual> 1 swap d/ unpack-dual ] unit-test
+{ 2 } [ 1 1 <dual> 2 d^ epsilon-part>> ] unit-test
+{ 2.0 .25 } [ 4 1 <dual> dsqrt unpack-dual ] unit-test
+{ 2 -1 } [ -2 1 <dual> dabs unpack-dual ] unit-test
+{ -2 -1 } [ 2 1 <dual> dneg unpack-dual ] unit-test
{ { 1 8+4/5 16+3/5 24+2/5 32+1/5 } } [ 1 40 5 linspace[a,b) >array ] unit-test
{ { 1 10+3/4 20+1/2 30+1/4 40 } } [ 1 40 5 linspace[a,b] >array ] unit-test
-[ f ] [ { } majority ] unit-test
-[ 1 ] [ { 1 } majority ] unit-test
-[ f ] [ { 1 2 } majority ] unit-test
-[ 1 ] [ { 1 1 2 } majority ] unit-test
-[ f ] [ { 1 1 2 2 } majority ] unit-test
-[ 2 ] [ { 1 1 2 2 2 } majority ] unit-test
-[ 3 ] [ { 1 2 3 1 2 3 1 2 3 3 } majority ] unit-test
+{ f } [ { } majority ] unit-test
+{ 1 } [ { 1 } majority ] unit-test
+{ f } [ { 1 2 } majority ] unit-test
+{ 1 } [ { 1 1 2 } majority ] unit-test
+{ f } [ { 1 1 2 2 } majority ] unit-test
+{ 2 } [ { 1 1 2 2 2 } majority ] unit-test
+{ 3 } [ { 1 2 3 1 2 3 1 2 3 3 } majority ] unit-test
{ CHAR: C } [ "AAACCBBCCCBCC" majority ] unit-test
-[ -5 ] [ -4-3/5 round-to-even ] unit-test
-[ -4 ] [ -4-1/2 round-to-even ] unit-test
-[ -4 ] [ -4-2/5 round-to-even ] unit-test
-[ 5 ] [ 4+3/5 round-to-even ] unit-test
-[ 4 ] [ 4+1/2 round-to-even ] unit-test
-[ 4 ] [ 4+2/5 round-to-even ] unit-test
-
-[ -5.0 ] [ -4.6 round-to-even ] unit-test
-[ -4.0 ] [ -4.5 round-to-even ] unit-test
-[ -4.0 ] [ -4.4 round-to-even ] unit-test
-[ 5.0 ] [ 4.6 round-to-even ] unit-test
-[ 4.0 ] [ 4.5 round-to-even ] unit-test
-[ 4.0 ] [ 4.4 round-to-even ] unit-test
+{ -5 } [ -4-3/5 round-to-even ] unit-test
+{ -4 } [ -4-1/2 round-to-even ] unit-test
+{ -4 } [ -4-2/5 round-to-even ] unit-test
+{ 5 } [ 4+3/5 round-to-even ] unit-test
+{ 4 } [ 4+1/2 round-to-even ] unit-test
+{ 4 } [ 4+2/5 round-to-even ] unit-test
+
+{ -5.0 } [ -4.6 round-to-even ] unit-test
+{ -4.0 } [ -4.5 round-to-even ] unit-test
+{ -4.0 } [ -4.4 round-to-even ] unit-test
+{ 5.0 } [ 4.6 round-to-even ] unit-test
+{ 4.0 } [ 4.5 round-to-even ] unit-test
+{ 4.0 } [ 4.4 round-to-even ] unit-test
{ 0.0 } [ 0 2 round-to-decimal ] unit-test
{ 1.0 } [ 1 2 round-to-decimal ] unit-test
USING: kernel math.functions math.ranges sequences tools.test ;
IN: math.factorials
-[ 1 ] [ -1 factorial ] unit-test ! not necessarily correct
-[ 1 ] [ 0 factorial ] unit-test
-[ 1 ] [ 1 factorial ] unit-test
-[ 3628800 ] [ 10 factorial ] unit-test
+{ 1 } [ -1 factorial ] unit-test ! not necessarily correct
+{ 1 } [ 0 factorial ] unit-test
+{ 1 } [ 1 factorial ] unit-test
+{ 3628800 } [ 10 factorial ] unit-test
{ { 1 1 2 6 24 120 720 5040 40320 362880 3628800 } } [
10 factorials
IN: math.finance.tests
-[ { 1 2 3 4 5 } ] [ { 1 2 3 4 5 } 1 ema ] unit-test
-[ { 1+1/2 2+1/2 3+1/2 4+1/2 } ] [ { 1 2 3 4 5 } 2 ema ] unit-test
-[ { 2 3 4 } ] [ { 1 2 3 4 5 } 3 ema ] unit-test
+{ { 1 2 3 4 5 } } [ { 1 2 3 4 5 } 1 ema ] unit-test
+{ { 1+1/2 2+1/2 3+1/2 4+1/2 } } [ { 1 2 3 4 5 } 2 ema ] unit-test
+{ { 2 3 4 } } [ { 1 2 3 4 5 } 3 ema ] unit-test
-[ { 2 4 } ] [ { 1 3 5 } 2 sma ] unit-test
+{ { 2 4 } } [ { 1 3 5 } 2 sma ] unit-test
-[ { 2 3 4 5 } ] [ 6 iota 2 dema ] unit-test
+{ { 2 3 4 5 } } [ 6 iota 2 dema ] unit-test
-[ t ] [ 6 iota 2 [ dema ] [ 1 gdema ] 2bi = ] unit-test
+{ t } [ 6 iota 2 [ dema ] [ 1 gdema ] 2bi = ] unit-test
-[ { 3 4 5 } ] [ 6 iota 2 tema ] unit-test
-[ { 6 7 8 9 } ] [ 10 iota 3 tema ] unit-test
+{ { 3 4 5 } } [ 6 iota 2 tema ] unit-test
+{ { 6 7 8 9 } } [ 10 iota 3 tema ] unit-test
-[ { 1 3 1 } ] [ { 1 3 2 6 3 } 2 momentum ] unit-test
+{ { 1 3 1 } } [ { 1 3 2 6 3 } 2 momentum ] unit-test
{ { 0.0 50.0 25.0 75.0 100.0 125.0 -50.0 -75.0 -90.0 } } [
{ 1 1.5 1.25 1.75 2.0 2.25 0.5 0.25 0.1 } performance
] unit-test
-[ 4+1/6 ] [ 100 semimonthly ] unit-test
+{ 4+1/6 } [ 100 semimonthly ] unit-test
math.constants fry sequences math random ;
IN: math.floating-point.tests
-[ t ] [ pi >double< >double pi = ] unit-test
-[ t ] [ -1.0 >double< >double -1.0 = ] unit-test
+{ t } [ pi >double< >double pi = ] unit-test
+{ t } [ -1.0 >double< >double -1.0 = ] unit-test
-[ t ] [ 1/0. infinity? ] unit-test
-[ t ] [ -1/0. infinity? ] unit-test
-[ f ] [ 0/0. infinity? ] unit-test
-[ f ] [ 10. infinity? ] unit-test
-[ f ] [ -10. infinity? ] unit-test
-[ f ] [ 0. infinity? ] unit-test
+{ t } [ 1/0. infinity? ] unit-test
+{ t } [ -1/0. infinity? ] unit-test
+{ f } [ 0/0. infinity? ] unit-test
+{ f } [ 10. infinity? ] unit-test
+{ f } [ -10. infinity? ] unit-test
+{ f } [ 0. infinity? ] unit-test
-[ 0 ] [ 0.0 double>ratio ] unit-test
-[ 1 ] [ 1.0 double>ratio ] unit-test
-[ 1/2 ] [ 0.5 double>ratio ] unit-test
-[ 3/4 ] [ 0.75 double>ratio ] unit-test
-[ 12+1/2 ] [ 12.5 double>ratio ] unit-test
-[ -12-1/2 ] [ -12.5 double>ratio ] unit-test
-[ 3+39854788871587/281474976710656 ] [ pi double>ratio ] unit-test
+{ 0 } [ 0.0 double>ratio ] unit-test
+{ 1 } [ 1.0 double>ratio ] unit-test
+{ 1/2 } [ 0.5 double>ratio ] unit-test
+{ 3/4 } [ 0.75 double>ratio ] unit-test
+{ 12+1/2 } [ 12.5 double>ratio ] unit-test
+{ -12-1/2 } [ -12.5 double>ratio ] unit-test
+{ 3+39854788871587/281474976710656 } [ pi double>ratio ] unit-test
: roundtrip ( n -- )
[ '[ _ ] ] keep '[ _ double>ratio >float ] unit-test ;
SPECIALIZED-ARRAY: float-4
IN: math.matrices.simd.tests
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 3.0 0.0 0.0 0.0 }
float-4{ 0.0 0.0 0.0 1.0 }
}
}
-] [ float-4{ 3.0 4.0 2.0 0.0 } scale-matrix4 ] unit-test
+} [ float-4{ 3.0 4.0 2.0 0.0 } scale-matrix4 ] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 1/8. 0.0 0.0 0.0 }
float-4{ 0.0 0.0 0.0 1.0 }
}
}
-] [ float-4{ 8.0 4.0 2.0 0.0 } ortho-matrix4 ] unit-test
+} [ float-4{ 8.0 4.0 2.0 0.0 } ortho-matrix4 ] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 0.0 0.0 -1.0 0.0 }
float-4{ 3.0 4.0 2.0 1.0 }
}
}
-] [
+} [
S{ matrix4 f
float-4-array{
float-4{ 0.0 1.0 0.0 3.0 }
} transpose-matrix4
] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 1.0 0.0 0.0 0.0 }
float-4{ 3.0 4.0 2.0 1.0 }
}
}
-] [ float-4{ 3.0 4.0 2.0 0.0 } translation-matrix4 ] unit-test
+} [ float-4{ 3.0 4.0 2.0 0.0 } translation-matrix4 ] unit-test
-[ t ] [
+{ t } [
float-4{ $[ 1/2. sqrt ] 0.0 $[ 1/2. sqrt ] 0.0 } pi rotation-matrix4
S{ matrix4 f
float-4-array{
1.0e-7 m~
] unit-test
-[ t ] [
+{ t } [
float-4{ 0.0 1.0 0.0 1.0 } pi 1/2. * rotation-matrix4
S{ matrix4 f
float-4-array{
1.0e-7 m~
] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 2.0 0.0 0.0 0.0 }
float-4{ 10.0 18.0 28.0 1.0 }
}
}
-] [
+} [
S{ matrix4 f
float-4-array{
float-4{ 2.0 0.0 0.0 0.0 }
m4.
] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 3.0 0.0 0.0 0.0 }
float-4{ 5.0 6.0 7.0 2.0 }
}
}
-] [
+} [
S{ matrix4 f
float-4-array{
float-4{ 2.0 0.0 0.0 0.0 }
m4+
] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 1.0 0.0 0.0 0.0 }
float-4{ -5.0 -6.0 -7.0 0.0 }
}
}
-] [
+} [
S{ matrix4 f
float-4-array{
float-4{ 2.0 0.0 0.0 0.0 }
m4-
] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 3.0 0.0 0.0 15.0 }
float-4{ 0.0 0.0 0.0 3.0 }
}
}
-] [
+} [
S{ matrix4 f
float-4-array{
float-4{ 1.0 0.0 0.0 5.0 }
3.0 m4*n
] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 3.0 0.0 0.0 15.0 }
float-4{ 0.0 0.0 0.0 3.0 }
}
}
-] [
+} [
3.0
S{ matrix4 f
float-4-array{
n*m4
] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 1/2. 0.0 0.0 0.0 }
float-4{ 0.0 0.0 -10/4. 0.0 }
}
}
-] [
+} [
float-4{ 2.0 2.0 0.0 0.0 } 1.0 5.0
frustum-matrix4
] unit-test
-[ float-4{ 3.0 4.0 5.0 1.0 } ]
+{ float-4{ 3.0 4.0 5.0 1.0 } }
[ float-4{ 1.0 1.0 1.0 1.0 } translation-matrix4 float-4{ 2.0 3.0 4.0 1.0 } m4.v ] unit-test
-[ float-4{ 2.0 2.5 3.0 1.0 } ]
+{ float-4{ 2.0 2.5 3.0 1.0 } }
[
float-4{ 1.0 1.0 1.0 1.0 } translation-matrix4
float-4{ 0.5 0.5 0.5 1.0 } scale-matrix4 m4.
float-4{ 2.0 3.0 4.0 1.0 } m4.v
] unit-test
-[
+{
S{ matrix4 f
float-4-array{
float-4{ 1.0 0.0 0.0 0.0 }
float-4{ 0.0 0.0 0.0 1.0 }
}
}
-] [
+} [
float-4{ 1.0 0.0 0.0 0.0 } q>matrix4
] unit-test
-[ t ] [
+{ t } [
pi 0.5 * 0.0 0.0 euler4 q>matrix4
S{ matrix4 f
float-4-array{
1.0e-7 m~
] unit-test
-[ t ] [
+{ t } [
0.0 pi 0.25 * 0.0 euler4 q>matrix4
S{ matrix4 f
float-4-array{
math.constants math.functions ;
IN: math.numerical-integration.tests
-[ 50 ] [ 0 10 [ ] integrate-simpson ] unit-test
-[ 1000/3 ] [ 0 10 [ sq ] integrate-simpson ] unit-test
-[ t ] [ 0 pi 2 / [ sin ] integrate-simpson 1 .000000001 ~abs ] unit-test
-[ t ] [ 0 pi [ sin ] integrate-simpson 2 .00000001 ~abs ] unit-test
-[ t ] [ 0 pi 2 * [ sin ] integrate-simpson 0 .00000000001 ~abs ] unit-test
+{ 50 } [ 0 10 [ ] integrate-simpson ] unit-test
+{ 1000/3 } [ 0 10 [ sq ] integrate-simpson ] unit-test
+{ t } [ 0 pi 2 / [ sin ] integrate-simpson 1 .000000001 ~abs ] unit-test
+{ t } [ 0 pi [ sin ] integrate-simpson 2 .00000001 ~abs ] unit-test
+{ t } [ 0 pi 2 * [ sin ] integrate-simpson 0 .00000000001 ~abs ] unit-test
USING: math.functions math.text.english tools.test ;
IN: math.text.english.tests
-[ "zero" ] [ 0 number>text ] unit-test
-[ "twenty-one" ] [ 21 number>text ] unit-test
-[ "one hundred" ] [ 100 number>text ] unit-test
-[ "one hundred and one" ] [ 101 number>text ] unit-test
-[ "one thousand and one" ] [ 1001 number>text ] unit-test
-[ "one thousand, one hundred and one" ] [ 1101 number>text ] unit-test
-[ "one million, one thousand and one" ] [ 1001001 number>text ] unit-test
-[ "one million, one thousand, one hundred and one" ] [ 1001101 number>text ] unit-test
-[ "one million, one hundred and eleven thousand, one hundred and eleven" ] [ 1111111 number>text ] unit-test
-[ "one duotrigintillion" ] [ 10 99 ^ number>text ] unit-test
+{ "zero" } [ 0 number>text ] unit-test
+{ "twenty-one" } [ 21 number>text ] unit-test
+{ "one hundred" } [ 100 number>text ] unit-test
+{ "one hundred and one" } [ 101 number>text ] unit-test
+{ "one thousand and one" } [ 1001 number>text ] unit-test
+{ "one thousand, one hundred and one" } [ 1101 number>text ] unit-test
+{ "one million, one thousand and one" } [ 1001001 number>text ] unit-test
+{ "one million, one thousand, one hundred and one" } [ 1001101 number>text ] unit-test
+{ "one million, one hundred and eleven thousand, one hundred and eleven" } [ 1111111 number>text ] unit-test
+{ "one duotrigintillion" } [ 10 99 ^ number>text ] unit-test
-[ "negative one hundred and twenty-three" ] [ -123 number>text ] unit-test
+{ "negative one hundred and twenty-three" } [ -123 number>text ] unit-test
USING: math math.functions math.parser math.text.french sequences tools.test ;
-[ "zéro" ] [ 0 number>text ] unit-test
-[ "vingt et un" ] [ 21 number>text ] unit-test
-[ "vingt-deux" ] [ 22 number>text ] unit-test
-[ "deux mille" ] [ 2000 number>text ] unit-test
-[ "soixante et un" ] [ 61 number>text ] unit-test
-[ "soixante-deux" ] [ 62 number>text ] unit-test
-[ "quatre-vingts" ] [ 80 number>text ] unit-test
-[ "quatre-vingt-un" ] [ 81 number>text ] unit-test
-[ "quatre-vingt-onze" ] [ 91 number>text ] unit-test
-[ "deux cents" ] [ 200 number>text ] unit-test
-[ "mille deux cents" ] [ 1200 number>text ] unit-test
-[ "mille deux cent quatre-vingts" ] [ 1280 number>text ] unit-test
-[ "mille deux cent quatre-vingt-un" ] [ 1281 number>text ] unit-test
-[ "un billion deux cent vingt milliards quatre-vingts millions trois cent quatre-vingt mille deux cents" ] [ 1220080380200 number>text ] unit-test
-[ "un million" ] [ 1000000 number>text ] unit-test
-[ "un million un" ] [ 1000001 number>text ] unit-test
-[ "moins vingt" ] [ -20 number>text ] unit-test
-[ 104 ] [ -1 10 102 ^ - number>text length ] unit-test
+{ "zéro" } [ 0 number>text ] unit-test
+{ "vingt et un" } [ 21 number>text ] unit-test
+{ "vingt-deux" } [ 22 number>text ] unit-test
+{ "deux mille" } [ 2000 number>text ] unit-test
+{ "soixante et un" } [ 61 number>text ] unit-test
+{ "soixante-deux" } [ 62 number>text ] unit-test
+{ "quatre-vingts" } [ 80 number>text ] unit-test
+{ "quatre-vingt-un" } [ 81 number>text ] unit-test
+{ "quatre-vingt-onze" } [ 91 number>text ] unit-test
+{ "deux cents" } [ 200 number>text ] unit-test
+{ "mille deux cents" } [ 1200 number>text ] unit-test
+{ "mille deux cent quatre-vingts" } [ 1280 number>text ] unit-test
+{ "mille deux cent quatre-vingt-un" } [ 1281 number>text ] unit-test
+{ "un billion deux cent vingt milliards quatre-vingts millions trois cent quatre-vingt mille deux cents" } [ 1220080380200 number>text ] unit-test
+{ "un million" } [ 1000000 number>text ] unit-test
+{ "un million un" } [ 1000001 number>text ] unit-test
+{ "moins vingt" } [ -20 number>text ] unit-test
+{ 104 } [ -1 10 102 ^ - number>text length ] unit-test
! Check that we do not exhaust stack
-[ 1484 ] [ 10 100 ^ 1 - number>text length ] unit-test
+{ 1484 } [ 10 100 ^ 1 - number>text length ] unit-test
USING: math.text.utils tools.test ;
-[ { 1 999 2 } ] [ 2999001 3 digit-groups ] unit-test
+{ { 1 999 2 } } [ 2999001 3 digit-groups ] unit-test
USING: math.transforms.haar tools.test ;
IN: math.transforms.haar.tests
-[ { 3 2 -1 -2 3 0 4 1 } ] [ { 7 1 6 6 3 -5 4 2 } haar ] unit-test
-[ { 7 1 6 6 3 -5 4 2 } ] [ { 3 2 -1 -2 3 0 4 1 } rev-haar ] unit-test
+{ { 3 2 -1 -2 3 0 4 1 } } [ { 7 1 6 6 3 -5 4 2 } haar ] unit-test
+{ { 7 1 6 6 3 -5 4 2 } } [ { 3 2 -1 -2 3 0 4 1 } rev-haar ] unit-test
USING: math.vectors.homogeneous tools.test ;
IN: math.vectors.homogeneous.tests
-[ { 1.0 2.0 1.0 } ] [ { 1.0 0.0 1.0 } { 0.0 2.0 1.0 } h+ ] unit-test
-[ { 1.0 -2.0 1.0 } ] [ { 1.0 0.0 1.0 } { 0.0 2.0 1.0 } h- ] unit-test
-[ { 2.0 2.0 2.0 } ] [ { 1.0 0.0 1.0 } { 0.0 2.0 2.0 } h+ ] unit-test
-[ { 1.0 2.0 2.0 } ] [ { 1.0 0.0 2.0 } { 0.0 2.0 2.0 } h+ ] unit-test
+{ { 1.0 2.0 1.0 } } [ { 1.0 0.0 1.0 } { 0.0 2.0 1.0 } h+ ] unit-test
+{ { 1.0 -2.0 1.0 } } [ { 1.0 0.0 1.0 } { 0.0 2.0 1.0 } h- ] unit-test
+{ { 2.0 2.0 2.0 } } [ { 1.0 0.0 1.0 } { 0.0 2.0 2.0 } h+ ] unit-test
+{ { 1.0 2.0 2.0 } } [ { 1.0 0.0 2.0 } { 0.0 2.0 2.0 } h+ ] unit-test
-[ { 2.0 4.0 2.0 } ] [ 2.0 { 1.0 2.0 2.0 } n*h ] unit-test
-[ { 2.0 4.0 2.0 } ] [ { 1.0 2.0 2.0 } 2.0 h*n ] unit-test
+{ { 2.0 4.0 2.0 } } [ 2.0 { 1.0 2.0 2.0 } n*h ] unit-test
+{ { 2.0 4.0 2.0 } } [ { 1.0 2.0 2.0 } 2.0 h*n ] unit-test
-[ { 0.5 1.5 } ] [ { 1.0 3.0 2.0 } h>v ] unit-test
-[ { 0.5 1.5 1.0 } ] [ { 0.5 1.5 } v>h ] unit-test
-[ { 0.5 1.5 1.0 } ] [ { 0.5 1.5 } v>h ] unit-test
+{ { 0.5 1.5 } } [ { 1.0 3.0 2.0 } h>v ] unit-test
+{ { 0.5 1.5 1.0 } } [ { 0.5 1.5 } v>h ] unit-test
+{ { 0.5 1.5 1.0 } } [ { 0.5 1.5 } v>h ] unit-test
PRIVATE>
! test version
-[ t ] [ [ m/version ] with-memcached length 0 > ] unit-test
+{ t } [ [ m/version ] with-memcached length 0 > ] unit-test
! test simple set get
[ m/flush ] with-memcached
[ "valuex" x m/set ] with-memcached
-[ "valuex" ] [ [ x m/get ] with-memcached ] unit-test
+{ "valuex" } [ [ x m/get ] with-memcached ] unit-test
! test flush
[ m/flush ] with-memcached
[ "valuex" x m/set "valuey" y m/set ] with-memcached
-[ "valuex" ] [ [ x m/get ] with-memcached ] unit-test
-[ "valuey" ] [ [ y m/get ] with-memcached ] unit-test
+{ "valuex" } [ [ x m/get ] with-memcached ] unit-test
+{ "valuey" } [ [ y m/get ] with-memcached ] unit-test
[ m/flush ] with-memcached
[ [ x m/get ] with-memcached ] not-found?
[ [ y m/get ] with-memcached ] not-found?
! test delete
[ m/flush ] with-memcached
[ "valuex" x m/set ] with-memcached
-[ "valuex" ] [ [ x m/get ] with-memcached ] unit-test
+{ "valuex" } [ [ x m/get ] with-memcached ] unit-test
[ x m/delete ] with-memcached
[ [ x m/get ] with-memcached ] not-found?
[ [ x m/get ] with-memcached ] not-found?
[ [ "ex" x m/replace ] with-memcached ] not-found?
[ "ex" x m/add ] with-memcached
-[ "ex" ] [ [ x m/get ] with-memcached ] unit-test
+{ "ex" } [ [ x m/get ] with-memcached ] unit-test
[ "ex2" x m/replace ] with-memcached
-[ "ex2" ] [ [ x m/get ] with-memcached ] unit-test
+{ "ex2" } [ [ x m/get ] with-memcached ] unit-test
! test incr
[ m/flush ] with-memcached
-[ 0 ] [ [ x m/incr ] with-memcached ] unit-test
-[ 1 ] [ [ x m/incr ] with-memcached ] unit-test
-[ 212 ] [ [ 211 x m/incr-val ] with-memcached ] unit-test
-[ 8589934804 ] [ [ 2 33 ^ x m/incr-val ] with-memcached ] unit-test
+{ 0 } [ [ x m/incr ] with-memcached ] unit-test
+{ 1 } [ [ x m/incr ] with-memcached ] unit-test
+{ 212 } [ [ 211 x m/incr-val ] with-memcached ] unit-test
+{ 8589934804 } [ [ 2 33 ^ x m/incr-val ] with-memcached ] unit-test
! test decr
[ m/flush ] with-memcached
[ "5" x m/set ] with-memcached
-[ 4 ] [ [ x m/decr ] with-memcached ] unit-test
-[ 0 ] [ [ 211 x m/decr-val ] with-memcached ] unit-test
+{ 4 } [ [ x m/decr ] with-memcached ] unit-test
+{ 0 } [ [ 211 x m/decr-val ] with-memcached ] unit-test
! test timebombed flush
[ m/flush ] with-memcached
[ [ x m/get ] with-memcached ] not-found?
[ "valuex" x m/set ] with-memcached
-[ "valuex" ] [ [ x m/get ] with-memcached ] unit-test
+{ "valuex" } [ [ x m/get ] with-memcached ] unit-test
[ 2 m/flush-later ] with-memcached
-[ "valuex" ] [ [ x m/get ] with-memcached ] unit-test
+{ "valuex" } [ [ x m/get ] with-memcached ] unit-test
3 seconds sleep
[ [ x m/get ] with-memcached ] not-found?
[ m/flush ] with-memcached
[ "some" x m/set ] with-memcached
[ "thing" x m/append ] with-memcached
-[ "something" ] [ [ x m/get ] with-memcached ] unit-test
+{ "something" } [ [ x m/get ] with-memcached ] unit-test
! test prepend
[ m/flush ] with-memcached
[ "some" x m/set ] with-memcached
[ "thing" x m/prepend ] with-memcached
-[ "thingsome" ] [ [ x m/get ] with-memcached ] unit-test
+{ "thingsome" } [ [ x m/get ] with-memcached ] unit-test
! test multi-get
[ m/flush ] with-memcached
-[ H{ } ] [ [ x y z 3array m/getseq ] with-memcached ] unit-test
+{ H{ } } [ [ x y z 3array m/getseq ] with-memcached ] unit-test
[ "5" x m/set ] with-memcached
[ "valuex" y m/set ] with-memcached
-[ { "5" "valuex" } ] [
+{ { "5" "valuex" } } [
[ x y z 3array m/getseq values natural-sort ] with-memcached
] unit-test
memory.piles tools.test ;
IN: memory.piles.tests
-[ 25 ] [
+{ 25 } [
[
100 <pile> &dispose
[ 25 pile-alloc ] [ 50 pile-alloc ] bi
] with-destructors
] unit-test
-[ 32 ] [
+{ 32 } [
[
100 <pile> &dispose
[ 25 pile-alloc ] [ 8 pile-align 50 pile-alloc ] bi
] with-destructors
] unit-test
-[ 75 ] [
+{ 75 } [
[
100 <pile> &dispose
dup 25 pile-alloc drop
] with-destructors
] unit-test
-[ 100 ] [
+{ 100 } [
[
100 <pile> &dispose
dup 25 pile-alloc drop
TUPLE: foo x ;
-[ 1 ] [
+{ 1 } [
foo 2 foo <pool> set-class-pool
foo new-from-pool drop
foo class-pool pool-size
] unit-test
-[ T{ foo } T{ foo } f ] [
+{ T{ foo } T{ foo } f } [
foo 2 foo <pool> set-class-pool
foo new-from-pool
foo new-from-pool
] unit-test
-[ f ] [
+{ f } [
foo 2 foo <pool> set-class-pool
foo new-from-pool
AFTER: string testing append ;
BEFORE: array testing over prefix "a" set ;
-[ V{ 3 2 1 } ] [ 3 V{ 1 2 3 } testing ] unit-test
-[ "heyyeh" ] [ 4 "yeh" testing ] unit-test
-[ { 4 2 0 } ] [ 5 { 0 2 4 } testing ] unit-test
-[ { 5 0 2 4 } ] [ "a" get ] unit-test
+{ V{ 3 2 1 } } [ 3 V{ 1 2 3 } testing ] unit-test
+{ "heyyeh" } [ 4 "yeh" testing ] unit-test
+{ { 4 2 0 } } [ 5 { 0 2 4 } testing ] unit-test
+{ { 5 0 2 4 } } [ "a" get ] unit-test
"history" get add-history
-[ t ] [ "history" get back>> empty? ] unit-test
-[ t ] [ "history" get forward>> empty? ] unit-test
+{ t } [ "history" get back>> empty? ] unit-test
+{ t } [ "history" get forward>> empty? ] unit-test
"history" get add-history
3 "history" get set-model
-[ t ] [ "history" get back>> empty? ] unit-test
-[ t ] [ "history" get forward>> empty? ] unit-test
+{ t } [ "history" get back>> empty? ] unit-test
+{ t } [ "history" get forward>> empty? ] unit-test
"history" get add-history
4 "history" get set-model
-[ f ] [ "history" get back>> empty? ] unit-test
-[ t ] [ "history" get forward>> empty? ] unit-test
+{ f } [ "history" get back>> empty? ] unit-test
+{ t } [ "history" get forward>> empty? ] unit-test
"history" get go-back
-[ 3 ] [ "history" get value>> ] unit-test
+{ 3 } [ "history" get value>> ] unit-test
-[ t ] [ "history" get back>> empty? ] unit-test
-[ f ] [ "history" get forward>> empty? ] unit-test
+{ t } [ "history" get back>> empty? ] unit-test
+{ f } [ "history" get forward>> empty? ] unit-test
"history" get go-forward
-[ 4 ] [ "history" get value>> ] unit-test
+{ 4 } [ "history" get value>> ] unit-test
-[ f ] [ "history" get back>> empty? ] unit-test
-[ t ] [ "history" get forward>> empty? ] unit-test
+{ f } [ "history" get back>> empty? ] unit-test
+{ t } [ "history" get forward>> empty? ] unit-test
FROM: monads => do ;
IN: monads.tests
-[ 5 ] [ 1 identity-monad return [ 4 + ] fmap run-identity ] unit-test
+{ 5 } [ 1 identity-monad return [ 4 + ] fmap run-identity ] unit-test
[ "OH HAI" identity-monad fail ] must-fail
-[ 666 ] [
+{ 666 } [
111 <just> [ 6 * ] fmap [ ] [ "OOPS" throw ] if-maybe
] unit-test
-[ nothing ] [
+{ nothing } [
111 <just> [ maybe-monad fail ] bind
] unit-test
-[ 100 ] [
+{ 100 } [
5 either-monad return [ 10 * ] [ 20 * ] if-either
] unit-test
-[ T{ left f "OOPS" } ] [
+{ T{ left f "OOPS" } } [
5 either-monad return >>= [ drop "OOPS" either-monad fail ] swap call
] unit-test
-[ { 10 20 30 } ] [
+{ { 10 20 30 } } [
{ 1 2 3 } [ 10 * ] fmap
] unit-test
-[ { } ] [
+{ { } } [
{ 1 2 3 } [ drop "OOPS" array-monad fail ] bind
] unit-test
-[ 5 ] [
+{ 5 } [
5 state-monad return "initial state" run-st
] unit-test
-[ 8 ] [
+{ 8 } [
5 state-monad return [ 3 + state-monad return ] bind
"initial state" run-st
] unit-test
-[ 8 ] [
+{ 8 } [
5 state-monad return >>=
[ 3 + state-monad return ] swap call
"initial state" run-st
] unit-test
-[ 11 ] [
+{ 11 } [
f state-monad return >>=
[ drop get-st ] swap call
11 run-st
] unit-test
-[ 15 ] [
+{ 15 } [
f state-monad return
[ drop get-st ] bind
[ 4 + put-st ] bind
11 run-st
] unit-test
-[ 15 ] [
+{ 15 } [
{
[ f return-st ]
[ drop get-st ]
11 run-st
] unit-test
-[ nothing ] [
+{ nothing } [
{
[ "hi" <just> ]
[ " bye" append <just> ]
: nats ( -- list ) 0 nats-from ;
-[ 3 ] [
+{ 3 } [
{
[ nats ]
[ dup 3 = [ list-monad return ] [ list-monad fail ] if ]
} do car
] unit-test
-[ 9/11 ] [
+{ 9/11 } [
{
[ ask ]
} do 9/11 run-reader
] unit-test
-[ 8 ] [
+{ 8 } [
{
[ ask ]
[ 3 + reader-monad return ]
5 run-reader
] unit-test
-[ 6 ] [
+{ 6 } [
f reader-monad return [ drop ask ] bind [ 1 + ] local 5 run-reader
] unit-test
-[ f { 1 2 3 } ] [
+{ f { 1 2 3 } } [
5 writer-monad return
[ drop { 1 2 3 } tell ] bind
run-writer
] unit-test
-[ T{ identity f 7 } ]
+{ T{ identity f 7 } }
[
4 identity-monad return
[ 3 + ] identity-monad return
identity-monad apply
] unit-test
-[ nothing ] [
+{ nothing } [
5 <just> nothing maybe-monad apply
] unit-test
-[ T{ just f 15 } ] [
+{ T{ just f 15 } } [
5 <just> [ 10 + ] <just> maybe-monad apply
] unit-test
USING: money parser tools.test eval ;
IN: money.tests
-[ -1/10 ] [ DECIMAL: -.1 ] unit-test
-[ -1/10 ] [ DECIMAL: -0.1 ] unit-test
-[ -1/10 ] [ DECIMAL: -00.10 ] unit-test
+{ -1/10 } [ DECIMAL: -.1 ] unit-test
+{ -1/10 } [ DECIMAL: -0.1 ] unit-test
+{ -1/10 } [ DECIMAL: -00.10 ] unit-test
-[ 0 ] [ DECIMAL: .0 ] unit-test
-[ 0 ] [ DECIMAL: 0.0 ] unit-test
-[ 0 ] [ DECIMAL: 0. ] unit-test
-[ 0 ] [ DECIMAL: 0 ] unit-test
-[ 1/10 ] [ DECIMAL: .1 ] unit-test
-[ 1/10 ] [ DECIMAL: 0.1 ] unit-test
-[ 1/10 ] [ DECIMAL: 00.10 ] unit-test
-[ 23 ] [ DECIMAL: 23 ] unit-test
-[ -23 ] [ DECIMAL: -23 ] unit-test
-[ -23-1/100 ] [ DECIMAL: -23.01 ] unit-test
+{ 0 } [ DECIMAL: .0 ] unit-test
+{ 0 } [ DECIMAL: 0.0 ] unit-test
+{ 0 } [ DECIMAL: 0. ] unit-test
+{ 0 } [ DECIMAL: 0 ] unit-test
+{ 1/10 } [ DECIMAL: .1 ] unit-test
+{ 1/10 } [ DECIMAL: 0.1 ] unit-test
+{ 1/10 } [ DECIMAL: 00.10 ] unit-test
+{ 23 } [ DECIMAL: 23 ] unit-test
+{ -23 } [ DECIMAL: -23 ] unit-test
+{ -23-1/100 } [ DECIMAL: -23.01 ] unit-test
[ "DECIMAL: ." eval ] must-fail
[ "DECIMAL: f" eval ] must-fail
[ "DECIMAL: 0.f" eval ] must-fail
[ "DECIMAL: f.0" eval ] must-fail
-[ "$100.00" ] [ DECIMAL: 100.0 money>string ] unit-test
-[ "$0.00" ] [ DECIMAL: 0.0 money>string ] unit-test
+{ "$100.00" } [ DECIMAL: 100.0 money>string ] unit-test
+{ "$0.00" } [ DECIMAL: 0.0 money>string ] unit-test
USING: arrays morse strings tools.test ;
IN: morse.tests
-[ "?" ] [ CHAR: \\ ch>morse ] unit-test
-[ "..." ] [ CHAR: s ch>morse ] unit-test
-[ CHAR: s ] [ "..." morse>ch ] unit-test
-[ CHAR: \s ] [ "..--..--.." morse>ch ] unit-test
-[ "-- --- .-. ... . / -.-. --- -.. ." ] [ "morse code" >morse ] unit-test
-[ "morse code" ] [ "-- --- .-. ... . / -.-. --- -.. ." morse> ] unit-test
-[ "hello, world!" ] [ "Hello, World!" >morse morse> ] unit-test
-[ ".- -... -.-." ] [ "abc" >morse ] unit-test
+{ "?" } [ CHAR: \\ ch>morse ] unit-test
+{ "..." } [ CHAR: s ch>morse ] unit-test
+{ CHAR: s } [ "..." morse>ch ] unit-test
+{ CHAR: \s } [ "..--..--.." morse>ch ] unit-test
+{ "-- --- .-. ... . / -.-. --- -.. ." } [ "morse code" >morse ] unit-test
+{ "morse code" } [ "-- --- .-. ... . / -.-. --- -.. ." morse> ] unit-test
+{ "hello, world!" } [ "Hello, World!" >morse morse> ] unit-test
+{ ".- -... -.-." } [ "abc" >morse ] unit-test
-[ "abc" ] [ ".- -... -.-." morse> ] unit-test
+{ "abc" } [ ".- -... -.-." morse> ] unit-test
-[ "morse code" ] [
+{ "morse code" } [
[MORSE
-- --- .-. ... . /
-.-. --- -.. .
MORSE] >morse morse> ] unit-test
-[ "morse code 123" ] [
+{ "morse code 123" } [
[MORSE
__ ___ ._. ... . /
_._. ___ _.. . /
.____ ..___ ...__
MORSE] ] unit-test
-[ [MORSE
+{ [MORSE
-- --- .-. ... . /
-.-. --- -.. .
- MORSE] ] [
+ MORSE] } [
"morse code" >morse morse>
] unit-test
-[ "factor rocks!" ] [
+{ "factor rocks!" } [
[MORSE
..-. .- -.-. - --- .-. /
.-. --- -.-. -.- ... -.-.--
USING: msxml-to-csv tools.test csv io.encodings.utf8
io.files.temp kernel ;
-[ t ] [
+{ t } [
"test.csv" temp-file
"resource:extra/msxml-to-csv/test.xml" msxml>csv
"test.csv" temp-file utf8 file>csv
IN: nested-comments.tests
! Correct
-[ ] [
+{ } [
"USE: nested-comments (* comment *)" eval( -- )
] unit-test
-[ ] [
+{ } [
"USE: nested-comments (* comment*)" eval( -- )
] unit-test
-[ ] [
+{ } [
"USE: nested-comments (* comment
*)" eval( -- )
] unit-test
-[ ] [
+{ } [
"USE: nested-comments (* comment
*)" eval( -- )
] unit-test
-[ ] [
+{ } [
"USE: nested-comments (* comment
*)" eval( -- )
] unit-test
-[ ] [
+{ } [
"USE: nested-comments (* comment
(* *)
IN: noise.tests
USING: noise tools.test sequences math ;
-[ t ] [ { 100 100 } perlin-noise-map-coords [ [ 100 <= ] all? ] all? ] unit-test
+{ t } [ { 100 100 } perlin-noise-map-coords [ [ 100 <= ] all? ] all? ] unit-test
{ 1.0 0.0 1.0 }
} { 0.0 0.0 0.0 0.25 0.25 0.5 0.5 0.75 0.75 1.0 1.0 1.0 } <nurbs-curve> test-nurbs set
-[ t ] [ test-nurbs get 0.0 eval-nurbs { 1.0 0.0 } 0.00001 v~ ] unit-test
-[ t ] [ test-nurbs get 0.25 eval-nurbs { 0.0 1.0 } 0.00001 v~ ] unit-test
-[ t ] [ test-nurbs get 0.5 eval-nurbs { -1.0 0.0 } 0.00001 v~ ] unit-test
-[ t ] [ test-nurbs get 0.75 eval-nurbs { 0.0 -1.0 } 0.00001 v~ ] unit-test
+{ t } [ test-nurbs get 0.0 eval-nurbs { 1.0 0.0 } 0.00001 v~ ] unit-test
+{ t } [ test-nurbs get 0.25 eval-nurbs { 0.0 1.0 } 0.00001 v~ ] unit-test
+{ t } [ test-nurbs get 0.5 eval-nurbs { -1.0 0.0 } 0.00001 v~ ] unit-test
+{ t } [ test-nurbs get 0.75 eval-nurbs { 0.0 -1.0 } 0.00001 v~ ] unit-test
-[ t ] [ test-nurbs get 0.125 eval-nurbs ${ √2/2 √2/2 } 0.00001 v~ ] unit-test
-[ t ] [ test-nurbs get 0.375 eval-nurbs ${ -√2/2 √2/2 } 0.00001 v~ ] unit-test
-[ t ] [ test-nurbs get 0.625 eval-nurbs ${ -√2/2 -√2/2 } 0.00001 v~ ] unit-test
-[ t ] [ test-nurbs get 0.875 eval-nurbs ${ √2/2 -√2/2 } 0.00001 v~ ] unit-test
+{ t } [ test-nurbs get 0.125 eval-nurbs ${ √2/2 √2/2 } 0.00001 v~ ] unit-test
+{ t } [ test-nurbs get 0.375 eval-nurbs ${ -√2/2 √2/2 } 0.00001 v~ ] unit-test
+{ t } [ test-nurbs get 0.625 eval-nurbs ${ -√2/2 -√2/2 } 0.00001 v~ ] unit-test
+{ t } [ test-nurbs get 0.875 eval-nurbs ${ √2/2 -√2/2 } 0.00001 v~ ] unit-test
strings namespaces urls ;
IN: oauth.tests
-[ "%26&b" ] [ "&" "b" hmac-key ] unit-test
-[ "%26&" ] [ "&" f hmac-key ] unit-test
+{ "%26&b" } [ "&" "b" hmac-key ] unit-test
+{ "%26&" } [ "&" f hmac-key ] unit-test
-[ "B&http%3A%2F%2Ftwitter.com%2F&a%3Db" ] [
+{ "B&http%3A%2F%2Ftwitter.com%2F&a%3Db" } [
URL" http://twitter.com"
"B"
{ { "a" "b" } }
signature-base-string
] unit-test
-[ "0EieqbHx0FJ/RtFskmRj9/TDpqo=" ] [
+{ "0EieqbHx0FJ/RtFskmRj9/TDpqo=" } [
"ABC" "DEF" <token> consumer-token set
URL" http://twitter.com"
queue clReleaseCommandQueue cl-success
context clReleaseContext cl-success ;
-[ float-array{ 1.0 4.0 9.0 16.0 100.0 } ]
+{ float-array{ 1.0 4.0 9.0 16.0 100.0 } }
[ float-array{ 1.0 2.0 3.0 4.0 10.0 } opencl-square ] unit-test
] with-cl-state
] with-destructors ;
-[ float-array{ 1.0 4.0 9.0 16.0 100.0 } ]
+{ float-array{ 1.0 4.0 9.0 16.0 100.0 } }
[ float-array{ 1.0 2.0 3.0 4.0 10.0 } opencl-square ] unit-test
PAIR-M: barm zim blibble
"coconut " class-names ;
-[ "vanilla zang-zim" ] [ zim new zang new blibble ] unit-test
+{ "vanilla zang-zim" } [ zim new zang new blibble ] unit-test
! args automatically swap to match most specific method
-[ "chocolate foom-zim" ] [ foom new zim new blibble ] unit-test
-[ "chocolate foom-zim" ] [ zim new foom new blibble ] unit-test
+{ "chocolate foom-zim" } [ foom new zim new blibble ] unit-test
+{ "chocolate foom-zim" } [ zim new foom new blibble ] unit-test
-[ "strawberry barm-barm" ] [ barm new barm new blibble ] unit-test
-[ "strawberry barm-foom" ] [ barm new foom new blibble ] unit-test
-[ "strawberry barm-foom" ] [ foom new barm new blibble ] unit-test
+{ "strawberry barm-barm" } [ barm new barm new blibble ] unit-test
+{ "strawberry barm-foom" } [ barm new foom new blibble ] unit-test
+{ "strawberry barm-foom" } [ foom new barm new blibble ] unit-test
-[ "coconut barm-zang" ] [ zang new barm new blibble ] unit-test
-[ "coconut barm-zim" ] [ barm new zim new blibble ] unit-test
+{ "coconut barm-zang" } [ zang new barm new blibble ] unit-test
+{ "coconut barm-zim" } [ barm new zim new blibble ] unit-test
[ 1 2 blibble ] [ no-pair-method? ] must-fail-with
USING: kernel pair-rocket tools.test ;
IN: pair-rocket.tests
-[ { "a" 1 } ] [ "a" => 1 ] unit-test
-[ { { "a" } { 1 } } ] [ { "a" } => { 1 } ] unit-test
-[ { drop 1 } ] [ drop => 1 ] unit-test
+{ { "a" 1 } } [ "a" => 1 ] unit-test
+{ { { "a" } { 1 } } } [ { "a" } => { 1 } ] unit-test
+{ { drop 1 } } [ drop => 1 ] unit-test
-[ H{ { "zippity" 5 } { "doo" 2 } { "dah" 7 } } ]
+{ H{ { "zippity" 5 } { "doo" 2 } { "dah" 7 } } }
[ H{ "zippity" => 5 "doo" => 2 "dah" => 7 } ] unit-test
"blah" blah <pair> "b" set
-[ "blah" t ] [ blah "b" get at* ] unit-test
-[ f f ] [ "fdaf" "b" get at* ] unit-test
-[ 1 ] [ "b" get assoc-size ] unit-test
-[ { { blah "blah" } } ] [ "b" get >alist ] unit-test
-[ ] [ "bleah" blah "b" get set-at ] unit-test
-[ 1 ] [ "b" get assoc-size ] unit-test
-[ { { blah "bleah" } } ] [ "b" get >alist ] unit-test
-[ "bleah" t ] [ blah "b" get at* ] unit-test
-[ f f ] [ "fdaf" "b" get at* ] unit-test
+{ "blah" t } [ blah "b" get at* ] unit-test
+{ f f } [ "fdaf" "b" get at* ] unit-test
+{ 1 } [ "b" get assoc-size ] unit-test
+{ { { blah "blah" } } } [ "b" get >alist ] unit-test
+{ } [ "bleah" blah "b" get set-at ] unit-test
+{ 1 } [ "b" get assoc-size ] unit-test
+{ { { blah "bleah" } } } [ "b" get >alist ] unit-test
+{ "bleah" t } [ blah "b" get at* ] unit-test
+{ f f } [ "fdaf" "b" get at* ] unit-test
[ blah "b" get delete-at ] must-fail
-[ ] [ 1 2 "b" get set-at ] unit-test
-[ "bleah" t ] [ blah "b" get at* ] unit-test
-[ 1 t ] [ 2 "b" get at* ] unit-test
-[ f f ] [ "fdaf" "b" get at* ] unit-test
-[ 2 ] [ "b" get assoc-size ] unit-test
-[ { { 2 1 } { blah "bleah" } } ] [ "b" get >alist ] unit-test
+{ } [ 1 2 "b" get set-at ] unit-test
+{ "bleah" t } [ blah "b" get at* ] unit-test
+{ 1 t } [ 2 "b" get at* ] unit-test
+{ f f } [ "fdaf" "b" get at* ] unit-test
+{ 2 } [ "b" get assoc-size ] unit-test
+{ { { 2 1 } { blah "bleah" } } } [ "b" get >alist ] unit-test
'[ over + @ drop ] each-integer drop f
] bshift 2nip ; inline
-[ 55 ] [
+{ 55 } [
0 sum set
[ 1 10 range sum get + sum set f ] breset drop
sum get
>>
! Existing path from s to f
-[
+{
{
{ 1 1 }
{ 2 1 }
{ 8 7 }
{ 8 6 }
}
-] [
+} [
{ 8 6 } test1 drop
] unit-test
! Check that only the right positions have been considered in the s to f path
-[ 7 ] [ { 7 1 } test1 nip length ] unit-test
+{ 7 } [ { 7 1 } test1 nip length ] unit-test
! Non-existing path from s to g -- all positions must have been considered
-[ f 26 ] [ { 1 7 } test1 length ] unit-test
+{ f 26 } [ { 1 7 } test1 length ] unit-test
! Look for a path between A and C. The best path is A --> D --> C. C will be placed
! in the open set early because B will be examined first. This checks that the evaluation
>>
! Check path from A to C -- all nodes but F must have been examined
-[ "ADC" "ABCDE" ] [ "AC" test2 [ >string ] dip ] unit-test
+{ "ADC" "ABCDE" } [ "AC" test2 [ >string ] dip ] unit-test
! No path from D to B -- all nodes reachable from D must have been examined
-[ f "CDEF" ] [ "DB" test2 ] unit-test
+{ f "CDEF" } [ "DB" test2 ] unit-test
! Find a path using BFS. There are no path from F to A, and the path from D to
! C does not include any other node.
-[ f ] [ "FA" first2 routes <bfs> find-path ] unit-test
-[ "DC" ] [ "DC" first2 routes <bfs> find-path >string ] unit-test
+{ f } [ "FA" first2 routes <bfs> find-path ] unit-test
+{ "DC" } [ "DC" first2 routes <bfs> find-path >string ] unit-test
<<
>>
! Check path from A to C -- all nodes but F must have been examined
-[ "ADC" "ABCDE" ] [ "AC" test3 [ >string ] dip ] unit-test
+{ "ADC" "ABCDE" } [ "AC" test3 [ >string ] dip ] unit-test
! No path from D to B -- all nodes reachable from D must have been examined
-[ f "CDEF" ] [ "DB" test3 ] unit-test
+{ f "CDEF" } [ "DB" test3 ] unit-test
-[ { 1 3 } ] [
+{ { 1 3 } } [
1 3 H{
{ 1 H{ { 2 0 } { 3 0 } } }
{ 2 H{ { 3 0 } { 1 0 } { 4 0 } } }
USING: pcre.ffi sequences splitting tools.test ;
IN: pcre.ffi.tests
-[ 2 ] [ pcre_version " " split length ] unit-test
+{ 2 } [ pcre_version " " split length ] unit-test
QUALIFIED: regexp
IN: pcre.tests
-[ { "Bords" "words" "word" } ] [
+{ { "Bords" "words" "word" } } [
"Bords, words, word." { ", " ", " "." } split-subseqs
] unit-test
-[ { { 3 "day" } { 2 "month" } { 1 "year" } } ] [
+{ { { 3 "day" } { 2 "month" } { 1 "year" } } } [
"(?P<year>\\d{4})-(?P<month>\\d{2})-(?P<day>\\d{2})"
<compiled-pcre> nametable>>
] unit-test
! On windows the erroffset appears to be set to 0 despite there being
! nothing wrong with the regexp.
-[ t ] [
+{ t } [
"foo" (pcre) 3array rest { { f -1 } { f 0 } } member?
] unit-test
-[ { 1 2 3 } ] [
+{ { 1 2 3 } } [
iso-date <pcre>
{ "year" "month" "day" } [ pcre_get_stringnumber ] with map
] unit-test
-[ t ] [ "foo" <compiled-pcre> PCRE_UTF8 has-option? ] unit-test
+{ t } [ "foo" <compiled-pcre> PCRE_UTF8 has-option? ] unit-test
os unix? [ [ 10 ] [ PCRE_CONFIG_NEWLINE pcre-config ] unit-test ] when
! In this day and age, not supporting utf-8 is broken.
-[ 1 ] [ PCRE_CONFIG_UTF8 pcre-config ] unit-test
+{ 1 } [ PCRE_CONFIG_UTF8 pcre-config ] unit-test
-[ 1 ] [ PCRE_CONFIG_UNICODE_PROPERTIES pcre-config ] unit-test
+{ 1 } [ PCRE_CONFIG_UNICODE_PROPERTIES pcre-config ] unit-test
! Ok if these options throw if the pcre library is to old to support
! these configuration parameters.
-[ t ] [
+{ t } [
[ PCRE_CONFIG_UTF16 pcre-config ] [ what>> ] recover
{ 0 $ PCRE_CONFIG_UTF16 } member?
] unit-test
-[ t ] [
+{ t } [
[ PCRE_CONFIG_UTF32 pcre-config ] [ what>> ] recover
{ 0 $ PCRE_CONFIG_UTF32 } member?
] unit-test
-[ 33 ]
+{ 33 }
[
[ "foo" <pcre> f 33 pcre-fullinfo ] [ what>> ] recover
] unit-test
! Tests for findall
-[
+{
{ { f "1999-01-12" } { "year" "1999" } { "month" "01" } { "day" "12" } }
-] [
+} [
"1999-01-12" iso-date <compiled-pcre> findall first
] unit-test
-[ 3 ] [
+{ 3 } [
"2003-10-09 1999-09-01 1514-10-20" iso-date <compiled-pcre> findall length
] unit-test
-[ 5 ] [ "abcdef" "[a-e]" findall length ] unit-test
+{ 5 } [ "abcdef" "[a-e]" findall length ] unit-test
-[ 3 ] [ "foo bar baz" "foo|bar|baz" findall length ] unit-test
+{ 3 } [ "foo bar baz" "foo|bar|baz" findall length ] unit-test
-[ 3 ] [ "örjan är åtta" "[åäö]" findall length ] unit-test
+{ 3 } [ "örjan är åtta" "[åäö]" findall length ] unit-test
-[ 3 ] [ "ÅÄÖ" "\\p{Lu}" findall length ] unit-test
+{ 3 } [ "ÅÄÖ" "\\p{Lu}" findall length ] unit-test
-[ 3 ] [ "foobar" "foo(?=bar)" findall first first second length ] unit-test
+{ 3 } [ "foobar" "foo(?=bar)" findall first first second length ] unit-test
-[ { { { f ", " } } { { f ", " } } { { f "." } } } ] [
+{ { { { f ", " } } { { f ", " } } { { f "." } } } } [
"Words, words, word." "\\W+" findall
] unit-test
-[ { ", " ", " "." } ] [
+{ { ", " ", " "." } } [
"Words, words, word." "\\W+" findall [ first second ] map
] unit-test
10000 [ CHAR: a CHAR: z [a,b] random ] "" replicate-as ;
! Performance
-[ 0 ] [ long-string ".{0,15}foobar.{0,10}" findall length ] unit-test
+{ 0 } [ long-string ".{0,15}foobar.{0,10}" findall length ] unit-test
! Empty matches, corner case behaviour is copied from pcredemo.c
-[ { { { f "foo" } } { { f "" } } } ]
+{ { { { f "foo" } } { { f "" } } } }
[ "foo" ".*" findall ] unit-test
-[ { { { f "" } } { { f "" } } { { f "" } } } ]
+{ { { { f "" } } { { f "" } } { { f "" } } } }
[ "foo" "B*" findall ] unit-test
! Empty matches in strings with multi-byte characters are tricky.
-[ { { { f "" } } { { f "" } } { { f "" } } { { f "" } } } ]
+{ { { { f "" } } { { f "" } } { { f "" } } { { f "" } } } }
[ "öööö" "x*" findall ] unit-test
! Tests for matches?
-[ t ] [ "örjan" "örjan" matches? ] unit-test
+{ t } [ "örjan" "örjan" matches? ] unit-test
-[ t ] [ "abcö" "\\p{Ll}{4}" matches? ] unit-test
+{ t } [ "abcö" "\\p{Ll}{4}" matches? ] unit-test
! Dotall mode, off by default
-[ f ] [ "." <compiled-pcre> PCRE_DOTALL has-option? ] unit-test
-[ t ] [ "(?s)." <compiled-pcre> PCRE_DOTALL has-option? ] unit-test
+{ f } [ "." <compiled-pcre> PCRE_DOTALL has-option? ] unit-test
+{ t } [ "(?s)." <compiled-pcre> PCRE_DOTALL has-option? ] unit-test
-[ f ] [ "\n" "." matches? ] unit-test
-[ t ] [ "\n" "(?s)." matches? ] unit-test
+{ f } [ "\n" "." matches? ] unit-test
+{ t } [ "\n" "(?s)." matches? ] unit-test
! Caseless mode, off by default
-[ { f t } ] [
+{ { f t } } [
{ "x" "(?i)x" } [ <compiled-pcre> PCRE_CASELESS has-option? ] map
] unit-test
! Backreferences
-[ { t f } ] [
+{ { t f } } [
{ "response and responsibility" "sense and responsibility" }
[ "(sens|respons)e and \\1ibility" matches? ] map
] unit-test
-[ { t t f } ] [
+{ { t t f } } [
{ "rah rah" "RAH RAH" "RAH rah" } [ "((?i)rah)\\s+\\1" matches? ] map
] unit-test
! Splitting
-[ { { "Words" "words" "word" } { "Words" "words" "word" } } ] [
+{ { { "Words" "words" "word" } { "Words" "words" "word" } } } [
"Words, words, word." { "\\W+" "[,. ]" } [ split ] with map
] unit-test
! Bigger tests
-[ t ] [
+{ t } [
"http://factorcode.org/" http-get nip
"href=\"(?P<link>[^\"]+)\"" findall [ "link" of ] map sequence?
] unit-test
! Test that the regexp syntax works.
-[ t ] [ "1234abcd" regexp:R[ ^\d+\w+$] matches? ] unit-test
+{ t } [ "1234abcd" regexp:R[ ^\d+\w+$] matches? ] unit-test
IN: pdf.units.tests
-[ 0 ] [ "0" string>points ] unit-test
-[ 1 ] [ "1" string>points ] unit-test
-[ 1.5 ] [ "1.5" string>points ] unit-test
+{ 0 } [ "0" string>points ] unit-test
+{ 1 } [ "1" string>points ] unit-test
+{ 1.5 } [ "1.5" string>points ] unit-test
-[ 12 ] [ "12pt" string>points ] unit-test
+{ 12 } [ "12pt" string>points ] unit-test
-[ 72.0 ] [ "1in" string>points ] unit-test
-[ 108.0 ] [ "1.5in" string>points ] unit-test
+{ 72.0 } [ "1in" string>points ] unit-test
+{ 108.0 } [ "1.5in" string>points ] unit-test
IN: picomath
-[ t ] [
+{ t } [
{
{ -3 -0.999977909503 }
{ -1 -0.842700792950 }
supremum 1e-6 <
] unit-test
-[ t ] [
+{ t } [
{
{ -1 -0.632120558828558 }
{ 0.0 0.0 }
supremum 1e-6 <
] unit-test
-[ t ] [
+{ t } [
{
{ -3 0.00134989803163 }
{ -1 0.158655253931 }
: factorial ( n -- n! ) [ 1 ] [ [1,b] 1 [ * ] reduce ] if-zero ;
-[ t ] [
+{ t } [
{ 0 1 10 100 1000 10000 } [
[ factorial log ] [ log-factorial ] bi - abs
] map supremum 1e-6 <
: relative-error ( approx value -- relative-error )
[ - abs ] keep / ;
-[ t ] [
+{ t } [
{
{ 1e-20 1e+20 }
{ 2.19824158876e-16 4.5490905327e+15 } ! 0.99*DBL_EPSILON
supremum 1e-6 <
] unit-test
-[ t ] [
+{ t } [
{
{ 1e-12 27.6310211159 }
{ 0.9999 5.77297915613e-05 }
USING: accessors kernel math math.order poker poker.private tools.test ;
IN: poker.tests
-[ 134236965 ] [ "KD" >ckf ] unit-test
-[ 529159 ] [ "5s" >ckf ] unit-test
-[ 33589533 ] [ "jc" >ckf ] unit-test
+{ 134236965 } [ "KD" >ckf ] unit-test
+{ 529159 } [ "5s" >ckf ] unit-test
+{ 33589533 } [ "jc" >ckf ] unit-test
-[ 7462 ] [ "7C 5D 4H 3S 2C" string>value ] unit-test
-[ 1601 ] [ "KD QS JC TH 9S" string>value ] unit-test
-[ 11 ] [ "AC AD AH AS KC" string>value ] unit-test
-[ 9 ] [ "6C 5C 4C 3C 2C" string>value ] unit-test
-[ 1 ] [ "AC KC QC JC TC" string>value ] unit-test
+{ 7462 } [ "7C 5D 4H 3S 2C" string>value ] unit-test
+{ 1601 } [ "KD QS JC TH 9S" string>value ] unit-test
+{ 11 } [ "AC AD AH AS KC" string>value ] unit-test
+{ 9 } [ "6C 5C 4C 3C 2C" string>value ] unit-test
+{ 1 } [ "AC KC QC JC TC" string>value ] unit-test
-[ "High Card" ] [ "7C 5D 4H 3S 2C" string>hand-name ] unit-test
-[ "Straight" ] [ "KD QS JC TH 9S" string>hand-name ] unit-test
-[ "Four of a Kind" ] [ "AC AD AH AS KC" string>hand-name ] unit-test
-[ "Straight Flush" ] [ "6C 5C 4C 3C 2C" string>hand-name ] unit-test
+{ "High Card" } [ "7C 5D 4H 3S 2C" string>hand-name ] unit-test
+{ "Straight" } [ "KD QS JC TH 9S" string>hand-name ] unit-test
+{ "Four of a Kind" } [ "AC AD AH AS KC" string>hand-name ] unit-test
+{ "Straight Flush" } [ "6C 5C 4C 3C 2C" string>hand-name ] unit-test
-[ t ] [ "7C 5D 4H 3S 2C" "KD QS JC TH 9S" [ string>value ] bi@ > ] unit-test
-[ t ] [ "AC AD AH AS KC" "KD QS JC TH 9S" [ string>value ] bi@ < ] unit-test
-[ t ] [ "7C 5D 4H 3S 2C" "7D 5D 4D 3C 2S" [ string>value ] bi@ = ] unit-test
+{ t } [ "7C 5D 4H 3S 2C" "KD QS JC TH 9S" [ string>value ] bi@ > ] unit-test
+{ t } [ "AC AD AH AS KC" "KD QS JC TH 9S" [ string>value ] bi@ < ] unit-test
+{ t } [ "7C 5D 4H 3S 2C" "7D 5D 4D 3C 2S" [ string>value ] bi@ = ] unit-test
-[ t ] [ "7C 5D 4H 3S 2C" "2C 3S 4H 5D 7C" [ string>value ] bi@ = ] unit-test
+{ t } [ "7C 5D 4H 3S 2C" "2C 3S 4H 5D 7C" [ string>value ] bi@ = ] unit-test
-[ t ] [ "7C 5D 4H 3S 2C" "7D 5D 4D 3C 2S" [ string>value ] bi@ = ] unit-test
+{ t } [ "7C 5D 4H 3S 2C" "7D 5D 4D 3C 2S" [ string>value ] bi@ = ] unit-test
-[ 190 ] [ "AS KD JC KH 2D 2S KC" string>value ] unit-test
+{ 190 } [ "AS KD JC KH 2D 2S KC" string>value ] unit-test
<promise> "p1" set
-[ ] [ "p1" get mock-pop3-server ] unit-test
-[ ] [
+{ } [ "p1" get mock-pop3-server ] unit-test
+{ } [
<pop3-account>
"127.0.0.1" >>host
"p1" get 5 seconds ?promise-timeout >>port
connect
] unit-test
-[ ] [ "username@host.com" >user ] unit-test
-[ ] [ "password" >pwd ] unit-test
-[ { "CAPA" "TOP" "UIDL" } ] [ capa ] unit-test
-[ 2 ] [ count ] unit-test
-[ H{ { 1 "1006" } { 2 "747" } } ] [ list ] unit-test
-[
+{ } [ "username@host.com" >user ] unit-test
+{ } [ "password" >pwd ] unit-test
+{ { "CAPA" "TOP" "UIDL" } } [ capa ] unit-test
+{ 2 } [ count ] unit-test
+{ H{ { 1 "1006" } { 2 "747" } } } [ list ] unit-test
+{
H{
{ "From:" "from.first@mail.com" }
{ "Subject:" "First test with mock POP3 server" }
{ "To:" "username@host.com" }
}
-] [ 1 0 top drop headers ] unit-test
-[
+} [ 1 0 top drop headers ] unit-test
+{
{
T{ message
{ # 1 }
{ size "747" }
}
}
-] [ consolidate ] unit-test
-[ "000000d547ac2fc2" ] [ 1 uidl ] unit-test
-[ ] [ 1 delete ] unit-test
-[ ] [ reset ] unit-test
-[ ] [ close ] unit-test
+} [ consolidate ] unit-test
+{ "000000d547ac2fc2" } [ 1 uidl ] unit-test
+{ } [ 1 delete ] unit-test
+{ } [ reset ] unit-test
+{ } [ close ] unit-test
<promise> "p2" set
-[ ] [ "p2" get mock-pop3-server ] unit-test
-[ ] [
+{ } [ "p2" get mock-pop3-server ] unit-test
+{ } [
<pop3-account>
"127.0.0.1" >>host
"p2" get 5 seconds ?promise-timeout >>port
"password" >>pwd
connect
] unit-test
-[ f ] [ 1 retrieve empty? ] unit-test
-[ ] [ close ] unit-test
+{ f } [ 1 retrieve empty? ] unit-test
+{ } [ close ] unit-test
USING: project-euler.001 tools.test ;
IN: project-euler.001.tests
-[ 233168 ] [ euler001 ] unit-test
-[ 233168 ] [ euler001a ] unit-test
-[ 233168 ] [ euler001b ] unit-test
-[ 233168 ] [ euler001c ] unit-test
-[ 233168 ] [ euler001d ] unit-test
+{ 233168 } [ euler001 ] unit-test
+{ 233168 } [ euler001a ] unit-test
+{ 233168 } [ euler001b ] unit-test
+{ 233168 } [ euler001c ] unit-test
+{ 233168 } [ euler001d ] unit-test
USING: project-euler.002 tools.test ;
IN: project-euler.002.tests
-[ 4613732 ] [ euler002 ] unit-test
-[ 4613732 ] [ euler002a ] unit-test
-[ 4613732 ] [ euler002b ] unit-test
+{ 4613732 } [ euler002 ] unit-test
+{ 4613732 } [ euler002a ] unit-test
+{ 4613732 } [ euler002b ] unit-test
USING: project-euler.003 tools.test ;
IN: project-euler.003.tests
-[ 6857 ] [ euler003 ] unit-test
+{ 6857 } [ euler003 ] unit-test
USING: project-euler.004 tools.test ;
IN: project-euler.004.tests
-[ 906609 ] [ euler004 ] unit-test
+{ 906609 } [ euler004 ] unit-test
USING: project-euler.005 tools.test ;
IN: project-euler.005.tests
-[ 232792560 ] [ euler005 ] unit-test
+{ 232792560 } [ euler005 ] unit-test
USING: project-euler.006 tools.test ;
IN: project-euler.006.tests
-[ 25164150 ] [ euler006 ] unit-test
+{ 25164150 } [ euler006 ] unit-test
USING: project-euler.007 tools.test ;
IN: project-euler.007.tests
-[ 104743 ] [ euler007 ] unit-test
+{ 104743 } [ euler007 ] unit-test
USING: project-euler.008 tools.test ;
IN: project-euler.008.tests
-[ 40824 ] [ euler008 ] unit-test
+{ 40824 } [ euler008 ] unit-test
USING: project-euler.009 tools.test ;
IN: project-euler.009.tests
-[ 31875000 ] [ euler009 ] unit-test
+{ 31875000 } [ euler009 ] unit-test
USING: project-euler.010 tools.test ;
IN: project-euler.010.tests
-[ 142913828922 ] [ euler010 ] unit-test
+{ 142913828922 } [ euler010 ] unit-test
USING: project-euler.011 tools.test ;
IN: project-euler.011.tests
-[ 70600674 ] [ euler011 ] unit-test
+{ 70600674 } [ euler011 ] unit-test
USING: project-euler.012 tools.test ;
IN: project-euler.012.tests
-[ 76576500 ] [ euler012 ] unit-test
+{ 76576500 } [ euler012 ] unit-test
USING: project-euler.013 tools.test ;
IN: project-euler.013.tests
-[ 5537376230 ] [ euler013 ] unit-test
+{ 5537376230 } [ euler013 ] unit-test
USING: project-euler.014 tools.test ;
IN: project-euler.014.tests
-[ 837799 ] [ euler014 ] unit-test
-[ 837799 ] [ euler014a ] unit-test
+{ 837799 } [ euler014 ] unit-test
+{ 837799 } [ euler014a ] unit-test
USING: project-euler.015 tools.test ;
IN: project-euler.015.tests
-[ 137846528820 ] [ euler015 ] unit-test
+{ 137846528820 } [ euler015 ] unit-test
USING: project-euler.016 tools.test ;
IN: project-euler.016.tests
-[ 1366 ] [ euler016 ] unit-test
+{ 1366 } [ euler016 ] unit-test
USING: project-euler.017 tools.test ;
IN: project-euler.017.tests
-[ 21124 ] [ euler017 ] unit-test
+{ 21124 } [ euler017 ] unit-test
USING: project-euler.018 tools.test ;
IN: project-euler.018.tests
-[ 1074 ] [ euler018 ] unit-test
-[ 1074 ] [ euler018a ] unit-test
+{ 1074 } [ euler018 ] unit-test
+{ 1074 } [ euler018a ] unit-test
USING: project-euler.019 tools.test ;
IN: project-euler.019.tests
-[ 171 ] [ euler019 ] unit-test
-[ 171 ] [ euler019a ] unit-test
+{ 171 } [ euler019 ] unit-test
+{ 171 } [ euler019a ] unit-test
USING: project-euler.020 tools.test ;
IN: project-euler.020.tests
-[ 648 ] [ euler020 ] unit-test
+{ 648 } [ euler020 ] unit-test
USING: project-euler.021 tools.test ;
IN: project-euler.021.tests
-[ 31626 ] [ euler021 ] unit-test
+{ 31626 } [ euler021 ] unit-test
USING: project-euler.022 tools.test ;
IN: project-euler.022.tests
-[ 871198282 ] [ euler022 ] unit-test
+{ 871198282 } [ euler022 ] unit-test
USING: project-euler.023 tools.test ;
IN: project-euler.023.tests
-[ 4179871 ] [ euler023 ] unit-test
+{ 4179871 } [ euler023 ] unit-test
USING: project-euler.024 tools.test ;
IN: project-euler.024.tests
-[ 2783915460 ] [ euler024 ] unit-test
+{ 2783915460 } [ euler024 ] unit-test
USING: project-euler.025 tools.test ;
IN: project-euler.025.tests
-[ 4782 ] [ euler025 ] unit-test
-[ 4782 ] [ euler025a ] unit-test
+{ 4782 } [ euler025 ] unit-test
+{ 4782 } [ euler025a ] unit-test
USING: project-euler.026 tools.test ;
IN: project-euler.026.tests
-[ 983 ] [ euler026 ] unit-test
+{ 983 } [ euler026 ] unit-test
USING: project-euler.027 tools.test ;
IN: project-euler.027.tests
-[ -59231 ] [ euler027 ] unit-test
+{ -59231 } [ euler027 ] unit-test
USING: project-euler.028 tools.test ;
IN: project-euler.028.tests
-[ 669171001 ] [ euler028 ] unit-test
+{ 669171001 } [ euler028 ] unit-test
USING: project-euler.029 tools.test ;
IN: project-euler.029.tests
-[ 9183 ] [ euler029 ] unit-test
+{ 9183 } [ euler029 ] unit-test
USING: project-euler.030 tools.test ;
IN: project-euler.030.tests
-[ 443839 ] [ euler030 ] unit-test
+{ 443839 } [ euler030 ] unit-test
USING: project-euler.031 tools.test ;
IN: project-euler.031.tests
-[ 73682 ] [ euler031 ] unit-test
+{ 73682 } [ euler031 ] unit-test
USING: project-euler.032 tools.test ;
IN: project-euler.032.tests
-[ 45228 ] [ euler032 ] unit-test
-[ 45228 ] [ euler032a ] unit-test
+{ 45228 } [ euler032 ] unit-test
+{ 45228 } [ euler032a ] unit-test
USING: project-euler.033 tools.test ;
IN: project-euler.033.tests
-[ 100 ] [ euler033 ] unit-test
+{ 100 } [ euler033 ] unit-test
USING: project-euler.034 tools.test ;
IN: project-euler.034.tests
-[ 40730 ] [ euler034 ] unit-test
+{ 40730 } [ euler034 ] unit-test
USING: project-euler.035 tools.test ;
IN: project-euler.035.tests
-[ 55 ] [ euler035 ] unit-test
+{ 55 } [ euler035 ] unit-test
USING: project-euler.036 tools.test ;
IN: project-euler.036.tests
-[ 872187 ] [ euler036 ] unit-test
+{ 872187 } [ euler036 ] unit-test
USING: project-euler.037 tools.test ;
IN: project-euler.037.tests
-[ 748317 ] [ euler037 ] unit-test
+{ 748317 } [ euler037 ] unit-test
USING: project-euler.038 tools.test ;
IN: project-euler.038.tests
-[ 932718654 ] [ euler038 ] unit-test
+{ 932718654 } [ euler038 ] unit-test
USING: project-euler.039 tools.test ;
IN: project-euler.039.tests
-[ 840 ] [ euler039 ] unit-test
+{ 840 } [ euler039 ] unit-test
USING: project-euler.040 tools.test ;
IN: project-euler.040.tests
-[ 210 ] [ euler040 ] unit-test
+{ 210 } [ euler040 ] unit-test
USING: project-euler.041 tools.test ;
IN: project-euler.041.tests
-[ 7652413 ] [ euler041 ] unit-test
+{ 7652413 } [ euler041 ] unit-test
USING: project-euler.042 tools.test ;
IN: project-euler.042.tests
-[ 162 ] [ euler042 ] unit-test
-[ 162 ] [ euler042a ] unit-test
+{ 162 } [ euler042 ] unit-test
+{ 162 } [ euler042a ] unit-test
USING: project-euler.043 tools.test ;
IN: project-euler.043.tests
-[ 16695334890 ] [ euler043 ] unit-test
-[ 16695334890 ] [ euler043a ] unit-test
+{ 16695334890 } [ euler043 ] unit-test
+{ 16695334890 } [ euler043a ] unit-test
USING: project-euler.044 tools.test ;
IN: project-euler.044.tests
-[ 5482660 ] [ euler044 ] unit-test
+{ 5482660 } [ euler044 ] unit-test
USING: project-euler.045 tools.test ;
IN: project-euler.045.tests
-[ 1533776805 ] [ euler045 ] unit-test
+{ 1533776805 } [ euler045 ] unit-test
USING: project-euler.046 tools.test ;
IN: project-euler.046.tests
-[ 5777 ] [ euler046 ] unit-test
+{ 5777 } [ euler046 ] unit-test
USING: project-euler.047 tools.test ;
IN: project-euler.047.tests
-[ 134043 ] [ euler047 ] unit-test
-[ 134043 ] [ euler047a ] unit-test
+{ 134043 } [ euler047 ] unit-test
+{ 134043 } [ euler047a ] unit-test
USING: project-euler.048 tools.test ;
IN: project-euler.048.tests
-[ 9110846700 ] [ euler048 ] unit-test
+{ 9110846700 } [ euler048 ] unit-test
USING: project-euler.049 tools.test ;
IN: project-euler.049.tests
-[ 296962999629 ] [ euler049 ] unit-test
+{ 296962999629 } [ euler049 ] unit-test
USING: project-euler.050 project-euler.050.private tools.test ;
IN: project-euler.050.tests
-[ 41 ] [ 100 solve ] unit-test
-[ 953 ] [ 1000 solve ] unit-test
-[ 997651 ] [ euler050 ] unit-test
+{ 41 } [ 100 solve ] unit-test
+{ 953 } [ 1000 solve ] unit-test
+{ 997651 } [ euler050 ] unit-test
USING: project-euler.051 tools.test ;
IN: project-euler.051.tests
-[ 121313 ] [ euler051 ] unit-test
+{ 121313 } [ euler051 ] unit-test
USING: project-euler.052 tools.test ;
IN: project-euler.052.tests
-[ 142857 ] [ euler052 ] unit-test
+{ 142857 } [ euler052 ] unit-test
USING: project-euler.053 tools.test ;
IN: project-euler.053.tests
-[ 4075 ] [ euler053 ] unit-test
+{ 4075 } [ euler053 ] unit-test
USING: project-euler.054 tools.test ;
IN: project-euler.054.tests
-[ 376 ] [ euler054 ] unit-test
+{ 376 } [ euler054 ] unit-test
USING: project-euler.055 tools.test ;
IN: project-euler.055.tests
-[ 249 ] [ euler055 ] unit-test
+{ 249 } [ euler055 ] unit-test
USING: project-euler.056 tools.test ;
IN: project-euler.056.tests
-[ 972 ] [ euler056 ] unit-test
+{ 972 } [ euler056 ] unit-test
USING: project-euler.059 tools.test ;
IN: project-euler.059.tests
-[ 107359 ] [ euler059 ] unit-test
+{ 107359 } [ euler059 ] unit-test
USING: project-euler.062 tools.test ;
IN: project-euler.062.tests
-[ 127035954683 ] [ euler062 ] unit-test
+{ 127035954683 } [ euler062 ] unit-test
USING: project-euler.065 tools.test ;
IN: project-euler.065.tests
-[ 272 ] [ euler065 ] unit-test
+{ 272 } [ euler065 ] unit-test
USING: project-euler.067 tools.test ;
IN: project-euler.067.tests
-[ 7273 ] [ euler067 ] unit-test
-[ 7273 ] [ euler067a ] unit-test
+{ 7273 } [ euler067 ] unit-test
+{ 7273 } [ euler067a ] unit-test
USING: project-euler.070 tools.test ;
IN: project-euler.070.tests
-[ 8319823 ] [ euler070 ] unit-test
+{ 8319823 } [ euler070 ] unit-test
USING: project-euler.071 tools.test ;
IN: project-euler.071.tests
-[ 428570 ] [ euler071 ] unit-test
+{ 428570 } [ euler071 ] unit-test
USING: project-euler.072 tools.test ;
IN: project-euler.072.tests
-[ 303963552391 ] [ euler072 ] unit-test
+{ 303963552391 } [ euler072 ] unit-test
USING: project-euler.073 tools.test ;
IN: project-euler.073.tests
-[ 5066251 ] [ euler073 ] unit-test
+{ 5066251 } [ euler073 ] unit-test
USING: project-euler.074 tools.test ;
IN: project-euler.074.tests
-[ 402 ] [ euler074 ] unit-test
+{ 402 } [ euler074 ] unit-test
USING: project-euler.075 tools.test ;
IN: project-euler.075.tests
-[ 214954 ] [ euler075 ] unit-test
+{ 214954 } [ euler075 ] unit-test
USING: project-euler.076 tools.test ;
IN: project-euler.076.tests
-[ 190569291 ] [ euler076 ] unit-test
+{ 190569291 } [ euler076 ] unit-test
USING: project-euler.079 tools.test ;
IN: project-euler.079.tests
-[ 73162890 ] [ euler079 ] unit-test
+{ 73162890 } [ euler079 ] unit-test
USING: project-euler.081 tools.test ;
IN: project-euler.081.tests
-[ 427337 ] [ euler081 ] unit-test
+{ 427337 } [ euler081 ] unit-test
USING: project-euler.085 tools.test ;
IN: project-euler.085.tests
-[ 2772 ] [ euler085 ] unit-test
+{ 2772 } [ euler085 ] unit-test
USING: project-euler.089 tools.test ;
IN: project-euler.089.tests
-[ 743 ] [ euler089 ] unit-test
+{ 743 } [ euler089 ] unit-test
USING: project-euler.092 tools.test ;
IN: project-euler.092.tests
-[ 8581146 ] [ euler092 ] unit-test
+{ 8581146 } [ euler092 ] unit-test
USING: project-euler.097 tools.test ;
IN: project-euler.097.tests
-[ 8739992577 ] [ euler097 ] unit-test
+{ 8739992577 } [ euler097 ] unit-test
USING: project-euler.099 project-euler.099.private tools.test ;
IN: project-euler.099.tests
-[ 2 ] [ { { 2 11 } { 3 7 } } solve ] unit-test
-[ 709 ] [ euler099 ] unit-test
+{ 2 } [ { { 2 11 } { 3 7 } } solve ] unit-test
+{ 709 } [ euler099 ] unit-test
USING: project-euler.100 tools.test ;
IN: project-euler.100.tests
-[ 756872327473 ] [ euler100 ] unit-test
+{ 756872327473 } [ euler100 ] unit-test
USING: project-euler.102 tools.test ;
IN: project-euler.102.tests
-[ 228 ] [ euler102 ] unit-test
+{ 228 } [ euler102 ] unit-test
USING: project-euler.112 tools.test ;
IN: project-euler.112.tests
-[ 1587000 ] [ euler112 ] unit-test
+{ 1587000 } [ euler112 ] unit-test
USING: project-euler.116 tools.test ;
IN: project-euler.116.tests
-[ 20492570929 ] [ euler116 ] unit-test
+{ 20492570929 } [ euler116 ] unit-test
USING: project-euler.117 tools.test ;
IN: project-euler.117.tests
-[ 100808458960497 ] [ euler117 ] unit-test
+{ 100808458960497 } [ euler117 ] unit-test
USING: project-euler.124 tools.test ;
IN: project-euler.124.tests
-[ 21417 ] [ euler124 ] unit-test
+{ 21417 } [ euler124 ] unit-test
USING: project-euler.134 tools.test ;
IN: project-euler.134.tests
-[ 18613426663617118 ] [ euler134 ] unit-test
+{ 18613426663617118 } [ euler134 ] unit-test
USING: project-euler.148 tools.test ;
IN: project-euler.148.tests
-[ 2129970655314432 ] [ euler148 ] unit-test
+{ 2129970655314432 } [ euler148 ] unit-test
USING: project-euler.150 tools.test ;
IN: project-euler.150.tests
-[ -271248680 ] [ euler150 ] unit-test
+{ -271248680 } [ euler150 ] unit-test
USING: project-euler.151 tools.test ;
IN: project-euler.151.tests
-[ 12138569781349/26138246400000 ] [ euler151 ] unit-test
+{ 12138569781349/26138246400000 } [ euler151 ] unit-test
USING: project-euler.164 tools.test ;
IN: project-euler.164.tests
-[ 378158756814587 ] [ euler164 ] unit-test
+{ 378158756814587 } [ euler164 ] unit-test
USING: project-euler.169 tools.test ;
IN: project-euler.169.tests
-[ 178653872807 ] [ euler169 ] unit-test
+{ 178653872807 } [ euler169 ] unit-test
USING: project-euler.173 tools.test ;
IN: project-euler.173.tests
-[ 1572729 ] [ euler173 ] unit-test
+{ 1572729 } [ euler173 ] unit-test
USING: project-euler.175 tools.test ;
IN: project-euler.175.tests
-[ "1,13717420,8" ] [ euler175 ] unit-test
+{ "1,13717420,8" } [ euler175 ] unit-test
USING: project-euler.188 tools.test ;
IN: project-euler.188.tests
-[ 95962097 ] [ euler188 ] unit-test
+{ 95962097 } [ euler188 ] unit-test
USING: project-euler.190 tools.test ;
IN: project-euler.190.tests
-[ 371048281 ] [ euler190 ] unit-test
+{ 371048281 } [ euler190 ] unit-test
USING: project-euler.203 project-euler.203.private tools.test ;
IN: project-euler.203.tests
-[ 105 ] [ 8 solve ] unit-test
-[ 34029210557338 ] [ euler203 ] unit-test
+{ 105 } [ 8 solve ] unit-test
+{ 34029210557338 } [ euler203 ] unit-test
USING: project-euler.206 tools.test ;
IN: project-euler.206.tests
-[ 1389019170 ] [ euler206 ] unit-test
+{ 1389019170 } [ euler206 ] unit-test
USING: project-euler.215 project-euler.215.private tools.test ;
IN: project-euler.215.tests
-[ 8 ] [ 9 3 solve ] unit-test
-[ 806844323190414 ] [ euler215 ] unit-test
+{ 8 } [ 9 3 solve ] unit-test
+{ 806844323190414 } [ euler215 ] unit-test
USING: project-euler.255 tools.test ;
IN: project-euler.255.tests
-[ 4.4474011180 ] [ euler255 ] unit-test
+{ 4.4474011180 } [ euler255 ] unit-test
! See http://factorcode.org/license.txt for BSD license.
USING: project-euler.265 tools.test ;
-[ 209110240768 ] [ euler265 ] unit-test
+{ 209110240768 } [ euler265 ] unit-test
USING: tools.test math arrays project-euler.ave-time ;
{ 0 3 } [ 1 2 [ + ] 10 collect-benchmarks ] must-infer-as
-[ 1 2 t ] [ 1 2 [ + ] 10 collect-benchmarks array? ] unit-test
+{ 1 2 t } [ 1 2 [ + ] 10 collect-benchmarks array? ] unit-test
USING: tools.test project-euler.common ;
IN: project-euler.common.tests
-[ 4 ] [ -1000 number-length ] unit-test
-[ 3 ] [ -999 number-length ] unit-test
-[ 3 ] [ -100 number-length ] unit-test
-[ 2 ] [ -99 number-length ] unit-test
-[ 1 ] [ -9 number-length ] unit-test
-[ 1 ] [ -1 number-length ] unit-test
-[ 1 ] [ 0 number-length ] unit-test
-[ 1 ] [ 9 number-length ] unit-test
-[ 2 ] [ 99 number-length ] unit-test
-[ 3 ] [ 100 number-length ] unit-test
-[ 3 ] [ 999 number-length ] unit-test
-[ 4 ] [ 1000 number-length ] unit-test
+{ 4 } [ -1000 number-length ] unit-test
+{ 3 } [ -999 number-length ] unit-test
+{ 3 } [ -100 number-length ] unit-test
+{ 2 } [ -99 number-length ] unit-test
+{ 1 } [ -9 number-length ] unit-test
+{ 1 } [ -1 number-length ] unit-test
+{ 1 } [ 0 number-length ] unit-test
+{ 1 } [ 9 number-length ] unit-test
+{ 2 } [ 99 number-length ] unit-test
+{ 3 } [ 100 number-length ] unit-test
+{ 3 } [ 999 number-length ] unit-test
+{ 4 } [ 1000 number-length ] unit-test
{ } [ 123 <alien> unsteal-ref ] unit-test
-[ t ] [ Py_GetVersion string? ] unit-test
+{ t } [ Py_GetVersion string? ] unit-test
[ "os" ] [ "os" py-import PyModule_GetName ] py-test
: delete>>key ( assoc key -- assoc )
over delete-at ; inline
-[ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } { 0.0 -0.25 } "a" f f f f t } ]
+{ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } { 0.0 -0.25 } "a" f f f f t } }
[
unit-bounds <quadtree>
"a" { 0.0 -0.25 } value>>key
] unit-test
-[ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } { 0.0 -0.25 } "b" f f f f t } ]
+{ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } { 0.0 -0.25 } "b" f f f f t } }
[
unit-bounds <quadtree>
"a" { 0.0 -0.25 } value>>key
"b" { 0.0 -0.25 } value>>key
] unit-test
-[ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
+{ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
T{ quadtree f T{ rect f { -1.0 -1.0 } { 1.0 1.0 } } { -0.5 -0.75 } "c" f f f f t }
T{ quadtree f T{ rect f { 0.0 -1.0 } { 1.0 1.0 } } { 0.0 -0.25 } "a" f f f f t }
T{ quadtree f T{ rect f { -1.0 0.0 } { 1.0 1.0 } } f f f f f f t }
T{ quadtree f T{ rect f { 0.0 0.0 } { 1.0 1.0 } } { 0.25 0.25 } "b" f f f f t }
f
-} ] [
+} } [
unit-bounds <quadtree>
"a" { 0.0 -0.25 } value>>key
"b" { 0.25 0.25 } value>>key
"c" { -0.5 -0.75 } value>>key
] unit-test
-[ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
+{ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
T{ quadtree f T{ rect f { -1.0 -1.0 } { 1.0 1.0 } } { -0.5 -0.75 } "c" f f f f t }
T{ quadtree f T{ rect f { 0.0 -1.0 } { 1.0 1.0 } } { 0.0 -0.25 } "a" f f f f t }
T{ quadtree f T{ rect f { -1.0 0.0 } { 1.0 1.0 } } f f f f f f t }
T{ quadtree f T{ rect f { 0.5 0.5 } { 0.5 0.5 } } f f f f f f t }
}
f
-} ] [
+} } [
unit-bounds <quadtree>
"a" { 0.0 -0.25 } value>>key
"b" { 0.25 0.25 } value>>key
"d" { 0.75 0.25 } value>>key
] unit-test
-[ "b" t ] [
+{ "b" t } [
unit-bounds <quadtree>
"a" { 0.0 -0.25 } value>>key
"b" { 0.25 0.25 } value>>key
{ 0.25 0.25 } ?of
] unit-test
-[ { 1.0 1.0 } f ] [
+{ { 1.0 1.0 } f } [
unit-bounds <quadtree>
"a" { 0.0 -0.25 } value>>key
"b" { 0.25 0.25 } value>>key
{ 1.0 1.0 } ?of
] unit-test
-[ { "a" "c" } ] [
+{ { "a" "c" } } [
unit-bounds <quadtree>
"a" { 0.0 -0.25 } value>>key
"b" { 0.25 0.25 } value>>key
{ -0.6 -0.8 } { 0.8 1.0 } <rect> swap in-rect natural-sort
] unit-test
-[ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
+{ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
T{ quadtree f T{ rect f { -1.0 -1.0 } { 1.0 1.0 } } { -0.5 -0.75 } "c" f f f f t }
T{ quadtree f T{ rect f { 0.0 -1.0 } { 1.0 1.0 } } { 0.0 -0.25 } "a" f f f f t }
T{ quadtree f T{ rect f { -1.0 0.0 } { 1.0 1.0 } } f f f f f f t }
T{ quadtree f T{ rect f { 0.0 0.0 } { 1.0 1.0 } } { 0.75 0.25 } "d" f f f f t }
f
-} ] [
+} } [
unit-bounds <quadtree>
"a" { 0.0 -0.25 } value>>key
"b" { 0.25 0.25 } value>>key
prune-quadtree
] unit-test
-[ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
+{ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
T{ quadtree f T{ rect f { -1.0 -1.0 } { 1.0 1.0 } } { -0.5 -0.75 } "c" f f f f t }
T{ quadtree f T{ rect f { 0.0 -1.0 } { 1.0 1.0 } } { 0.0 -0.25 } "a" f f f f t }
T{ quadtree f T{ rect f { -1.0 0.0 } { 1.0 1.0 } } f f f f f f t }
T{ quadtree f T{ rect f { 0.0 0.0 } { 1.0 1.0 } } f f f f f f t }
f
-} ] [
+} } [
unit-bounds <quadtree>
"a" { 0.0 -0.25 } value>>key
"b" { 0.25 0.25 } value>>key
prune-quadtree
] unit-test
-[ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
+{ T{ quadtree f T{ rect f { -1.0 -1.0 } { 2.0 2.0 } } f f
T{ quadtree f T{ rect f { -1.0 -1.0 } { 1.0 1.0 } } f f
T{ quadtree f T{ rect f { -1.0 -1.0 } { 0.5 0.5 } } { -0.75 -0.75 } "b" f f f f t }
T{ quadtree f T{ rect f { -0.5 -1.0 } { 0.5 0.5 } } f f f f f f t }
f
}
f
-} ] [
+} } [
unit-bounds <quadtree>
"a" { -0.25 -0.25 } value>>key
"b" { -0.75 -0.75 } value>>key
prune-quadtree
] unit-test
-[ 8 ] [
+{ 8 } [
unit-bounds <quadtree>
"a" { -0.25 -0.25 } value>>key
"b" { -0.75 -0.75 } value>>key
assoc-size
] unit-test
-[ {
+{ {
{ { -0.75 -0.75 } "b" }
{ { -0.75 0.75 } "d" }
{ { -0.25 -0.25 } "a" }
{ { 0.25 0.25 } "g" }
{ { 0.75 -0.75 } "f" }
{ { 0.75 0.75 } "h" }
-} ] [
+} } [
unit-bounds <quadtree>
"a" { -0.25 -0.25 } value>>key
"b" { -0.75 -0.75 } value>>key
TUPLE: pointy-thing center ;
-[ {
+{ {
T{ pointy-thing f { 0 0 } }
T{ pointy-thing f { 1 0 } }
T{ pointy-thing f { 0 1 } }
T{ pointy-thing f { 3 2 } }
T{ pointy-thing f { 2 3 } }
T{ pointy-thing f { 3 3 } }
-} ] [
+} } [
{
T{ pointy-thing f { 3 1 } }
T{ pointy-thing f { 2 3 } }
USING: qw tools.test ;
IN: qw.tests
-[ { "zippity" "doo" "dah" } ] [ qw{ zippity doo dah } ] unit-test
+{ { "zippity" "doo" "dah" } } [ qw{ zippity doo dah } ] unit-test
grouping ;
IN: blum-blum-shub.tests
-[ 887708070 ] [
+{ 887708070 } [
T{ blum-blum-shub f 590695557939 811977232793 } clone random-32*
] unit-test
-[ 887708070 ] [
+{ 887708070 } [
T{ blum-blum-shub f 590695557939 811977232793 } clone [
32 random-bits
] with-random
] unit-test
-[ 3812677130378646276 ] [
+{ 3812677130378646276 } [
T{ blum-blum-shub f 590695557939 811977232793 } clone [
64 random-bits
] with-random
] unit-test
-[ 3716213681 ]
+{ 3716213681 }
[
T{ blum-blum-shub f 200352954495 846054538649 } clone 100 over [
random-32* drop
SPECIALIZED-ARRAY: uint
IN: random.cmwc.tests
-[ ] [
+{ } [
cmwc-4096 [
random-32 drop
] with-random
] unit-test
-[
+{
{
4294604858
4294948512
4294817038
4294798256
}
-] [
+} [
cmwc-4096
4096 iota uint >c-array 362436 <cmwc-seed> seed-random [
10 [ random-32 ] replicate
] with-random
] unit-test
-[ t ] [
+{ t } [
cmwc-4096 [
4096 iota uint >c-array 362436 <cmwc-seed> seed-random [
10 [ random-32 ] replicate
SPECIALIZED-ARRAY: double
IN: random.lagged-fibonacci.tests
-[ t ] [
+{ t } [
3 <lagged-fibonacci> [
1000 [ random-float ] double-array{ } replicate-as
999 swap nth 0.860072135925293 -.01 ~
] with-random
] unit-test
-[ t ] [
+{ t } [
3 <lagged-fibonacci> [
[
1000 [ random-float ] double-array{ } replicate-as
USING: tools.test redis.response-parser io.streams.string ;
IN: redis.response-parser.tests
-[ 1 ] [ ":1\r\n" [ read-response ] with-string-reader ] unit-test
+{ 1 } [ ":1\r\n" [ read-response ] with-string-reader ] unit-test
-[ "hello" ] [ "$5\r\nhello\r\n" [ read-response ] with-string-reader ] unit-test
+{ "hello" } [ "$5\r\nhello\r\n" [ read-response ] with-string-reader ] unit-test
-[ f ] [ "$-1\r\n" [ read-response ] with-string-reader ] unit-test
+{ f } [ "$-1\r\n" [ read-response ] with-string-reader ] unit-test
-[ { "hello" "world!" } ] [
+{ { "hello" "world!" } } [
"*2\r\n$5\r\nhello\r\n$6\r\nworld!\r\n" [ read-response ] with-string-reader
] unit-test
-[ { "hello" f "world!" } ] [
+{ { "hello" f "world!" } } [
"*3\r\n$5\r\nhello\r\n$-1\r\n$6\r\nworld!\r\n" [
read-response
] with-string-reader
urls ;
IN: robots.tests
-[
+{
{ "http://www.chiplist.com/sitemap.txt" }
{
T{ rules
{ unknowns H{ } }
}
}
-] [ "vocab:robots/robots.txt" utf8 file-contents parse-robots.txt ] unit-test
+} [ "vocab:robots/robots.txt" utf8 file-contents parse-robots.txt ] unit-test
TUPLE: tuning-spork <{ utensil spoon tuning-fork } ;
! role class testing
-[ t ] [ fork role? ] unit-test
-[ f ] [ foon role? ] unit-test
+{ t } [ fork role? ] unit-test
+{ f } [ foon role? ] unit-test
! roles aren't tuple classes by themselves and can't be instantiated
-[ f ] [ fork tuple-class? ] unit-test
+{ f } [ fork tuple-class? ] unit-test
[ fork new ] must-fail
! tuples which consume roles fall under their class
-[ t ] [ foon new fork? ] unit-test
-[ t ] [ foon new spoon? ] unit-test
-[ f ] [ foon new tuning-fork? ] unit-test
-[ f ] [ foon new instrument? ] unit-test
+{ t } [ foon new fork? ] unit-test
+{ t } [ foon new spoon? ] unit-test
+{ f } [ foon new tuning-fork? ] unit-test
+{ f } [ foon new instrument? ] unit-test
-[ t ] [ tuning-spork new fork? ] unit-test
-[ t ] [ tuning-spork new spoon? ] unit-test
-[ t ] [ tuning-spork new tuning-fork? ] unit-test
-[ t ] [ tuning-spork new instrument? ] unit-test
+{ t } [ tuning-spork new fork? ] unit-test
+{ t } [ tuning-spork new spoon? ] unit-test
+{ t } [ tuning-spork new tuning-fork? ] unit-test
+{ t } [ tuning-spork new instrument? ] unit-test
! consumed role slots are placed in tuples in order
-[ qw{ handle tines bowl } ] [ foon all-slots [ name>> ] map ] unit-test
-[ qw{ handle bowl tines tone volume } ] [ tuning-spork all-slots [ name>> ] map ] unit-test
+{ qw{ handle tines bowl } } [ foon all-slots [ name>> ] map ] unit-test
+{ qw{ handle bowl tines tone volume } } [ tuning-spork all-slots [ name>> ] map ] unit-test
! can't combine roles whose slots overlap
ROLE: bong bowl ;
M: spoon scoop drop " got scooped" append ;
M: instrument tune drop " got tuned" append ;
-[ "potato got poked" "potato got scooped" "potato got tuned" ]
+{ "potato got poked" "potato got scooped" "potato got tuned" }
[ "potato" tuning-spork new [ poke ] [ scoop ] [ tune ] 2tri ] unit-test
USING: kernel tools.test ;
IN: rosetta-code.y-combinator
-[ 120 ] [ 5 [ almost-fac ] Y call ] unit-test
-[ 8 ] [ 6 [ almost-fib ] Y call ] unit-test
-[ 61 ] [ 3 3 [ almost-ack ] Y call ] unit-test
+{ 120 } [ 5 [ almost-fac ] Y call ] unit-test
+{ 8 } [ 6 [ almost-fib ] Y call ] unit-test
+{ 61 } [ 3 3 [ almost-ack ] Y call ] unit-test
IN: rpn.tests
USING: rpn lists tools.test ;
-[ { 2 } ] [ "4 2 -" rpn-parse rpn-eval list>array ] unit-test
+{ { 2 } } [ "4 2 -" rpn-parse rpn-eval list>array ] unit-test
USING: assocs sequences.abbrev tools.test ;
IN: sequences.abbrev.tests
-[ { "hello" "help" } ] [
+{ { "hello" "help" } } [
"he" { "apple" "hello" "help" } abbrev at
] unit-test
-[ f ] [
+{ f } [
"he" { "apple" "hello" "help" } unique-abbrev at
] unit-test
-[ { "apple" } ] [
+{ { "apple" } } [
"a" { "apple" "hello" "help" } abbrev at
] unit-test
-[ { "apple" } ] [
+{ { "apple" } } [
"a" { "apple" "hello" "help" } unique-abbrev at
] unit-test
-[ f ] [
+{ f } [
"a" { "hello" "help" } abbrev at
] unit-test
-[ f ] [
+{ f } [
"a" { "hello" "help" } unique-abbrev at
] unit-test
IN: sequences.extras.tests
-[ { "a" "b" "c" "d" "ab" "bc" "cd" "abc" "bcd" "abcd" } ] [ "abcd" all-subseqs ] unit-test
+{ { "a" "b" "c" "d" "ab" "bc" "cd" "abc" "bcd" "abcd" } } [ "abcd" all-subseqs ] unit-test
-[ { "a" "ab" "abc" "abcd" "b" "bc" "bcd" "c" "cd" "d" } ]
+{ { "a" "ab" "abc" "abcd" "b" "bc" "bcd" "c" "cd" "d" } }
[ [ "abcd" [ , ] each-subseq ] { } make ] unit-test
{ B{ 115 } } [ 1 2 "asdf" B{ } subseq-as ] unit-test
-[ "" ] [ "abc" "def" longest-subseq ] unit-test
-[ "abcd" ] [ "abcd" "abcde" longest-subseq ] unit-test
-[ "foo" ] [ "foo" "foobar" longest-subseq ] unit-test
-[ "foo" ] [ "foobar" "foo" longest-subseq ] unit-test
+{ "" } [ "abc" "def" longest-subseq ] unit-test
+{ "abcd" } [ "abcd" "abcde" longest-subseq ] unit-test
+{ "foo" } [ "foo" "foobar" longest-subseq ] unit-test
+{ "foo" } [ "foobar" "foo" longest-subseq ] unit-test
-[ "" "" ] [ "" "" CHAR: ? pad-longest ] unit-test
-[ "abc" "def" ] [ "abc" "def" CHAR: ? pad-longest ] unit-test
-[ " " "abc" ] [ "" "abc" CHAR: \s pad-longest ] unit-test
-[ "abc" " " ] [ "abc" "" CHAR: \s pad-longest ] unit-test
-[ "abc..." "foobar" ] [ "abc" "foobar" CHAR: . pad-longest ] unit-test
+{ "" "" } [ "" "" CHAR: ? pad-longest ] unit-test
+{ "abc" "def" } [ "abc" "def" CHAR: ? pad-longest ] unit-test
+{ " " "abc" } [ "" "abc" CHAR: \s pad-longest ] unit-test
+{ "abc" " " } [ "abc" "" CHAR: \s pad-longest ] unit-test
+{ "abc..." "foobar" } [ "abc" "foobar" CHAR: . pad-longest ] unit-test
-[ { 0 1 0 1 } ] [
+{ { 0 1 0 1 } } [
{ 0 0 0 0 } { 1 3 } over [ 1 + ] change-nths
] unit-test
{ 1 2 3 } [ even? ] selector* [ each ] dip
] unit-test
-[ { 1 3 5 } ] [ { 1 2 3 4 5 6 } [ nip even? ] filter-index ] unit-test
+{ { 1 3 5 } } [ { 1 2 3 4 5 6 } [ nip even? ] filter-index ] unit-test
-[ V{ 1 3 5 } ] [ { 1 2 3 4 5 6 } [ nip even? ] V{ } filter-index-as ] unit-test
+{ V{ 1 3 5 } } [ { 1 2 3 4 5 6 } [ nip even? ] V{ } filter-index-as ] unit-test
-[ { 1 3 5 } ] [ { 1 2 3 4 5 6 } even-indices ] unit-test
+{ { 1 3 5 } } [ { 1 2 3 4 5 6 } even-indices ] unit-test
-[ { 2 4 6 } ] [ { 1 2 3 4 5 6 } odd-indices ] unit-test
+{ { 2 4 6 } } [ { 1 2 3 4 5 6 } odd-indices ] unit-test
{ "a b c d e" }
[ "a b \t \n \r c d \n e " [ blank? ] " " compact ] unit-test
unicode.case ;
IN: sequences.inserters.tests
-[ V{ 1 2 "Three" "Four" "Five" } ] [
+{ V{ 1 2 "Three" "Four" "Five" } } [
{ "three" "four" "five" }
[ >title ] V{ 1 2 } clone <appender> map-as
] unit-test
-[ t ] [
+{ t } [
{ "three" "four" "five" }
[ >title ] V{ 1 2 } clone [ <appender> map-as ] keep eq?
] unit-test
-[ V{ 1 2 "Three" "Four" "Five" } ] [
+{ V{ 1 2 "Three" "Four" "Five" } } [
{ { "Th" "ree" } { "Fo" "ur" } { "Fi" "ve" } }
[ append ] V{ 1 2 } clone <appender> assoc>map
] unit-test
-[ t ] [
+{ t } [
{ { "Th" "ree" } { "Fo" "ur" } { "Fi" "ve" } }
[ append ] V{ 1 2 } clone [ <appender> assoc>map ] keep eq?
] unit-test
-[ V{ "Three" "Four" "Five" } ] [
+{ V{ "Three" "Four" "Five" } } [
{ "three" "four" "five" }
[ >title ] V{ 1 2 } clone <replacer> map-as
] unit-test
-[ t ] [
+{ t } [
{ "three" "four" "five" }
[ >title ] V{ 1 2 } clone [ <replacer> map-as ] keep eq?
] unit-test
-[ V{ "Three" "Four" "Five" } ] [
+{ V{ "Three" "Four" "Five" } } [
{ { "Th" "ree" } { "Fo" "ur" } { "Fi" "ve" } }
[ append ] V{ 1 2 } clone <replacer> assoc>map
] unit-test
-[ t ] [
+{ t } [
{ { "Th" "ree" } { "Fo" "ur" } { "Fi" "ve" } }
[ append ] V{ 1 2 } clone [ <replacer> assoc>map ] keep eq?
] unit-test
USING: accessors arrays kernel sequences sequences.modified tools.test ;
IN: sequences.modified.tests
-[ { 2 4 6 } ] [ { 1 2 3 } 2 scale ] unit-test
-[ { 1 4 3 } ] [ { 1 2 3 } 2 <scaled> 8 1 pick set-nth seq>> ] unit-test
-[ { 2 8 6 } ] [ { 1 2 3 } 2 <scaled> 8 1 pick set-nth >array ] unit-test
+{ { 2 4 6 } } [ { 1 2 3 } 2 scale ] unit-test
+{ { 1 4 3 } } [ { 1 2 3 } 2 <scaled> 8 1 pick set-nth seq>> ] unit-test
+{ { 2 8 6 } } [ { 1 2 3 } 2 <scaled> 8 1 pick set-nth >array ] unit-test
-[ { 2 3 4 } ] [ { 1 2 3 } 1 seq-offset ] unit-test
-[ { 1 5 3 } ] [ { 1 2 3 } 1 <offset> 6 1 pick set-nth seq>> ] unit-test
-[ { 2 6 4 } ] [ { 1 2 3 } 1 <offset> 6 1 pick set-nth >array ] unit-test
+{ { 2 3 4 } } [ { 1 2 3 } 1 seq-offset ] unit-test
+{ { 1 5 3 } } [ { 1 2 3 } 1 <offset> 6 1 pick set-nth seq>> ] unit-test
+{ { 2 6 4 } } [ { 1 2 3 } 1 <offset> 6 1 pick set-nth >array ] unit-test
-[ 4 ] [ { { 1 2 } { 3 4 } } <summed> 0 swap nth ] unit-test
-[ 6 ] [ { { 1 2 } { 3 4 } } <summed> 1 swap nth ] unit-test
-[ 2 ] [ { { 1 2 } { 3 4 } } <summed> length ] unit-test
-[ { 4 6 } ] [ { { 1 2 } { 3 4 } } <summed> >array ] unit-test
+{ 4 } [ { { 1 2 } { 3 4 } } <summed> 0 swap nth ] unit-test
+{ 6 } [ { { 1 2 } { 3 4 } } <summed> 1 swap nth ] unit-test
+{ 2 } [ { { 1 2 } { 3 4 } } <summed> length ] unit-test
+{ { 4 6 } } [ { { 1 2 } { 3 4 } } <summed> >array ] unit-test
"December"
} clone 1 <n-based-assoc> ; inline
-[ "December" t ]
+{ "December" t }
[ 12 months at* ] unit-test
-[ f f ]
+{ f f }
[ 13 months at* ] unit-test
-[ f f ]
+{ f f }
[ 0 months at* ] unit-test
-[ 12 ] [ months assoc-size ] unit-test
+{ 12 } [ months assoc-size ] unit-test
-[ {
+{ {
{ 1 "January" }
{ 2 "February" }
{ 3 "March" }
{ 10 "October" }
{ 11 "November" }
{ 12 "December" }
-} ] [ months >alist ] unit-test
+} } [ months >alist ] unit-test
-[ V{
+{ V{
"January"
"February"
"March"
"November"
"December"
"Smarch"
-} ] [ "Smarch" 13 months [ set-at ] keep seq>> ] unit-test
+} } [ "Smarch" 13 months [ set-at ] keep seq>> ] unit-test
-[ V{ } ] [ months [ clear-assoc ] keep seq>> ] unit-test
+{ V{ } } [ months [ clear-assoc ] keep seq>> ] unit-test
USING: sequences.repeating tools.test ;
IN: sequences.repeating.tests
-[ { 1 2 3 1 2 } ] [ { 1 2 3 } 5 cycle ] unit-test
-[ { 1 2 3 1 2 3 1 2 3 } ] [ { 1 2 3 } 9 cycle ] unit-test
+{ { 1 2 3 1 2 } } [ { 1 2 3 } 5 cycle ] unit-test
+{ { 1 2 3 1 2 3 1 2 3 } } [ { 1 2 3 } 9 cycle ] unit-test
-[ { } ] [ { 1 2 3 } 0 repeat ] unit-test
-[ { 1 2 3 } ] [ { 1 2 3 } 1 repeat ] unit-test
-[ { 1 1 2 2 3 3 } ] [ { 1 2 3 } 2 repeat ] unit-test
-[ { 1 1 1 2 2 2 3 3 3 } ] [ { 1 2 3 } 3 repeat ] unit-test
-[ { 1 1 1 1 2 2 2 2 3 3 3 3 } ] [ { 1 2 3 } 4 repeat ] unit-test
+{ { } } [ { 1 2 3 } 0 repeat ] unit-test
+{ { 1 2 3 } } [ { 1 2 3 } 1 repeat ] unit-test
+{ { 1 1 2 2 3 3 } } [ { 1 2 3 } 2 repeat ] unit-test
+{ { 1 1 1 2 2 2 3 3 3 } } [ { 1 2 3 } 3 repeat ] unit-test
+{ { 1 1 1 1 2 2 2 2 3 3 3 3 } } [ { 1 2 3 } 4 repeat ] unit-test
USING: kernel sequences sequences.squish tools.test vectors ;
IN: sequences.squish.tests
-[ { { 1 2 3 } { 4 } { 5 6 } } ] [
+{ { { 1 2 3 } { 4 } { 5 6 } } } [
V{ { 1 2 3 } V{ { 4 } { 5 6 } } }
[ vector? ] { } squish
] unit-test
f <site> select-tuples
] with-db ;
-[ f ] [ fake-sites empty? ] unit-test
+{ f } [ fake-sites empty? ] unit-test
TUPLE: slot-test1 a b c ;
-[ 1 2 3 ] [ T{ slot-test1 f 1 2 3 } slots[ a b c ] ] unit-test
-[ 3 ] [ T{ slot-test1 f 1 2 3 } slots[ c ] ] unit-test
-[ ] [ T{ slot-test1 f 1 2 3 } slots[ ] ] unit-test
+{ 1 2 3 } [ T{ slot-test1 f 1 2 3 } slots[ a b c ] ] unit-test
+{ 3 } [ T{ slot-test1 f 1 2 3 } slots[ c ] ] unit-test
+{ } [ T{ slot-test1 f 1 2 3 } slots[ ] ] unit-test
-[ { 1 2 3 } ] [ T{ slot-test1 f 1 2 3 } slots{ a b c } ] unit-test
-[ { 3 } ] [ T{ slot-test1 f 1 2 3 } slots{ c } ] unit-test
-[ { } ] [ T{ slot-test1 f 1 2 3 } slots{ } ] unit-test
+{ { 1 2 3 } } [ T{ slot-test1 f 1 2 3 } slots{ a b c } ] unit-test
+{ { 3 } } [ T{ slot-test1 f 1 2 3 } slots{ c } ] unit-test
+{ { } } [ T{ slot-test1 f 1 2 3 } slots{ } ] unit-test
TUPLE: slot-test2 a b c d ;
-[ T{ slot-test2 f 1 2 33 44 } ]
+{ T{ slot-test2 f 1 2 33 44 } }
[ 1 2 3 slot-test1 boa 11 22 33 44 slot-test2 boa copy-slots{ a b } ] unit-test
: test-inference ( ast -- in# out# )
test-compilation infer [ in>> ] [ out>> ] bi [ length ] bi@ ;
-[ 2 1 ] [
+{ 2 1 } [
T{ ast-block f
{ "a" "b" }
{
} test-inference
] unit-test
-[ 3 1 ] [
+{ 3 1 } [
T{ ast-block f
{ "a" "b" "c" }
{
} test-inference
] unit-test
-[ 0 1 ] [
+{ 0 1 } [
T{ ast-block f
{ }
{ }
} test-inference
] unit-test
-[ "a" ] [
+{ "a" } [
T{ ast-block f
{ }
{ }
H{ { "jumble" fake-local } } >>local-writers
lexenv set
-[ [ fake-local ] ] [ "mumble" lexenv get lookup-reader ] unit-test
-[ [ fake-self x>> ] ] [ "x" lexenv get lookup-reader ] unit-test
-[ [ \ tuple ] ] [ "Object" lexenv get lookup-reader ] unit-test
+{ [ fake-local ] } [ "mumble" lexenv get lookup-reader ] unit-test
+{ [ fake-self x>> ] } [ "x" lexenv get lookup-reader ] unit-test
+{ [ \ tuple ] } [ "Object" lexenv get lookup-reader ] unit-test
-[ [ fake-local ] ] [ "jumble" lexenv get lookup-writer ] unit-test
-[ [ fake-self y<< ] ] [ "y" lexenv get lookup-writer ] unit-test
+{ [ fake-local ] } [ "jumble" lexenv get lookup-writer ] unit-test
+{ [ fake-self y<< ] } [ "y" lexenv get lookup-writer ] unit-test
[ "blahblah" lexenv get lookup-writer ] must-fail
USING: smalltalk.parser smalltalk.compiler.return tools.test ;
-[ t ] [ "(i <= 1) ifTrue: [^1] ifFalse: [^((Fib new i:(i-1)) compute + (Fib new i:(i-2)) compute)]" parse-smalltalk need-return-continuation? ] unit-test
+{ t } [ "(i <= 1) ifTrue: [^1] ifFalse: [^((Fib new i:(i-1)) compute + (Fib new i:(i-2)) compute)]" parse-smalltalk need-return-continuation? ] unit-test
IN: smalltalk.eval.tests
USING: smalltalk.eval tools.test io.streams.string kernel ;
-[ 3 ] [ "1+2" eval-smalltalk ] unit-test
-[ "HAI" ] [ "(1<10) ifTrue:['HAI'] ifFalse:['BAI']" eval-smalltalk ] unit-test
-[ 7 ] [ "1+2+3;+4" eval-smalltalk ] unit-test
-[ 6 "5\n6\n" ] [ [ "[:x|x print] value: 5; value: 6" eval-smalltalk ] with-string-writer ] unit-test
-[ 5 ] [ "|x| x:=5. x" eval-smalltalk ] unit-test
-[ 11 ] [ "[:i| |x| x:=5. i+x] value: 6" eval-smalltalk ] unit-test
-[ t ] [ "class Blah [method foo [5]]. Blah new foo" eval-smalltalk tuple? ] unit-test
-[ 196418 ] [ "vocab:smalltalk/eval/fib.st" eval-smalltalk-file ] unit-test
+{ 3 } [ "1+2" eval-smalltalk ] unit-test
+{ "HAI" } [ "(1<10) ifTrue:['HAI'] ifFalse:['BAI']" eval-smalltalk ] unit-test
+{ 7 } [ "1+2+3;+4" eval-smalltalk ] unit-test
+{ 6 "5\n6\n" } [ [ "[:x|x print] value: 5; value: 6" eval-smalltalk ] with-string-writer ] unit-test
+{ 5 } [ "|x| x:=5. x" eval-smalltalk ] unit-test
+{ 11 } [ "[:i| |x| x:=5. i+x] value: 6" eval-smalltalk ] unit-test
+{ t } [ "class Blah [method foo [5]]. Blah new foo" eval-smalltalk tuple? ] unit-test
+{ 196418 } [ "vocab:smalltalk/eval/fib.st" eval-smalltalk-file ] unit-test
test = <foreign parse-smalltalk Character>
;EBNF
-[ CHAR: a ] [ "a" test-Character ] unit-test
+{ CHAR: a } [ "a" test-Character ] unit-test
EBNF: test-Comment
test = <foreign parse-smalltalk Comment>
;EBNF
-[ T{ ast-comment f "Hello, this is a comment." } ]
+{ T{ ast-comment f "Hello, this is a comment." } }
[ "\"Hello, this is a comment.\"" test-Comment ]
unit-test
-[ T{ ast-comment f "Hello, \"this\" is a comment." } ]
+{ T{ ast-comment f "Hello, \"this\" is a comment." } }
[ "\"Hello, \"\"this\"\" is a comment.\"" test-Comment ]
unit-test
test = <foreign parse-smalltalk Identifier>
;EBNF
-[ "OrderedCollection" ] [ "OrderedCollection" test-Identifier ] unit-test
+{ "OrderedCollection" } [ "OrderedCollection" test-Identifier ] unit-test
EBNF: test-Literal
test = <foreign parse-smalltalk Literal>
;EBNF
-[ nil ] [ "nil" test-Literal ] unit-test
-[ 123 ] [ "123" test-Literal ] unit-test
-[ 0xdeadbeef ] [ "16rdeadbeef" test-Literal ] unit-test
-[ -123 ] [ "-123" test-Literal ] unit-test
-[ 1.2 ] [ "1.2" test-Literal ] unit-test
-[ -1.24 ] [ "-1.24" test-Literal ] unit-test
-[ 12.4e7 ] [ "12.4e7" test-Literal ] unit-test
-[ 12.4e-7 ] [ "12.4e-7" test-Literal ] unit-test
-[ -12.4e7 ] [ "-12.4e7" test-Literal ] unit-test
-[ CHAR: x ] [ "$x" test-Literal ] unit-test
-[ "Hello, world" ] [ "'Hello, world'" test-Literal ] unit-test
-[ "Hello, 'funny' world" ] [ "'Hello, ''funny'' world'" test-Literal ] unit-test
-[ T{ symbol f "foo" } ] [ "#foo" test-Literal ] unit-test
-[ T{ symbol f "+" } ] [ "#+" test-Literal ] unit-test
-[ T{ symbol f "at:put:" } ] [ "#at:put:" test-Literal ] unit-test
-[ T{ symbol f "Hello world" } ] [ "#'Hello world'" test-Literal ] unit-test
-[ B{ 1 2 3 4 } ] [ "#[1 2 3 4]" test-Literal ] unit-test
-[ { nil t f } ] [ "#(nil true false)" test-Literal ] unit-test
-[ { nil { t f } } ] [ "#(nil (true false))" test-Literal ] unit-test
-[ T{ ast-block f { } { } { } } ] [ "[]" test-Literal ] unit-test
-[ T{ ast-block f { "x" } { } { T{ ast-return f T{ ast-name f "x" } } } } ] [ "[ :x|^x]" test-Literal ] unit-test
-[ T{ ast-block f { } { } { T{ ast-return f self } } } ] [ "[^self]" test-Literal ] unit-test
-
-[
+{ nil } [ "nil" test-Literal ] unit-test
+{ 123 } [ "123" test-Literal ] unit-test
+{ 0xdeadbeef } [ "16rdeadbeef" test-Literal ] unit-test
+{ -123 } [ "-123" test-Literal ] unit-test
+{ 1.2 } [ "1.2" test-Literal ] unit-test
+{ -1.24 } [ "-1.24" test-Literal ] unit-test
+{ 12.4e7 } [ "12.4e7" test-Literal ] unit-test
+{ 12.4e-7 } [ "12.4e-7" test-Literal ] unit-test
+{ -12.4e7 } [ "-12.4e7" test-Literal ] unit-test
+{ CHAR: x } [ "$x" test-Literal ] unit-test
+{ "Hello, world" } [ "'Hello, world'" test-Literal ] unit-test
+{ "Hello, 'funny' world" } [ "'Hello, ''funny'' world'" test-Literal ] unit-test
+{ T{ symbol f "foo" } } [ "#foo" test-Literal ] unit-test
+{ T{ symbol f "+" } } [ "#+" test-Literal ] unit-test
+{ T{ symbol f "at:put:" } } [ "#at:put:" test-Literal ] unit-test
+{ T{ symbol f "Hello world" } } [ "#'Hello world'" test-Literal ] unit-test
+{ B{ 1 2 3 4 } } [ "#[1 2 3 4]" test-Literal ] unit-test
+{ { nil t f } } [ "#(nil true false)" test-Literal ] unit-test
+{ { nil { t f } } } [ "#(nil (true false))" test-Literal ] unit-test
+{ T{ ast-block f { } { } { } } } [ "[]" test-Literal ] unit-test
+{ T{ ast-block f { "x" } { } { T{ ast-return f T{ ast-name f "x" } } } } } [ "[ :x|^x]" test-Literal ] unit-test
+{ T{ ast-block f { } { } { T{ ast-return f self } } } } [ "[^self]" test-Literal ] unit-test
+
+{
T{ ast-block
{ arguments { "i" } }
{ body
}
}
}
-]
+}
[ "[ :i | i print ]" test-Literal ] unit-test
-[
+{
T{ ast-block
{ body { 5 self } }
}
-]
+}
[ "[5. self]" test-Literal ] unit-test
EBNF: test-FormalBlockArgumentDeclarationList
test = <foreign parse-smalltalk FormalBlockArgumentDeclarationList>
;EBNF
-[ V{ "x" "y" "elt" } ] [ ":x :y :elt" test-FormalBlockArgumentDeclarationList ] unit-test
+{ V{ "x" "y" "elt" } } [ ":x :y :elt" test-FormalBlockArgumentDeclarationList ] unit-test
EBNF: test-Operand
test = <foreign parse-smalltalk Operand>
;EBNF
-[ { 123 15.6 { t f } } ] [ "#(123 15.6 (true false))" test-Operand ] unit-test
-[ T{ ast-name f "x" } ] [ "x" test-Operand ] unit-test
+{ { 123 15.6 { t f } } } [ "#(123 15.6 (true false))" test-Operand ] unit-test
+{ T{ ast-name f "x" } } [ "x" test-Operand ] unit-test
EBNF: test-Expression
test = <foreign parse-smalltalk Expression>
;EBNF
-[ self ] [ "self" test-Expression ] unit-test
-[ { 123 15.6 { t f } } ] [ "#(123 15.6 (true false))" test-Expression ] unit-test
-[ T{ ast-name f "x" } ] [ "x" test-Expression ] unit-test
-[ T{ ast-message-send f 5 "print" { } } ] [ "5 print" test-Expression ] unit-test
-[ T{ ast-message-send f T{ ast-message-send f 5 "squared" { } } "print" { } } ] [ "5 squared print" test-Expression ] unit-test
-[ T{ ast-message-send f 2 "+" { 2 } } ] [ "2+2" test-Expression ] unit-test
+{ self } [ "self" test-Expression ] unit-test
+{ { 123 15.6 { t f } } } [ "#(123 15.6 (true false))" test-Expression ] unit-test
+{ T{ ast-name f "x" } } [ "x" test-Expression ] unit-test
+{ T{ ast-message-send f 5 "print" { } } } [ "5 print" test-Expression ] unit-test
+{ T{ ast-message-send f T{ ast-message-send f 5 "squared" { } } "print" { } } } [ "5 squared print" test-Expression ] unit-test
+{ T{ ast-message-send f 2 "+" { 2 } } } [ "2+2" test-Expression ] unit-test
-[
+{
T{ ast-message-send f
T{ ast-message-send f 3 "factorial" { } }
"+"
{ T{ ast-message-send f 4 "factorial" { } } }
}
-]
+}
[ "3 factorial + 4 factorial" test-Expression ] unit-test
-[
+{
T{ ast-message-send f
T{ ast-message-send f 3 "factorial" { } }
"+"
{ T{ ast-message-send f 4 "factorial" { } } }
}
-]
+}
[ " 3 factorial + 4 factorial" test-Expression ] unit-test
-[
+{
T{ ast-message-send f
T{ ast-message-send f 3 "factorial" { } }
"+"
{ T{ ast-message-send f 4 "factorial" { } } }
}
-]
+}
[ " 3 factorial + 4 factorial " test-Expression ] unit-test
-[
+{
T{ ast-message-send f
T{ ast-message-send f
T{ ast-message-send f 3 "factorial" { } }
"factorial"
{ }
}
-]
+}
[ "(3 factorial + 4) factorial" test-Expression ] unit-test
-[
+{
T{ ast-message-send
{ receiver
T{ ast-message-send
}
{ selector "print" }
}
-]
+}
[ "((1 < 10) ifTrue: [ 'HI' ] ifFalse: [ 'BYE' ]) print" test-Expression ] unit-test
-[
+{
T{ ast-cascade
{ receiver 12 }
{ messages
}
}
}
-]
+}
[ "12 sqrt; + 2" test-Expression ] unit-test
-[
+{
T{ ast-cascade
{ receiver T{ ast-message-send f 12 "sqrt" } }
{ messages
}
}
}
-]
+}
[ "12 sqrt + 1; + 2" test-Expression ] unit-test
-[
+{
T{ ast-cascade
{ receiver T{ ast-message-send f 12 "squared" } }
{ messages
}
}
}
-]
+}
[ "12 squared to: 100; sqrt" test-Expression ] unit-test
-[
+{
T{ ast-message-send f
T{ ast-message-send f 1 "+" { 2 } }
"*"
{ 3 }
}
-]
+}
[ "1+2*3" test-Expression ] unit-test
-[
+{
T{ ast-message-send
{ receiver
T{ ast-message-send
}
{ selector "value" }
}
-]
+}
[ "(#(['a']) at: 0) value" test-Expression ] unit-test
EBNF: test-FinalStatement
test = <foreign parse-smalltalk FinalStatement>
;EBNF
-[ T{ ast-name f "value" } ] [ "value" test-FinalStatement ] unit-test
-[ T{ ast-return f T{ ast-name f "value" } } ] [ "^value" test-FinalStatement ] unit-test
-[ T{ ast-assignment f T{ ast-name f "value" } 5 } ] [ "value:=5" test-FinalStatement ] unit-test
+{ T{ ast-name f "value" } } [ "value" test-FinalStatement ] unit-test
+{ T{ ast-return f T{ ast-name f "value" } } } [ "^value" test-FinalStatement ] unit-test
+{ T{ ast-assignment f T{ ast-name f "value" } 5 } } [ "value:=5" test-FinalStatement ] unit-test
EBNF: test-LocalVariableDeclarationList
test = <foreign parse-smalltalk LocalVariableDeclarationList>
;EBNF
-[ T{ ast-local-variables f { "i" "j" } } ] [ " | i j |" test-LocalVariableDeclarationList ] unit-test
+{ T{ ast-local-variables f { "i" "j" } } } [ " | i j |" test-LocalVariableDeclarationList ] unit-test
-[ T{ ast-message-send f T{ ast-name f "x" } "foo:bar:" { 1 2 } } ]
+{ T{ ast-message-send f T{ ast-name f "x" } "foo:bar:" { 1 2 } } }
[ "x foo:1 bar:2" test-Expression ] unit-test
-[
+{
T{ ast-message-send
f
T{ ast-message-send f
"between:and:"
{ 10 100 }
}
-]
+}
[ "3 factorial + 4 factorial between: 10 and: 100" test-Expression ] unit-test
-[ T{ ast-sequence f { } { 1 2 } } ] [ "1. 2" parse-smalltalk ] unit-test
+{ T{ ast-sequence f { } { 1 2 } } } [ "1. 2" parse-smalltalk ] unit-test
-[ T{ ast-sequence f { } { 1 2 } } ] [ "1. 2." parse-smalltalk ] unit-test
+{ T{ ast-sequence f { } { 1 2 } } } [ "1. 2." parse-smalltalk ] unit-test
-[
+{
T{ ast-sequence f { }
{
T{ ast-class
}
}
}
-]
+}
[ "class Test [|a|]" parse-smalltalk ] unit-test
-[
+{
T{ ast-sequence f { }
{
T{ ast-class
}
}
}
-]
+}
[ "class Test1 [|a|]. class Test2 extends Test1 [|b|]" parse-smalltalk ] unit-test
-[ ] [ "class Foo []. Tests blah " parse-smalltalk drop ] unit-test
+{ } [ "class Foo []. Tests blah " parse-smalltalk drop ] unit-test
-[ ] [ "vocab:smalltalk/parser/test.st" ascii file-contents parse-smalltalk drop ] unit-test
+{ } [ "vocab:smalltalk/parser/test.st" ascii file-contents parse-smalltalk drop ] unit-test
IN: smalltalk.printer.tests
USING: smalltalk.printer tools.test ;
-[ "#((1 2) 'hi')" ] [ { { 1 2 } "hi" } smalltalk>string ] unit-test
+{ "#((1 2) 'hi')" } [ { { 1 2 } "hi" } smalltalk>string ] unit-test
: test-correct ( word -- word/f )
test-dictionary (correct) ;
-[ "government" ] [ "goverment" test-correct ] unit-test
-[ "government" ] [ "govxernment" test-correct ] unit-test
-[ "government" ] [ "govermnent" test-correct ] unit-test
-[ "government" ] [ "govxermnent" test-correct ] unit-test
-[ "government" ] [ "govyrmnent" test-correct ] unit-test
+{ "government" } [ "goverment" test-correct ] unit-test
+{ "government" } [ "govxernment" test-correct ] unit-test
+{ "government" } [ "govermnent" test-correct ] unit-test
+{ "government" } [ "govxermnent" test-correct ] unit-test
+{ "government" } [ "govyrmnent" test-correct ] unit-test
IN: sudoku.tests
USING: tools.test sudoku ;
-[ ] [ sudoku-demo ] unit-test
+{ } [ sudoku-demo ] unit-test
"scale(2.0 4.0)" svg-transform>affine-transform
] unit-test
-[ t ] [
+{ t } [
"skewX(45)" svg-transform>affine-transform
{ 1.0 0.0 } { 1.0 1.0 } { 0.0 0.0 } <affine-transform> 0.001 a~
] unit-test
-[ t ] [
+{ t } [
"skewY(-4.5e1)" svg-transform>affine-transform
{ 1.0 -1.0 } { 0.0 1.0 } { 0.0 0.0 } <affine-transform> 0.001 a~
] unit-test
-[ t ] [
+{ t } [
"rotate(30)" svg-transform>affine-transform
{ $[ 0.75 sqrt ] 0.5 }
{ -0.5 $[ 0.75 sqrt ] }
0.001 a~
] unit-test
-[ t ] [
+{ t } [
"rotate(30 1.0,2.0)" svg-transform>affine-transform
{ $[ 30 degrees cos ] $[ 30 degrees sin ] }
{ $[ -30 degrees sin ] $[ 30 degrees cos ] } {
"translate(1 2) rotate(30)" svg-transform>affine-transform
] unit-test
-[ {
+{ {
T{ moveto f { 1.0 1.0 } f }
T{ lineto f { 3.0 -1.0 } f }
T{ smooth-quadratic-bezier-curveto f { 3.0 4.0 } t }
T{ elliptical-arc f { 5.0 6.0 } 7.0 t f { 8.0 9.0 } f }
-} ] [
+} } [
"""
M 1.0,+1 3,-10e-1 l 2 2, 2 -2, 2 2 v -9 1 H 9 8 z
M 0 0 C -4.0 0.0 -8.0 4.0 -8.0 8.0 -8.0 4.0 -12.0 8.0 -16.0 8.0
: test-svg-path ( -- obj )
test-svg-string string>xml body>> children-tags first ;
-[ { T{ moveto f { -1.0 -1.0 } f } T{ lineto f { 2.0 2.0 } t } } ]
+{ { T{ moveto f { -1.0 -1.0 } f } T{ lineto f { 2.0 2.0 } t } } }
[ test-svg-path tag-d ] unit-test
-[ T{ affine-transform f { 1.0 0.0 } { 0.0 1.0 } { 1.0 2.0 } } ]
+{ T{ affine-transform f { 1.0 0.0 } { 0.0 1.0 } { 1.0 2.0 } } }
[ test-svg-path tag-transform ] unit-test
IN: synth.tests
-[
+{
{
0.0
0.9510565162951535
-0.587785252292473
-0.9510565162951536
}
-] [ 5 single-sine-wave ] unit-test
+} [ 5 single-sine-wave ] unit-test
calendar taxes.usa.w4 usa-cities math.finance ;
IN: taxes.usa.tests
-[
+{
426 23
-] [
+} [
12000 2008 3 f <w4> <federal> net biweekly
dollars/cents
] unit-test
-[
+{
426 23
-] [
+} [
12000 2008 3 t <w4> <federal> net biweekly
dollars/cents
] unit-test
-[
+{
684 4
-] [
+} [
20000 2008 3 f <w4> <federal> net biweekly
dollars/cents
] unit-test
-[
+{
804 58
-] [
+} [
24000 2008 3 f <w4> <federal> net biweekly
dollars/cents
] unit-test
-[
+{
831 31
-] [
+} [
24000 2008 3 t <w4> <federal> net biweekly
dollars/cents
] unit-test
-[
+{
780 81
-] [
+} [
24000 2008 3 f <w4> <mn> net biweekly
dollars/cents
] unit-test
-[
+{
818 76
-] [
+} [
24000 2008 3 t <w4> <mn> net biweekly
dollars/cents
] unit-test
-[
+{
2124 39
-] [
+} [
78250 2008 3 f <w4> <mn> net biweekly
dollars/cents
] unit-test
-[
+{
2321 76
-] [
+} [
78250 2008 3 t <w4> <mn> net biweekly
dollars/cents
] unit-test
-[
+{
2612 63
-] [
+} [
100000 2008 3 f <w4> <mn> net biweekly
dollars/cents
] unit-test
-[
+{
22244 52
-] [
+} [
1000000 2008 3 f <w4> <mn> net biweekly
dollars/cents
] unit-test
-[
+{
578357 40
-] [
+} [
1000000 2008 3 f <w4> <mn> net
dollars/cents
] unit-test
-[
+{
588325 41
-] [
+} [
1000000 2008 3 t <w4> <mn> net
dollars/cents
] unit-test
-[ 30 97 ] [
+{ 30 97 } [
24000 2008 2 f <w4> <mn> MN withholding* biweekly dollars/cents
] unit-test
-[ 173 66 ] [
+{ 173 66 } [
78250 2008 2 f <w4> <mn> MN withholding* biweekly dollars/cents
] unit-test
-[ 138 69 ] [
+{ 138 69 } [
24000 2008 2 f <w4> <federal> total-withholding biweekly dollars/cents
] unit-test
-[ 754 72 ] [
+{ 754 72 } [
78250 2008 2 f <w4> <federal> total-withholding biweekly dollars/cents
] unit-test
USING: accessors arrays colors colors.constants kernel tetris.board tetris.piece tools.test ;
-[ { { f f } { f f } { f f } } ] [ 2 3 make-rows ] unit-test
-[ { { f f } { f f } { f f } } ] [ 2 3 <board> rows>> ] unit-test
-[ 1 { f f } ] [ 2 3 <board> { 1 1 } board@block ] unit-test
-[ f ] [ 2 3 <board> { 1 1 } block ] unit-test
+{ { { f f } { f f } { f f } } } [ 2 3 make-rows ] unit-test
+{ { { f f } { f f } { f f } } } [ 2 3 <board> rows>> ] unit-test
+{ 1 { f f } } [ 2 3 <board> { 1 1 } board@block ] unit-test
+{ f } [ 2 3 <board> { 1 1 } block ] unit-test
[ 2 3 <board> { 2 3 } block ] must-fail
{ COLOR: red } [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 1 1 } block ] unit-test
-[ t ] [ 2 3 <board> { 1 1 } block-free? ] unit-test
-[ f ] [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 1 1 } block-free? ] unit-test
-[ t ] [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 1 2 } block-free? ] unit-test
-[ t ] [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 0 1 } block-free? ] unit-test
-[ t ] [ 2 3 <board> { 0 0 } block-in-bounds? ] unit-test
-[ f ] [ 2 3 <board> { -1 0 } block-in-bounds? ] unit-test
-[ t ] [ 2 3 <board> { 1 2 } block-in-bounds? ] unit-test
-[ f ] [ 2 3 <board> { 2 2 } block-in-bounds? ] unit-test
-[ t ] [ 2 3 <board> { 1 1 } location-valid? ] unit-test
-[ f ] [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 1 1 } location-valid? ] unit-test
-[ t ] [ 10 10 <board> 10 <random-piece> piece-valid? ] unit-test
-[ f ] [ 2 3 <board> 10 <random-piece> { 1 2 } >>location piece-valid? ] unit-test
-[ { { f } { f } } ] [ 1 1 <board> add-row rows>> ] unit-test
-[ { { f } } ] [ 1 2 <board> dup { 0 1 } COLOR: red set-block remove-full-rows rows>> ] unit-test
-[ { { f } { f } } ] [ 1 2 <board> dup { 0 1 } COLOR: red set-block dup check-rows drop rows>> ] unit-test
+{ t } [ 2 3 <board> { 1 1 } block-free? ] unit-test
+{ f } [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 1 1 } block-free? ] unit-test
+{ t } [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 1 2 } block-free? ] unit-test
+{ t } [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 0 1 } block-free? ] unit-test
+{ t } [ 2 3 <board> { 0 0 } block-in-bounds? ] unit-test
+{ f } [ 2 3 <board> { -1 0 } block-in-bounds? ] unit-test
+{ t } [ 2 3 <board> { 1 2 } block-in-bounds? ] unit-test
+{ f } [ 2 3 <board> { 2 2 } block-in-bounds? ] unit-test
+{ t } [ 2 3 <board> { 1 1 } location-valid? ] unit-test
+{ f } [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 1 1 } location-valid? ] unit-test
+{ t } [ 10 10 <board> 10 <random-piece> piece-valid? ] unit-test
+{ f } [ 2 3 <board> 10 <random-piece> { 1 2 } >>location piece-valid? ] unit-test
+{ { { f } { f } } } [ 1 1 <board> add-row rows>> ] unit-test
+{ { { f } } } [ 1 2 <board> dup { 0 1 } COLOR: red set-block remove-full-rows rows>> ] unit-test
+{ { { f } { f } } } [ 1 2 <board> dup { 0 1 } COLOR: red set-block dup check-rows drop rows>> ] unit-test
sequences ;
FROM: tetris.game => level>> ;
-[ t ] [ <default-tetris> [ current-piece ] [ next-piece ] bi and t f ? ] unit-test
-[ t ] [ <default-tetris> { 1 1 } can-move? ] unit-test
-[ t ] [ <default-tetris> { 1 1 } tetris-move ] unit-test
-[ 1 ] [ <default-tetris> dup { 1 1 } tetris-move drop current-piece location>> second ] unit-test
-[ 1 ] [ <default-tetris> level>> ] unit-test
-[ 1 ] [ <default-tetris> 9 >>rows level>> ] unit-test
-[ 2 ] [ <default-tetris> 10 >>rows level>> ] unit-test
-[ 0 ] [ 3 0 rows-score ] unit-test
-[ 80 ] [ 1 1 rows-score ] unit-test
-[ 4800 ] [ 3 4 rows-score ] unit-test
-[ 1 ] [ <default-tetris> dup 3 score-rows dup 3 score-rows dup 3 score-rows level>> ] unit-test
-[ 2 ] [ <default-tetris> dup 4 score-rows dup 4 score-rows dup 2 score-rows level>> ] unit-test
+{ t } [ <default-tetris> [ current-piece ] [ next-piece ] bi and t f ? ] unit-test
+{ t } [ <default-tetris> { 1 1 } can-move? ] unit-test
+{ t } [ <default-tetris> { 1 1 } tetris-move ] unit-test
+{ 1 } [ <default-tetris> dup { 1 1 } tetris-move drop current-piece location>> second ] unit-test
+{ 1 } [ <default-tetris> level>> ] unit-test
+{ 1 } [ <default-tetris> 9 >>rows level>> ] unit-test
+{ 2 } [ <default-tetris> 10 >>rows level>> ] unit-test
+{ 0 } [ 3 0 rows-score ] unit-test
+{ 80 } [ 1 1 rows-score ] unit-test
+{ 4800 } [ 3 4 rows-score ] unit-test
+{ 1 } [ <default-tetris> dup 3 score-rows dup 3 score-rows dup 3 score-rows level>> ] unit-test
+{ 2 } [ <default-tetris> dup 4 score-rows dup 4 score-rows dup 2 score-rows level>> ] unit-test
! these two tests rely on the first rotation of the first tetromino being the
! 'I' tetromino in its vertical orientation.
-[ 4 ] [ tetrominoes get first states>> first blocks-width ] unit-test
-[ 1 ] [ tetrominoes get first states>> first blocks-height ] unit-test
+{ 4 } [ tetrominoes get first states>> first blocks-width ] unit-test
+{ 1 } [ tetrominoes get first states>> first blocks-height ] unit-test
-[ { 0 0 } ] [ random-tetromino <piece> location>> ] unit-test
-[ 0 ] [ 10 <random-piece> rotation>> ] unit-test
+{ { 0 0 } } [ random-tetromino <piece> location>> ] unit-test
+{ 0 } [ 10 <random-piece> rotation>> ] unit-test
-[ { { 0 0 } { 1 0 } { 2 0 } { 3 0 } } ]
+{ { { 0 0 } { 1 0 } { 2 0 } { 3 0 } } }
[ tetrominoes get first <piece> piece-blocks ] unit-test
-[ { { 0 0 } { 0 1 } { 0 2 } { 0 3 } } ]
+{ { { 0 0 } { 0 1 } { 0 2 } { 0 3 } } }
[ tetrominoes get first <piece> 1 rotate-piece piece-blocks ] unit-test
-[ { { 1 1 } { 2 1 } { 3 1 } { 4 1 } } ]
+{ { { 1 1 } { 2 1 } { 3 1 } { 4 1 } } }
[ tetrominoes get first <piece> { 1 1 } move-piece piece-blocks ] unit-test
-[ 3 ] [ tetrominoes get second <piece> piece-width ] unit-test
-[ 2 ] [ tetrominoes get second <piece> 1 rotate-piece piece-width ] unit-test
+{ 3 } [ tetrominoes get second <piece> piece-width ] unit-test
+{ 2 } [ tetrominoes get second <piece> 1 rotate-piece piece-width ] unit-test
USING: kernel tnetstrings sequences tools.test ;
-[ t ] [
+{ t } [
{
{ H{ } "0:}" }
{ { } "0:]" }
assocs accessors trees.avl.private trees.private ;
IN: trees.avl.tests
-[ "key1" 0 "key2" 0 ] [
+{ "key1" 0 "key2" 0 } [
T{ avl-node f "key1" f f T{ avl-node f "key2" f f 1 } 2 }
[ single-rotate ] go-left
[ left>> dup key>> swap balance>> ] keep
dup key>> swap balance>>
] unit-test
-[ "key1" 0 "key2" 0 ] [
+{ "key1" 0 "key2" 0 } [
T{ avl-node f "key1" f f T{ avl-node f "key2" f f f 1 } 2 }
[ select-rotate ] go-left
[ left>> dup key>> swap balance>> ] keep
dup key>> swap balance>>
] unit-test
-[ "key1" 0 "key2" 0 ] [
+{ "key1" 0 "key2" 0 } [
T{ avl-node f "key1" f T{ avl-node f "key2" f f f -1 } f -2 }
[ single-rotate ] go-right
[ right>> dup key>> swap balance>> ] keep
dup key>> swap balance>>
] unit-test
-[ "key1" 0 "key2" 0 ] [
+{ "key1" 0 "key2" 0 } [
T{ avl-node f "key1" f T{ avl-node f "key2" f f f -1 } f -2 }
[ select-rotate ] go-right
[ right>> dup key>> swap balance>> ] keep
dup key>> swap balance>>
] unit-test
-[ "key1" -1 "key2" 0 "key3" 0 ]
+{ "key1" -1 "key2" 0 "key3" 0 }
[ T{ avl-node f "key1" f f
T{ avl-node f "key2" f
T{ avl-node f "key3" f f f 1 } f -1 } 2 }
[ left>> dup key>> swap balance>> ] keep
[ right>> dup key>> swap balance>> ] keep
dup key>> swap balance>> ] unit-test
-[ "key1" 0 "key2" 0 "key3" 0 ]
+{ "key1" 0 "key2" 0 "key3" 0 }
[ T{ avl-node f "key1" f f
T{ avl-node f "key2" f
T{ avl-node f "key3" f f f 0 } f -1 } 2 }
[ left>> dup key>> swap balance>> ] keep
[ right>> dup key>> swap balance>> ] keep
dup key>> swap balance>> ] unit-test
-[ "key1" 0 "key2" 1 "key3" 0 ]
+{ "key1" 0 "key2" 1 "key3" 0 }
[ T{ avl-node f "key1" f f
T{ avl-node f "key2" f
T{ avl-node f "key3" f f f -1 } f -1 } 2 }
[ right>> dup key>> swap balance>> ] keep
dup key>> swap balance>> ] unit-test
-[ "key1" 1 "key2" 0 "key3" 0 ]
+{ "key1" 1 "key2" 0 "key3" 0 }
[ T{ avl-node f "key1" f
T{ avl-node f "key2" f f
T{ avl-node f "key3" f f f -1 } 1 } f -2 }
[ right>> dup key>> swap balance>> ] keep
[ left>> dup key>> swap balance>> ] keep
dup key>> swap balance>> ] unit-test
-[ "key1" 0 "key2" 0 "key3" 0 ]
+{ "key1" 0 "key2" 0 "key3" 0 }
[ T{ avl-node f "key1" f
T{ avl-node f "key2" f f
T{ avl-node f "key3" f f f 0 } 1 } f -2 }
[ right>> dup key>> swap balance>> ] keep
[ left>> dup key>> swap balance>> ] keep
dup key>> swap balance>> ] unit-test
-[ "key1" 0 "key2" -1 "key3" 0 ]
+{ "key1" 0 "key2" -1 "key3" 0 }
[ T{ avl-node f "key1" f
T{ avl-node f "key2" f f
T{ avl-node f "key3" f f f 1 } 1 } f -2 }
[ left>> dup key>> swap balance>> ] keep
dup key>> swap balance>> ] unit-test
-[ "eight" ] [
+{ "eight" } [
<avl> "seven" 7 pick set-at
"eight" 8 pick set-at "nine" 9 pick set-at
root>> value>>
] unit-test
-[ "another eight" ] [ ! ERROR!
+{ "another eight" } [ ! ERROR!
<avl> "seven" 7 pick set-at
"another eight" 8 pick set-at 8 of
] unit-test
} clone ;
! test set-at, at, at*
-[ t ] [ test-tree avl? ] unit-test
-[ "seven" ] [ <avl> "seven" 7 pick set-at 7 of ] unit-test
-[ "seven" t ] [ <avl> "seven" 7 pick set-at 7 ?of ] unit-test
-[ 8 f ] [ <avl> "seven" 7 pick set-at 8 ?of ] unit-test
-[ "seven" ] [ <avl> "seven" 7 pick set-at 7 of ] unit-test
-[ "replacement" ] [ <avl> "seven" 7 pick set-at "replacement" 7 pick set-at 7 of ] unit-test
-[ "nine" ] [ test-tree 9 of ] unit-test
-[ "replaced four" ] [ test-tree 4 of ] unit-test
-[ "replaced seven" ] [ test-tree 7 of ] unit-test
+{ t } [ test-tree avl? ] unit-test
+{ "seven" } [ <avl> "seven" 7 pick set-at 7 of ] unit-test
+{ "seven" t } [ <avl> "seven" 7 pick set-at 7 ?of ] unit-test
+{ 8 f } [ <avl> "seven" 7 pick set-at 8 ?of ] unit-test
+{ "seven" } [ <avl> "seven" 7 pick set-at 7 of ] unit-test
+{ "replacement" } [ <avl> "seven" 7 pick set-at "replacement" 7 pick set-at 7 of ] unit-test
+{ "nine" } [ test-tree 9 of ] unit-test
+{ "replaced four" } [ test-tree 4 of ] unit-test
+{ "replaced seven" } [ test-tree 7 of ] unit-test
! test delete-at--all errors!
-[ f ] [ test-tree 9 over delete-at 9 of ] unit-test
-[ "replaced seven" ] [ test-tree 9 over delete-at 7 of ] unit-test
-[ "nine" ] [ test-tree 7 over delete-at 4 over delete-at 9 of ] unit-test
+{ f } [ test-tree 9 over delete-at 9 of ] unit-test
+{ "replaced seven" } [ test-tree 9 over delete-at 7 of ] unit-test
+{ "nine" } [ test-tree 7 over delete-at 4 over delete-at 9 of ] unit-test
} clone ;
! test set-at, at, at*
-[ "seven" ] [ <tree> "seven" 7 pick set-at 7 of ] unit-test
-[ "seven" t ] [ <tree> "seven" 7 pick set-at 7 ?of ] unit-test
-[ 8 f ] [ <tree> "seven" 7 pick set-at 8 ?of ] unit-test
-[ "seven" ] [ <tree> "seven" 7 pick set-at 7 of ] unit-test
-[ "replacement" ] [ <tree> "seven" 7 pick set-at "replacement" 7 pick set-at 7 of ] unit-test
-[ "replaced four" ] [ test-tree 4 of ] unit-test
-[ "nine" ] [ test-tree 9 of ] unit-test
+{ "seven" } [ <tree> "seven" 7 pick set-at 7 of ] unit-test
+{ "seven" t } [ <tree> "seven" 7 pick set-at 7 ?of ] unit-test
+{ 8 f } [ <tree> "seven" 7 pick set-at 8 ?of ] unit-test
+{ "seven" } [ <tree> "seven" 7 pick set-at 7 of ] unit-test
+{ "replacement" } [ <tree> "seven" 7 pick set-at "replacement" 7 pick set-at 7 of ] unit-test
+{ "replaced four" } [ test-tree 4 of ] unit-test
+{ "nine" } [ test-tree 9 of ] unit-test
! test delete-at
-[ f ] [ test-tree 9 over delete-at 9 of ] unit-test
-[ "replaced seven" ] [ test-tree 9 over delete-at 7 of ] unit-test
-[ "replaced four" ] [ test-tree 9 over delete-at 4 of ] unit-test
-[ "nine" "replaced four" ] [ test-tree 7 over delete-at 9 over at 4 rot at ] unit-test
-[ "nine" ] [ test-tree 7 over delete-at 4 over delete-at 9 of ] unit-test
+{ f } [ test-tree 9 over delete-at 9 of ] unit-test
+{ "replaced seven" } [ test-tree 9 over delete-at 7 of ] unit-test
+{ "replaced four" } [ test-tree 9 over delete-at 4 of ] unit-test
+{ "nine" "replaced four" } [ test-tree 7 over delete-at 9 over at 4 rot at ] unit-test
+{ "nine" } [ test-tree 7 over delete-at 4 over delete-at 9 of ] unit-test
IN: txon.tests
-[ "ABC" ] [ "ABC" >txon ] unit-test
+{ "ABC" } [ "ABC" >txon ] unit-test
-[ "A\\`C" ] [ "A`C" >txon ] unit-test
+{ "A\\`C" } [ "A`C" >txon ] unit-test
-[ "123" ] [ 123 >txon ] unit-test
+{ "123" } [ 123 >txon ] unit-test
-[ "1\n2\n3" ] [ { 1 2 3 } >txon ] unit-test
+{ "1\n2\n3" } [ { 1 2 3 } >txon ] unit-test
-[ "a:`123`\nb:`456`" ] [ H{ { "a" 123 } { "b" 456 } } >txon ] unit-test
+{ "a:`123`\nb:`456`" } [ H{ { "a" 123 } { "b" 456 } } >txon ] unit-test
-[ "foo" ] [ "foo" txon> ] unit-test
+{ "foo" } [ "foo" txon> ] unit-test
-[ "foo" ] [ " foo " txon> ] unit-test
+{ "foo" } [ " foo " txon> ] unit-test
-[ H{ { "foo" "" } } ]
+{ H{ { "foo" "" } } }
[ "foo:``" txon> ] unit-test
-[ H{ { "foo" " " } } ]
+{ H{ { "foo" " " } } }
[ "foo:` `" txon> ] unit-test
-[ H{ { "name" "value" } } ]
+{ H{ { "name" "value" } } }
[ "name:`value`" txon> ] unit-test
-[ H{ { "name" "value" } } ]
+{ H{ { "name" "value" } } }
[ " name:`value` " txon> ] unit-test
-[ H{ { "foo`bar" "value" } } ]
+{ H{ { "foo`bar" "value" } } }
[ "foo\\`bar:`value`" txon> ] unit-test
-[ H{ { "foo" "bar`baz" } } ]
+{ H{ { "foo" "bar`baz" } } }
[ "foo:`bar\\`baz`" txon> ] unit-test
-[ { H{ { "name1" "value1" } } H{ { "name2" "value2" } } } ]
+{ { H{ { "name1" "value1" } } H{ { "name2" "value2" } } } }
[ "name1:`value1`name2:`value2`" txon> ] unit-test
-[ H{ { "name1" H{ { "name2" "nested value" } } } } ]
+{ H{ { "name1" H{ { "name2" "nested value" } } } } }
[ "name1:` name2:`nested value` `" txon> ] unit-test
-[ "name1:`name2:`nested value``" ]
+{ "name1:`name2:`nested value``" }
[
H{ { "name1" H{ { "name2" "nested value" } } } } >txon
] unit-test
-[
+{
H{
{ "name1" H{ { "name2" "value2" } { "name3" "value3" } } }
}
-] [
+} [
"
name1:`
name2:`value2`
" txon>
] unit-test
-[
+{
H{
{ "name1" H{ { "name2" H{ { "name3" "value3" } } } } }
}
-] [
+} [
"
name1:`
name2:`
" txon>
] unit-test
-[ H{ { "a" { "1" "2" "3" } } } ] [ "a:`1\n2\n3`" txon> ] unit-test
+{ H{ { "a" { "1" "2" "3" } } } } [ "a:`1\n2\n3`" txon> ] unit-test
USING: ui.gadgets.lists models prettyprint math tools.test
kernel ;
-[ ] [ [ drop ] [ 3 + . ] f <model> <list> invoke-value-action ] unit-test
+{ } [ [ drop ] [ 3 + . ] f <model> <list> invoke-value-action ] unit-test
USING: kernel math tools.test units.imperial inverse ;
IN: units.imperial.tests
-[ 1 ] [ 12 inches [ feet ] undo ] unit-test
-[ 12 ] [ 1 feet [ inches ] undo ] unit-test
+{ 1 } [ 12 inches [ feet ] undo ] unit-test
+{ 12 } [ 1 feet [ inches ] undo ] unit-test
-[ t ] [ 16 ounces 1 pounds = ] unit-test
-[ t ] [ 1 pounds [ ounces ] undo 16 = ] unit-test
+{ t } [ 16 ounces 1 pounds = ] unit-test
+{ t } [ 1 pounds [ ounces ] undo 16 = ] unit-test
-[ 1 ] [ 4 quarts [ gallons ] undo ] unit-test
-[ 4 ] [ 1 gallons [ quarts ] undo ] unit-test
+{ 1 } [ 4 quarts [ gallons ] undo ] unit-test
+{ 4 } [ 1 gallons [ quarts ] undo ] unit-test
-[ 2 ] [ 1 pints [ cups ] undo ] unit-test
-[ 1 ] [ 2 cups [ pints ] undo ] unit-test
+{ 2 } [ 1 pints [ cups ] undo ] unit-test
+{ 1 } [ 2 cups [ pints ] undo ] unit-test
-[ 256 ] [ 1 gallons [ tablespoons ] undo ] unit-test
-[ 1 ] [ 256 tablespoons [ gallons ] undo ] unit-test
+{ 256 } [ 1 gallons [ tablespoons ] undo ] unit-test
+{ 1 } [ 256 tablespoons [ gallons ] undo ] unit-test
-[ 768 ] [ 1 gallons [ teaspoons ] undo ] unit-test
-[ 1 ] [ 768 teaspoons [ gallons ] undo ] unit-test
+{ 768 } [ 1 gallons [ teaspoons ] undo ] unit-test
+{ 1 } [ 768 teaspoons [ gallons ] undo ] unit-test
{ 1 } [ 6 feet [ fathoms ] undo ] unit-test
{ 1 } [ 8 furlongs [ miles ] undo ] unit-test
math.order math.parser sequences tools.test ;
IN: units.reduction
-[ "0Bi" ] [ 0 n>storage ] unit-test
-[ "0B" ] [ 0 n>Storage ] unit-test
-[ "0Bi" ] [ -0 n>storage ] unit-test
-[ "0B" ] [ -0 n>Storage ] unit-test
-[ "1000Bi" ] [ 1,000 n>storage ] unit-test
-[ "1K" ] [ 1,000 n>Storage ] unit-test
-[ "976Ki" ] [ 1,000,000 n>storage ] unit-test
-[ "1Mi" ] [ 2,000,000 n>storage ] unit-test
-[ "190Mi" ] [ 200,000,000 n>storage ] unit-test
-[ "1M" ] [ 1,000,000 n>Storage ] unit-test
-[ "953Mi" ] [ 1,000,000,000 n>storage ] unit-test
-[ "1G" ] [ 1,000,000,000 n>Storage ] unit-test
-[ "931Gi" ] [ 1,000,000,000,000 n>storage ] unit-test
-[ "1T" ] [ 1,000,000,000,000 n>Storage ] unit-test
-[ "909Ti" ] [ 1,000,000,000,000,000 n>storage ] unit-test
-[ "1P" ] [ 1,000,000,000,000,000 n>Storage ] unit-test
-[ "888Pi" ] [ 1,000,000,000,000,000,000 n>storage ] unit-test
-[ "1E" ] [ 1,000,000,000,000,000,000 n>Storage ] unit-test
-[ "-1E" ] [ -1,000,000,000,000,000,000 n>Storage ] unit-test
+{ "0Bi" } [ 0 n>storage ] unit-test
+{ "0B" } [ 0 n>Storage ] unit-test
+{ "0Bi" } [ -0 n>storage ] unit-test
+{ "0B" } [ -0 n>Storage ] unit-test
+{ "1000Bi" } [ 1,000 n>storage ] unit-test
+{ "1K" } [ 1,000 n>Storage ] unit-test
+{ "976Ki" } [ 1,000,000 n>storage ] unit-test
+{ "1Mi" } [ 2,000,000 n>storage ] unit-test
+{ "190Mi" } [ 200,000,000 n>storage ] unit-test
+{ "1M" } [ 1,000,000 n>Storage ] unit-test
+{ "953Mi" } [ 1,000,000,000 n>storage ] unit-test
+{ "1G" } [ 1,000,000,000 n>Storage ] unit-test
+{ "931Gi" } [ 1,000,000,000,000 n>storage ] unit-test
+{ "1T" } [ 1,000,000,000,000 n>Storage ] unit-test
+{ "909Ti" } [ 1,000,000,000,000,000 n>storage ] unit-test
+{ "1P" } [ 1,000,000,000,000,000 n>Storage ] unit-test
+{ "888Pi" } [ 1,000,000,000,000,000,000 n>storage ] unit-test
+{ "1E" } [ 1,000,000,000,000,000,000 n>Storage ] unit-test
+{ "-1E" } [ -1,000,000,000,000,000,000 n>Storage ] unit-test
: test-n>storage ( string -- string ) n>storage storage>n n>storage ;
: test-n>Storage ( string -- string ) n>Storage storage>n n>Storage ;
-[ "0Bi" ] [ 0 test-n>storage ] unit-test
-[ "0B" ] [ 0 test-n>Storage ] unit-test
-[ "0Bi" ] [ -0 test-n>storage ] unit-test
-[ "0B" ] [ -0 test-n>Storage ] unit-test
-[ "1000Bi" ] [ 1,000 test-n>storage ] unit-test
-[ "1K" ] [ 1,000 test-n>Storage ] unit-test
-[ "976Ki" ] [ 1,000,000 test-n>storage ] unit-test
-[ "1Mi" ] [ 2,000,000 test-n>storage ] unit-test
-[ "190Mi" ] [ 200,000,000 test-n>storage ] unit-test
-[ "1M" ] [ 1,000,000 test-n>Storage ] unit-test
-[ "953Mi" ] [ 1,000,000,000 test-n>storage ] unit-test
-[ "1G" ] [ 1,000,000,000 test-n>Storage ] unit-test
-[ "931Gi" ] [ 1,000,000,000,000 test-n>storage ] unit-test
-[ "1T" ] [ 1,000,000,000,000 test-n>Storage ] unit-test
-[ "909Ti" ] [ 1,000,000,000,000,000 test-n>storage ] unit-test
-[ "1P" ] [ 1,000,000,000,000,000 test-n>Storage ] unit-test
-[ "888Pi" ] [ 1,000,000,000,000,000,000 test-n>storage ] unit-test
-[ "1E" ] [ 1,000,000,000,000,000,000 test-n>Storage ] unit-test
-[ "-1E" ] [ -1,000,000,000,000,000,000 test-n>Storage ] unit-test
+{ "0Bi" } [ 0 test-n>storage ] unit-test
+{ "0B" } [ 0 test-n>Storage ] unit-test
+{ "0Bi" } [ -0 test-n>storage ] unit-test
+{ "0B" } [ -0 test-n>Storage ] unit-test
+{ "1000Bi" } [ 1,000 test-n>storage ] unit-test
+{ "1K" } [ 1,000 test-n>Storage ] unit-test
+{ "976Ki" } [ 1,000,000 test-n>storage ] unit-test
+{ "1Mi" } [ 2,000,000 test-n>storage ] unit-test
+{ "190Mi" } [ 200,000,000 test-n>storage ] unit-test
+{ "1M" } [ 1,000,000 test-n>Storage ] unit-test
+{ "953Mi" } [ 1,000,000,000 test-n>storage ] unit-test
+{ "1G" } [ 1,000,000,000 test-n>Storage ] unit-test
+{ "931Gi" } [ 1,000,000,000,000 test-n>storage ] unit-test
+{ "1T" } [ 1,000,000,000,000 test-n>Storage ] unit-test
+{ "909Ti" } [ 1,000,000,000,000,000 test-n>storage ] unit-test
+{ "1P" } [ 1,000,000,000,000,000 test-n>Storage ] unit-test
+{ "888Pi" } [ 1,000,000,000,000,000,000 test-n>storage ] unit-test
+{ "1E" } [ 1,000,000,000,000,000,000 test-n>Storage ] unit-test
+{ "-1E" } [ -1,000,000,000,000,000,000 test-n>Storage ] unit-test
[ "abc" storage>n ] [ bad-storage-string? ] must-fail-with
[ "-abc" storage>n ] [ bad-storage-string? ] must-fail-with
math.functions units.imperial ;
IN: units.si.tests
-[ t ] [ 1 m 100 cm = ] unit-test
+{ t } [ 1 m 100 cm = ] unit-test
-[ t ] [ 180 arc-deg [ radians ] undo pi 0.0001 ~ ] unit-test
+{ t } [ 180 arc-deg [ radians ] undo pi 0.0001 ~ ] unit-test
-[ t ] [ 180 arc-min [ arc-deg ] undo 3 0.0001 ~ ] unit-test
+{ t } [ 180 arc-min [ arc-deg ] undo 3 0.0001 ~ ] unit-test
-[ -40 ] [ -40 deg-F [ deg-C ] undo ] unit-test
+{ -40 } [ -40 deg-F [ deg-C ] undo ] unit-test
-[ -40 ] [ -40 deg-C [ deg-F ] undo ] unit-test
+{ -40 } [ -40 deg-C [ deg-F ] undo ] unit-test
units.imperial units inverse math.functions ;
IN: units.tests
-[ T{ dimensioned f 3 { m } { } } ] [ 3 m ] unit-test
-[ T{ dimensioned f 3 { m } { s } } ] [ 3 m/s ] unit-test
-[ T{ dimensioned f 4000 { m } { } } ] [ 4 km ] unit-test
+{ T{ dimensioned f 3 { m } { } } } [ 3 m ] unit-test
+{ T{ dimensioned f 3 { m } { s } } } [ 3 m/s ] unit-test
+{ T{ dimensioned f 4000 { m } { } } } [ 4 km ] unit-test
-[ t ] [ 4 m 5 m d+ 9 m = ] unit-test
-[ t ] [ 5 m 1 m d- 4 m = ] unit-test
-[ t ] [ 5 m 2 m d* 10 m^2 = ] unit-test
-[ t ] [ 5 m 2 m d/ 5/2 { } { } <dimensioned> = ] unit-test
-[ t ] [ 2 m 5 m 2 m d/ drop 2 m = ] unit-test
+{ t } [ 4 m 5 m d+ 9 m = ] unit-test
+{ t } [ 5 m 1 m d- 4 m = ] unit-test
+{ t } [ 5 m 2 m d* 10 m^2 = ] unit-test
+{ t } [ 5 m 2 m d/ 5/2 { } { } <dimensioned> = ] unit-test
+{ t } [ 2 m 5 m 2 m d/ drop 2 m = ] unit-test
-[ t ] [ 1 m 2 m 3 m 3array d-product 6 m^3 = ] unit-test
-[ t ] [ 3 m d-recip 1/3 { } { m } <dimensioned> = ] unit-test
+{ t } [ 1 m 2 m 3 m 3array d-product 6 m^3 = ] unit-test
+{ t } [ 3 m d-recip 1/3 { } { m } <dimensioned> = ] unit-test
: km/L ( n -- d ) km 1 L d/ ;
: mpg ( n -- d ) miles 1 gallons d/ ;
-[ t ] [ 100 10 / km/L [ mpg ] undo 23 1 ~ ] unit-test
+{ t } [ 100 10 / km/L [ mpg ] undo 23 1 ~ ] unit-test
USING: accessors kernel tools.test usa-cities ;
IN: usa-cities.tests
-[ t ] [ 55406 find-zip-code name>> "Minneapolis" = ] unit-test
+{ t } [ 55406 find-zip-code name>> "Minneapolis" = ] unit-test
cons: { { first object } { rest list } }
;
-[ t ] [ nil list? ] unit-test
-[ t ] [ 1 nil <cons> list? ] unit-test
-[ f ] [ 1 list? ] unit-test
+{ t } [ nil list? ] unit-test
+{ t } [ 1 nil <cons> list? ] unit-test
+{ f } [ 1 list? ] unit-test
: list-length ( list -- length )
{
{ cons [ nip list-length 1 + ] }
} match ;
-[ 4 ]
+{ 4 }
[ 5 6 7 8 nil <cons> <cons> <cons> <cons> list-length ] unit-test
-[ nil t ] [ list initial-value ] unit-test
+{ nil t } [ list initial-value ] unit-test
VARIANT: list2 ;
VARIANT-MEMBER: list2 nil2
VARIANT-MEMBER: list2 cons2: { { first object } { rest list2 } }
-[ t ] [ nil2 list2? ] unit-test
-[ t ] [ 1 nil2 <cons2> list2? ] unit-test
-[ f ] [ 1 list2? ] unit-test
+{ t } [ nil2 list2? ] unit-test
+{ t } [ 1 nil2 <cons2> list2? ] unit-test
+{ f } [ 1 list2? ] unit-test
: list2-length ( list2 -- length )
{
{ cons2 [ nip list2-length 1 + ] }
} match ;
-[ 4 ]
+{ 4 }
[ 5 6 7 8 nil2 <cons2> <cons2> <cons2> <cons2> list2-length ] unit-test
[ "mason-test.db" temp-file delete-file ] ignore-errors
-[ 0 1 2 ] [
+{ 0 1 2 } [
! Do it in a with-transaction to simulate semantics of
! with-mason-db
"mason-test.db" temp-file <sqlite-db> [
: testfn ( a b c d -- a+b c+d )
+ [ + ] dip ;
-[ 3 7 ]
+{ 3 7 }
[ reset-word-timer
\ testfn [ reset ] [ add-timer ] bi
1 2 3 4 testfn ] unit-test
USING: tools.test yahoo kernel io.files xml sequences accessors urls ;
-[ T{
+{ T{
result
f
"Official Foo Fighters"
"http://www.foofighters.com/"
"Official site with news, tour dates, discography, store, community, and more."
-} ] [ "resource:extra/yahoo/test-results.xml" file>xml parse-yahoo first ] unit-test
+} } [ "resource:extra/yahoo/test-results.xml" file>xml parse-yahoo first ] unit-test
-[ URL" http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=Factor-search&query=hi&results=2&similar_ok=1" ] [ "hi" <search> "Factor-search" >>appid 2 >>results t >>similar-ok query ] unit-test
+{ URL" http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=Factor-search&query=hi&results=2&similar_ok=1" } [ "hi" <search> "Factor-search" >>appid 2 >>results t >>similar-ok query ] unit-test
USING: tools.test z-algorithm ;
IN: z-algorithm.tests
-[ 0 ] [ "qwerty" "" lcp ] unit-test
-[ 0 ] [ "qwerty" "asdf" lcp ] unit-test
-[ 3 ] [ "qwerty" "qwe" lcp ] unit-test
-[ 3 ] [ "qwerty" "qwet" lcp ] unit-test
+{ 0 } [ "qwerty" "" lcp ] unit-test
+{ 0 } [ "qwerty" "asdf" lcp ] unit-test
+{ 3 } [ "qwerty" "qwe" lcp ] unit-test
+{ 3 } [ "qwerty" "qwet" lcp ] unit-test
-[ { } ] [ "" z-values ] unit-test
-[ { 1 } ] [ "q" z-values ] unit-test
-[ { 9 0 5 0 3 0 1 0 1 } ] [ "abababaca" z-values ] unit-test
+{ { } } [ "" z-values ] unit-test
+{ { 1 } } [ "q" z-values ] unit-test
+{ { 9 0 5 0 3 0 1 0 1 } } [ "abababaca" z-values ] unit-test