CONSTANT: xyz 123
-[ 492 ] [ { int xyz } heap-size ] unit-test
+{ 492 } [ { int xyz } heap-size ] unit-test
UNION-STRUCT: foo
{ a int }
{ b int } ;
-[ t ] [ pointer: void lookup-c-type void* lookup-c-type = ] unit-test
-[ t ] [ pointer: int lookup-c-type void* lookup-c-type = ] unit-test
-[ t ] [ pointer: int* lookup-c-type void* lookup-c-type = ] unit-test
-[ f ] [ pointer: foo lookup-c-type void* lookup-c-type = ] unit-test
-[ t ] [ pointer: foo* lookup-c-type void* lookup-c-type = ] unit-test
+{ t } [ pointer: void lookup-c-type void* lookup-c-type = ] unit-test
+{ t } [ pointer: int lookup-c-type void* lookup-c-type = ] unit-test
+{ t } [ pointer: int* lookup-c-type void* lookup-c-type = ] unit-test
+{ f } [ pointer: foo lookup-c-type void* lookup-c-type = ] unit-test
+{ t } [ pointer: foo* lookup-c-type void* lookup-c-type = ] unit-test
-[ t ] [ c-string lookup-c-type c-string lookup-c-type = ] unit-test
+{ t } [ c-string lookup-c-type c-string lookup-c-type = ] unit-test
-[ t ] [ foo heap-size int heap-size = ] unit-test
+{ t } [ foo heap-size int heap-size = ] unit-test
TYPEDEF: int MyInt
-[ t ] [ int lookup-c-type MyInt lookup-c-type = ] unit-test
-[ t ] [ void* lookup-c-type pointer: MyInt lookup-c-type = ] unit-test
+{ t } [ int lookup-c-type MyInt lookup-c-type = ] unit-test
+{ t } [ void* lookup-c-type pointer: MyInt lookup-c-type = ] unit-test
-[ 32 ] [ { int 8 } heap-size ] unit-test
+{ 32 } [ { int 8 } heap-size ] unit-test
-[ ] [ pointer: { int 8 } heap-size pointer: void heap-size assert= ] unit-test
+{ } [ pointer: { int 8 } heap-size pointer: void heap-size assert= ] unit-test
TYPEDEF: char MyChar
-[ t ] [ pointer: void lookup-c-type pointer: MyChar lookup-c-type = ] unit-test
+{ t } [ pointer: void lookup-c-type pointer: MyChar lookup-c-type = ] unit-test
TYPEDEF: { c-string ascii } MyFunkyString
-[ { c-string ascii } ] [ MyFunkyString lookup-c-type ] unit-test
+{ { c-string ascii } } [ MyFunkyString lookup-c-type ] unit-test
TYPEDEF: c-string MyString
-[ t ] [ c-string lookup-c-type MyString lookup-c-type = ] unit-test
-[ t ] [ void* lookup-c-type pointer: MyString lookup-c-type = ] unit-test
+{ t } [ c-string lookup-c-type MyString lookup-c-type = ] unit-test
+{ t } [ void* lookup-c-type pointer: MyString lookup-c-type = ] unit-test
TYPEDEF: int* MyIntArray
-[ t ] [ void* lookup-c-type MyIntArray lookup-c-type = ] unit-test
+{ t } [ void* lookup-c-type MyIntArray lookup-c-type = ] unit-test
-[ 0 ] [ -10 uchar c-type-clamp ] unit-test
-[ 12 ] [ 12 uchar c-type-clamp ] unit-test
-[ -10 ] [ -10 char c-type-clamp ] unit-test
-[ 127 ] [ 230 char c-type-clamp ] unit-test
-[ t ] [ pi dup float c-type-clamp = ] unit-test
+{ 0 } [ -10 uchar c-type-clamp ] unit-test
+{ 12 } [ 12 uchar c-type-clamp ] unit-test
+{ -10 } [ -10 char c-type-clamp ] unit-test
+{ 127 } [ 230 char c-type-clamp ] unit-test
+{ t } [ pi dup float c-type-clamp = ] unit-test
C-TYPE: opaque
-[ t ] [ void* lookup-c-type pointer: opaque lookup-c-type = ] unit-test
+{ t } [ void* lookup-c-type pointer: opaque lookup-c-type = ] unit-test
[ opaque lookup-c-type ] [ no-c-type? ] must-fail-with
[ """
STRUCT: backward { x forward* } ;
STRUCT: forward { x backward* } ;
-[ t ] [ forward lookup-c-type struct-c-type? ] unit-test
-[ t ] [ backward lookup-c-type struct-c-type? ] unit-test
+{ t } [ forward lookup-c-type struct-c-type? ] unit-test
+{ t } [ backward lookup-c-type struct-c-type? ] unit-test
DEFER: struct-redefined
-[ f ]
+{ f }
[
"""
: <complex-holder> ( z -- alien )
complex-holder <struct-boa> ;
-[ ] [
+{ } [
C{ 1.0 2.0 } <complex-holder> "h" set
] unit-test
-[ C{ 1.0 2.0 } ] [ "h" get z>> ] unit-test
+{ C{ 1.0 2.0 } } [ "h" get z>> ] unit-test
-[ complex ] [ complex-float c-type-boxed-class ] unit-test
+{ complex } [ complex-float c-type-boxed-class ] unit-test
-[ complex ] [ complex-double c-type-boxed-class ] unit-test
+{ complex } [ complex-double c-type-boxed-class ] unit-test
QUALIFIED-WITH: alien.c-types c
IN: alien.data.tests
-[ -1 ] [ -1 c:char <ref> c:char deref ] unit-test
-[ -1 ] [ -1 c:short <ref> c:short deref ] unit-test
-[ -1 ] [ -1 c:int <ref> c:int deref ] unit-test
+{ -1 } [ -1 c:char <ref> c:char deref ] unit-test
+{ -1 } [ -1 c:short <ref> c:short deref ] unit-test
+{ -1 } [ -1 c:int <ref> c:int deref ] unit-test
! I don't care if this throws an error or works, but at least
! it should be consistent between platforms
-[ -1 ] [ -1.0 c:int <ref> c:int deref ] unit-test
-[ -1 ] [ -1.0 c:long <ref> c:long deref ] unit-test
-[ -1 ] [ -1.0 c:longlong <ref> c:longlong deref ] unit-test
-[ 1 ] [ 1.0 c:uint <ref> c:uint deref ] unit-test
-[ 1 ] [ 1.0 c:ulong <ref> c:ulong deref ] unit-test
-[ 1 ] [ 1.0 c:ulonglong <ref> c:ulonglong deref ] unit-test
+{ -1 } [ -1.0 c:int <ref> c:int deref ] unit-test
+{ -1 } [ -1.0 c:long <ref> c:long deref ] unit-test
+{ -1 } [ -1.0 c:longlong <ref> c:longlong deref ] unit-test
+{ 1 } [ 1.0 c:uint <ref> c:uint deref ] unit-test
+{ 1 } [ 1.0 c:ulong <ref> c:ulong deref ] unit-test
+{ 1 } [ 1.0 c:ulonglong <ref> c:ulonglong deref ] unit-test
[
0 B{ 1 2 3 4 } <displaced-alien> c:void* <ref>
SPECIALIZED-ARRAY: foo
-[ t ] [ 0 binary-zero? ] unit-test
-[ f ] [ 1 binary-zero? ] unit-test
-[ f ] [ -1 binary-zero? ] unit-test
-[ t ] [ 0.0 binary-zero? ] unit-test
-[ f ] [ 1.0 binary-zero? ] unit-test
-[ f ] [ -0.0 binary-zero? ] unit-test
-[ t ] [ C{ 0.0 0.0 } binary-zero? ] unit-test
-[ f ] [ C{ 1.0 0.0 } binary-zero? ] unit-test
-[ f ] [ C{ -0.0 0.0 } binary-zero? ] unit-test
-[ f ] [ C{ 0.0 1.0 } binary-zero? ] unit-test
-[ f ] [ C{ 0.0 -0.0 } binary-zero? ] unit-test
-[ t ] [ f binary-zero? ] unit-test
-[ t ] [ 0 <alien> binary-zero? ] unit-test
-[ f ] [ 1 <alien> binary-zero? ] unit-test
-[ f ] [ B{ } binary-zero? ] unit-test
-[ t ] [ S{ foo f 0 f f } binary-zero? ] unit-test
-[ f ] [ S{ foo f 1 f f } binary-zero? ] unit-test
-[ f ] [ S{ foo f 0 ALIEN: 8 f } binary-zero? ] unit-test
-[ f ] [ S{ foo f 0 f t } binary-zero? ] unit-test
-[ t t f ] [
+{ t } [ 0 binary-zero? ] unit-test
+{ f } [ 1 binary-zero? ] unit-test
+{ f } [ -1 binary-zero? ] unit-test
+{ t } [ 0.0 binary-zero? ] unit-test
+{ f } [ 1.0 binary-zero? ] unit-test
+{ f } [ -0.0 binary-zero? ] unit-test
+{ t } [ C{ 0.0 0.0 } binary-zero? ] unit-test
+{ f } [ C{ 1.0 0.0 } binary-zero? ] unit-test
+{ f } [ C{ -0.0 0.0 } binary-zero? ] unit-test
+{ f } [ C{ 0.0 1.0 } binary-zero? ] unit-test
+{ f } [ C{ 0.0 -0.0 } binary-zero? ] unit-test
+{ t } [ f binary-zero? ] unit-test
+{ t } [ 0 <alien> binary-zero? ] unit-test
+{ f } [ 1 <alien> binary-zero? ] unit-test
+{ f } [ B{ } binary-zero? ] unit-test
+{ t } [ S{ foo f 0 f f } binary-zero? ] unit-test
+{ f } [ S{ foo f 1 f f } binary-zero? ] unit-test
+{ f } [ S{ foo f 0 ALIEN: 8 f } binary-zero? ] unit-test
+{ f } [ S{ foo f 0 f t } binary-zero? ] unit-test
+{ t t f } [
foo-array{
S{ foo f 0 f f }
S{ foo f 0 f f }
} [ first binary-zero? ] [ second binary-zero? ] [ third binary-zero? ] tri
] unit-test
-[ ] [
+{ } [
[
foo specialized-array-vocab forget-vocab
] with-compilation-unit
: endian-test-struct-f0 ( -- obj )
endian-bytes-f0 endian-struct memory>struct ;
-[ 0xff00 ] [ endian-test-struct-0f a>> ] unit-test
-[ -256 ] [ endian-test-struct-0f b>> ] unit-test
-[ 0x00ff ] [ endian-test-struct-0f c>> ] unit-test
-[ 0x00ff ] [ endian-test-struct-0f d>> ] unit-test
-
-[ 0xff000000 ] [ endian-test-struct-0f e>> ] unit-test
-[ -16777216 ] [ endian-test-struct-0f f>> ] unit-test
-[ 0x000000ff ] [ endian-test-struct-0f g>> ] unit-test
-[ 0x000000ff ] [ endian-test-struct-0f h>> ] unit-test
-
-[ 0xff00000000000000 ] [ endian-test-struct-0f i>> ] unit-test
-[ -72057594037927936 ] [ endian-test-struct-0f j>> ] unit-test
-[ 0x00000000000000ff ] [ endian-test-struct-0f k>> ] unit-test
-[ 0x00000000000000ff ] [ endian-test-struct-0f l>> ] unit-test
-
-
-[ 0xff00 ] [ endian-test-struct-f0 c>> ] unit-test
-[ -256 ] [ endian-test-struct-f0 d>> ] unit-test
-[ 0x00ff ] [ endian-test-struct-f0 a>> ] unit-test
-[ 0x00ff ] [ endian-test-struct-f0 b>> ] unit-test
-
-[ 0xff000000 ] [ endian-test-struct-f0 g>> ] unit-test
-[ -16777216 ] [ endian-test-struct-f0 h>> ] unit-test
-[ 0x000000ff ] [ endian-test-struct-f0 e>> ] unit-test
-[ 0x000000ff ] [ endian-test-struct-f0 f>> ] unit-test
-
-[ 0xff00000000000000 ] [ endian-test-struct-f0 k>> ] unit-test
-[ -72057594037927936 ] [ endian-test-struct-f0 l>> ] unit-test
-[ 0x00000000000000ff ] [ endian-test-struct-f0 i>> ] unit-test
-[ 0x00000000000000ff ] [ endian-test-struct-f0 j>> ] unit-test
-
-[ t ]
+{ 0xff00 } [ endian-test-struct-0f a>> ] unit-test
+{ -256 } [ endian-test-struct-0f b>> ] unit-test
+{ 0x00ff } [ endian-test-struct-0f c>> ] unit-test
+{ 0x00ff } [ endian-test-struct-0f d>> ] unit-test
+
+{ 0xff000000 } [ endian-test-struct-0f e>> ] unit-test
+{ -16777216 } [ endian-test-struct-0f f>> ] unit-test
+{ 0x000000ff } [ endian-test-struct-0f g>> ] unit-test
+{ 0x000000ff } [ endian-test-struct-0f h>> ] unit-test
+
+{ 0xff00000000000000 } [ endian-test-struct-0f i>> ] unit-test
+{ -72057594037927936 } [ endian-test-struct-0f j>> ] unit-test
+{ 0x00000000000000ff } [ endian-test-struct-0f k>> ] unit-test
+{ 0x00000000000000ff } [ endian-test-struct-0f l>> ] unit-test
+
+
+{ 0xff00 } [ endian-test-struct-f0 c>> ] unit-test
+{ -256 } [ endian-test-struct-f0 d>> ] unit-test
+{ 0x00ff } [ endian-test-struct-f0 a>> ] unit-test
+{ 0x00ff } [ endian-test-struct-f0 b>> ] unit-test
+
+{ 0xff000000 } [ endian-test-struct-f0 g>> ] unit-test
+{ -16777216 } [ endian-test-struct-f0 h>> ] unit-test
+{ 0x000000ff } [ endian-test-struct-f0 e>> ] unit-test
+{ 0x000000ff } [ endian-test-struct-f0 f>> ] unit-test
+
+{ 0xff00000000000000 } [ endian-test-struct-f0 k>> ] unit-test
+{ -72057594037927936 } [ endian-test-struct-f0 l>> ] unit-test
+{ 0x00000000000000ff } [ endian-test-struct-f0 i>> ] unit-test
+{ 0x00000000000000ff } [ endian-test-struct-f0 j>> ] unit-test
+
+{ t }
[ endian-test-struct-0f binary [ write ] with-byte-writer endian-bytes-0f = ] unit-test
-[ t ]
+{ t }
[ endian-test-struct-f0 binary [ write ] with-byte-writer endian-bytes-f0 = ] unit-test
LE-STRUCT: le-endian-struct
{ k ube64 }
{ l be64 } ;
-[ t ]
+{ t }
[
endian-bytes-0f le-endian-struct memory>struct
binary [ write ] with-byte-writer endian-bytes-0f =
] unit-test
-[ t ]
+{ t }
[
endian-bytes-f0 le-endian-struct memory>struct
binary [ write ] with-byte-writer endian-bytes-f0 =
{ k ube64 }
{ l be64 } ;
-[ t ]
+{ t }
[
endian-bytes-0f be-endian-struct memory>struct
binary [ write ] with-byte-writer endian-bytes-0f =
] unit-test
-[ t ]
+{ t }
[
endian-bytes-f0 be-endian-struct memory>struct
binary [ write ] with-byte-writer endian-bytes-f0 =
{ k ube64 }
{ l be64 } ;
-[ t ]
+{ t }
[
endian-bytes-0f le-override-struct memory>struct
binary [ write ] with-byte-writer endian-bytes-0f =
] unit-test
-[ t ]
+{ t }
[
endian-bytes-f0 le-override-struct memory>struct
binary [ write ] with-byte-writer endian-bytes-f0 =
{ k ulonglong }
{ l longlong } ;
-[ t ]
+{ t }
[
endian-bytes-0f be-override-struct memory>struct
binary [ write ] with-byte-writer endian-bytes-0f =
] unit-test
-[ t ]
+{ t }
[
endian-bytes-f0 be-override-struct memory>struct
binary [ write ] with-byte-writer endian-bytes-f0 =
{ a char[7] }
{ b int } ;
-[ t ]
+{ t }
[
B{ 0 0 0 0 0 0 0 3 0 0 0 } [
le-packed-struct memory>struct
] keep =
] unit-test
-[ 3 ]
+{ 3 }
[
B{ 0 0 0 0 0 0 0 3 0 0 0 } le-packed-struct memory>struct
b>>
{ a char[7] }
{ b int } ;
-[ t ]
+{ t }
[
B{ 0 0 0 0 0 0 0 0 0 0 3 } [
be-packed-struct memory>struct
] keep =
] unit-test
-[ 3 ]
+{ 3 }
[
B{ 0 0 0 0 0 0 0 0 0 0 3 } be-packed-struct memory>struct
b>>
ENUM: colores { rojo red } { verde green } { azul blue } { colorado rojo } ;
-[ { 0 3 4 0 } ] [ { rojo verde azul colorado } [ enum>number ] map ] unit-test
+{ { 0 3 4 0 } } [ { rojo verde azul colorado } [ enum>number ] map ] unit-test
SYMBOLS: couleurs rouge vert bleu jaune azure ;
{ azure bleu }
} define-enum >>
-[ { 0 3 4 14 4 } ] [ { rouge vert bleu jaune azure } [ enum>number ] map ] unit-test
+{ { 0 3 4 14 4 } } [ { rouge vert bleu jaune azure } [ enum>number ] map ] unit-test
USING: alien alien.libraries alien.syntax tools.test kernel ;
IN: alien.libraries.tests
-[ f ] [ DLL" fadfasdfsada" dll-valid? ] unit-test
+{ f } [ DLL" fadfasdfsada" dll-valid? ] unit-test
-[ f ] [ "does not exist" DLL" fadsfasfdsaf" dlsym ] unit-test
+{ f } [ "does not exist" DLL" fadsfasfdsaf" dlsym ] unit-test
-[ ] [ "doesnotexist" dlopen dlclose ] unit-test
+{ } [ "doesnotexist" dlopen dlclose ] unit-test
[ "fdasfsf" dll-valid? drop ] must-fail
-[ t ] [
+{ t } [
"test-library" "blah" cdecl add-library
"test-library" "BLAH" cdecl add-library?
"blah" remove-library
] unit-test
-[ t ] [
+{ t } [
"test-library" "blah" cdecl add-library
"test-library" "blah" stdcall add-library?
"blah" remove-library
] unit-test
-[ f ] [
+{ f } [
"test-library" "blah" cdecl add-library
"test-library" "blah" cdecl add-library?
"blah" remove-library
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
USING: ascii tools.test sequences kernel math strings ;
IN: ascii.tests
-[ t ] [ CHAR: a letter? ] unit-test
-[ f ] [ CHAR: A letter? ] unit-test
-[ f ] [ CHAR: a LETTER? ] unit-test
-[ t ] [ CHAR: A LETTER? ] unit-test
-[ t ] [ CHAR: 0 digit? ] unit-test
-[ f ] [ CHAR: x digit? ] unit-test
+{ t } [ CHAR: a letter? ] unit-test
+{ f } [ CHAR: A letter? ] unit-test
+{ f } [ CHAR: a LETTER? ] unit-test
+{ t } [ CHAR: A LETTER? ] unit-test
+{ t } [ CHAR: 0 digit? ] unit-test
+{ f } [ CHAR: x digit? ] unit-test
-[ 4 ] [
+{ 4 } [
0 "There are Four Upper Case characters"
[ LETTER? [ 1 + ] when ] each
] unit-test
-[ t f ] [ CHAR: \s ascii? 400 ascii? ] unit-test
+{ t f } [ CHAR: \s ascii? 400 ascii? ] unit-test
-[ "HELLO HOW ARE YOU?" ] [ "hellO hOw arE YOU?" >upper ] unit-test
-[ "i'm good thx bai" ] [ "I'm Good THX bai" >lower ] unit-test
+{ "HELLO HOW ARE YOU?" } [ "hellO hOw arE YOU?" >upper ] unit-test
+{ "i'm good thx bai" } [ "I'm Good THX bai" >lower ] unit-test
-[ "Hello How Are You?" ] [ "hEllo how ARE yOU?" >title ] unit-test
-[ { " " "Hello" " " " " " " "World" } ] [ " Hello World" >words [ >string ] map ] unit-test
+{ "Hello How Are You?" } [ "hEllo how ARE yOU?" >title ] unit-test
+{ { " " "Hello" " " " " " " "World" } } [ " Hello World" >words [ >string ] map ] unit-test
io.encodings.string io.encodings.ascii ;
IN: base64.tests
-[ "abcdefghijklmnopqrstuvwxyz" ] [ "abcdefghijklmnopqrstuvwxyz" ascii encode >base64 base64> ascii decode
+{ "abcdefghijklmnopqrstuvwxyz" } [ "abcdefghijklmnopqrstuvwxyz" ascii encode >base64 base64> ascii decode
] unit-test
-[ "" ] [ "" ascii encode >base64 base64> ascii decode ] unit-test
-[ "a" ] [ "a" ascii encode >base64 base64> ascii decode ] unit-test
-[ "ab" ] [ "ab" ascii encode >base64 base64> ascii decode ] unit-test
-[ "abc" ] [ "abc" ascii encode >base64 base64> ascii decode ] unit-test
-[ "abcde" ] [ "abcde" ascii encode >base64 3 cut "\r\n" swap 3append base64> ascii decode ] unit-test
+{ "" } [ "" ascii encode >base64 base64> ascii decode ] unit-test
+{ "a" } [ "a" ascii encode >base64 base64> ascii decode ] unit-test
+{ "ab" } [ "ab" ascii encode >base64 base64> ascii decode ] unit-test
+{ "abc" } [ "abc" ascii encode >base64 base64> ascii decode ] unit-test
+{ "abcde" } [ "abcde" ascii encode >base64 3 cut "\r\n" swap 3append base64> ascii decode ] unit-test
! From http://en.wikipedia.org/wiki/Base64
-[ "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=" ]
+{ "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=" }
[
"Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure."
ascii encode >base64 >string
] unit-test
-[ "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz\r\nIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg\r\ndGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu\r\ndWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo\r\nZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=" ]
+{ "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz\r\nIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg\r\ndGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu\r\ndWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo\r\nZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=" }
[
"Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure."
ascii encode >base64-lines >string
<bihash> "h" set
-[ 0 ] [ "h" get assoc-size ] unit-test
+{ 0 } [ "h" get assoc-size ] unit-test
-[ ] [ 1 2 "h" get set-at ] unit-test
+{ } [ 1 2 "h" get set-at ] unit-test
-[ 1 ] [ 2 "h" get at ] unit-test
+{ 1 } [ 2 "h" get at ] unit-test
-[ 2 ] [ 1 "h" get value-at ] unit-test
+{ 2 } [ 1 "h" get value-at ] unit-test
-[ 1 ] [ "h" get assoc-size ] unit-test
+{ 1 } [ "h" get assoc-size ] unit-test
-[ ] [ 1 3 "h" get set-at ] unit-test
+{ } [ 1 3 "h" get set-at ] unit-test
-[ 1 ] [ 3 "h" get at ] unit-test
+{ 1 } [ 3 "h" get at ] unit-test
-[ 2 ] [ 1 "h" get value-at ] unit-test
+{ 2 } [ 1 "h" get value-at ] unit-test
-[ 2 ] [ "h" get assoc-size ] unit-test
+{ 2 } [ "h" get assoc-size ] unit-test
H{ { "a" "A" } { "b" "B" } } "a" set
-[ ] [ "a" get >biassoc "b" set ] unit-test
+{ } [ "a" get >biassoc "b" set ] unit-test
-[ t ] [ "b" get biassoc? ] unit-test
+{ t } [ "b" get biassoc? ] unit-test
-[ "A" ] [ "a" "b" get at ] unit-test
+{ "A" } [ "a" "b" get at ] unit-test
-[ "a" ] [ "A" "b" get value-at ] unit-test
+{ "a" } [ "A" "b" get value-at ] unit-test
-[ ] [ H{ { 1 2 } } >biassoc "h" set ] unit-test
+{ } [ H{ { 1 2 } } >biassoc "h" set ] unit-test
-[ ] [ "h" get clone "g" set ] unit-test
+{ } [ "h" get clone "g" set ] unit-test
-[ ] [ 3 4 "g" get set-at ] unit-test
+{ } [ 3 4 "g" get set-at ] unit-test
-[ H{ { 1 2 } } ] [ "h" get >hashtable ] unit-test
+{ H{ { 1 2 } } } [ "h" get >hashtable ] unit-test
-[ H{ { 1 2 } { 4 3 } } ] [ "g" get >hashtable ] unit-test
+{ H{ { 1 2 } { 4 3 } } } [ "g" get >hashtable ] unit-test
USING: binary-search math.order sequences kernel tools.test ;
IN: binary-search.tests
-[ f ] [ 3 { } [ <=> ] with search drop ] unit-test
-[ 0 ] [ 3 { 3 } [ <=> ] with search drop ] unit-test
-[ 1 ] [ 2 { 1 2 3 } [ <=> ] with search drop ] unit-test
-[ 3 ] [ 4 { 1 2 3 4 5 6 } [ <=> ] with search drop ] unit-test
-[ 2 ] [ 3.5 { 1 2 3 4 5 6 7 8 } [ <=> ] with search drop ] unit-test
-[ 4 ] [ 5.5 { 1 2 3 4 5 6 7 8 } [ <=> ] with search drop ] unit-test
-[ 10 ] [ 10 20 iota [ <=> ] with search drop ] unit-test
+{ f } [ 3 { } [ <=> ] with search drop ] unit-test
+{ 0 } [ 3 { 3 } [ <=> ] with search drop ] unit-test
+{ 1 } [ 2 { 1 2 3 } [ <=> ] with search drop ] unit-test
+{ 3 } [ 4 { 1 2 3 4 5 6 } [ <=> ] with search drop ] unit-test
+{ 2 } [ 3.5 { 1 2 3 4 5 6 7 8 } [ <=> ] with search drop ] unit-test
+{ 4 } [ 5.5 { 1 2 3 4 5 6 7 8 } [ <=> ] with search drop ] unit-test
+{ 10 } [ 10 20 iota [ <=> ] with search drop ] unit-test
-[ 0 ] [ "alligator" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-index ] unit-test
-[ 3 ] [ "hey" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-index ] unit-test
-[ 5 ] [ "java" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-index ] unit-test
-[ t ] [ "hello" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-member? ] unit-test
-[ f ] [ "hello" { "alligator" "cat" "fish" "ikarus" "java" } sorted-member? ] unit-test
-[ f ] [ "zebra" { "alligator" "cat" "fish" "ikarus" "java" } sorted-member? ] unit-test
+{ 0 } [ "alligator" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-index ] unit-test
+{ 3 } [ "hey" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-index ] unit-test
+{ 5 } [ "java" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-index ] unit-test
+{ t } [ "hello" { "alligator" "cat" "fish" "hello" "ikarus" "java" } sorted-member? ] unit-test
+{ f } [ "hello" { "alligator" "cat" "fish" "ikarus" "java" } sorted-member? ] unit-test
+{ f } [ "zebra" { "alligator" "cat" "fish" "ikarus" "java" } sorted-member? ] unit-test
[ -1 <bit-array> ] [ T{ bad-array-length f -1 } = ] must-fail-with
-[ 100 ] [ 100 <bit-array> length ] unit-test
+{ 100 } [ 100 <bit-array> length ] unit-test
-[
+{
{ t f t }
-] [
+} [
3 <bit-array> t 0 pick set-nth t 2 pick set-nth
>array
] unit-test
-[
+{
{ t f t }
-] [
+} [
{ t f t } >bit-array >array
] unit-test
-[
+{
{ t f t } { f t f }
-] [
+} [
{ t f t } >bit-array dup clone [ not ] map!
[ >array ] bi@
] unit-test
-[
+{
{ f f f f f }
-] [
+} [
{ t f t t f } >bit-array dup clear-bits >array
] unit-test
-[
+{
{ t t t t t }
-] [
+} [
{ t f t t f } >bit-array dup set-bits >array
] unit-test
-[ t ] [
+{ t } [
100 [
drop 100 [ 2 random zero? ] replicate
dup >bit-array >array =
] all-integers?
] unit-test
-[ ?{ f } ] [
+{ ?{ f } } [
1 2 { t f t f } <slice> >bit-array
] unit-test
-[ ?{ f t } ] [ 0 2 ?{ f t f } subseq ] unit-test
+{ ?{ f t } } [ 0 2 ?{ f t f } subseq ] unit-test
-[ ?{ t f t f f f } ] [ 6 ?{ t f t } resize ] unit-test
+{ ?{ t f t f f f } } [ 6 ?{ t f t } resize ] unit-test
-[ ?{ t t } ] [ 2 ?{ t t f t f t f t t t f t } resize ] unit-test
+{ ?{ t t } } [ 2 ?{ t t f t f t f t t t f t } resize ] unit-test
[ -10 ?{ } resize ] must-fail
[ -1 integer>bit-array ] must-fail
-[ ?{ } ] [ 0 integer>bit-array ] unit-test
-[ ?{ f t } ] [ 2 integer>bit-array ] unit-test
-[ ?{ t t t t t t t t t } ] [ 511 integer>bit-array ] unit-test
-[ ?{
+{ ?{ } } [ 0 integer>bit-array ] unit-test
+{ ?{ f t } } [ 2 integer>bit-array ] unit-test
+{ ?{ t t t t t t t t t } } [ 511 integer>bit-array ] unit-test
+{ ?{
t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
-} ] [
+} } [
0xffffffffffffffffffffffffffffffff integer>bit-array
] unit-test
-[ 14 ] [ ?{ f t t t } bit-array>integer ] unit-test
-[ 0 ] [ ?{ } bit-array>integer ] unit-test
-[ 0xffffffffffffffffffffffffffffffff ] [ ?{
+{ 14 } [ ?{ f t t t } bit-array>integer ] unit-test
+{ 0 } [ ?{ } bit-array>integer ] unit-test
+{ 0xffffffffffffffffffffffffffffffff } [ ?{
t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
} bit-array>integer ] unit-test
-[ 49 ] [ 49 <bit-array> dup set-bits [ ] count ] unit-test
+{ 49 } [ 49 <bit-array> dup set-bits [ ] count ] unit-test
-[ 1 ] [ ?{ f t f t } byte-length ] unit-test
+{ 1 } [ ?{ f t f t } byte-length ] unit-test
-[ 0xa ] [ ?{ f t f t } bit-array>integer ] unit-test
+{ 0xa } [ ?{ f t f t } bit-array>integer ] unit-test
-[ 0x100 ] [ ?{ f f f f f f f f t } bit-array>integer ] unit-test
+{ 0x100 } [ ?{ f f f f f f f f t } bit-array>integer ] unit-test
USING: bit-sets tools.test sets kernel bit-arrays ;
IN: bit-sets.tests
-[ T{ bit-set f ?{ t f t f t f } } ] [
+{ T{ bit-set f ?{ t f t f t f } } } [
T{ bit-set f ?{ t f f f t f } }
T{ bit-set f ?{ f f t f t f } } union
] unit-test
-[ T{ bit-set f ?{ f f f f t f } } ] [
+{ T{ bit-set f ?{ f f f f t f } } } [
T{ bit-set f ?{ t f f f t f } }
T{ bit-set f ?{ f f t f t f } } intersect
] unit-test
-[ f ] [ T{ bit-set f ?{ t f f f t f } } null? ] unit-test
-[ t ] [ T{ bit-set f ?{ f f f f f f } } null? ] unit-test
+{ f } [ T{ bit-set f ?{ t f f f t f } } null? ] unit-test
+{ t } [ T{ bit-set f ?{ f f f f f f } } null? ] unit-test
-[ T{ bit-set f ?{ t f t f f f } } ] [
+{ T{ bit-set f ?{ t f t f f f } } } [
T{ bit-set f ?{ t t t f f f } }
T{ bit-set f ?{ f t f f t t } } diff
] unit-test
-[ f ] [
+{ f } [
T{ bit-set f ?{ t t t f f f } }
T{ bit-set f ?{ f t f f t t } } subset?
] unit-test
-[ t ] [
+{ t } [
T{ bit-set f ?{ t t t f f f } }
T{ bit-set f ?{ f t f f f f } } subset?
] unit-test
-[ t ] [
+{ t } [
{ 0 1 2 }
T{ bit-set f ?{ f t f f f f } } subset?
] unit-test
-[ f ] [
+{ f } [
T{ bit-set f ?{ f t f f f f } }
T{ bit-set f ?{ t t t f f f } } subset?
] unit-test
-[ f ] [
+{ f } [
{ 1 }
T{ bit-set f ?{ t t t f f f } } subset?
] unit-test
-[ V{ 0 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } members ] unit-test
+{ V{ 0 2 5 } } [ T{ bit-set f ?{ t f t f f t } } members ] unit-test
-[ t V{ 1 2 3 } ] [
+{ t V{ 1 2 3 } } [
{ 1 2 } 5 <bit-set> set-like
[ bit-set? ] keep
3 over adjoin
members
] unit-test
-[ V{ 0 1 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ 1 swap adjoin ] keep members ] unit-test
+{ V{ 0 1 2 5 } } [ T{ bit-set f ?{ t f t f f t } } clone [ 1 swap adjoin ] keep members ] unit-test
[ T{ bit-set f ?{ t f t f f t } } clone [ 9 swap adjoin ] keep members ] must-fail
[ T{ bit-set f ?{ t f t f f t } } clone [ "foo" swap adjoin ] keep members ] must-fail
-[ V{ 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ 0 swap delete ] keep members ] unit-test
-[ V{ 0 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ 1 swap delete ] keep members ] unit-test
-[ V{ 0 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ 9 swap delete ] keep members ] unit-test
-[ V{ 0 2 5 } ] [ T{ bit-set f ?{ t f t f f t } } clone [ "foo" swap delete ] keep members ] unit-test
+{ V{ 2 5 } } [ T{ bit-set f ?{ t f t f f t } } clone [ 0 swap delete ] keep members ] unit-test
+{ V{ 0 2 5 } } [ T{ bit-set f ?{ t f t f f t } } clone [ 1 swap delete ] keep members ] unit-test
+{ V{ 0 2 5 } } [ T{ bit-set f ?{ t f t f f t } } clone [ 9 swap delete ] keep members ] unit-test
+{ V{ 0 2 5 } } [ T{ bit-set f ?{ t f t f f t } } clone [ "foo" swap delete ] keep members ] unit-test
-[ T{ bit-set f ?{ f } } T{ bit-set f ?{ t } } ]
+{ T{ bit-set f ?{ f } } T{ bit-set f ?{ t } } }
[ 1 <bit-set> dup clone 0 over adjoin ] unit-test
-[ 0 ] [ T{ bit-set f ?{ } } cardinality ] unit-test
-[ 0 ] [ T{ bit-set f ?{ f f f f } } cardinality ] unit-test
-[ 1 ] [ T{ bit-set f ?{ f t f f } } cardinality ] unit-test
-[ 2 ] [ T{ bit-set f ?{ f t f t } } cardinality ] unit-test
+{ 0 } [ T{ bit-set f ?{ } } cardinality ] unit-test
+{ 0 } [ T{ bit-set f ?{ f f f f } } cardinality ] unit-test
+{ 1 } [ T{ bit-set f ?{ f t f f } } cardinality ] unit-test
+{ 2 } [ T{ bit-set f ?{ f t f t } } cardinality ] unit-test
USING: tools.test bit-vectors vectors sequences kernel math ;
IN: bit-vectors.tests
-[ 0 ] [ 123 <bit-vector> length ] unit-test
+{ 0 } [ 123 <bit-vector> length ] unit-test
: do-it ( seq -- )
1234 swap [ [ even? ] dip push ] curry each-integer ;
-[ t ] [
+{ t } [
3 <bit-vector> dup do-it
3 <vector> dup do-it sequence=
] unit-test
-[ t ] [ ?V{ } bit-vector? ] unit-test
+{ t } [ ?V{ } bit-vector? ] unit-test
io.streams.byte-array ;
IN: bitstreams.tests
-[ 0b1111111111 ]
+{ 0b1111111111 }
[
B{ 0x0f 0xff 0xff 0xff } <msb0-bit-reader>
2 >>byte-pos 6 >>bit-pos
10 swap peek
] unit-test
-[ 0b111111111 ]
+{ 0b111111111 }
[
B{ 0x0f 0xff 0xff 0xff } <msb0-bit-reader>
2 >>byte-pos 6 >>bit-pos
9 swap peek
] unit-test
-[ 0b11111111 ]
+{ 0b11111111 }
[
B{ 0x0f 0xff 0xff 0xff } <msb0-bit-reader>
2 >>byte-pos 6 >>bit-pos
8 swap peek
] unit-test
-[ 0b1111111 ]
+{ 0b1111111 }
[
B{ 0x0f 0xff 0xff 0xff } <msb0-bit-reader>
2 >>byte-pos 6 >>bit-pos
7 swap peek
] unit-test
-[ 0b111111 ]
+{ 0b111111 }
[
B{ 0x0f 0xff 0xff 0xff } <msb0-bit-reader>
2 >>byte-pos 6 >>bit-pos
6 swap peek
] unit-test
-[ 0b11111 ]
+{ 0b11111 }
[
B{ 0x0f 0xff 0xff 0xff } <msb0-bit-reader>
2 >>byte-pos 6 >>bit-pos
[ B{ } <msb0-bit-reader> 1 swap peek ] must-fail
[ B{ } <msb0-bit-reader> 8 swap peek ] must-fail
-[ 0 ] [ B{ } <msb0-bit-reader> 0 swap peek ] unit-test
+{ 0 } [ B{ } <msb0-bit-reader> 0 swap peek ] 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: boxes namespaces tools.test accessors ;
IN: boxes.tests
-[ ] [ <box> "b" set ] unit-test
+{ } [ <box> "b" set ] unit-test
-[ ] [ 3 "b" get >box ] unit-test
+{ } [ 3 "b" get >box ] unit-test
-[ t ] [ "b" get occupied>> ] unit-test
+{ t } [ "b" get occupied>> ] unit-test
[ 4 "b" >box ] must-fail
-[ 3 ] [ "b" get box> ] unit-test
+{ 3 } [ "b" get box> ] unit-test
-[ f ] [ "b" get occupied>> ] unit-test
+{ f } [ "b" get occupied>> ] unit-test
[ "b" get box> ] must-fail
-[ f f ] [ "b" get ?box ] unit-test
+{ f f } [ "b" get ?box ] unit-test
-[ ] [ 12 "b" get >box ] unit-test
+{ } [ 12 "b" get >box ] unit-test
-[ 12 t ] [ "b" get ?box ] unit-test
+{ 12 t } [ "b" get ?box ] unit-test
-[ f ] [ "b" get occupied>> ] unit-test
+{ f } [ "b" get occupied>> ] 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
M: mock-disposable dispose* drop ;
-[ ] [ <cache-assoc> "cache" set ] unit-test
+{ } [ <cache-assoc> "cache" set ] unit-test
-[ 0 ] [ "cache" get assoc-size ] unit-test
+{ 0 } [ "cache" get assoc-size ] unit-test
-[ ] [ "cache" get 2 >>max-age drop ] unit-test
+{ } [ "cache" get 2 >>max-age drop ] unit-test
-[ ] [ 1 <mock-disposable> dup "a" set 2 "cache" get set-at ] unit-test
+{ } [ 1 <mock-disposable> dup "a" set 2 "cache" get set-at ] unit-test
-[ 1 ] [ "cache" get assoc-size ] unit-test
+{ 1 } [ "cache" get assoc-size ] unit-test
-[ ] [ "cache" get purge-cache ] unit-test
+{ } [ "cache" get purge-cache ] unit-test
-[ ] [ 2 <mock-disposable> 3 "cache" get set-at ] unit-test
+{ } [ 2 <mock-disposable> 3 "cache" get set-at ] unit-test
-[ 2 ] [ "cache" get assoc-size ] unit-test
+{ 2 } [ "cache" get assoc-size ] unit-test
-[ ] [ "cache" get purge-cache ] unit-test
+{ } [ "cache" get purge-cache ] unit-test
-[ 1 ] [ "cache" get assoc-size ] unit-test
+{ 1 } [ "cache" get assoc-size ] unit-test
-[ ] [ 3 <mock-disposable> dup "b" set 4 "cache" get set-at ] unit-test
+{ } [ 3 <mock-disposable> dup "b" set 4 "cache" get set-at ] unit-test
-[ 2 ] [ "cache" get assoc-size ] unit-test
+{ 2 } [ "cache" get assoc-size ] unit-test
-[ ] [ "cache" get purge-cache ] unit-test
+{ } [ "cache" get purge-cache ] unit-test
-[ 1 ] [ "cache" get assoc-size ] unit-test
+{ 1 } [ "cache" get assoc-size ] unit-test
-[ f ] [ 2 "cache" get key? ] unit-test
+{ f } [ 2 "cache" get key? ] unit-test
-[ 3 ] [ 4 "cache" get at n>> ] unit-test
+{ 3 } [ 4 "cache" get at n>> ] unit-test
-[ t ] [ "a" get disposed>> ] unit-test
+{ t } [ "a" get disposed>> ] unit-test
-[ f ] [ "b" get disposed>> ] unit-test
+{ f } [ "b" get disposed>> ] unit-test
-[ ] [ "cache" get clear-assoc ] unit-test
+{ } [ "cache" get clear-assoc ] unit-test
-[ t ] [ "b" get disposed>> ] unit-test
+{ t } [ "b" get disposed>> ] unit-test
USING: cairo tools.test math.rectangles accessors ;
IN: cairo.tests
-[ { 10 20 } ] [
+{ { 10 20 } } [
{ 10 20 } [
{ 0 1 } { 3 4 } <rect> fill-rect
] make-bitmap-image dim>>
random ;
IN: calendar.tests
-[ f ] [ 2004 12 32 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
-[ f ] [ 2004 2 30 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
-[ f ] [ 2003 2 29 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
-[ f ] [ 2004 -2 9 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
-[ f ] [ 2004 12 0 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
-[ f ] [ 2004 12 1 24 0 0 instant <timestamp> valid-timestamp? ] unit-test
-[ f ] [ 2004 12 1 23 60 0 instant <timestamp> valid-timestamp? ] unit-test
-[ f ] [ 2004 12 1 23 59 60 instant <timestamp> valid-timestamp? ] unit-test
-[ t ] [ now valid-timestamp? ] unit-test
-
-[ f ] [ 1900 leap-year? ] unit-test
-[ t ] [ 1904 leap-year? ] unit-test
-[ t ] [ 2000 leap-year? ] unit-test
-[ f ] [ 2001 leap-year? ] unit-test
-[ f ] [ 2006 leap-year? ] unit-test
-
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> 1 seconds time+
+{ f } [ 2004 12 32 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
+{ f } [ 2004 2 30 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
+{ f } [ 2003 2 29 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
+{ f } [ 2004 -2 9 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
+{ f } [ 2004 12 0 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
+{ f } [ 2004 12 1 24 0 0 instant <timestamp> valid-timestamp? ] unit-test
+{ f } [ 2004 12 1 23 60 0 instant <timestamp> valid-timestamp? ] unit-test
+{ f } [ 2004 12 1 23 59 60 instant <timestamp> valid-timestamp? ] unit-test
+{ t } [ now valid-timestamp? ] unit-test
+
+{ f } [ 1900 leap-year? ] unit-test
+{ t } [ 1904 leap-year? ] unit-test
+{ t } [ 2000 leap-year? ] unit-test
+{ f } [ 2001 leap-year? ] unit-test
+{ f } [ 2006 leap-year? ] unit-test
+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> 1 seconds time+
2006 10 10 0 0 1 instant <timestamp> = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> 100 seconds time+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> 100 seconds time+
2006 10 10 0 1 40 instant <timestamp> = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> -100 seconds time+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> -100 seconds time+
2006 10 9 23 58 20 instant <timestamp> = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> 86400 seconds time+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> 86400 seconds time+
2006 10 11 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> 10 minutes time+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> 10 minutes time+
2006 10 10 0 10 0 instant <timestamp> = ] unit-test
-[ +eq+ ] [ 2006 10 10 0 0 0 instant <timestamp> 10.5 minutes time+
+{ +eq+ } [ 2006 10 10 0 0 0 instant <timestamp> 10.5 minutes time+
2006 10 10 0 10 30 instant <timestamp> <=> ] unit-test
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> 3/4 minutes time+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> 3/4 minutes time+
2006 10 10 0 0 45 instant <timestamp> = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> -3/4 minutes time+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> -3/4 minutes time+
2006 10 9 23 59 15 instant <timestamp> = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> 7200 minutes time+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> 7200 minutes time+
2006 10 15 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> -10 minutes time+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> -10 minutes time+
2006 10 9 23 50 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 instant <timestamp> -100 minutes time+
+{ t } [ 2006 10 10 0 0 0 instant <timestamp> -100 minutes time+
2006 10 9 22 20 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 1 hours time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 1 hours time+
2006 1 1 1 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 24 hours time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 24 hours time+
2006 1 2 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> -24 hours time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> -24 hours time+
2005 12 31 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 12 hours time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 12 hours time+
2006 1 1 12 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 72 hours time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 72 hours time+
2006 1 4 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 1 days time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 1 days time+
2006 1 2 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> -1 days time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> -1 days time+
2005 12 31 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 365 days time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 365 days time+
2007 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> -365 days time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> -365 days time+
2005 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2004 1 1 0 0 0 instant <timestamp> 365 days time+
+{ t } [ 2004 1 1 0 0 0 instant <timestamp> 365 days time+
2004 12 31 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2004 1 1 0 0 0 instant <timestamp> 366 days time+
+{ t } [ 2004 1 1 0 0 0 instant <timestamp> 366 days time+
2005 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 11 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 11 months time+
2006 12 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 12 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 12 months time+
2007 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 24 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 24 months time+
2008 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 13 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 13 months time+
2007 2 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 1 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 1 months time+
2006 2 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 0 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 0 months time+
2006 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> -1 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> -1 months time+
2005 12 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> -2 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> -2 months time+
2005 11 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> -13 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> -13 months time+
2004 12 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> -24 months time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> -24 months time+
2004 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2004 2 29 0 0 0 instant <timestamp> 12 months time+
+{ t } [ 2004 2 29 0 0 0 instant <timestamp> 12 months time+
2005 3 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2004 2 29 0 0 0 instant <timestamp> -12 months time+
+{ t } [ 2004 2 29 0 0 0 instant <timestamp> -12 months time+
2003 3 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 0 years time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 0 years time+
2006 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> 1 years time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> 1 years time+
2007 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> -1 years time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> -1 years time+
2005 1 1 0 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 instant <timestamp> -100 years time+
+{ t } [ 2006 1 1 0 0 0 instant <timestamp> -100 years time+
1906 1 1 0 0 0 instant <timestamp> = ] unit-test
! [ t ] [ 2004 2 29 0 0 0 instant <timestamp> -1 years time+
! 2003 2 28 0 0 0 instant <timestamp> = ] unit-test
-[ 5 ] [ 2006 7 14 0 0 0 instant <timestamp> day-of-week ] unit-test
+{ 5 } [ 2006 7 14 0 0 0 instant <timestamp> day-of-week ] unit-test
-[ t ] [ 2006 7 14 [ julian-day-number julian-day-number>date 0 0 0 instant <timestamp> ] 3keep 0 0 0 instant <timestamp> = ] unit-test
+{ t } [ 2006 7 14 [ julian-day-number julian-day-number>date 0 0 0 instant <timestamp> ] 3keep 0 0 0 instant <timestamp> = ] unit-test
-[ 1 ] [ 2006 1 1 0 0 0 instant <timestamp> day-of-year ] unit-test
-[ 60 ] [ 2004 2 29 0 0 0 instant <timestamp> day-of-year ] unit-test
-[ 61 ] [ 2004 3 1 0 0 0 instant <timestamp> day-of-year ] unit-test
-[ 366 ] [ 2004 12 31 0 0 0 instant <timestamp> day-of-year ] unit-test
-[ 365 ] [ 2003 12 31 0 0 0 instant <timestamp> day-of-year ] unit-test
-[ 60 ] [ 2003 3 1 0 0 0 instant <timestamp> day-of-year ] unit-test
+{ 1 } [ 2006 1 1 0 0 0 instant <timestamp> day-of-year ] unit-test
+{ 60 } [ 2004 2 29 0 0 0 instant <timestamp> day-of-year ] unit-test
+{ 61 } [ 2004 3 1 0 0 0 instant <timestamp> day-of-year ] unit-test
+{ 366 } [ 2004 12 31 0 0 0 instant <timestamp> day-of-year ] unit-test
+{ 365 } [ 2003 12 31 0 0 0 instant <timestamp> day-of-year ] unit-test
+{ 60 } [ 2003 3 1 0 0 0 instant <timestamp> day-of-year ] unit-test
-[ t ] [ 2004 12 31 0 0 0 instant <timestamp> dup = ] unit-test
-[ t ] [ 2004 1 1 0 0 0 instant <timestamp> 10 seconds 5 years time+ time+
+{ t } [ 2004 12 31 0 0 0 instant <timestamp> dup = ] unit-test
+{ t } [ 2004 1 1 0 0 0 instant <timestamp> 10 seconds 5 years time+ time+
2009 1 1 0 0 10 instant <timestamp> = ] unit-test
-[ t ] [ 2004 1 1 0 0 0 instant <timestamp> -10 seconds -5 years time+ time+
+{ t } [ 2004 1 1 0 0 0 instant <timestamp> -10 seconds -5 years time+ time+
1998 12 31 23 59 50 instant <timestamp> = ] unit-test
-[ t ] [ 2004 1 1 23 0 0 12 hours <timestamp> >gmt
+{ t } [ 2004 1 1 23 0 0 12 hours <timestamp> >gmt
2004 1 1 11 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2004 1 1 5 0 0 -11 hours <timestamp> >gmt
+{ t } [ 2004 1 1 5 0 0 -11 hours <timestamp> >gmt
2004 1 1 16 0 0 instant <timestamp> = ] unit-test
-[ t ] [ 2004 1 1 23 0 0 9+1/2 hours <timestamp> >gmt
+{ t } [ 2004 1 1 23 0 0 9+1/2 hours <timestamp> >gmt
2004 1 1 13 30 0 instant <timestamp> = ] unit-test
-[ +eq+ ] [ 2004 1 1 13 30 0 instant <timestamp>
+{ +eq+ } [ 2004 1 1 13 30 0 instant <timestamp>
2004 1 1 12 30 0 -1 hours <timestamp> <=> ] unit-test
-[ +gt+ ] [ 2004 1 1 13 30 0 instant <timestamp>
+{ +gt+ } [ 2004 1 1 13 30 0 instant <timestamp>
2004 1 1 12 30 0 instant <timestamp> <=> ] unit-test
-[ +lt+ ] [ 2004 1 1 12 30 0 instant <timestamp>
+{ +lt+ } [ 2004 1 1 12 30 0 instant <timestamp>
2004 1 1 13 30 0 instant <timestamp> <=> ] unit-test
-[ +gt+ ] [ 2005 1 1 12 30 0 instant <timestamp>
+{ +gt+ } [ 2005 1 1 12 30 0 instant <timestamp>
2004 1 1 13 30 0 instant <timestamp> <=> ] unit-test
-[ t ] [ 0 micros>timestamp unix-1970 = ] unit-test
-[ t ] [ 123456789000000 [ micros>timestamp timestamp>micros ] keep = ] unit-test
-[ t ] [ 123456789123456000 [ micros>timestamp timestamp>micros ] keep = ] unit-test
+{ t } [ 0 micros>timestamp unix-1970 = ] unit-test
+{ t } [ 123456789000000 [ micros>timestamp timestamp>micros ] keep = ] unit-test
+{ t } [ 123456789123456000 [ micros>timestamp timestamp>micros ] keep = ] unit-test
: checktime+ ( duration -- ? ) now dup clone [ rot time+ drop ] keep = ;
-[ t ] [ 5 seconds checktime+ ] unit-test
+{ t } [ 5 seconds checktime+ ] unit-test
-[ t ] [ 5 minutes checktime+ ] unit-test
+{ t } [ 5 minutes checktime+ ] unit-test
-[ t ] [ 5 hours checktime+ ] unit-test
+{ t } [ 5 hours checktime+ ] unit-test
-[ t ] [ 5 days checktime+ ] unit-test
+{ t } [ 5 days checktime+ ] unit-test
-[ t ] [ 5 weeks checktime+ ] unit-test
+{ t } [ 5 weeks checktime+ ] unit-test
-[ t ] [ 5 months checktime+ ] unit-test
+{ t } [ 5 months checktime+ ] unit-test
-[ t ] [ 5 years checktime+ ] unit-test
+{ t } [ 5 years checktime+ ] unit-test
-[ t ] [ now 50 milliseconds sleep now before? ] unit-test
-[ t ] [ now 50 milliseconds sleep now swap after? ] unit-test
-[ t ] [ now 50 milliseconds sleep now 50 milliseconds sleep now swapd between? ] unit-test
+{ t } [ now 50 milliseconds sleep now before? ] unit-test
+{ t } [ now 50 milliseconds sleep now swap after? ] unit-test
+{ t } [ now 50 milliseconds sleep now 50 milliseconds sleep now swapd between? ] unit-test
-[ 4 12 ] [ 2009 easter [ month>> ] [ day>> ] bi ] unit-test
-[ 4 2 ] [ 1961 easter [ month>> ] [ day>> ] bi ] unit-test
+{ 4 12 } [ 2009 easter [ month>> ] [ day>> ] bi ] unit-test
+{ 4 2 } [ 1961 easter [ month>> ] [ day>> ] bi ] unit-test
-[ f ] [ now dup midnight eq? ] unit-test
-[ f ] [ now dup easter eq? ] unit-test
-[ f ] [ now dup beginning-of-year eq? ] unit-test
+{ f } [ now dup midnight eq? ] unit-test
+{ f } [ now dup easter eq? ] unit-test
+{ f } [ now dup beginning-of-year eq? ] unit-test
-[ t ] [ 1325376000 unix-time>timestamp 2012 <year-gmt> = ] unit-test
-[ t ] [ 1356998399 unix-time>timestamp 2013 <year-gmt> 1 seconds time- = ] unit-test
+{ t } [ 1325376000 unix-time>timestamp 2012 <year-gmt> = ] unit-test
+{ t } [ 1356998399 unix-time>timestamp 2013 <year-gmt> 1 seconds time- = ] unit-test
-[ t ] [ 1500000000 random [ unix-time>timestamp timestamp>unix-time ] keep = ] unit-test
+{ t } [ 1500000000 random [ unix-time>timestamp timestamp>unix-time ] keep = ] unit-test
-[ t ] [
+{ t } [
2009 1 29 <date> 1 months time+
2009 3 1 <date> =
] unit-test
-[ t ] [
+{ t } [
2008 1 29 <date> 1 months time+
2008 2 29 <date> =
] unit-test
-[ 0 ]
+{ 0 }
[ gmt gmt-offset>> duration>seconds ] unit-test
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
strings tools.test ;
IN: circular.tests
-[ 0 ] [ { 0 1 2 3 4 } <circular> 0 swap virtual@ drop ] unit-test
-[ 2 ] [ { 0 1 2 3 4 } <circular> 2 swap virtual@ drop ] unit-test
+{ 0 } [ { 0 1 2 3 4 } <circular> 0 swap virtual@ drop ] unit-test
+{ 2 } [ { 0 1 2 3 4 } <circular> 2 swap virtual@ drop ] unit-test
-[ CHAR: t ] [ "test" <circular> 0 swap nth ] unit-test
-[ "test" ] [ "test" <circular> >string ] unit-test
+{ CHAR: t } [ "test" <circular> 0 swap nth ] unit-test
+{ "test" } [ "test" <circular> >string ] unit-test
-[ CHAR: e ] [ "test" <circular> 5 swap nth-unsafe ] unit-test
+{ CHAR: e } [ "test" <circular> 5 swap nth-unsafe ] unit-test
-[ [ 1 2 3 ] ] [ { 1 2 3 } <circular> [ ] like ] unit-test
-[ [ 2 3 1 ] ] [ { 1 2 3 } <circular> [ rotate-circular ] keep [ ] like ] unit-test
-[ [ 3 1 2 ] ] [ { 1 2 3 } <circular> [ rotate-circular ] keep [ rotate-circular ] keep [ ] like ] unit-test
-[ [ 2 3 1 ] ] [ { 1 2 3 } <circular> 1 over change-circular-start [ ] like ] unit-test
-[ [ 3 1 2 ] ] [ { 1 2 3 } <circular> 1 over change-circular-start 1 over change-circular-start [ ] like ] unit-test
-[ [ 3 1 2 ] ] [ { 1 2 3 } <circular> -100 over change-circular-start [ ] like ] unit-test
+{ [ 1 2 3 ] } [ { 1 2 3 } <circular> [ ] like ] unit-test
+{ [ 2 3 1 ] } [ { 1 2 3 } <circular> [ rotate-circular ] keep [ ] like ] unit-test
+{ [ 3 1 2 ] } [ { 1 2 3 } <circular> [ rotate-circular ] keep [ rotate-circular ] keep [ ] like ] unit-test
+{ [ 2 3 1 ] } [ { 1 2 3 } <circular> 1 over change-circular-start [ ] like ] unit-test
+{ [ 3 1 2 ] } [ { 1 2 3 } <circular> 1 over change-circular-start 1 over change-circular-start [ ] like ] unit-test
+{ [ 3 1 2 ] } [ { 1 2 3 } <circular> -100 over change-circular-start [ ] like ] unit-test
-[ "fob" ] [ "foo" <circular> CHAR: b 2 pick set-nth >string ] unit-test
-[ "boo" ] [ "foo" <circular> CHAR: b 3 pick set-nth-unsafe >string ] unit-test
-[ "ornact" ] [ "factor" <circular> 4 over change-circular-start CHAR: n 2 pick set-nth >string ] unit-test
+{ "fob" } [ "foo" <circular> CHAR: b 2 pick set-nth >string ] unit-test
+{ "boo" } [ "foo" <circular> CHAR: b 3 pick set-nth-unsafe >string ] unit-test
+{ "ornact" } [ "factor" <circular> 4 over change-circular-start CHAR: n 2 pick set-nth >string ] unit-test
-[ "bcd" ] [ 3 <circular-string> "abcd" [ over circular-push ] each >string ] unit-test
+{ "bcd" } [ 3 <circular-string> "abcd" [ over circular-push ] each >string ] unit-test
-[ { 0 0 } ] [ { 0 0 } <circular> -1 over change-circular-start >array ] unit-test
+{ { 0 0 } } [ { 0 0 } <circular> -1 over change-circular-start >array ] unit-test
! This no longer fails
! [ "test" <circular> 5 swap nth ] must-fail
! [ "foo" <circular> CHAR: b 3 rot set-nth ] must-fail
-[ { } ] [ 3 <growing-circular> >array ] unit-test
-[ { 1 2 } ] [
+{ { } } [ 3 <growing-circular> >array ] unit-test
+{ { 1 2 } } [
3 <growing-circular>
[ 1 swap growing-circular-push ] keep
[ 2 swap growing-circular-push ] keep >array
] unit-test
-[ { 3 4 5 } ] [
+{ { 3 4 5 } } [
3 <growing-circular> dup { 1 2 3 4 5 } [
swap growing-circular-push
] with each >array
] unit-test
-[ V{ 1 2 3 } ] [
+{ V{ 1 2 3 } } [
{ 1 2 3 } <circular> V{ } [
[ push f ] curry circular-while
] keep
] unit-test
CONSTANT: test-sequence1 { t f f f }
-[ V{ 1 2 3 1 } ] [
+{ V{ 1 2 3 1 } } [
{ 1 2 3 } <circular> V{ } [
[ [ push ] [ length 1 - test-sequence1 nth ] bi ] curry circular-while
] keep
] unit-test
CONSTANT: test-sequence2 { t f t t f f t t t f f f }
-[ V{ 1 2 3 1 2 3 1 2 3 1 2 3 } ] [
+{ V{ 1 2 3 1 2 3 1 2 3 1 2 3 } } [
{ 1 2 3 } <circular> V{ } [
[ [ push ] [ length 1 - test-sequence2 nth ] bi ] curry circular-while
] keep
] unit-test
-[ V{ 1 2 3 1 2 } ] [
+{ V{ 1 2 3 1 2 } } [
{ 1 2 3 } <circular> V{ } [
[ [ push ] [ length 5 < ] bi ] curry circular-loop
] keep
] unit-test
-[ V{ 1 } ] [
+{ V{ 1 } } [
{ 1 2 3 } <circular> V{ } [
[ push f ] curry circular-loop
] keep
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 >>
dup 1.0 2.0 101.0 102.0 <CGRect> -> foo:
-> release ;
-[ ] [ test-foo ] unit-test
+{ } [ test-foo ] unit-test
-[ 1.0 ] [ "x" get CGRect-x ] unit-test
-[ 2.0 ] [ "x" get CGRect-y ] unit-test
-[ 101.0 ] [ "x" get CGRect-w ] unit-test
-[ 102.0 ] [ "x" get CGRect-h ] unit-test
+{ 1.0 } [ "x" get CGRect-x ] unit-test
+{ 2.0 } [ "x" get CGRect-y ] unit-test
+{ 101.0 } [ "x" get CGRect-w ] unit-test
+{ 102.0 } [ "x" get CGRect-h ] unit-test
CLASS: Bar < NSObject
[
METHOD: NSRect bar [ test-foo "x" get ]
]
-[ ] [
+{ } [
Bar [
-> alloc -> init
dup -> bar "x" set
] compile-call
] unit-test
-[ 1.0 ] [ "x" get CGRect-x ] unit-test
-[ 2.0 ] [ "x" get CGRect-y ] unit-test
-[ 101.0 ] [ "x" get CGRect-w ] unit-test
-[ 102.0 ] [ "x" get CGRect-h ] unit-test
+{ 1.0 } [ "x" get CGRect-x ] unit-test
+{ 2.0 } [ "x" get CGRect-y ] unit-test
+{ 101.0 } [ "x" get CGRect-w ] unit-test
+{ 102.0 } [ "x" get CGRect-h ] unit-test
! Make sure that we can add methods
CLASS: Bar < NSObject
METHOD: int babb: int x [ x sq ]
]
-[ 144 ] [
+{ 144 } [
Bar [
-> alloc -> init
dup 12 -> babb:
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
! Columns
{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } [ clone ] map "seq" set
-[ { 1 4 7 } ] [ "seq" get 0 <column> >array ] unit-test
-[ ] [ "seq" get 1 <column> [ sq ] map! drop ] unit-test
-[ { 4 25 64 } ] [ "seq" get 1 <column> >array ] unit-test
+{ { 1 4 7 } } [ "seq" get 0 <column> >array ] unit-test
+{ } [ "seq" get 1 <column> [ sq ] map! drop ] unit-test
+{ { 4 25 64 } } [ "seq" get 1 <column> >array ] unit-test
-[ { { 1 3 } { 2 4 } } ] [ { { 1 2 } { 3 4 } } <flipped> [ >array ] map ] unit-test
+{ { { 1 3 } { 2 4 } } } [ { { 1 2 } { 3 4 } } <flipped> [ >array ] map ] 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
slots[ allot-area-base spill-area-base total-size ]
! Exclude any reserved stack space 32 bytes on win64, 0 bytes
! on all other platforms.
- reserved-stack-space -
+ reserved-stack-space }
] 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
{ { 3 8 } T{ spill-slot { n 32 } } }
{ { 1234 8 } T{ spill-slot } }
{ { 45 16 } T{ spill-slot { n 16 } } }
-} ? 1array
+} ? }
[
H{ } clone spill-slots set
f f <basic-block> <cfg> cfg set
[ 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 }
T{ ##add-imm f 4 2 31337 }
T{ ##load-memory f 5 4 3 0 0 int-rep c:uchar }
}
-] ?
+] }
[
V{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 4 3 31337 }
T{ ##load-memory f 5 2 4 0 1 int-rep c:uchar }
}
-] ?
+] }
[
V{
T{ ##peek f 0 D 0 }
! 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 }
T{ ##shl-imm f 4 3 2 }
T{ ##load-memory f 5 2 4 0 0 int-rep c:uchar }
}
-] ?
+] }
[
V{
T{ ##peek f 0 D 0 }
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 {
{ 4 [ [ [ "COMPLEX SHUFFLE" fixnum+ "COMPLEX SHUFFLE" set-alien-unsigned-4 ] ] ] }
{ 8 [ [ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-unsigned-4 ] ] ] }
-} 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 {
{ 4 [ [ [ "COMPLEX SHUFFLE" fixnum+ "COMPLEX SHUFFLE" set-alien-signed-4 ] ] ] }
{ 8 [ [ [ "COMPLEX SHUFFLE" fixnum+fast "COMPLEX SHUFFLE" set-alien-signed-4 ] ] ] }
-} 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
USING: tools.test core-graphics kernel images ;
IN: core-graphics.tests
-[ t ] [ { 100 200 } [ drop ] make-bitmap-image image? ] unit-test
+{ t } [ { 100 200 } [ drop ] make-bitmap-image image? ] unit-test
-[ ] [ dummy-context drop ] unit-test
+{ } [ dummy-context drop ] unit-test
: test-font ( name -- font )
[ >cf &CFRelease 0.0 f CTFontCreateWithName ] with-destructors ;
-[ ] [ "Helvetica" test-font CFRelease ] unit-test
+{ } [ "Helvetica" test-font CFRelease ] unit-test
-[ ] [
+{ } [
[
kCTFontAttributeName "Helvetica" test-font &CFRelease 2array 1array
<CFDictionary> &CFRelease drop
} cleave and and and
] with-destructors ;
-[ t ] [ "Hello world" "Helvetica" test-typographic-bounds ] unit-test
+{ t } [ "Hello world" "Helvetica" test-typographic-bounds ] unit-test
-[ t ] [ "Hello world" "Chicago" test-typographic-bounds ] unit-test
+{ t } [ "Hello world" "Chicago" test-typographic-bounds ] unit-test
-[ t ] [ "日本語" "Helvetica" test-typographic-bounds ] unit-test
+{ t } [ "日本語" "Helvetica" test-typographic-bounds ] 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
! !!!!!!!! other tests
-[ { { "Phil Dawes" } } ]
+{ { { "Phil Dawes" } } }
[ "\"Phil Dawes\"" string>csv ] unit-test
-[ { { "1" "2" "3" } { "4" "5" "6" } } ]
+{ { { "1" "2" "3" } { "4" "5" "6" } } }
[ "1,2,3\n4,5,6\n" string>csv ] unit-test
"trims leading and trailing whitespace - n.b. this isn't really conformant, but lots of csv seems to assume this"
[ "\"fo\"\"o1\",bar1\n\"fo\no2\",\"b,ar2\"\n" ]
[ { { "fo\"o1" "bar1" } { "fo\no2" "b,ar2" } } csv>string ] named-unit-test ! "
-[ { { "writing" "some" "csv" "tests" } } ]
+{ { { "writing" "some" "csv" "tests" } } }
[
"writing,some,csv,tests"
"csv-test1-" unique-file utf8
[ set-file-contents ] [ file>csv ] [ drop delete-file ] 2tri
] unit-test
-[ t ] [
+{ t } [
{ { "writing,some,csv,tests" } } dup "csv-test2-"
unique-file utf8 [ csv>file ] [ file>csv ] 2bi =
] unit-test
-[ { { "hello" "" "" "" "goodbye" "" } } ]
+{ { { "hello" "" "" "" "goodbye" "" } } }
[ "hello,,\"\",,goodbye," string>csv ] unit-test
{ { { "asd\"f\"" "asdf" } } } [ "asd\"f\",asdf" string>csv ] unit-test
! FIXME: { { { "asd\"f\"" "asdf" } } } [ "\"asd\"\"\"f\",asdf" string>csv ] unit-test
{ { { "as,d\"f" "asdf" } } } [ "\"as,\"d\"\"\"\"f,asdf" string>csv ] unit-test
-[ { } ] [ "" string>csv ] unit-test
+{ { } } [ "" string>csv ] unit-test
-[
+{
{ { "Year" "Make" "Model" }
{ "1997" "Ford" "E350" }
}
-]
+}
[ "Year,Make,\"Model\"\r\n1997,Ford,E350" string>csv ] 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
namespaces tools.test ;
IN: debugger.tests
-[ ] [ [ drop ] [ error. ] recover ] unit-test
+{ } [ [ drop ] [ error. ] recover ] unit-test
-[ f ] [ { } vm-error? ] unit-test
-[ f ] [ { "A" "B" } vm-error? ] unit-test
+{ f } [ { } vm-error? ] unit-test
+{ f } [ { "A" "B" } vm-error? ] unit-test
-[ ] [
+{ } [
T{ test-failure
{ error
{
} error.
] unit-test
-[ "foo" { 1 2 3 "foo" } ] [
+{ "foo" { 1 2 3 "foo" } } [
[ 1 2 3 "foo" throw ] [ ] recover error-continuation get data>>
] unit-test
CONSULT: hello goodbye those>> ;
M: hello bing hello-test ;
-[ 1 { t 1 0 } ] [ 1 0 <hello> [ foo ] [ bar ] bi ] unit-test
-[ { t 1 0 } ] [ 1 0 <hello> bing ] unit-test
-[ 1 ] [ 1 0 <hello> f <goodbye> foo ] unit-test
-[ { t 1 0 } ] [ 1 0 <hello> f <goodbye> bar ] unit-test
-[ 3 ] [ 1 0 <hello> 2 whoa ] unit-test
-[ 3 ] [ 1 0 <hello> f <goodbye> 2 whoa ] unit-test
+{ 1 { t 1 0 } } [ 1 0 <hello> [ foo ] [ bar ] bi ] unit-test
+{ { t 1 0 } } [ 1 0 <hello> bing ] unit-test
+{ 1 } [ 1 0 <hello> f <goodbye> foo ] unit-test
+{ { t 1 0 } } [ 1 0 <hello> f <goodbye> bar ] unit-test
+{ 3 } [ 1 0 <hello> 2 whoa ] unit-test
+{ 3 } [ 1 0 <hello> f <goodbye> 2 whoa ] unit-test
-[ ] [ 3 [ "USING: accessors delegate ; IN: delegate.tests CONSULT: baz goodbye these>> ;" eval( -- ) ] times ] unit-test
-[ H{ { goodbye T{ consultation f baz goodbye [ these>> ] } } } ] [ baz protocol-consult ] unit-test
-[ H{ } ] [ bee protocol-consult ] unit-test
+{ } [ 3 [ "USING: accessors delegate ; IN: delegate.tests CONSULT: baz goodbye these>> ;" eval( -- ) ] times ] unit-test
+{ H{ { goodbye T{ consultation f baz goodbye [ these>> ] } } } } [ baz protocol-consult ] unit-test
+{ H{ } } [ bee protocol-consult ] unit-test
-[ "USING: delegate ;\nIN: delegate.tests\nPROTOCOL: baz foo bar { whoa 1 } ; inline\n" ] [ [ baz see ] with-string-writer ] unit-test
+{ "USING: delegate ;\nIN: delegate.tests\nPROTOCOL: baz foo bar { whoa 1 } ; inline\n" } [ [ baz see ] with-string-writer ] unit-test
GENERIC: one ( a -- b )
M: integer one ;
CONSULT: alpha hey value>> 1 + ;
CONSULT: beta hey value>> 1 - ;
-[ 2 ] [ 1 <hey> one ] unit-test
-[ 2 ] [ 1 <hey> two ] unit-test
-[ 0 ] [ 1 <hey> three ] unit-test
-[ { hey } ] [ alpha protocol-users ] unit-test
-[ { hey } ] [ beta protocol-users ] unit-test
-[ ] [ "USE: delegate IN: delegate.tests PROTOCOL: alpha one ;" eval( -- ) ] unit-test
-[ f ] [ hey \ two ?lookup-method ] unit-test
-[ f ] [ hey \ four ?lookup-method ] unit-test
-[ ] [ "USE: delegate IN: delegate.tests PROTOCOL: beta two three four ;" eval( -- ) ] unit-test
-[ { hey } ] [ alpha protocol-users ] unit-test
-[ { hey } ] [ beta protocol-users ] unit-test
-[ 2 ] [ 1 <hey> one ] unit-test
-[ 0 ] [ 1 <hey> two ] unit-test
-[ 0 ] [ 1 <hey> three ] unit-test
-[ 0 ] [ 1 <hey> four ] unit-test
-[ ] [ "USING: math accessors delegate ; IN: delegate.tests CONSULT: beta hey value>> 2 - ;" eval( -- ) ] unit-test
-[ 2 ] [ 1 <hey> one ] unit-test
-[ -1 ] [ 1 <hey> two ] unit-test
-[ -1 ] [ 1 <hey> three ] unit-test
-[ -1 ] [ 1 <hey> four ] unit-test
-[ ] [ "IN: delegate.tests FORGET: alpha" eval( -- ) ] unit-test
-[ f ] [ hey \ one ?lookup-method ] unit-test
+{ 2 } [ 1 <hey> one ] unit-test
+{ 2 } [ 1 <hey> two ] unit-test
+{ 0 } [ 1 <hey> three ] unit-test
+{ { hey } } [ alpha protocol-users ] unit-test
+{ { hey } } [ beta protocol-users ] unit-test
+{ } [ "USE: delegate IN: delegate.tests PROTOCOL: alpha one ;" eval( -- ) ] unit-test
+{ f } [ hey \ two ?lookup-method ] unit-test
+{ f } [ hey \ four ?lookup-method ] unit-test
+{ } [ "USE: delegate IN: delegate.tests PROTOCOL: beta two three four ;" eval( -- ) ] unit-test
+{ { hey } } [ alpha protocol-users ] unit-test
+{ { hey } } [ beta protocol-users ] unit-test
+{ 2 } [ 1 <hey> one ] unit-test
+{ 0 } [ 1 <hey> two ] unit-test
+{ 0 } [ 1 <hey> three ] unit-test
+{ 0 } [ 1 <hey> four ] unit-test
+{ } [ "USING: math accessors delegate ; IN: delegate.tests CONSULT: beta hey value>> 2 - ;" eval( -- ) ] unit-test
+{ 2 } [ 1 <hey> one ] unit-test
+{ -1 } [ 1 <hey> two ] unit-test
+{ -1 } [ 1 <hey> three ] unit-test
+{ -1 } [ 1 <hey> four ] unit-test
+{ } [ "IN: delegate.tests FORGET: alpha" eval( -- ) ] unit-test
+{ f } [ hey \ one ?lookup-method ] unit-test
TUPLE: slot-protocol-test-1 a b ;
TUPLE: slot-protocol-test-2 < slot-protocol-test-1 { c integer } ;
CONSULT: slot-protocol-test-2 slot-protocol-test-3 d>> ;
-[ "a" "b" 5 ] [
+{ "a" "b" 5 } [
T{ slot-protocol-test-3 f T{ slot-protocol-test-2 f "a" "b" 5 } }
[ a>> ] [ b>> ] [ c>> ] tri
] unit-test
CONSULT: slot-protocol-test-5 slot-protocol-test-4 x>> ;
-[ "hey" ] [
+{ "hey" } [
"hey" slot-protocol-test-5 boa slot-protocol-test-4 boa
a-read-only-slot>>
] unit-test
M: f do-me drop ;
-[ ] [ f do-me ] unit-test
+{ } [ f do-me ] unit-test
TUPLE: a-tuple ;
PROTOCOL: silly-protocol do-me ;
! Replacing a method definition with a consultation would cause problems
-[ [ ] ] [
+{ [ ] } [
"IN: delegate.tests
USE: kernel
M: a-tuple do-me drop ;" <string-reader> "delegate-test" parse-stream
] unit-test
-[ ] [ T{ a-tuple } do-me ] unit-test
+{ } [ T{ a-tuple } do-me ] unit-test
! Change method definition to consultation
-[ [ ] ] [
+{ [ ] } [
"IN: delegate.tests
USE: kernel
USE: delegate
] unit-test
! Method should be there
-[ ] [ T{ a-tuple } do-me ] unit-test
+{ } [ T{ a-tuple } do-me ] unit-test
! Now try removing the consultation
-[ [ ] ] [
+{ [ ] } [
"IN: delegate.tests" <string-reader> "delegate-test" parse-stream
] unit-test
DEFER: slot-protocol-test-3
SLOT: y
-[ f ] [ \ slot-protocol-test-3 \ y>> ?lookup-method >boolean ] unit-test
+{ f } [ \ slot-protocol-test-3 \ y>> ?lookup-method >boolean ] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: delegate.tests
USING: accessors delegate ;
TUPLE: slot-protocol-test-3 x ;
<string-reader> "delegate-test-1" parse-stream
] unit-test
-[ t ] [ \ slot-protocol-test-3 \ y>> ?lookup-method >boolean ] unit-test
+{ t } [ \ slot-protocol-test-3 \ y>> ?lookup-method >boolean ] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: delegate.tests
TUPLE: slot-protocol-test-3 x y ;"
<string-reader> "delegate-test-1" parse-stream
! We now have a real accessor for the y slot; we don't want it to
! get lost
-[ t ] [ \ slot-protocol-test-3 \ y>> ?lookup-method >boolean ] unit-test
+{ t } [ \ slot-protocol-test-3 \ y>> ?lookup-method >boolean ] unit-test
! We want to be able to override methods after consultation
-[ [ ] ] [
+{ [ ] } [
"IN: delegate.tests
USING: delegate kernel sequences delegate.protocols accessors ;
TUPLE: override-method-test seq ;
DEFER: seq-delegate
! See if removing a consultation updates protocol-consult word prop
-[ [ ] ] [
+{ [ ] } [
"IN: delegate.tests
USING: accessors delegate delegate.protocols ;
TUPLE: seq-delegate seq ;
<string-reader> "remove-consult-test" parse-stream
] unit-test
-[ t ] [
+{ t } [
seq-delegate
sequence-protocol \ protocol-consult word-prop
key?
] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: delegate.tests
USING: delegate delegate.protocols ;
TUPLE: seq-delegate seq ;"
<string-reader> "remove-consult-test" parse-stream
] unit-test
-[ f ] [
+{ f } [
seq-delegate
sequence-protocol \ protocol-consult word-prop
key?
[ "USING: accessors delegate ; IN: delegate.tests BROADCAST: nonbroadcastable broadcaster targets>> ;" eval( -- ) ]
[ error>> broadcast-words-must-have-no-outputs? ] must-fail-with
-[ { 2 3 4 } ]
+{ { 2 3 4 } }
[ { 1 2 3 } broadcaster boa [ broadcastable ] { } make ] unit-test
SYMBOL: uf
-[ ] [
+{ } [
<disjoint-set> uf set
+blah+ uf get add-atom
19026 uf get add-atom
19026 +blah+ uf get equate
] unit-test
-[ 2 ] [ 19026 uf get equiv-set-size ] unit-test
+{ 2 } [ 19026 uf get equiv-set-size ] unit-test
math sequences tools.test ;
IN: dlists.tests
-[ t ] [ <dlist> deque-empty? ] unit-test
+{ t } [ <dlist> deque-empty? ] unit-test
-[ T{ dlist f T{ dlist-node f f f 1 } T{ dlist-node f f f 1 } } ]
+{ T{ dlist f T{ dlist-node f f f 1 } T{ dlist-node f f f 1 } } }
[ <dlist> 1 over push-front ] unit-test
! Make sure empty lists are empty
-[ t ] [ <dlist> deque-empty? ] unit-test
-[ f ] [ <dlist> 1 over push-front deque-empty? ] unit-test
-[ f ] [ <dlist> 1 over push-back deque-empty? ] unit-test
-
-[ 1 ] [ <dlist> 1 over push-front pop-front ] unit-test
-[ 1 ] [ <dlist> 1 over push-front pop-back ] unit-test
-[ 1 ] [ <dlist> 1 over push-back pop-front ] unit-test
-[ 1 ] [ <dlist> 1 over push-back pop-back ] unit-test
-[ T{ dlist f f f } ] [ <dlist> 1 over push-front dup pop-front* ] unit-test
-[ T{ dlist f f f } ] [ <dlist> 1 over push-front dup pop-back* ] unit-test
-[ T{ dlist f f f } ] [ <dlist> 1 over push-back dup pop-front* ] unit-test
-[ T{ dlist f f f } ] [ <dlist> 1 over push-back dup pop-back* ] unit-test
+{ t } [ <dlist> deque-empty? ] unit-test
+{ f } [ <dlist> 1 over push-front deque-empty? ] unit-test
+{ f } [ <dlist> 1 over push-back deque-empty? ] unit-test
+
+{ 1 } [ <dlist> 1 over push-front pop-front ] unit-test
+{ 1 } [ <dlist> 1 over push-front pop-back ] unit-test
+{ 1 } [ <dlist> 1 over push-back pop-front ] unit-test
+{ 1 } [ <dlist> 1 over push-back pop-back ] unit-test
+{ T{ dlist f f f } } [ <dlist> 1 over push-front dup pop-front* ] unit-test
+{ T{ dlist f f f } } [ <dlist> 1 over push-front dup pop-back* ] unit-test
+{ T{ dlist f f f } } [ <dlist> 1 over push-back dup pop-front* ] unit-test
+{ T{ dlist f f f } } [ <dlist> 1 over push-back dup pop-back* ] unit-test
! Test the prev,next links for two nodes
-[ f ] [
+{ f } [
<dlist> 1 over push-back 2 over push-back
front>> prev>>
] unit-test
-[ 2 ] [
+{ 2 } [
<dlist> 1 over push-back 2 over push-back
front>> next>> obj>>
] unit-test
-[ 1 ] [
+{ 1 } [
<dlist> 1 over push-back 2 over push-back
front>> next>> prev>> obj>>
] unit-test
-[ f ] [
+{ f } [
<dlist> 1 over push-back 2 over push-back
front>> next>> next>>
] unit-test
-[ f f ] [ <dlist> [ 1 = ] dlist-find ] unit-test
-[ 1 t ] [ <dlist> 1 over push-back [ 1 = ] dlist-find ] unit-test
-[ f f ] [ <dlist> 1 over push-back [ 2 = ] dlist-find ] unit-test
-[ f ] [ <dlist> 1 over push-back [ 2 = ] dlist-any? ] unit-test
-[ t ] [ <dlist> 1 over push-back [ 1 = ] dlist-any? ] unit-test
+{ f f } [ <dlist> [ 1 = ] dlist-find ] unit-test
+{ 1 t } [ <dlist> 1 over push-back [ 1 = ] dlist-find ] unit-test
+{ f f } [ <dlist> 1 over push-back [ 2 = ] dlist-find ] unit-test
+{ f } [ <dlist> 1 over push-back [ 2 = ] dlist-any? ] unit-test
+{ t } [ <dlist> 1 over push-back [ 1 = ] dlist-any? ] unit-test
-[ 1 ] [ <dlist> 1 over push-back [ 1 = ] delete-node-if ] unit-test
-[ t ] [ <dlist> 1 over push-back dup [ 1 = ] delete-node-if drop deque-empty? ] unit-test
-[ t ] [ <dlist> 1 over push-back dup [ 1 = ] delete-node-if drop deque-empty? ] unit-test
+{ 1 } [ <dlist> 1 over push-back [ 1 = ] delete-node-if ] unit-test
+{ t } [ <dlist> 1 over push-back dup [ 1 = ] delete-node-if drop deque-empty? ] unit-test
+{ t } [ <dlist> 1 over push-back dup [ 1 = ] delete-node-if drop deque-empty? ] unit-test
-[ t ] [ <dlist> 4 over push-back 5 over push-back [ obj>> 4 = ] dlist-find-node class-of dlist-node = ] unit-test
-[ t ] [ <dlist> 4 over push-back 5 over push-back [ obj>> 5 = ] dlist-find-node class-of dlist-node = ] unit-test
-[ t ] [ <dlist> 4 over push-back 5 over push-back* [ = ] curry dlist-find-node class-of dlist-node = ] unit-test
-[ ] [ <dlist> 4 over push-back 5 over push-back [ drop ] dlist-each ] unit-test
+{ t } [ <dlist> 4 over push-back 5 over push-back [ obj>> 4 = ] dlist-find-node class-of dlist-node = ] unit-test
+{ t } [ <dlist> 4 over push-back 5 over push-back [ obj>> 5 = ] dlist-find-node class-of dlist-node = ] unit-test
+{ t } [ <dlist> 4 over push-back 5 over push-back* [ = ] curry dlist-find-node class-of dlist-node = ] unit-test
+{ } [ <dlist> 4 over push-back 5 over push-back [ drop ] dlist-each ] unit-test
-[ f ] [ <dlist> ?peek-front ] unit-test
-[ 1 ] [ <dlist> 1 over push-front ?peek-front ] unit-test
-[ f ] [ <dlist> ?peek-back ] unit-test
-[ 1 ] [ <dlist> 1 over push-back ?peek-back ] unit-test
+{ f } [ <dlist> ?peek-front ] unit-test
+{ 1 } [ <dlist> 1 over push-front ?peek-front ] unit-test
+{ f } [ <dlist> ?peek-back ] unit-test
+{ 1 } [ <dlist> 1 over push-back ?peek-back ] unit-test
[ <dlist> peek-front ] [ empty-deque? ] must-fail-with
[ <dlist> peek-back ] [ empty-deque? ] must-fail-with
[ <dlist> pop-front ] [ empty-deque? ] must-fail-with
[ <dlist> pop-back ] [ empty-deque? ] must-fail-with
-[ t ] [ <dlist> 3 over push-front 4 over push-back 3 swap deque-member? ] unit-test
+{ t } [ <dlist> 3 over push-front 4 over push-back 3 swap deque-member? ] unit-test
-[ f ] [ <dlist> 3 over push-front 4 over push-back -1 swap deque-member? ] unit-test
+{ f } [ <dlist> 3 over push-front 4 over push-back -1 swap deque-member? ] unit-test
-[ f ] [ <dlist> 0 swap deque-member? ] unit-test
+{ f } [ <dlist> 0 swap deque-member? ] unit-test
! Make sure clone does the right thing
-[ V{ 2 1 } V{ 2 1 3 } ] [
+{ V{ 2 1 } V{ 2 1 3 } } [
<dlist> 1 over push-front 2 over push-front
dup clone 3 over push-back
[ dlist>sequence ] bi@
] unit-test
-[ V{ f 3 1 f } ] [ <dlist> 1 over push-front 3 over push-front f over push-front f over push-back dlist>sequence ] unit-test
+{ V{ f 3 1 f } } [ <dlist> 1 over push-front 3 over push-front f over push-front f over push-back dlist>sequence ] unit-test
-[ V{ } ] [ <dlist> dlist>sequence ] unit-test
+{ V{ } } [ <dlist> dlist>sequence ] unit-test
-[ V{ 0 2 4 } ] [ <dlist> { 0 1 2 3 4 } over push-all-back [ even? ] dlist-filter dlist>sequence ] unit-test
-[ V{ 2 4 } ] [ <dlist> { 1 2 3 4 } over push-all-back [ even? ] dlist-filter dlist>sequence ] unit-test
-[ V{ 2 4 } ] [ <dlist> { 1 2 3 4 5 } over push-all-back [ even? ] dlist-filter dlist>sequence ] unit-test
-[ V{ 0 2 4 } ] [ <dlist> { 0 1 2 3 4 5 } over push-all-back [ even? ] dlist-filter dlist>sequence ] unit-test
+{ V{ 0 2 4 } } [ <dlist> { 0 1 2 3 4 } over push-all-back [ even? ] dlist-filter dlist>sequence ] unit-test
+{ V{ 2 4 } } [ <dlist> { 1 2 3 4 } over push-all-back [ even? ] dlist-filter dlist>sequence ] unit-test
+{ V{ 2 4 } } [ <dlist> { 1 2 3 4 5 } over push-all-back [ even? ] dlist-filter dlist>sequence ] unit-test
+{ V{ 0 2 4 } } [ <dlist> { 0 1 2 3 4 5 } over push-all-back [ even? ] dlist-filter dlist>sequence ] unit-test
-[ t ] [ DL{ } DL{ } = ] unit-test
-[ t ] [ DL{ 1 } DL{ 1 } = ] unit-test
-[ t ] [ DL{ 1 2 } DL{ 1 2 } = ] unit-test
-[ t ] [ DL{ 1 1 } DL{ 1 1 } = ] unit-test
-[ f ] [ DL{ 1 2 3 } DL{ 1 2 } = ] unit-test
-[ f ] [ DL{ 1 2 } DL{ 1 2 3 } = ] unit-test
-[ f ] [ DL{ } DL{ 1 } = ] unit-test
-[ f ] [ DL{ f } DL{ 1 } = ] unit-test
-[ f ] [ f DL{ } = ] unit-test
-[ f ] [ DL{ } f = ] unit-test
+{ t } [ DL{ } DL{ } = ] unit-test
+{ t } [ DL{ 1 } DL{ 1 } = ] unit-test
+{ t } [ DL{ 1 2 } DL{ 1 2 } = ] unit-test
+{ t } [ DL{ 1 1 } DL{ 1 1 } = ] unit-test
+{ f } [ DL{ 1 2 3 } DL{ 1 2 } = ] unit-test
+{ f } [ DL{ 1 2 } DL{ 1 2 3 } = ] unit-test
+{ f } [ DL{ } DL{ 1 } = ] unit-test
+{ f } [ DL{ f } DL{ 1 } = ] unit-test
+{ f } [ f DL{ } = ] unit-test
+{ f } [ DL{ } f = ] unit-test
TUPLE: my-node < dlist-link { obj fixnum } ;
my-node new
swap >>obj ; inline
-[ V{ 1 } ] [ <dlist> 1 <my-node> over push-node-front dlist>sequence ] unit-test
-[ V{ 2 1 } ] [ <dlist> 1 <my-node> over push-node-front 2 <my-node> over push-node-front dlist>sequence ] unit-test
+{ V{ 1 } } [ <dlist> 1 <my-node> over push-node-front dlist>sequence ] unit-test
+{ V{ 2 1 } } [ <dlist> 1 <my-node> over push-node-front 2 <my-node> over push-node-front dlist>sequence ] unit-test
-[ V{ 1 } ] [ <dlist> 1 <my-node> over push-node-back dlist>sequence ] unit-test
-[ V{ 1 2 } ] [ <dlist> 1 <my-node> over push-node-back 2 <my-node> over push-node-back dlist>sequence ] unit-test
-[ V{ 1 2 3 } ] [ <dlist> 1 <my-node> over push-node-back 2 <my-node> over push-node-back 3 <my-node> over push-node-back dlist>sequence ] unit-test
+{ V{ 1 } } [ <dlist> 1 <my-node> over push-node-back dlist>sequence ] unit-test
+{ V{ 1 2 } } [ <dlist> 1 <my-node> over push-node-back 2 <my-node> over push-node-back dlist>sequence ] unit-test
+{ V{ 1 2 3 } } [ <dlist> 1 <my-node> over push-node-back 2 <my-node> over push-node-back 3 <my-node> over push-node-back dlist>sequence ] unit-test
: assert-links ( dlist-node -- )
[ prev>> ] [ next>> ] bi 2array { f f } assert= ;
-[ V{ } ] [ <dlist> 1 <my-node> over push-node-back [ [ back>> ] [ ] bi delete-node ] [ ] bi dlist>sequence ] unit-test
-[ V{ 1 2 } t ] [| |
+{ V{ } } [ <dlist> 1 <my-node> over push-node-back [ [ back>> ] [ ] bi delete-node ] [ ] bi dlist>sequence ] unit-test
+{ V{ 1 2 } t } [| |
<dlist> :> dl
1 <my-node> :> n1 n1 dl push-node-back
2 <my-node> :> n2 n2 dl push-node-back
dl dlist>sequence dup >dlist dl =
] unit-test
-[ V{ 1 3 } t ] [| |
+{ V{ 1 3 } t } [| |
<dlist> :> dl
1 <my-node> :> n1 n1 dl push-node-back
2 <my-node> :> n2 n2 dl push-node-back
dl dlist>sequence dup >dlist dl =
] unit-test
-[ V{ 2 3 } t ] [| |
+{ V{ 2 3 } t } [| |
<dlist> :> dl
1 <my-node> :> n1 n1 dl push-node-back
2 <my-node> :> n2 n2 dl push-node-back
! Tests
-[ { } ] [
+{ { } } [
[
{ 1 10 }
{ 1 10 } [ , "HI" , ] each-line
] { } make
] unit-test
-[ { 1 "HI" } ] [
+{ { 1 "HI" } } [
[
{ 1 10 }
{ 1 11 } [ , "HI" , ] each-line
] { } make
] unit-test
-[ { 1 "HI" 2 "HI" } ] [
+{ { 1 "HI" 2 "HI" } } [
[
{ 1 10 }
{ 2 11 } [ , "HI" , ] each-line
] { } make
] unit-test
-[ { { t f 1 } { t f 2 } } ] [
+{ { { t f 1 } { t f 2 } } } [
[
{ 1 10 } { 2 11 }
t f
] { } make
] unit-test
-[ { 10 4 } ] [ { "a" } { 10 3 } text+loc ] unit-test
-[ { 10 4 } ] [ { "a" } { 10 3 } text+loc ] unit-test
+{ { 10 4 } } [ { "a" } { 10 3 } text+loc ] unit-test
+{ { 10 4 } } [ { "a" } { 10 3 } text+loc ] unit-test
-[ { 2 9 } ] [
+{ { 2 9 } } [
<document> "doc" set
"Hello world,\nhow are you?\nMore text"
"doc" get set-doc-string
{ 10 0 } "doc" get validate-loc
] unit-test
-[ { 1 12 } ] [
+{ { 1 12 } } [
<document> "doc" set
"Hello world,\nhow are you?\nMore text"
"doc" get set-doc-string
{ 1 20 } "doc" get validate-loc
] unit-test
-[ " world,\nhow are you?\nMore" ] [
+{ " world,\nhow are you?\nMore" } [
<document> "doc" set
"Hello world,\nhow are you?\nMore text"
"doc" get set-doc-string
{ 0 5 } { 2 4 } "doc" get doc-range
] unit-test
-[ "Hello world,\nhow you?\nMore text" ] [
+{ "Hello world,\nhow you?\nMore text" } [
<document> "doc" set
"Hello world,\nhow are you?\nMore text"
"doc" get set-doc-string
"doc" get doc-string
] unit-test
-[ "Hello world,\nhow text" ] [
+{ "Hello world,\nhow text" } [
<document> "doc" set
"Hello world,\nhow are you?\nMore text"
"doc" get set-doc-string
"doc" get doc-string
] unit-test
-[ "Hello world,\nhow you?\nMore text" ] [
+{ "Hello world,\nhow you?\nMore text" } [
<document> "doc" set
"Hello world,\nhow are you?\nMore text"
"doc" get set-doc-string
"doc" get doc-string
] unit-test
-[ "Hello world,\nhow text" ] [
+{ "Hello world,\nhow text" } [
<document> "doc" set
"Hello world,\nhow are you?\nMore text"
"doc" get set-doc-string
<document> "doc" set
"Hello\nworld, how are\nyou?" "doc" get set-doc-string
-[ { 2 4 } ] [ "doc" get doc-end ] unit-test
+{ { 2 4 } } [ "doc" get doc-end ] unit-test
! Undo/redo
-[ ] [ <document> "d" set ] unit-test
+{ } [ <document> "d" set ] unit-test
-[ ] [ "Hello, world." "d" get set-doc-string ] unit-test
+{ } [ "Hello, world." "d" get set-doc-string ] unit-test
-[
+{
T{ edit
{ old-string "" }
{ new-string "Hello, world." }
{ old-to { 0 0 } }
{ new-to { 0 13 } }
}
-] [ "d" get undos>> first ] unit-test
+} [ "d" get undos>> first ] unit-test
-[ ] [ "Goodbye" { 0 0 } { 0 5 } "d" get set-doc-range ] unit-test
+{ } [ "Goodbye" { 0 0 } { 0 5 } "d" get set-doc-range ] unit-test
-[ "Goodbye, world." ] [ "d" get doc-string ] unit-test
+{ "Goodbye, world." } [ "d" get doc-string ] unit-test
-[ ] [ "cruel " { 0 9 } { 0 9 } "d" get set-doc-range ] unit-test
+{ } [ "cruel " { 0 9 } { 0 9 } "d" get set-doc-range ] unit-test
-[ 3 ] [ "d" get undos>> length ] unit-test
+{ 3 } [ "d" get undos>> length ] unit-test
-[ "Goodbye, cruel world." ] [ "d" get doc-string ] unit-test
+{ "Goodbye, cruel world." } [ "d" get doc-string ] unit-test
-[ "" { 0 9 } { 0 15 } ] [
+{ "" { 0 9 } { 0 15 } } [
"d" get undos>> last
[ old-string>> ] [ from>> ] [ new-to>> ] tri
] unit-test
-[ ] [ "d" get undo ] unit-test
+{ } [ "d" get undo ] unit-test
-[ "Goodbye, world." ] [ "d" get doc-string ] unit-test
+{ "Goodbye, world." } [ "d" get doc-string ] unit-test
-[ ] [ "d" get undo ] unit-test
+{ } [ "d" get undo ] unit-test
-[ "Hello, world." ] [ "d" get doc-string ] unit-test
+{ "Hello, world." } [ "d" get doc-string ] unit-test
-[ ] [ "d" get redo ] unit-test
+{ } [ "d" get redo ] unit-test
-[ "Goodbye, world." ] [ "d" get doc-string ] unit-test
+{ "Goodbye, world." } [ "d" get doc-string ] unit-test
-[ ] [ <document> "d" set ] unit-test
+{ } [ <document> "d" set ] unit-test
-[ ] [ "d" get clear-doc ] unit-test
+{ } [ "d" get clear-doc ] unit-test
-[ ] [ "d" get clear-doc ] unit-test
+{ } [ "d" get clear-doc ] unit-test
-[ 0 ] [ "d" get undos>> length ] unit-test
+{ 0 } [ "d" get undos>> length ] unit-test
-[ ] [ <document> "d" set ] unit-test
+{ } [ <document> "d" set ] unit-test
-[ ] [ "d" get value>> "value" set ] unit-test
+{ } [ "d" get value>> "value" set ] unit-test
-[ ] [ "Hello world" "d" get set-doc-string ] unit-test
+{ } [ "Hello world" "d" get set-doc-string ] unit-test
-[ { "" } ] [ "value" get ] unit-test
+{ { "" } } [ "value" get ] 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
USING: kernel namespaces tools.test endian ;
IN: endian.tests
-[ t ] [ [ endianness get big-endian = ] with-big-endian ] unit-test
-[ t ] [ [ endianness get little-endian = ] with-little-endian ] unit-test
+{ t } [ [ endianness get big-endian = ] with-big-endian ] unit-test
+{ t } [ [ endianness get little-endian = ] with-little-endian ] unit-test
environment strings sequences ;
IN: environment.tests
-[ ] [ os-envs . ] unit-test
+{ } [ os-envs . ] unit-test
os unix? [
[ ] [ os-envs "envs" set ] unit-test
[ t ] [ os-envs "envs" get = ] unit-test
] when
-[ ] [ "factor-test-key-1" unset-os-env ] unit-test
-[ ] [ "ps3" "factor-test-key-1" set-os-env ] unit-test
-[ "ps3" ] [ "factor-test-key-1" os-env ] unit-test
-[ ] [ "factor-test-key-1" unset-os-env ] unit-test
-[ f ] [ "factor-test-key-1" os-env ] unit-test
+{ } [ "factor-test-key-1" unset-os-env ] unit-test
+{ } [ "ps3" "factor-test-key-1" set-os-env ] unit-test
+{ "ps3" } [ "factor-test-key-1" os-env ] unit-test
+{ } [ "factor-test-key-1" unset-os-env ] unit-test
+{ f } [ "factor-test-key-1" os-env ] unit-test
-[ ] [
+{ } [
32766 CHAR: a <string> "factor-test-key-long" set-os-env
] unit-test
-[ 32766 ] [ "factor-test-key-long" os-env length ] unit-test
-[ ] [ "factor-test-key-long" unset-os-env ] unit-test
+{ 32766 } [ "factor-test-key-long" os-env length ] unit-test
+{ } [ "factor-test-key-long" unset-os-env ] unit-test
-[ "abc" ] [
+{ "abc" } [
"a" "factor-test-key-change" set-os-env
"factor-test-key-change" [ "bc" append ] change-os-env
"factor-test-key-change" os-env
] unit-test
-[ ] [ "factor-test-key-change" unset-os-env ] unit-test
+{ } [ "factor-test-key-change" unset-os-env ] unit-test
! Issue #794, setting something to ``f`` is a memory protection fault on mac
-[ ] [ f "dummy-env-variable-for-factor-test" set-os-env ] unit-test
+{ } [ f "dummy-env-variable-for-factor-test" set-os-env ] unit-test
{ f "value" f } [
"factor-test-key" os-env
USING: eval tools.test ;
IN: eval.tests
-[ 4 ] [ "USE: math 2 2 +" eval( -- result ) ] unit-test
+{ 4 } [ "USE: math 2 2 +" eval( -- result ) ] unit-test
[ "USE: math 2 2 +" eval( -- ) ] must-fail
-[ "4\n" ] [ "USING: math prettyprint ; 2 2 + ." eval>string ] unit-test
+{ "4\n" } [ "USING: math prettyprint ; 2 2 + ." eval>string ] unit-test
disable-images? off
link-no-follow? off
-[ "Baz" ] [ "Foo/Bar/Baz" simple-link-title ] unit-test
-[ "Baz" ] [ "Baz" simple-link-title ] unit-test
+{ "Baz" } [ "Foo/Bar/Baz" simple-link-title ] unit-test
+{ "Baz" } [ "Baz" simple-link-title ] unit-test
-[ ] [
+{ } [
"abcd-*strong*\nasdifj\nweouh23ouh23" parse-farkup drop
] unit-test
-[ ] [
+{ } [
"abcd-*strong*\nasdifj\nweouh23ouh23\n" parse-farkup drop
] unit-test
-[ "<p>a-b</p>" ] [ "a-b" convert-farkup ] unit-test
-[ "<p><strong>foo</strong></p><p>bar</p>" ] [ "*foo\nbar\n" convert-farkup ] unit-test
-[ "<p><strong>Wow!</strong></p>" ] [ "*Wow!*" convert-farkup ] unit-test
-[ "<p><em>Wow.</em></p>" ] [ "_Wow._" convert-farkup ] unit-test
+{ "<p>a-b</p>" } [ "a-b" convert-farkup ] unit-test
+{ "<p><strong>foo</strong></p><p>bar</p>" } [ "*foo\nbar\n" convert-farkup ] unit-test
+{ "<p><strong>Wow!</strong></p>" } [ "*Wow!*" convert-farkup ] unit-test
+{ "<p><em>Wow.</em></p>" } [ "_Wow._" convert-farkup ] unit-test
-[ "<p><strong></strong></p>" ] [ "*" convert-farkup ] unit-test
-[ "<p>*</p>" ] [ "\\*" convert-farkup ] unit-test
-[ "<p>*<strong></strong></p>" ] [ "\\**" convert-farkup ] unit-test
+{ "<p><strong></strong></p>" } [ "*" convert-farkup ] unit-test
+{ "<p>*</p>" } [ "\\*" convert-farkup ] unit-test
+{ "<p>*<strong></strong></p>" } [ "\\**" convert-farkup ] unit-test
-[ "<ul><li>a-b</li></ul>" ] [ "-a-b" convert-farkup ] unit-test
-[ "<ul><li>foo</li></ul>" ] [ "-foo" convert-farkup ] unit-test
-[ "<ul><li>foo</li></ul>" ] [ "-foo\n" convert-farkup ] unit-test
-[ "<ul><li>foo</li><li>bar</li></ul>" ] [ "-foo\n-bar" convert-farkup ] unit-test
-[ "<ul><li>foo</li><li>bar</li></ul>" ] [ "-foo\n-bar\n" convert-farkup ] unit-test
+{ "<ul><li>a-b</li></ul>" } [ "-a-b" convert-farkup ] unit-test
+{ "<ul><li>foo</li></ul>" } [ "-foo" convert-farkup ] unit-test
+{ "<ul><li>foo</li></ul>" } [ "-foo\n" convert-farkup ] unit-test
+{ "<ul><li>foo</li><li>bar</li></ul>" } [ "-foo\n-bar" convert-farkup ] unit-test
+{ "<ul><li>foo</li><li>bar</li></ul>" } [ "-foo\n-bar\n" convert-farkup ] unit-test
-[ "<ul><li>foo</li></ul><p>bar</p>" ] [ "-foo\nbar\n" convert-farkup ] unit-test
+{ "<ul><li>foo</li></ul><p>bar</p>" } [ "-foo\nbar\n" convert-farkup ] unit-test
-[ "<ol><li>a-b</li></ol>" ] [ "#a-b" convert-farkup ] unit-test
-[ "<ol><li>foo</li></ol>" ] [ "#foo" convert-farkup ] unit-test
-[ "<ol><li>foo</li></ol>" ] [ "#foo\n" convert-farkup ] unit-test
-[ "<ol><li>foo</li><li>bar</li></ol>" ] [ "#foo\n#bar" convert-farkup ] unit-test
-[ "<ol><li>foo</li><li>bar</li></ol>" ] [ "#foo\n#bar\n" convert-farkup ] unit-test
+{ "<ol><li>a-b</li></ol>" } [ "#a-b" convert-farkup ] unit-test
+{ "<ol><li>foo</li></ol>" } [ "#foo" convert-farkup ] unit-test
+{ "<ol><li>foo</li></ol>" } [ "#foo\n" convert-farkup ] unit-test
+{ "<ol><li>foo</li><li>bar</li></ol>" } [ "#foo\n#bar" convert-farkup ] unit-test
+{ "<ol><li>foo</li><li>bar</li></ol>" } [ "#foo\n#bar\n" convert-farkup ] unit-test
-[ "<ol><li>foo</li></ol><p>bar</p>" ] [ "#foo\nbar\n" convert-farkup ] unit-test
+{ "<ol><li>foo</li></ol><p>bar</p>" } [ "#foo\nbar\n" convert-farkup ] unit-test
-[ "" ] [ "\n\n" convert-farkup ] unit-test
-[ "" ] [ "\r\n\r\n" convert-farkup ] unit-test
-[ "" ] [ "\r\r\r\r" convert-farkup ] unit-test
-[ "" ] [ "\r\r\r" convert-farkup ] unit-test
-[ "" ] [ "\n\n\n" convert-farkup ] unit-test
-[ "<p>foo</p><p>bar</p>" ] [ "foo\n\nbar" convert-farkup ] unit-test
-[ "<p>foo</p><p>bar</p>" ] [ "foo\r\n\r\nbar" convert-farkup ] unit-test
-[ "<p>foo</p><p>bar</p>" ] [ "foo\r\rbar" convert-farkup ] unit-test
-[ "<p>foo</p><p>bar</p>" ] [ "foo\r\r\nbar" convert-farkup ] unit-test
+{ "" } [ "\n\n" convert-farkup ] unit-test
+{ "" } [ "\r\n\r\n" convert-farkup ] unit-test
+{ "" } [ "\r\r\r\r" convert-farkup ] unit-test
+{ "" } [ "\r\r\r" convert-farkup ] unit-test
+{ "" } [ "\n\n\n" convert-farkup ] unit-test
+{ "<p>foo</p><p>bar</p>" } [ "foo\n\nbar" convert-farkup ] unit-test
+{ "<p>foo</p><p>bar</p>" } [ "foo\r\n\r\nbar" convert-farkup ] unit-test
+{ "<p>foo</p><p>bar</p>" } [ "foo\r\rbar" convert-farkup ] unit-test
+{ "<p>foo</p><p>bar</p>" } [ "foo\r\r\nbar" convert-farkup ] unit-test
-[ "<p>bar</p>" ] [ "\nbar\n" convert-farkup ] unit-test
-[ "<p>bar</p>" ] [ "\rbar\r" convert-farkup ] unit-test
-[ "<p>bar</p>" ] [ "\r\nbar\r\n" convert-farkup ] unit-test
+{ "<p>bar</p>" } [ "\nbar\n" convert-farkup ] unit-test
+{ "<p>bar</p>" } [ "\rbar\r" convert-farkup ] unit-test
+{ "<p>bar</p>" } [ "\r\nbar\r\n" convert-farkup ] unit-test
-[ "<p>foo</p><p>bar</p>" ] [ "foo\n\n\nbar" convert-farkup ] unit-test
+{ "<p>foo</p><p>bar</p>" } [ "foo\n\n\nbar" convert-farkup ] unit-test
-[ "" ] [ "" convert-farkup ] unit-test
+{ "" } [ "" convert-farkup ] unit-test
-[ "<table><tr><td>a</td></tr></table>" ]
+{ "<table><tr><td>a</td></tr></table>" }
[ "|a" convert-farkup ] unit-test
-[ "<table><tr><td>a</td></tr></table>" ]
+{ "<table><tr><td>a</td></tr></table>" }
[ "|a|" convert-farkup ] unit-test
-[ "<table><tr><td>a</td><td>b</td></tr></table>" ]
+{ "<table><tr><td>a</td><td>b</td></tr></table>" }
[ "|a|b|" convert-farkup ] unit-test
-[ "<table><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></table>" ]
+{ "<table><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></table>" }
[ "|a|b|\n|c|d|" convert-farkup ] unit-test
-[ "<table><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></table>" ]
+{ "<table><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></table>" }
[ "|a|b|\n|c|d|\n" convert-farkup ] unit-test
-[ "<p><strong>foo</strong></p><h1>aheading</h1><p>adfasd</p>" ]
+{ "<p><strong>foo</strong></p><h1>aheading</h1><p>adfasd</p>" }
[ "*foo*\n=aheading=\nadfasd" convert-farkup ] unit-test
-[ "<h1>foo</h1>" ] [ "=foo=\n" convert-farkup ] unit-test
-[ "<p>lol=foo=</p>" ] [ "lol=foo=\n" convert-farkup ] unit-test
-[ "<p>=foo</p>" ] [ "=foo\n" convert-farkup ] unit-test
-[ "<p>=foo</p>" ] [ "=foo" convert-farkup ] unit-test
-[ "<p>==foo</p>" ] [ "==foo" convert-farkup ] unit-test
-[ "<h1>foo</h1>" ] [ "==foo=" convert-farkup ] unit-test
-[ "<h2>foo</h2>" ] [ "==foo==" convert-farkup ] unit-test
-[ "<h2>foo</h2>" ] [ "==foo==" convert-farkup ] unit-test
-[ "<h2>foo</h2>" ] [ "===foo==" convert-farkup ] unit-test
-[ "<h1>foo</h1>" ] [ "=foo==" convert-farkup ] unit-test
-
-[ "<pre><span class=\"KEYWORD3\">int</span> <span class=\"FUNCTION\">main</span><span class=\"OPERATOR\">(</span><span class=\"OPERATOR\">)</span></pre>" ]
+{ "<h1>foo</h1>" } [ "=foo=\n" convert-farkup ] unit-test
+{ "<p>lol=foo=</p>" } [ "lol=foo=\n" convert-farkup ] unit-test
+{ "<p>=foo</p>" } [ "=foo\n" convert-farkup ] unit-test
+{ "<p>=foo</p>" } [ "=foo" convert-farkup ] unit-test
+{ "<p>==foo</p>" } [ "==foo" convert-farkup ] unit-test
+{ "<h1>foo</h1>" } [ "==foo=" convert-farkup ] unit-test
+{ "<h2>foo</h2>" } [ "==foo==" convert-farkup ] unit-test
+{ "<h2>foo</h2>" } [ "==foo==" convert-farkup ] unit-test
+{ "<h2>foo</h2>" } [ "===foo==" convert-farkup ] unit-test
+{ "<h1>foo</h1>" } [ "=foo==" convert-farkup ] unit-test
+
+{ "<pre><span class=\"KEYWORD3\">int</span> <span class=\"FUNCTION\">main</span><span class=\"OPERATOR\">(</span><span class=\"OPERATOR\">)</span></pre>" }
[ "[c{int main()}]" convert-farkup ] unit-test
-[ "<p><img src=\"lol.jpg\" alt=\"lol.jpg\"/></p>" ] [ "[[image:lol.jpg]]" convert-farkup ] unit-test
-[ "<p><img src=\"lol.jpg\" alt=\"teh lol\"/></p>" ] [ "[[image:lol.jpg|teh lol]]" convert-farkup ] unit-test
-[ "<p><a href=\"http://lol.com\">http://lol.com</a></p>" ] [ "[[http://lol.com]]" convert-farkup ] unit-test
-[ "<p><a href=\"http://lol.com\">haha</a></p>" ] [ "[[http://lol.com|haha]]" convert-farkup ] unit-test
-[ "<p><a href=\"http://lol.com/search?q=sex\">haha</a></p>" ] [ "[[http://lol.com/search?q=sex|haha]]" convert-farkup ] unit-test
-[ "<p><a href=\"Foo/Bar\">Bar</a></p>" ] [ "[[Foo/Bar]]" convert-farkup ] unit-test
+{ "<p><img src=\"lol.jpg\" alt=\"lol.jpg\"/></p>" } [ "[[image:lol.jpg]]" convert-farkup ] unit-test
+{ "<p><img src=\"lol.jpg\" alt=\"teh lol\"/></p>" } [ "[[image:lol.jpg|teh lol]]" convert-farkup ] unit-test
+{ "<p><a href=\"http://lol.com\">http://lol.com</a></p>" } [ "[[http://lol.com]]" convert-farkup ] unit-test
+{ "<p><a href=\"http://lol.com\">haha</a></p>" } [ "[[http://lol.com|haha]]" convert-farkup ] unit-test
+{ "<p><a href=\"http://lol.com/search?q=sex\">haha</a></p>" } [ "[[http://lol.com/search?q=sex|haha]]" convert-farkup ] unit-test
+{ "<p><a href=\"Foo/Bar\">Bar</a></p>" } [ "[[Foo/Bar]]" convert-farkup ] unit-test
"/wiki/view/" relative-link-prefix [
[ "<p><a href=\"/wiki/view/Foo/Bar\">Bar</a></p>" ] [ "[[Foo/Bar]]" convert-farkup ] unit-test
] with-variable
-[ ] [ "[{}]" convert-farkup drop ] unit-test
+{ } [ "[{}]" convert-farkup drop ] unit-test
-[ "<pre>hello</pre>" ] [ "[{hello}]" convert-farkup ] unit-test
+{ "<pre>hello</pre>" } [ "[{hello}]" convert-farkup ] unit-test
-[
+{
"<p>Feature comparison:</p><table><tr><td>a</td><td>Factor</td><td>Java</td><td>Lisp</td></tr><tr><td>Coolness</td><td>Yes</td><td>No</td><td>No</td></tr><tr><td>Badass</td><td>Yes</td><td>No</td><td>No</td></tr><tr><td>Enterprise</td><td>Yes</td><td>Yes</td><td>No</td></tr><tr><td>Kosher</td><td>Yes</td><td>No</td><td>Yes</td></tr></table>"
-] [ "Feature comparison:\n|a|Factor|Java|Lisp|\n|Coolness|Yes|No|No|\n|Badass|Yes|No|No|\n|Enterprise|Yes|Yes|No|\n|Kosher|Yes|No|Yes|\n" convert-farkup ] unit-test
+} [ "Feature comparison:\n|a|Factor|Java|Lisp|\n|Coolness|Yes|No|No|\n|Badass|Yes|No|No|\n|Enterprise|Yes|Yes|No|\n|Kosher|Yes|No|Yes|\n" convert-farkup ] unit-test
-[
+{
"<p>Feature comparison:</p><table><tr><td>a</td><td>Factor</td><td>Java</td><td>Lisp</td></tr><tr><td>Coolness</td><td>Yes</td><td>No</td><td>No</td></tr><tr><td>Badass</td><td>Yes</td><td>No</td><td>No</td></tr><tr><td>Enterprise</td><td>Yes</td><td>Yes</td><td>No</td></tr><tr><td>Kosher</td><td>Yes</td><td>No</td><td>Yes</td></tr></table>"
-] [ "Feature comparison:\n\n|a|Factor|Java|Lisp|\n|Coolness|Yes|No|No|\n|Badass|Yes|No|No|\n|Enterprise|Yes|Yes|No|\n|Kosher|Yes|No|Yes|\n" convert-farkup ] unit-test
+} [ "Feature comparison:\n\n|a|Factor|Java|Lisp|\n|Coolness|Yes|No|No|\n|Badass|Yes|No|No|\n|Enterprise|Yes|Yes|No|\n|Kosher|Yes|No|Yes|\n" convert-farkup ] unit-test
-[
+{
"<p>This wiki is written in <a href=\"Factor\">Factor</a> and is hosted on a <a href=\"http://linode.com\">http://linode.com</a> virtual server.</p>"
-] [
+} [
"This wiki is written in [[Factor]] and is hosted on a [[http://linode.com|http://linode.com]] virtual server."
convert-farkup
] unit-test
-[ "<p><a href=\"a\">a</a> <a href=\"b\">c</a></p>" ] [ "[[a]] [[b|c]]" convert-farkup ] unit-test
+{ "<p><a href=\"a\">a</a> <a href=\"b\">c</a></p>" } [ "[[a]] [[b|c]]" convert-farkup ] unit-test
-[ "<p><a href=\"C%2B%2B\">C++</a></p>" ] [ "[[C++]]" convert-farkup ] unit-test
+{ "<p><a href=\"C%2B%2B\">C++</a></p>" } [ "[[C++]]" convert-farkup ] unit-test
-[ "<p><foo></p>" ] [ "<foo>" convert-farkup ] unit-test
+{ "<p><foo></p>" } [ "<foo>" convert-farkup ] unit-test
-[ "<p>asdf</p><ul><li>lol</li><li>haha</li></ul>" ] [ "asdf\n-lol\n-haha" convert-farkup ] unit-test
+{ "<p>asdf</p><ul><li>lol</li><li>haha</li></ul>" } [ "asdf\n-lol\n-haha" convert-farkup ] unit-test
-[ "<p>asdf</p><ul><li>lol</li><li>haha</li></ul>" ]
+{ "<p>asdf</p><ul><li>lol</li><li>haha</li></ul>" }
[ "asdf\n\n-lol\n-haha" convert-farkup ] unit-test
-[ "<hr/>" ] [ "___" convert-farkup ] unit-test
-[ "<hr/>" ] [ "___\n" convert-farkup ] unit-test
+{ "<hr/>" } [ "___" convert-farkup ] unit-test
+{ "<hr/>" } [ "___\n" convert-farkup ] unit-test
-[ "<p>before:</p><pre><span class=\"OPERATOR\">{</span> <span class=\"DIGIT\">1</span> <span class=\"DIGIT\">2</span> <span class=\"DIGIT\">3</span> <span class=\"OPERATOR\">}</span> <span class=\"DIGIT\">1</span> tail</pre>" ]
+{ "<p>before:</p><pre><span class=\"OPERATOR\">{</span> <span class=\"DIGIT\">1</span> <span class=\"DIGIT\">2</span> <span class=\"DIGIT\">3</span> <span class=\"OPERATOR\">}</span> <span class=\"DIGIT\">1</span> tail</pre>" }
[ "before:\n[factor{{ 1 2 3 } 1 tail}]" convert-farkup ] unit-test
-[ "<p><a href=\"Factor\">Factor</a>-rific!</p>" ]
+{ "<p><a href=\"Factor\">Factor</a>-rific!</p>" }
[ "[[Factor]]-rific!" convert-farkup ] unit-test
-[ "<pre> 1 2 3 </pre>" ]
+{ "<pre> 1 2 3 </pre>" }
[ "[ factor { 1 2 3 }]" convert-farkup ] unit-test
-[ "<p>paragraph</p><hr/>" ]
+{ "<p>paragraph</p><hr/>" }
[ "paragraph\n___" convert-farkup ] unit-test
-[ "<p>paragraph</p><p> a <em></em><em> b</em></p>" ]
+{ "<p>paragraph</p><p> a <em></em><em> b</em></p>" }
[ "paragraph\n a ___ b" convert-farkup ] unit-test
-[ "<ul><li> a</li></ul><hr/>" ]
+{ "<ul><li> a</li></ul><hr/>" }
[ "\n- a\n___" convert-farkup ] unit-test
-[ "<p>hello<em>world how are you today?</em></p><ul><li> hello<em>world how are you today?</em></li></ul>" ]
+{ "<p>hello<em>world how are you today?</em></p><ul><li> hello<em>world how are you today?</em></li></ul>" }
[ "hello_world how are you today?\n- hello_world how are you today?" convert-farkup ] unit-test
: check-link-escaping ( string -- link )
convert-farkup string>xml-chunk
"a" deep-tag-named "href" attr url-decode ;
-[ "Trader Joe\"s" ] [ "[[Trader Joe\"s]]" check-link-escaping ] unit-test
-[ "<foo>" ] [ "[[<foo>]]" check-link-escaping ] unit-test
-[ "&blah;" ] [ "[[&blah;]]" check-link-escaping ] unit-test
-[ "C++" ] [ "[[C++]]" check-link-escaping ] unit-test
+{ "Trader Joe\"s" } [ "[[Trader Joe\"s]]" check-link-escaping ] unit-test
+{ "<foo>" } [ "[[<foo>]]" check-link-escaping ] unit-test
+{ "&blah;" } [ "[[&blah;]]" check-link-escaping ] unit-test
+{ "C++" } [ "[[C++]]" check-link-escaping ] unit-test
-[ "<h1>The <em>important</em> thing</h1>" ] [ "=The _important_ thing=" convert-farkup ] unit-test
-[ "<p><a href=\"Foo\"><strong>emphasized</strong> text</a></p>" ] [ "[[Foo|*emphasized* text]]" convert-farkup ] unit-test
-[ "<table><tr><td><strong>bold</strong></td><td><em>italics</em></td></tr></table>" ]
+{ "<h1>The <em>important</em> thing</h1>" } [ "=The _important_ thing=" convert-farkup ] unit-test
+{ "<p><a href=\"Foo\"><strong>emphasized</strong> text</a></p>" } [ "[[Foo|*emphasized* text]]" convert-farkup ] unit-test
+{ "<table><tr><td><strong>bold</strong></td><td><em>italics</em></td></tr></table>" }
[ "|*bold*|_italics_|" convert-farkup ] unit-test
-[ "<p><em>italics<strong>both</strong></em></p>" ] [ "_italics*both" convert-farkup ] unit-test
-[ "<p><em>italics<strong>both</strong></em></p>" ] [ "_italics*both*" convert-farkup ] unit-test
-[ "<p><em>italics<strong>both</strong></em></p>" ] [ "_italics*both*_" convert-farkup ] unit-test
-[ "<p><em>italics<strong>both</strong></em></p>" ] [ "_italics*both_" convert-farkup ] unit-test
-[ "<p><em>italics<strong>both</strong></em>after<strong></strong></p>" ] [ "_italics*both_after*" convert-farkup ] unit-test
-[ "<table><tr><td>foo|bar</td></tr></table>" ] [ "|foo\\|bar|" convert-farkup ] unit-test
-[ "<p></p>" ] [ "\\" convert-farkup ] unit-test
+{ "<p><em>italics<strong>both</strong></em></p>" } [ "_italics*both" convert-farkup ] unit-test
+{ "<p><em>italics<strong>both</strong></em></p>" } [ "_italics*both*" convert-farkup ] unit-test
+{ "<p><em>italics<strong>both</strong></em></p>" } [ "_italics*both*_" convert-farkup ] unit-test
+{ "<p><em>italics<strong>both</strong></em></p>" } [ "_italics*both_" convert-farkup ] unit-test
+{ "<p><em>italics<strong>both</strong></em>after<strong></strong></p>" } [ "_italics*both_after*" convert-farkup ] unit-test
+{ "<table><tr><td>foo|bar</td></tr></table>" } [ "|foo\\|bar|" convert-farkup ] unit-test
+{ "<p></p>" } [ "\\" convert-farkup ] unit-test
-[ "<p>[abc]</p>" ] [ "[abc]" convert-farkup ] unit-test
+{ "<p>[abc]</p>" } [ "[abc]" convert-farkup ] unit-test
: random-markup ( -- string )
10 [
] if
] replicate concat ;
-[ t ] [
+{ t } [
100 [
drop random-markup
[ convert-farkup drop t ] [ drop print f ] recover
] all-integers?
] unit-test
-[ "<p><a href=\"http://foo.com/~foo\">http://foo.com/~foo</a></p>" ] [ "[[http://foo.com/~foo]]" convert-farkup ] unit-test
+{ "<p><a href=\"http://foo.com/~foo\">http://foo.com/~foo</a></p>" } [ "[[http://foo.com/~foo]]" convert-farkup ] unit-test
[ "%s" printf ] must-infer
[ "%s" sprintf ] must-infer
-[ "" ] [ "" sprintf ] unit-test
-[ "asdf" ] [ "asdf" sprintf ] unit-test
-[ "10" ] [ 10 "%d" sprintf ] unit-test
-[ "+10" ] [ 10 "%+d" sprintf ] unit-test
-[ "-10" ] [ -10 "%d" sprintf ] unit-test
-[ " 23" ] [ 23 "% d" sprintf ] unit-test
-[ "-23" ] [ -23 "% d" sprintf ] unit-test
-[ " -10" ] [ -10 "%5d" sprintf ] unit-test
-[ "-0010" ] [ -10 "%05d" sprintf ] unit-test
-[ "+0010" ] [ 10 "%+05d" sprintf ] unit-test
-[ "123.456000" ] [ 123.456 "%f" sprintf ] unit-test
-[ "2.44" ] [ 2.436 "%.2f" sprintf ] unit-test
-[ "8.950" ] [ 8.950179003580072 "%.3f" sprintf ] unit-test
-[ "123.10" ] [ 123.1 "%01.2f" sprintf ] unit-test
-[ "1.2346" ] [ 1.23456789 "%.4f" sprintf ] unit-test
-[ " 1.23" ] [ 1.23456789 "%6.2f" sprintf ] unit-test
-[ "001100" ] [ 12 "%06b" sprintf ] unit-test
-[ "==14" ] [ 12 "%'=4o" sprintf ] unit-test
+{ "" } [ "" sprintf ] unit-test
+{ "asdf" } [ "asdf" sprintf ] unit-test
+{ "10" } [ 10 "%d" sprintf ] unit-test
+{ "+10" } [ 10 "%+d" sprintf ] unit-test
+{ "-10" } [ -10 "%d" sprintf ] unit-test
+{ " 23" } [ 23 "% d" sprintf ] unit-test
+{ "-23" } [ -23 "% d" sprintf ] unit-test
+{ " -10" } [ -10 "%5d" sprintf ] unit-test
+{ "-0010" } [ -10 "%05d" sprintf ] unit-test
+{ "+0010" } [ 10 "%+05d" sprintf ] unit-test
+{ "123.456000" } [ 123.456 "%f" sprintf ] unit-test
+{ "2.44" } [ 2.436 "%.2f" sprintf ] unit-test
+{ "8.950" } [ 8.950179003580072 "%.3f" sprintf ] unit-test
+{ "123.10" } [ 123.1 "%01.2f" sprintf ] unit-test
+{ "1.2346" } [ 1.23456789 "%.4f" sprintf ] unit-test
+{ " 1.23" } [ 1.23456789 "%6.2f" sprintf ] unit-test
+{ "001100" } [ 12 "%06b" sprintf ] unit-test
+{ "==14" } [ 12 "%'=4o" sprintf ] unit-test
{ "foo: 1 bar: 2" } [ { 1 2 3 } "foo: %d bar: %s" vsprintf ] unit-test
-[ "1.234000e+08" ] [ 123400000 "%e" sprintf ] unit-test
-[ "-1.234000e+08" ] [ -123400000 "%e" sprintf ] unit-test
-[ "1.234567e+08" ] [ 123456700 "%e" sprintf ] unit-test
-[ "3.625e+08" ] [ 362525200 "%.3e" sprintf ] unit-test
-[ "2.500000e-03" ] [ 0.0025 "%e" sprintf ] unit-test
-[ "2.500000E-03" ] [ 0.0025 "%E" sprintf ] unit-test
-[ " 1.0E+01" ] [ 10 "%10.1E" sprintf ] unit-test
-[ " -1.0E+01" ] [ -10 "%10.1E" sprintf ] unit-test
-[ " -1.0E+01" ] [ -10 "%+10.1E" sprintf ] unit-test
-[ " +1.0E+01" ] [ 10 "%+10.1E" sprintf ] unit-test
-[ "-001.0E+01" ] [ -10 "%+010.1E" sprintf ] unit-test
-[ "+001.0E+01" ] [ 10 "%+010.1E" sprintf ] unit-test
+{ "1.234000e+08" } [ 123400000 "%e" sprintf ] unit-test
+{ "-1.234000e+08" } [ -123400000 "%e" sprintf ] unit-test
+{ "1.234567e+08" } [ 123456700 "%e" sprintf ] unit-test
+{ "3.625e+08" } [ 362525200 "%.3e" sprintf ] unit-test
+{ "2.500000e-03" } [ 0.0025 "%e" sprintf ] unit-test
+{ "2.500000E-03" } [ 0.0025 "%E" sprintf ] unit-test
+{ " 1.0E+01" } [ 10 "%10.1E" sprintf ] unit-test
+{ " -1.0E+01" } [ -10 "%10.1E" sprintf ] unit-test
+{ " -1.0E+01" } [ -10 "%+10.1E" sprintf ] unit-test
+{ " +1.0E+01" } [ 10 "%+10.1E" sprintf ] unit-test
+{ "-001.0E+01" } [ -10 "%+010.1E" sprintf ] unit-test
+{ "+001.0E+01" } [ 10 "%+010.1E" sprintf ] unit-test
-[ "ff" ] [ 0xff "%x" sprintf ] unit-test
-[ "FF" ] [ 0xff "%X" sprintf ] unit-test
-[ "0f" ] [ 0xf "%02x" sprintf ] unit-test
-[ "0F" ] [ 0xf "%02X" sprintf ] unit-test
-[ "2008-09-10" ] [ 2008 9 10 "%04d-%02d-%02d" sprintf ] unit-test
-[ "Hello, World!" ] [ "Hello, World!" "%s" sprintf ] unit-test
-[ "printf test" ] [ "printf test" sprintf ] unit-test
-[ "char a = 'a'" ] [ CHAR: a "char %c = 'a'" sprintf ] unit-test
-[ "00" ] [ 0x0 "%02x" sprintf ] unit-test
-[ "ff" ] [ 0xff "%02x" sprintf ] unit-test
-[ "0 message(s)" ] [ 0 "message" "%d %s(s)" sprintf ] unit-test
-[ "0 message(s) with %" ] [ 0 "message" "%d %s(s) with %%" sprintf ] unit-test
-[ "justif: \"left \"" ] [ "left" "justif: \"%-10s\"" sprintf ] unit-test
-[ "justif: \" right\"" ] [ "right" "justif: \"%10s\"" sprintf ] unit-test
-[ " 3: 0003 zero padded" ] [ 3 " 3: %04d zero padded" sprintf ] unit-test
-[ " 3: 3 left justif" ] [ 3 " 3: %-4d left justif" sprintf ] unit-test
-[ " 3: 3 right justif" ] [ 3 " 3: %4d right justif" sprintf ] unit-test
-[ " -3: -003 zero padded" ] [ -3 " -3: %04d zero padded" sprintf ] unit-test
-[ " -3: -3 left justif" ] [ -3 " -3: %-4d left justif" sprintf ] unit-test
-[ " -3: -3 right justif" ] [ -3 " -3: %4d right justif" sprintf ] unit-test
-[ "There are 10 monkeys in the kitchen" ] [ 10 "kitchen" "There are %d monkeys in the %s" sprintf ] unit-test
-[ "10" ] [ 10 "%d" sprintf ] unit-test
-[ "[monkey]" ] [ "monkey" "[%s]" sprintf ] unit-test
-[ "[ monkey]" ] [ "monkey" "[%10s]" sprintf ] unit-test
-[ "[monkey ]" ] [ "monkey" "[%-10s]" sprintf ] unit-test
-[ "[0000monkey]" ] [ "monkey" "[%010s]" sprintf ] unit-test
-[ "[####monkey]" ] [ "monkey" "[%'#10s]" sprintf ] unit-test
-[ "[many monke]" ] [ "many monkeys" "[%10.10s]" sprintf ] unit-test
+{ "ff" } [ 0xff "%x" sprintf ] unit-test
+{ "FF" } [ 0xff "%X" sprintf ] unit-test
+{ "0f" } [ 0xf "%02x" sprintf ] unit-test
+{ "0F" } [ 0xf "%02X" sprintf ] unit-test
+{ "2008-09-10" } [ 2008 9 10 "%04d-%02d-%02d" sprintf ] unit-test
+{ "Hello, World!" } [ "Hello, World!" "%s" sprintf ] unit-test
+{ "printf test" } [ "printf test" sprintf ] unit-test
+{ "char a = 'a'" } [ CHAR: a "char %c = 'a'" sprintf ] unit-test
+{ "00" } [ 0x0 "%02x" sprintf ] unit-test
+{ "ff" } [ 0xff "%02x" sprintf ] unit-test
+{ "0 message(s)" } [ 0 "message" "%d %s(s)" sprintf ] unit-test
+{ "0 message(s) with %" } [ 0 "message" "%d %s(s) with %%" sprintf ] unit-test
+{ "justif: \"left \"" } [ "left" "justif: \"%-10s\"" sprintf ] unit-test
+{ "justif: \" right\"" } [ "right" "justif: \"%10s\"" sprintf ] unit-test
+{ " 3: 0003 zero padded" } [ 3 " 3: %04d zero padded" sprintf ] unit-test
+{ " 3: 3 left justif" } [ 3 " 3: %-4d left justif" sprintf ] unit-test
+{ " 3: 3 right justif" } [ 3 " 3: %4d right justif" sprintf ] unit-test
+{ " -3: -003 zero padded" } [ -3 " -3: %04d zero padded" sprintf ] unit-test
+{ " -3: -3 left justif" } [ -3 " -3: %-4d left justif" sprintf ] unit-test
+{ " -3: -3 right justif" } [ -3 " -3: %4d right justif" sprintf ] unit-test
+{ "There are 10 monkeys in the kitchen" } [ 10 "kitchen" "There are %d monkeys in the %s" sprintf ] unit-test
+{ "10" } [ 10 "%d" sprintf ] unit-test
+{ "[monkey]" } [ "monkey" "[%s]" sprintf ] unit-test
+{ "[ monkey]" } [ "monkey" "[%10s]" sprintf ] unit-test
+{ "[monkey ]" } [ "monkey" "[%-10s]" sprintf ] unit-test
+{ "[0000monkey]" } [ "monkey" "[%010s]" sprintf ] unit-test
+{ "[####monkey]" } [ "monkey" "[%'#10s]" sprintf ] unit-test
+{ "[many monke]" } [ "many monkeys" "[%10.10s]" sprintf ] unit-test
-[ "{ 1, 2, 3 }" ] [ { 1 2 3 } "%[%s, %]" sprintf ] unit-test
-[ "{ 1:2, 3:4 }" ] [ H{ { 1 2 } { 3 4 } } "%[%s: %s %]" sprintf ] unit-test
+{ "{ 1, 2, 3 }" } [ { 1 2 3 } "%[%s, %]" sprintf ] unit-test
+{ "{ 1:2, 3:4 }" } [ H{ { 1 2 } { 3 4 } } "%[%s: %s %]" sprintf ] unit-test
[ "%H:%M:%S" strftime ] must-infer
: testtime ( -- timestamp )
2008 10 9 12 3 15 instant <timestamp> ;
-[ t ] [ "12:03:15" testtime "%H:%M:%S" strftime = ] unit-test
-[ t ] [ "12:03:15" testtime "%X" strftime = ] unit-test
-[ t ] [ "10/09/2008" testtime "%m/%d/%Y" strftime = ] unit-test
-[ t ] [ "10/09/2008" testtime "%x" strftime = ] unit-test
-[ t ] [ "10/09/08" testtime "%m/%d/%y" strftime = ] unit-test
-[ t ] [ "Thu" testtime "%a" strftime = ] unit-test
-[ t ] [ "Thursday" testtime "%A" strftime = ] unit-test
-[ t ] [ "Oct" testtime "%b" strftime = ] unit-test
-[ t ] [ "October" testtime "%B" strftime = ] unit-test
-[ t ] [ "Thu Oct 09 12:03:15 2008" testtime "%c" strftime = ] unit-test
-[ t ] [ "PM" testtime "%p" strftime = ] unit-test
+{ t } [ "12:03:15" testtime "%H:%M:%S" strftime = ] unit-test
+{ t } [ "12:03:15" testtime "%X" strftime = ] unit-test
+{ t } [ "10/09/2008" testtime "%m/%d/%Y" strftime = ] unit-test
+{ t } [ "10/09/2008" testtime "%x" strftime = ] unit-test
+{ t } [ "10/09/08" testtime "%m/%d/%y" strftime = ] unit-test
+{ t } [ "Thu" testtime "%a" strftime = ] unit-test
+{ t } [ "Thursday" testtime "%A" strftime = ] unit-test
+{ t } [ "Oct" testtime "%b" strftime = ] unit-test
+{ t } [ "October" testtime "%B" strftime = ] unit-test
+{ t } [ "Thu Oct 09 12:03:15 2008" testtime "%c" strftime = ] unit-test
+{ t } [ "PM" testtime "%p" strftime = ] unit-test
SYMBOLS: a b c d e f g h ;
-[ [ ] ] [ '[ ] ] unit-test
-[ [ + ] ] [ '[ + ] ] unit-test
-[ [ 1 ] ] [ 1 '[ _ ] ] unit-test
-[ [ 1 ] ] [ [ 1 ] '[ @ ] ] unit-test
-[ [ 1 2 ] ] [ [ 1 ] [ 2 ] '[ @ @ ] ] unit-test
+{ [ ] } [ '[ ] ] unit-test
+{ [ + ] } [ '[ + ] ] unit-test
+{ [ 1 ] } [ 1 '[ _ ] ] unit-test
+{ [ 1 ] } [ [ 1 ] '[ @ ] ] unit-test
+{ [ 1 2 ] } [ [ 1 ] [ 2 ] '[ @ @ ] ] unit-test
-[ [ 1 2 a ] ] [ 1 2 '[ _ _ a ] ] unit-test
-[ [ 1 2 ] ] [ 1 2 '[ _ _ ] ] unit-test
-[ [ a 1 2 ] ] [ 1 2 '[ a _ _ ] ] unit-test
-[ [ 1 2 a ] ] [ [ 1 ] [ 2 ] '[ @ @ a ] ] unit-test
-[ [ 1 a 2 b ] ] [ 1 2 '[ _ a _ b ] ] unit-test
-[ [ 1 a 2 b ] ] [ 1 [ 2 ] '[ _ a @ b ] ] unit-test
-[ [ a 1 b ] ] [ 1 '[ a _ b ] ] unit-test
+{ [ 1 2 a ] } [ 1 2 '[ _ _ a ] ] unit-test
+{ [ 1 2 ] } [ 1 2 '[ _ _ ] ] unit-test
+{ [ a 1 2 ] } [ 1 2 '[ a _ _ ] ] unit-test
+{ [ 1 2 a ] } [ [ 1 ] [ 2 ] '[ @ @ a ] ] unit-test
+{ [ 1 a 2 b ] } [ 1 2 '[ _ a _ b ] ] unit-test
+{ [ 1 a 2 b ] } [ 1 [ 2 ] '[ _ a @ b ] ] unit-test
+{ [ a 1 b ] } [ 1 '[ a _ b ] ] unit-test
-[ [ a 1 b ] ] [ [ 1 ] '[ a @ b ] ] unit-test
-[ [ a 1 2 ] ] [ [ 1 ] [ 2 ] '[ a @ @ ] ] unit-test
+{ [ a 1 b ] } [ [ 1 ] '[ a @ b ] ] unit-test
+{ [ a 1 2 ] } [ [ 1 ] [ 2 ] '[ a @ @ ] ] unit-test
-[ [ a [ 1 ] b ] ] [ 1 '[ a [ _ ] b ] ] unit-test
-[ [ a 1 b [ c 2 d ] e 3 f ] ] [ 1 2 3 '[ a _ b [ c _ d ] e _ f ] ] unit-test
-[ [ a 1 b [ c 2 d [ e 3 f ] ] g 4 h ] ] [ 1 2 3 4 '[ a _ b [ c _ d [ e _ f ] ] g _ h ] ] unit-test
-[ [ a 1 b [ [ c 2 d ] e 3 f ] g 4 h ] ] [ 1 2 3 4 '[ a _ b [ [ c _ d ] e _ f ] g _ h ] ] unit-test
+{ [ a [ 1 ] b ] } [ 1 '[ a [ _ ] b ] ] unit-test
+{ [ a 1 b [ c 2 d ] e 3 f ] } [ 1 2 3 '[ a _ b [ c _ d ] e _ f ] ] unit-test
+{ [ a 1 b [ c 2 d [ e 3 f ] ] g 4 h ] } [ 1 2 3 4 '[ a _ b [ c _ d [ e _ f ] ] g _ h ] ] unit-test
+{ [ a 1 b [ [ c 2 d ] e 3 f ] g 4 h ] } [ 1 2 3 4 '[ a _ b [ [ c _ d ] e _ f ] g _ h ] ] unit-test
-[ [ 3 + ] ] [ 3 '[ _ + ] ] unit-test
+{ [ 3 + ] } [ 3 '[ _ + ] ] unit-test
-[ [ 1 3 + ] ] [ 1 3 '[ _ _ + ] ] unit-test
+{ [ 1 3 + ] } [ 1 3 '[ _ _ + ] ] unit-test
-[ [ 1 + ] ] [ 1 [ + ] '[ _ @ ] ] unit-test
+{ [ 1 + ] } [ 1 [ + ] '[ _ @ ] ] unit-test
-[ [ 1 + . ] ] [ 1 [ + ] '[ _ @ . ] ] unit-test
+{ [ 1 + . ] } [ 1 [ + ] '[ _ @ . ] ] unit-test
-[ [ + - ] ] [ [ + ] [ - ] '[ @ @ ] ] unit-test
+{ [ + - ] } [ [ + ] [ - ] '[ @ @ ] ] unit-test
-[ [ "a" write "b" print ] ]
+{ [ "a" write "b" print ] }
[ "a" "b" '[ _ write _ print ] ] unit-test
-[ 1/2 ] [
+{ 1/2 } [
1 '[ [ _ ] dip / ] 2 swap call
] unit-test
-[ { { 1 "a" "A" } { 1 "b" "B" } { 1 "c" "C" } } ] [
+{ { { 1 "a" "A" } { 1 "b" "B" } { 1 "c" "C" } } } [
1 '[ [ _ ] 2dip 3array ]
{ "a" "b" "c" } { "A" "B" "C" } rot 2map
] unit-test
-[ { { 1 "a" } { 1 "b" } { 1 "c" } } ] [
+{ { { 1 "a" } { 1 "b" } { 1 "c" } } } [
'[ [ 1 ] dip 2array ]
{ "a" "b" "c" } swap map
] unit-test
-[ { { 1 "a" 2 } { 1 "b" 2 } { 1 "c" 2 } } ] [
+{ { { 1 "a" 2 } { 1 "b" 2 } { 1 "c" 2 } } } [
1 2 '[ [ _ ] dip _ 3array ]
{ "a" "b" "c" } swap map
] unit-test
: funny-dip ( obj quot -- ) '[ [ @ ] dip ] call ; inline
-[ "hi" 3 ] [ "h" "i" 3 [ append ] funny-dip ] unit-test
+{ "hi" 3 } [ "h" "i" 3 [ append ] funny-dip ] unit-test
-[ { 1 2 3 } ] [
+{ { 1 2 3 } } [
3 1 '[ _ iota [ _ + ] map ] call
] unit-test
-[ { 1 { 2 { 3 } } } ] [
+{ { 1 { 2 { 3 } } } } [
1 2 3 '[ _ [ _ [ _ 1array ] call 2array ] call 2array ] call
] unit-test
{ 1 1 } [ '[ [ [ _ ] ] ] ] must-infer-as
-[ { { { 3 } } } ] [
+{ { { { 3 } } } } [
3 '[ [ [ _ 1array ] call 1array ] call 1array ] call
] unit-test
-[ { { { 3 } } } ] [
+{ { { { 3 } } } } [
3 '[ [ [ _ 1array ] call 1array ] call 1array ] call
] unit-test
[ "USING: fry locals.backend ; f '[ load-local _ ]" eval( -- quot ) ]
[ error>> >r/r>-in-fry-error? ] must-fail-with
-[ { { "a" 1 } { "b" 2 } { "c" 3 } { "d" 4 } } ] [
+{ { { "a" 1 } { "b" 2 } { "c" 3 } { "d" 4 } } } [
1 2 3 4 '[ "a" _ 2array "b" _ 2array "c" _ 2array "d" _ 2array 4array ] call
] 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
"$funny-dispatcher" resolve-base-path
<text-content> ;
-[ ] [
+{ } [
<dispatcher>
<dispatcher>
<funny-dispatcher>
main-responder set
] unit-test
-[ "/a/b/" ] [
+{ "/a/b/" } [
V{ } responder-nesting set
"a/b/c" split-path main-responder get call-responder body>>
] unit-test
-[ "<input type=\"hidden\" value=\"&&&\" name=\"foo\"/>" ]
+{ "<input type=\"hidden\" value=\"&&&\" name=\"foo\"/>" }
[ "&&&" "foo" hidden-form-field xml>string ]
unit-test
-[ f ] [ <request> request [ referrer ] with-variable ] unit-test
+{ f } [ <request> request [ referrer ] with-variable ] unit-test
-[ t ] [ URL" http://foo" dup url [ same-host? ] with-variable ] unit-test
+{ t } [ URL" http://foo" dup url [ same-host? ] with-variable ] unit-test
-[ f ] [ f URL" http://foo" url [ same-host? ] with-variable ] unit-test
+{ f } [ f URL" http://foo" url [ same-host? ] with-variable ] unit-test
[ ] [ 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
{ 17 } [ 3 1 3 3 7 5 nsum ] unit-test
{ 4 1 } [ 4 nsum ] must-infer-as
-[ "e1" "o1" "o2" "e2" "o1" "o2" ] [ "e1" "e2" "o1" "o2" 2 nweave ] unit-test
+{ "e1" "o1" "o2" "e2" "o1" "o2" } [ "e1" "e2" "o1" "o2" 2 nweave ] unit-test
{ 3 5 } [ 2 nweave ] must-infer-as
{ { 0 1 2 } { 3 5 4 } { 7 8 6 } }
USING: arrays tools.test globs io.pathnames sequences ;
IN: globs.tests
-[ f ] [ "abd" "fdf" glob-matches? ] unit-test
-[ f ] [ "fdsafas" "?" glob-matches? ] unit-test
-[ t ] [ "fdsafas" "*as" glob-matches? ] unit-test
-[ t ] [ "fdsafas" "*a*" glob-matches? ] unit-test
-[ t ] [ "fdsafas" "*a?" glob-matches? ] unit-test
-[ t ] [ "fdsafas" "*?" glob-matches? ] unit-test
-[ f ] [ "fdsafas" "*s?" glob-matches? ] unit-test
-[ t ] [ "a" "[abc]" glob-matches? ] unit-test
-[ f ] [ "a" "[^abc]" glob-matches? ] unit-test
-[ t ] [ "d" "[^abc]" glob-matches? ] unit-test
-[ f ] [ "foo.java" "*.{xml,txt}" glob-matches? ] unit-test
-[ t ] [ "foo.txt" "*.{xml,txt}" glob-matches? ] unit-test
-[ t ] [ "foo.xml" "*.{xml,txt}" glob-matches? ] unit-test
-[ f ] [ "foo." "*.{xml,txt}" glob-matches? ] unit-test
-[ t ] [ "foo." "*.{,xml,txt}" glob-matches? ] unit-test
-[ t ] [ "foo.{" "*.{" glob-matches? ] unit-test
+{ f } [ "abd" "fdf" glob-matches? ] unit-test
+{ f } [ "fdsafas" "?" glob-matches? ] unit-test
+{ t } [ "fdsafas" "*as" glob-matches? ] unit-test
+{ t } [ "fdsafas" "*a*" glob-matches? ] unit-test
+{ t } [ "fdsafas" "*a?" glob-matches? ] unit-test
+{ t } [ "fdsafas" "*?" glob-matches? ] unit-test
+{ f } [ "fdsafas" "*s?" glob-matches? ] unit-test
+{ t } [ "a" "[abc]" glob-matches? ] unit-test
+{ f } [ "a" "[^abc]" glob-matches? ] unit-test
+{ t } [ "d" "[^abc]" glob-matches? ] unit-test
+{ f } [ "foo.java" "*.{xml,txt}" glob-matches? ] unit-test
+{ t } [ "foo.txt" "*.{xml,txt}" glob-matches? ] unit-test
+{ t } [ "foo.xml" "*.{xml,txt}" glob-matches? ] unit-test
+{ f } [ "foo." "*.{xml,txt}" glob-matches? ] unit-test
+{ t } [ "foo." "*.{,xml,txt}" glob-matches? ] unit-test
+{ t } [ "foo.{" "*.{" glob-matches? ] unit-test
-[ f ] [ "foo" "bar" append-path "*" glob-matches? ] unit-test
-[ t ] [ "foo" "bar" append-path "*" "*" append-path glob-matches? ] unit-test
-[ f ] [ "foo" "bar" append-path "foo?bar" glob-matches? ] unit-test
-[ t ] [ "foo" "bar" append-path "fo?" "bar" append-path glob-matches? ] unit-test
+{ f } [ "foo" "bar" append-path "*" glob-matches? ] unit-test
+{ t } [ "foo" "bar" append-path "*" "*" append-path glob-matches? ] unit-test
+{ f } [ "foo" "bar" append-path "foo?bar" glob-matches? ] unit-test
+{ t } [ "foo" "bar" append-path "fo?" "bar" append-path glob-matches? ] unit-test
-[ f ] [ "foo" glob-pattern? ] unit-test
-[ t ] [ "fo?" glob-pattern? ] unit-test
-[ t ] [ "fo*" glob-pattern? ] unit-test
-[ t ] [ "fo[mno]" glob-pattern? ] unit-test
-[ t ] [ "fo\\*" glob-pattern? ] unit-test
-[ t ] [ "fo{o,bro}" glob-pattern? ] unit-test
+{ f } [ "foo" glob-pattern? ] unit-test
+{ t } [ "fo?" glob-pattern? ] unit-test
+{ t } [ "fo*" glob-pattern? ] unit-test
+{ t } [ "fo[mno]" glob-pattern? ] unit-test
+{ t } [ "fo\\*" glob-pattern? ] unit-test
+{ t } [ "fo{o,bro}" glob-pattern? ] unit-test
-{ "foo" "bar" } path-separator join 1array
+{ "foo" "bar" } path-separator join }
[ { "foo" "bar" "ba?" } path-separator join glob-parent-directory ] unit-test
-[ "foo" ]
+{ "foo" }
[ { "foo" "b?r" "bas" } path-separator join glob-parent-directory ] unit-test
-[ "" ]
+{ "" }
[ { "f*" "bar" "bas" } path-separator join glob-parent-directory ] unit-test
H{ } "g" set
{ 1 2 3 } "v" set
-[ ] [ "v" dup get "g" get add-vertex ] unit-test
+{ } [ "v" dup get "g" get add-vertex ] unit-test
-[ { "v" } ] [ 1 "g" get at keys ] unit-test
+{ { "v" } } [ 1 "g" get at keys ] unit-test
H{
{ 1 H{ { 1 1 } { 2 2 } } }
{ 4 H{ { 4 4 } { 5 5 } } }
} "g" set
-[ { 2 3 4 5 } ] [
+{ { 2 3 4 5 } } [
2 [ "g" get at ] closure keys natural-sort
] unit-test
H{ } "g" set
-[ ] [
+{ } [
"mary"
H{ { "billy" "one" } { "joey" "two" } }
"g" get add-vertex*
] unit-test
-[ H{ { "mary" "one" } } ] [
+{ H{ { "mary" "one" } } } [
"billy" "g" get at
] unit-test
-[ ] [
+{ } [
"liz"
H{ { "billy" "four" } { "fred" "three" } }
"g" get add-vertex*
] unit-test
-[ H{ { "mary" "one" } { "liz" "four" } } ] [
+{ H{ { "mary" "one" } { "liz" "four" } } } [
"billy" "g" get at
] unit-test
-[ ] [
+{ } [
"mary"
H{ { "billy" "one" } { "joey" "two" } }
"g" get remove-vertex*
] unit-test
-[ H{ { "liz" "four" } } ] [
+{ H{ { "liz" "four" } } } [
"billy" "g" get at
] unit-test
[ { 1 2 3 } 0 group ] must-fail
-[ { "hell" "o wo" "rld" } ] [ "hello world" 4 group ] unit-test
+{ { "hell" "o wo" "rld" } } [ "hello world" 4 group ] unit-test
-[ 0 ] [ { } 2 <clumps> length ] unit-test
-[ 0 ] [ { 1 } 2 <clumps> length ] unit-test
-[ 1 ] [ { 1 2 } 2 <clumps> length ] unit-test
-[ 2 ] [ { 1 2 3 } 2 <clumps> length ] unit-test
+{ 0 } [ { } 2 <clumps> length ] unit-test
+{ 0 } [ { 1 } 2 <clumps> length ] unit-test
+{ 1 } [ { 1 2 } 2 <clumps> length ] unit-test
+{ 2 } [ { 1 2 3 } 2 <clumps> length ] unit-test
{ { } } [ { 1 } 2 clump ] unit-test
{ { { 1 2 } } } [ { 1 2 } 2 clump ] unit-test
{ 0 } [ { } 2 <circular-clumps> length ] unit-test
{ 1 } [ { 1 } 2 <circular-clumps> length ] unit-test
-[ 2 ] [ { 1 2 } 2 <circular-clumps> length ] unit-test
-[ 3 ] [ { 1 2 3 } 2 <circular-clumps> length ] unit-test
+{ 2 } [ { 1 2 } 2 <circular-clumps> length ] unit-test
+{ 3 } [ { 1 2 3 } 2 <circular-clumps> length ] unit-test
-[ { { 1 1 } } ] [ { 1 } 2 circular-clump ] unit-test
-[ { { 1 2 } { 2 1 } } ] [ { 1 2 } 2 circular-clump ] unit-test
-[ { { 1 2 } { 2 3 } { 3 1 } } ] [ { 1 2 3 } 2 circular-clump ] unit-test
+{ { { 1 1 } } } [ { 1 } 2 circular-clump ] unit-test
+{ { { 1 2 } { 2 1 } } } [ { 1 2 } 2 circular-clump ] unit-test
+{ { { 1 2 } { 2 3 } { 3 1 } } } [ { 1 2 3 } 2 circular-clump ] unit-test
-[ 1 ] [ V{ } 2 <clumps> 0 over set-length seq>> length ] unit-test
-[ 2 ] [ V{ } 2 <clumps> 1 over set-length seq>> length ] unit-test
-[ 3 ] [ V{ } 2 <clumps> 2 over set-length seq>> length ] unit-test
+{ 1 } [ V{ } 2 <clumps> 0 over set-length seq>> length ] unit-test
+{ 2 } [ V{ } 2 <clumps> 1 over set-length seq>> length ] unit-test
+{ 3 } [ V{ } 2 <clumps> 2 over set-length seq>> length ] unit-test
-[ { { 1 2 } { 2 3 } } ] [ { 1 2 3 } 2 <clumps> [ >array ] map ] unit-test
+{ { { 1 2 } { 2 3 } } } [ { 1 2 3 } 2 <clumps> [ >array ] map ] unit-test
-[ f ] [ [ { } { } "Hello" ] all-equal? ] unit-test
-[ f ] [ [ { 2 } { } { } ] all-equal? ] unit-test
-[ t ] [ [ ] all-equal? ] unit-test
-[ t ] [ [ 1234 ] all-equal? ] unit-test
-[ f ] [ [ 1.0 1 1 ] all-equal? ] unit-test
-[ t ] [ { 1 2 3 4 } [ < ] monotonic? ] unit-test
-[ f ] [ { 1 2 3 4 } [ > ] monotonic? ] unit-test
+{ f } [ [ { } { } "Hello" ] all-equal? ] unit-test
+{ f } [ [ { 2 } { } { } ] all-equal? ] unit-test
+{ t } [ [ ] all-equal? ] unit-test
+{ t } [ [ 1234 ] all-equal? ] unit-test
+{ f } [ [ 1.0 1 1 ] all-equal? ] unit-test
+{ t } [ { 1 2 3 4 } [ < ] monotonic? ] unit-test
+{ f } [ { 1 2 3 4 } [ > ] monotonic? ] 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
[ <min-heap> heap-pop ] must-fail
[ <max-heap> heap-pop ] must-fail
-[ t ] [ <min-heap> heap-empty? ] unit-test
-[ f ] [ <min-heap> 1 t pick heap-push heap-empty? ] unit-test
-[ t ] [ <max-heap> heap-empty? ] unit-test
-[ f ] [ <max-heap> 1 t pick heap-push heap-empty? ] unit-test
+{ t } [ <min-heap> heap-empty? ] unit-test
+{ f } [ <min-heap> 1 t pick heap-push heap-empty? ] unit-test
+{ t } [ <max-heap> heap-empty? ] unit-test
+{ f } [ <max-heap> 1 t pick heap-push heap-empty? ] unit-test
! Binary Min Heap
{ 1 2 3 4 5 6 } [ 0 left 0 right 1 left 1 right 2 left 2 right ] unit-test
{ t } [ t 5 f <entry> t 3 f <entry> T{ min-heap } heap-compare ] unit-test
{ f } [ t 5 f <entry> t 3 f <entry> T{ max-heap } heap-compare ] unit-test
-[ t 2 ] [ <min-heap> t 300 pick heap-push t 200 pick heap-push t 400 pick heap-push t 3 pick heap-push t 2 pick heap-push heap-pop ] unit-test
+{ t 2 } [ <min-heap> t 300 pick heap-push t 200 pick heap-push t 400 pick heap-push t 3 pick heap-push t 2 pick heap-push heap-pop ] unit-test
-[ t 1 ] [ <min-heap> t 300 pick heap-push t 200 pick heap-push t 400 pick heap-push t 3 pick heap-push t 2 pick heap-push t 1 pick heap-push heap-pop ] unit-test
+{ t 1 } [ <min-heap> t 300 pick heap-push t 200 pick heap-push t 400 pick heap-push t 3 pick heap-push t 2 pick heap-push t 1 pick heap-push heap-pop ] unit-test
-[ t 400 ] [ <max-heap> t 300 pick heap-push t 200 pick heap-push t 400 pick heap-push t 3 pick heap-push t 2 pick heap-push t 1 pick heap-push heap-pop ] unit-test
+{ t 400 } [ <max-heap> t 300 pick heap-push t 200 pick heap-push t 400 pick heap-push t 3 pick heap-push t 2 pick heap-push t 1 pick heap-push heap-pop ] unit-test
-[ 0 ] [ <max-heap> heap-size ] unit-test
-[ 1 ] [ <max-heap> t 1 pick heap-push heap-size ] unit-test
+{ 0 } [ <max-heap> heap-size ] unit-test
+{ 1 } [ <max-heap> t 1 pick heap-push heap-size ] unit-test
: heap-sort ( alist heap -- keys )
[ heap-push-all ] keep heap-pop-all ;
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
IN: help.tests
[ 3 throw ] must-fail
-[ ] [ :help ] unit-test
-[ ] [ f print-topic ] unit-test
+{ } [ :help ] unit-test
+{ } [ f 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
HINTS: M\ hashtable blahblah { object fixnum object } { object word object } ;
-[ t ] [ M\ hashtable blahblah { count>> count<< } inlined? ] unit-test
+{ t } [ M\ hashtable blahblah { count>> count<< } inlined? ] 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"
io.encodings.8-bit.latin1 random combinators.short-circuit ;
IN: http.tests
-[ "text/plain" "UTF-8" ] [ "text/plain" parse-content-type ] unit-test
+{ "text/plain" "UTF-8" } [ "text/plain" parse-content-type ] unit-test
-[ "text/html" "ASCII" ] [ "text/html; charset=ASCII" parse-content-type ] unit-test
+{ "text/html" "ASCII" } [ "text/html; charset=ASCII" parse-content-type ] unit-test
-[ "text/html" "utf-8" ] [ "text/html; charset=\"utf-8\"" parse-content-type ] unit-test
+{ "text/html" "utf-8" } [ "text/html; charset=\"utf-8\"" parse-content-type ] unit-test
-[ "application/octet-stream" f ] [ "application/octet-stream" parse-content-type ] unit-test
+{ "application/octet-stream" f } [ "application/octet-stream" parse-content-type ] unit-test
-[ "localhost" f ] [ "localhost" parse-host ] unit-test
-[ "localhost" 8888 ] [ "localhost:8888" parse-host ] unit-test
-[ "::1" 8888 ] [ "::1:8888" parse-host ] unit-test
-[ "127.0.0.1" 8888 ] [ "127.0.0.1:8888" parse-host ] unit-test
+{ "localhost" f } [ "localhost" parse-host ] unit-test
+{ "localhost" 8888 } [ "localhost:8888" parse-host ] unit-test
+{ "::1" 8888 } [ "::1:8888" parse-host ] unit-test
+{ "127.0.0.1" 8888 } [ "127.0.0.1:8888" parse-host ] unit-test
-[ "localhost" ] [ T{ url { protocol "http" } { host "localhost" } } unparse-host ] unit-test
-[ "localhost" ] [ T{ url { protocol "http" } { host "localhost" } { port 80 } } unparse-host ] unit-test
-[ "localhost" ] [ T{ url { protocol "https" } { host "localhost" } { port 443 } } unparse-host ] unit-test
-[ "localhost:8080" ] [ T{ url { protocol "http" } { host "localhost" } { port 8080 } } unparse-host ] unit-test
-[ "localhost:8443" ] [ T{ url { protocol "https" } { host "localhost" } { port 8443 } } unparse-host ] unit-test
+{ "localhost" } [ T{ url { protocol "http" } { host "localhost" } } unparse-host ] unit-test
+{ "localhost" } [ T{ url { protocol "http" } { host "localhost" } { port 80 } } unparse-host ] unit-test
+{ "localhost" } [ T{ url { protocol "https" } { host "localhost" } { port 443 } } unparse-host ] unit-test
+{ "localhost:8080" } [ T{ url { protocol "http" } { host "localhost" } { port 8080 } } unparse-host ] unit-test
+{ "localhost:8443" } [ T{ url { protocol "https" } { host "localhost" } { port 8443 } } unparse-host ] unit-test
STRING: read-request-test-1
POST /bar HTTP/1.1
blah
;
-[
+{
T{ request
{ url T{ url { path "/bar" } } }
{ method "POST" }
{ cookies V{ } }
{ redirects 10 }
}
-] [
+} [
read-request-test-1 lf>crlf [
read-request
] with-string-reader
blah
;
-read-request-test-1' 1array [
+read-request-test-1' } [
read-request-test-1 lf>crlf
[ read-request ] with-string-reader
[ write-request ] with-string-writer
;
-[
+{
T{ request
{ url T{ url { host "www.sex.com" } { path "/bar" } } }
{ method "HEAD" }
{ cookies V{ } }
{ redirects 10 }
}
-] [
+} [
read-request-test-2 lf>crlf [
read-request
] with-string-reader
;
-[
+{
T{ request
{ url T{ url { host "www.sex.com" } { port 101 } { path "/bar" } } }
{ method "HEAD" }
{ cookies V{ } }
{ redirects 10 }
}
-] [
+} [
read-request-test-2' lf>crlf [
read-request
] with-string-reader
Host: "www.amazon.com"
;
-[ "www.amazon.com" ]
+{ "www.amazon.com" }
[
read-request-test-4 lf>crlf [ read-request ] with-string-reader
"host" header
blah
;
-[
+{
T{ response
{ version "1.1" }
{ code 404 }
{ content-charset "UTF-8" }
{ content-encoding utf8 }
}
-] [
+} [
read-response-test-1 lf>crlf
[ read-response ] with-string-reader
] unit-test
;
-read-response-test-1' 1array [
+read-response-test-1' } [
URL" http://localhost/" url set
read-response-test-1 lf>crlf
[ read-response ] with-string-reader
string-lines "\n" join
] unit-test
-[ t ] [
+{ t } [
"rmid=732423sdfs73242; path=/; domain=.example.net; expires=Fri, 31-Dec-2010 23:59:59 GMT"
dup parse-set-cookie first unparse-set-cookie =
] unit-test
-[ t ] [
+{ t } [
"a="
dup parse-set-cookie first unparse-set-cookie =
] unit-test
;
-[ 2 ] [
+{ 2 } [
read-response-test-2 lf>crlf
[ read-response ] with-string-reader
cookies>> length
;
-[ 1 ] [
+{ 1 } [
read-response-test-3 lf>crlf
[ read-response ] with-string-reader
cookies>> length
"http://localhost/quit" add-addr http-get nip
"Goodbye" assert= ;
-[ ] [
+{ } [
[ test-db-file delete-file ] ignore-errors
test-db [
] test-with-db-persistence
! Test cloning
-[ f ] [ <404> dup clone "b" "a" set-header drop "a" header ] unit-test
-[ f ] [ <404> dup clone "b" "a" <cookie> put-cookie drop "a" get-cookie ] unit-test
+{ f } [ <404> dup clone "b" "a" set-header drop "a" header ] unit-test
+{ f } [ <404> dup clone "b" "a" <cookie> put-cookie drop "a" get-cookie ] unit-test
! Test basic auth
-[ "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" ] [
+{ "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" } [
<request> "Aladdin" "open sesame" set-basic-auth "Authorization" header
] unit-test
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
USING: images tools.test kernel accessors ;
IN: images.tests
-[ B{ 57 57 57 255 } ] [ 1 1 T{ image f { 2 3 } RGBA ubyte-components f f B{
+{ B{ 57 57 57 255 } } [ 1 1 T{ image f { 2 3 } RGBA ubyte-components f f B{
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
} } pixel-at ] unit-test
-[ B{
+{ B{
0 0 0 0
0 0 0 0
0 0 0 0
57 57 57 255
0 0 0 0
0 0 0 0
-} ] [ B{ 57 57 57 255 } 1 1 T{ image f { 2 3 } RGBA ubyte-components f f B{
+} } [ B{ 57 57 57 255 } 1 1 T{ image f { 2 3 } RGBA ubyte-components f f B{
0 0 0 0
0 0 0 0
0 0 0 0
: 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
H{ } describe
H{ } describe
-[ "fixnum\n\n" ] [ [ 3 describe ] with-string-writer ] unit-test
+{ "fixnum\n\n" } [ [ 3 describe ] with-string-writer ] unit-test
-[ ] [ H{ } clone inspect ] unit-test
+{ } [ H{ } clone inspect ] unit-test
-[ ] [ "a" "b" &add ] unit-test
+{ } [ "a" "b" &add ] unit-test
-[ H{ { "b" "a" } } ] [ me get ] unit-test
+{ H{ { "b" "a" } } } [ me get ] unit-test
-[ ] [ "x" 0 &put ] unit-test
+{ } [ "x" 0 &put ] unit-test
-[ H{ { "b" "x" } } ] [ me get ] unit-test
+{ H{ { "b" "x" } } } [ me get ] unit-test
-[ ] [ 0 &at ] unit-test
+{ } [ 0 &at ] unit-test
-[ "x" ] [ me get ] unit-test
+{ "x" } [ me get ] unit-test
-[ ] [ &back ] unit-test
+{ } [ &back ] unit-test
-[ ] [ "y" 0 &rename ] unit-test
+{ } [ "y" 0 &rename ] unit-test
-[ H{ { "y" "x" } } ] [ me get ] unit-test
+{ H{ { "y" "x" } } } [ me get ] unit-test
-[ ] [ 0 &delete ] unit-test
+{ } [ 0 &delete ] unit-test
-[ H{ } ] [ me get ] unit-test
+{ H{ } } [ me get ] unit-test
"Sup ${name}, we heard you liked ${noun}, so we put ${noun} on your ${noun} so you can ${verb} while you ${verb}." interpolate>string
] unit-test
-{ "Oops, I accidentally the whole economy..." } [
+{ "Oops, I accidentally the whole economy..." } {
[let
"economy" :> noun
"accidentally" [ I[ Oops, I ${0} the whole ${noun}...]I ] with-string-writer
- ]
+ }
] unit-test
SYMBOL: test
-[ ] [ { { { 4 8 } 3 } { 1 2 } } <interval-map> test set ] unit-test
-[ 3 ] [ 5 test get interval-at ] unit-test
-[ 3 ] [ 8 test get interval-at ] unit-test
-[ 3 ] [ 4 test get interval-at ] unit-test
-[ f ] [ 9 test get interval-at ] unit-test
-[ 2 ] [ 1 test get interval-at ] unit-test
-[ f ] [ 2 test get interval-at ] unit-test
-[ f ] [ 0 test get interval-at ] unit-test
+{ } [ { { { 4 8 } 3 } { 1 2 } } <interval-map> test set ] unit-test
+{ 3 } [ 5 test get interval-at ] unit-test
+{ 3 } [ 8 test get interval-at ] unit-test
+{ 3 } [ 4 test get interval-at ] unit-test
+{ f } [ 9 test get interval-at ] unit-test
+{ 2 } [ 1 test get interval-at ] unit-test
+{ f } [ 2 test get interval-at ] unit-test
+{ f } [ 0 test get interval-at ] unit-test
[ { { { 1 4 } 3 } { { 4 8 } 6 } } <interval-map> ] must-fail
-[ { { { 1 3 } 2 } { { 4 5 } 4 } { { 7 8 } 4 } } ]
+{ { { { 1 3 } 2 } { { 4 5 } 4 } { { 7 8 } 4 } } }
[ { { 1 2 } { 2 2 } { 3 2 } { 4 4 } { 5 4 } { 7 4 } { 8 4 } } coalesce ] unit-test
combinators.short-circuit literals ;
IN: interval-sets.tests
-[ f ] [ 0 T{ interval-set } in? ] unit-test
-[ f ] [ 2 T{ interval-set } in? ] unit-test
+{ f } [ 0 T{ interval-set } in? ] unit-test
+{ f } [ 2 T{ interval-set } in? ] unit-test
CONSTANT: i1 $[
{ { 3 4 } } <interval-set> ]
-[ f ] [ 2 i1 in? ] unit-test
-[ t ] [ 3 i1 in? ] unit-test
-[ t ] [ 4 i1 in? ] unit-test
-[ f ] [ 5 i1 in? ] unit-test
+{ f } [ 2 i1 in? ] unit-test
+{ t } [ 3 i1 in? ] unit-test
+{ t } [ 4 i1 in? ] unit-test
+{ f } [ 5 i1 in? ] unit-test
CONSTANT: i2 $[
{ { 3 4 } } <interval-set>
0x10FFFF <interval-not> ] ! unicode-max
-[ t ] [ 2 i2 in? ] unit-test
-[ f ] [ 3 i2 in? ] unit-test
-[ f ] [ 4 i2 in? ] unit-test
-[ t ] [ 5 i2 in? ] unit-test
+{ t } [ 2 i2 in? ] unit-test
+{ f } [ 3 i2 in? ] unit-test
+{ f } [ 4 i2 in? ] unit-test
+{ t } [ 5 i2 in? ] unit-test
CONSTANT: i3 $[
{ { 2 4 } } <interval-set>
{ { 6 8 } } <interval-set>
<interval-or> ]
-[ f ] [ 1 i3 in? ] unit-test
-[ t ] [ 2 i3 in? ] unit-test
-[ t ] [ 3 i3 in? ] unit-test
-[ t ] [ 4 i3 in? ] unit-test
-[ f ] [ 5 i3 in? ] unit-test
-[ t ] [ 6 i3 in? ] unit-test
-[ t ] [ 7 i3 in? ] unit-test
-[ t ] [ 8 i3 in? ] unit-test
-[ f ] [ 9 i3 in? ] unit-test
+{ f } [ 1 i3 in? ] unit-test
+{ t } [ 2 i3 in? ] unit-test
+{ t } [ 3 i3 in? ] unit-test
+{ t } [ 4 i3 in? ] unit-test
+{ f } [ 5 i3 in? ] unit-test
+{ t } [ 6 i3 in? ] unit-test
+{ t } [ 7 i3 in? ] unit-test
+{ t } [ 8 i3 in? ] unit-test
+{ f } [ 9 i3 in? ] unit-test
CONSTANT: i4 $[
{ { 2 4 } } <interval-set>
{ { 6 8 } } <interval-set>
<interval-and> ]
-[ f ] [ 1 i4 in? ] unit-test
-[ f ] [ 2 i4 in? ] unit-test
-[ f ] [ 3 i4 in? ] unit-test
-[ f ] [ 4 i4 in? ] unit-test
-[ f ] [ 5 i4 in? ] unit-test
-[ f ] [ 6 i4 in? ] unit-test
-[ f ] [ 7 i4 in? ] unit-test
-[ f ] [ 8 i4 in? ] unit-test
-[ f ] [ 9 i4 in? ] unit-test
+{ f } [ 1 i4 in? ] unit-test
+{ f } [ 2 i4 in? ] unit-test
+{ f } [ 3 i4 in? ] unit-test
+{ f } [ 4 i4 in? ] unit-test
+{ f } [ 5 i4 in? ] unit-test
+{ f } [ 6 i4 in? ] unit-test
+{ f } [ 7 i4 in? ] unit-test
+{ f } [ 8 i4 in? ] unit-test
+{ f } [ 9 i4 in? ] unit-test
CONSTANT: i5 $[
{ { 2 5 } } <interval-set>
{ { 4 8 } } <interval-set>
<interval-or> ]
-[ f ] [ 1 i5 in? ] unit-test
-[ t ] [ 2 i5 in? ] unit-test
-[ t ] [ 3 i5 in? ] unit-test
-[ t ] [ 4 i5 in? ] unit-test
-[ t ] [ 5 i5 in? ] unit-test
-[ t ] [ 6 i5 in? ] unit-test
-[ t ] [ 7 i5 in? ] unit-test
-[ t ] [ 8 i5 in? ] unit-test
-[ f ] [ 9 i5 in? ] unit-test
+{ f } [ 1 i5 in? ] unit-test
+{ t } [ 2 i5 in? ] unit-test
+{ t } [ 3 i5 in? ] unit-test
+{ t } [ 4 i5 in? ] unit-test
+{ t } [ 5 i5 in? ] unit-test
+{ t } [ 6 i5 in? ] unit-test
+{ t } [ 7 i5 in? ] unit-test
+{ t } [ 8 i5 in? ] unit-test
+{ f } [ 9 i5 in? ] unit-test
CONSTANT: i6 $[
{ { 2 5 } } <interval-set>
{ { 4 8 } } <interval-set>
<interval-and> ]
-[ f ] [ 1 i6 in? ] unit-test
-[ f ] [ 2 i6 in? ] unit-test
-[ f ] [ 3 i6 in? ] unit-test
-[ t ] [ 4 i6 in? ] unit-test
-[ t ] [ 5 i6 in? ] unit-test
-[ f ] [ 6 i6 in? ] unit-test
-[ f ] [ 7 i6 in? ] unit-test
-[ f ] [ 8 i6 in? ] unit-test
-[ f ] [ 9 i6 in? ] unit-test
+{ f } [ 1 i6 in? ] unit-test
+{ f } [ 2 i6 in? ] unit-test
+{ f } [ 3 i6 in? ] unit-test
+{ t } [ 4 i6 in? ] unit-test
+{ t } [ 5 i6 in? ] unit-test
+{ f } [ 6 i6 in? ] unit-test
+{ f } [ 7 i6 in? ] unit-test
+{ f } [ 8 i6 in? ] unit-test
+{ f } [ 9 i6 in? ] unit-test
: criterion ( interval-set -- ? )
array>> {
[ length even? ]
} 1&& ;
-[ t ] [ i1 criterion ] unit-test
-[ t ] [ i2 criterion ] unit-test
-[ t ] [ i3 criterion ] unit-test
-[ t ] [ i4 criterion ] unit-test
-[ t ] [ i5 criterion ] unit-test
-[ t ] [ i6 criterion ] unit-test
+{ t } [ i1 criterion ] unit-test
+{ t } [ i2 criterion ] unit-test
+{ t } [ i3 criterion ] unit-test
+{ t } [ i4 criterion ] unit-test
+{ t } [ i5 criterion ] unit-test
+{ t } [ i6 criterion ] unit-test
math.functions math.constants continuations combinators.smart ;
IN: inverse-tests
-[ 2 ] [ { 3 2 } [ 3 swap 2array ] undo ] unit-test
+{ 2 } [ { 3 2 } [ 3 swap 2array ] undo ] unit-test
[ { 3 4 } [ dup 2array ] undo ] must-fail
TUPLE: foo bar baz ;
C: <foo> foo
-[ 1 2 ] [ 1 2 <foo> [ <foo> ] undo ] unit-test
+{ 1 2 } [ 1 2 <foo> [ <foo> ] undo ] unit-test
: 2same ( x -- {x,x} ) dup 2array ;
-[ t ] [ { 3 3 } [ 2same ] matches? ] unit-test
-[ f ] [ { 3 4 } [ 2same ] matches? ] unit-test
+{ t } [ { 3 3 } [ 2same ] matches? ] unit-test
+{ f } [ { 3 4 } [ 2same ] matches? ] unit-test
[ [ 2same ] matches? ] must-fail
: something ( array -- num )
{ [ 3array ] [ + + ] }
} switch ;
-[ 5 ] [ { 1 2 2 } something ] unit-test
-[ 6 ] [ { 2 3 } something ] unit-test
+{ 5 } [ { 1 2 2 } something ] unit-test
+{ 6 } [ { 2 3 } something ] unit-test
[ { 1 } something ] must-fail
[ 1 2 [ eq? ] undo ] must-fail
: f>c ( *fahrenheit -- *celsius )
32 - 1.8 / ;
-[ { 212.0 32.0 } ] [ { 100 0 } [ [ f>c ] map ] undo ] unit-test
-[ { t t f } ] [ { t f 1 } [ [ >boolean ] matches? ] map ] unit-test
-[ { t f } ] [ { { 1 2 3 } 4 } [ [ >array ] matches? ] map ] unit-test
-[ 9 9 ] [ 3 [ 1/2 ^ ] undo 3 [ sqrt ] undo ] unit-test
-[ 5 ] [ 6 5 - [ 6 swap - ] undo ] unit-test
-[ 6 ] [ 6 5 - [ 5 - ] undo ] unit-test
+{ { 212.0 32.0 } } [ { 100 0 } [ [ f>c ] map ] undo ] unit-test
+{ { t t f } } [ { t f 1 } [ [ >boolean ] matches? ] map ] unit-test
+{ { t f } } [ { { 1 2 3 } 4 } [ [ >array ] matches? ] map ] unit-test
+{ 9 9 } [ 3 [ 1/2 ^ ] undo 3 [ sqrt ] undo ] unit-test
+{ 5 } [ 6 5 - [ 6 swap - ] undo ] unit-test
+{ 6 } [ 6 5 - [ 5 - ] undo ] unit-test
TUPLE: cons car cdr ;
[ "Malformed list" throw ]
} switch ;
-[ 10 ] [ 1 2 3 4 <nil> <cons> <cons> <cons> <cons> list-sum ] unit-test
-[ ] [ <nil> [ <nil> ] undo ] unit-test
-[ 1 2 ] [ 1 2 <cons> [ <cons> ] undo ] unit-test
-[ t ] [ 1 2 <cons> [ <cons> ] matches? ] unit-test
-[ f ] [ 1 2 <cons> [ <foo> ] matches? ] unit-test
-[ "Malformed list" ] [ [ f list-sum ] [ ] recover ] unit-test
+{ 10 } [ 1 2 3 4 <nil> <cons> <cons> <cons> <cons> list-sum ] unit-test
+{ } [ <nil> [ <nil> ] undo ] unit-test
+{ 1 2 } [ 1 2 <cons> [ <cons> ] undo ] unit-test
+{ t } [ 1 2 <cons> [ <cons> ] matches? ] unit-test
+{ f } [ 1 2 <cons> [ <foo> ] matches? ] unit-test
+{ "Malformed list" } [ [ f list-sum ] [ ] recover ] unit-test
: empty-cons ( -- cons ) cons new ;
: cons* ( cdr car -- cons ) cons boa ;
-[ ] [ T{ cons f f f } [ empty-cons ] undo ] unit-test
-[ 1 2 ] [ 1 2 <cons> [ cons* ] undo ] unit-test
+{ } [ T{ cons f f f } [ empty-cons ] undo ] unit-test
+{ 1 2 } [ 1 2 <cons> [ cons* ] undo ] unit-test
-[ t ] [ pi [ pi ] matches? ] unit-test
-[ 0.0 ] [ 0.0 pi + [ pi + ] undo ] unit-test
-[ ] [ 3 [ __ ] undo ] unit-test
+{ t } [ pi [ pi ] matches? ] unit-test
+{ 0.0 } [ 0.0 pi + [ pi + ] undo ] unit-test
+{ } [ 3 [ __ ] undo ] unit-test
-[ 2.0 ] [ 2 3 ^ [ 3 ^ ] undo ] unit-test
-[ 3.0 ] [ 2 3 ^ [ 2 swap ^ ] undo ] unit-test
+{ 2.0 } [ 2 3 ^ [ 3 ^ ] undo ] unit-test
+{ 3.0 } [ 2 3 ^ [ 2 swap ^ ] undo ] unit-test
-[ { 1 } ] [ { 1 2 3 } [ { 2 3 } append ] undo ] unit-test
-[ { 3 } ] [ { 1 2 3 } [ { 1 2 } prepend ] undo ] unit-test
+{ { 1 } } [ { 1 2 3 } [ { 2 3 } append ] undo ] unit-test
+{ { 3 } } [ { 1 2 3 } [ { 1 2 } prepend ] undo ] unit-test
[ { 1 2 3 } [ { 1 2 } append ] undo ] must-fail
[ { 1 2 3 } [ { 2 3 } prepend ] undo ] must-fail
-[ [ sq ] ] [ [ sqrt ] [undo] ] unit-test
-[ [ sqrt ] ] [ [ sq ] [undo] ] unit-test
-[ [ not ] ] [ [ not ] [undo] ] unit-test
-[ { 3 2 1 } ] [ { 1 2 3 } [ reverse ] undo ] unit-test
+{ [ sq ] } [ [ sqrt ] [undo] ] unit-test
+{ [ sqrt ] } [ [ sq ] [undo] ] unit-test
+{ [ not ] } [ [ not ] [undo] ] unit-test
+{ { 3 2 1 } } [ { 1 2 3 } [ reverse ] undo ] unit-test
TUPLE: funny-tuple ;
: <funny-tuple> ( -- funny-tuple ) \ funny-tuple boa ;
: funny-tuple ( -- ) "OOPS" throw ;
-[ ] [ [ <funny-tuple> ] [undo] drop ] unit-test
+{ } [ [ <funny-tuple> ] [undo] drop ] unit-test
-[ 0 ] [ { 1 2 } [ [ 1 + 2 ] { } output>sequence ] undo ] unit-test
-[ { 0 1 } ] [ 1 2 [ [ [ 1 + ] bi@ ] input<sequence ] undo ] unit-test
+{ 0 } [ { 1 2 } [ [ 1 + 2 ] { } output>sequence ] undo ] unit-test
+{ { 0 1 } } [ 1 2 [ [ [ 1 + ] bi@ ] input<sequence ] undo ] unit-test
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
p 1 seconds ?promise-timeout (kill-process)
s 3 seconds ?promise-timeout 0 =
- ]
+ }
] unit-test
! Make sure that subprocesses don't inherit our signal mask
"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
{ "while 1:\n\tpass" } [ """ "while 1:\n\tpass" """ json> ] unit-test
! unicode is allowed in json
{ "ß∂¬ƒ˚∆" } [ """ "ß∂¬ƒ˚∆"""" json> ] unit-test
-{ 8 9 10 12 13 34 47 92 } >string 1array [ """ "\\b\\t\\n\\f\\r\\"\\/\\\\" """ json> ] unit-test
+{ 8 9 10 12 13 34 47 92 } >string } [ """ "\\b\\t\\n\\f\\r\\"\\/\\\\" """ json> ] unit-test
{ 0xabcd } >string 1array [ """ "\\uaBCd" """ json> ] unit-test
{ "𝄞" } [ "\"\\ud834\\udd1e\"" json> ] 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 ]
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test lcs ;
-[ 3 ] [ "sitting" "kitten" levenshtein ] unit-test
-[ 3 ] [ "kitten" "sitting" levenshtein ] unit-test
-[ 1 ] [ "freshpak" "freshpack" levenshtein ] unit-test
-[ 1 ] [ "freshpack" "freshpak" levenshtein ] unit-test
+{ 3 } [ "sitting" "kitten" levenshtein ] unit-test
+{ 3 } [ "kitten" "sitting" levenshtein ] unit-test
+{ 1 } [ "freshpak" "freshpack" levenshtein ] unit-test
+{ 1 } [ "freshpack" "freshpak" levenshtein ] unit-test
-[ "hell" ] [ "hello" "hell" lcs ] unit-test
-[ "hell" ] [ "hell" "hello" lcs ] unit-test
-[ "ell" ] [ "ell" "hell" lcs ] unit-test
-[ "ell" ] [ "hell" "ell" lcs ] unit-test
-[ "abd" ] [ "faxbcd" "abdef" lcs ] unit-test
+{ "hell" } [ "hello" "hell" lcs ] unit-test
+{ "hell" } [ "hell" "hello" lcs ] unit-test
+{ "ell" } [ "ell" "hell" lcs ] unit-test
+{ "ell" } [ "hell" "ell" lcs ] unit-test
+{ "abd" } [ "faxbcd" "abdef" lcs ] unit-test
-[ {
+{ {
T{ delete f CHAR: f }
T{ retain f CHAR: a }
T{ delete f CHAR: x }
T{ retain f CHAR: d }
T{ insert f CHAR: e }
T{ insert f CHAR: f }
-} ] [ "faxbcd" "abdef" lcs-diff ] unit-test
+} } [ "faxbcd" "abdef" lcs-diff ] unit-test
100 malloc "block" set
-[ t ] [ "block" get malloc-exists? ] unit-test
+{ t } [ "block" get malloc-exists? ] unit-test
-[ ] [ [ "block" get &free drop ] with-destructors ] unit-test
+{ } [ [ "block" get &free drop ] with-destructors ] unit-test
-[ f ] [ "block" get malloc-exists? ] unit-test
+{ f } [ "block" get malloc-exists? ] unit-test
-[ "Operation not permitted" ] [ 1 strerror ] unit-test
+{ "Operation not permitted" } [ 1 strerror ] unit-test
] unit-test
] with-file-vocabs
-[ ] [
+{ } [
[
"vocabs.loader.test.c" forget-vocab
] with-compilation-unit
] must-fail
] with-file-vocabs
-[ ] [
+{ } [
[
"vocabs.loader.test.c" forget-vocab
] with-compilation-unit
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
{ 1 2 3 } sequence>list { 4 5 6 } sequence>list lappend list>array
] unit-test
-[ { 1 } { 2 } ] [ { 1 2 } sequence>list 1 lcut [ list>array ] bi@ ] unit-test
+{ { 1 } { 2 } } [ { 1 2 } sequence>list 1 lcut [ list>array ] bi@ ] unit-test
: five ( -- a ) 5 ;
: seven-eleven ( -- b c ) 7 11 ;
-[ { 5 } ] [ { $ five } ] unit-test
-[ { 7 11 } ] [ { $ seven-eleven } ] unit-test
-[ { 6 6 6 } ] [ { $ six-six-six } ] unit-test
+{ { 5 } } [ { $ five } ] unit-test
+{ { 7 11 } } [ { $ seven-eleven } ] unit-test
+{ { 6 6 6 } } [ { $ six-six-six } ] unit-test
-[ { 6 6 6 7 } ] [ { $ six-six-six 7 } ] unit-test
+{ { 6 6 6 7 } } [ { $ six-six-six 7 } ] unit-test
-[ { 8 8 8 } ] [ { $[ six-six-six [ 2 + ] tri@ ] } ] unit-test
+{ { 8 8 8 } } [ { $[ six-six-six [ 2 + ] tri@ ] } ] unit-test
-[ { 0.5 2.0 } ] [ { $[ 1.0 2.0 / ] 2.0 } ] unit-test
+{ { 0.5 2.0 } } [ { $[ 1.0 2.0 / ] 2.0 } ] unit-test
-[ { 1.0 { 0.5 1.5 } 4.0 } ] [ { 1.0 { $[ 1.0 2.0 / ] 1.5 } $[ 2.0 2.0 * ] } ] unit-test
+{ { 1.0 { 0.5 1.5 } 4.0 } } [ { 1.0 { $[ 1.0 2.0 / ] 1.5 } $[ 2.0 2.0 * ] } ] unit-test
CONSTANT: constant-a 3
-[ { 3 10 "ftw" } ] [ ${ constant-a 10 "ftw" } ] unit-test
+{ { 3 10 "ftw" } } [ ${ constant-a 10 "ftw" } ] unit-test
{ { 4 } } [ ${ 1 constant-a + } ] unit-test
{ { 3 } } [ ${ 1 2 + } ] unit-test
{ { 1 2 \ + } } [ ${ 1 2 \ + } ] unit-test
: sixty-nine ( -- a b ) 6 9 ;
-[ { 6 9 } ] [ ${ sixty-nine } ] unit-test
+{ { 6 9 } } [ ${ sixty-nine } ] unit-test
CONSTANT: a 1
CONSTANT: b 2
CONSTANT: foo flags{ a b d }
-[ 3 ] [ foo ] unit-test
-[ 3 ] [ flags{ a b d } ] unit-test
+{ 3 } [ foo ] unit-test
+{ 3 } [ flags{ a b d } ] unit-test
\ foo def>> must-infer
-[ 1 ] [ flags{ 1 } ] unit-test
+{ 1 } [ flags{ 1 } ] unit-test
\ 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
:: foo ( a b -- a a ) a a ;
-[ 1 1 ] [ 1 2 foo ] unit-test
+{ 1 1 } [ 1 2 foo ] unit-test
:: add-test ( a b -- c ) a b + ;
-[ 3 ] [ 1 2 add-test ] unit-test
+{ 3 } [ 1 2 add-test ] unit-test
:: sub-test ( a b -- c ) a b - ;
-[ -1 ] [ 1 2 sub-test ] unit-test
+{ -1 } [ 1 2 sub-test ] unit-test
:: map-test ( a b -- seq ) a [ b + ] map ;
-[ { 5 6 7 } ] [ { 1 2 3 } 4 map-test ] unit-test
+{ { 5 6 7 } } [ { 1 2 3 } 4 map-test ] unit-test
:: map-test-2 ( seq inc -- seq ) seq [| elt | elt inc + ] map ;
-[ { 5 6 7 } ] [ { 1 2 3 } 4 map-test-2 ] unit-test
+{ { 5 6 7 } } [ { 1 2 3 } 4 map-test-2 ] unit-test
:: let-test ( c -- d )
[let 1 :> a 2 :> b a b + c + ] ;
-[ 7 ] [ 4 let-test ] unit-test
+{ 7 } [ 4 let-test ] unit-test
:: let-test-2 ( a -- a )
a [let :> a [let a :> b a ] ] ;
-[ 3 ] [ 3 let-test-2 ] unit-test
+{ 3 } [ 3 let-test-2 ] unit-test
:: let-test-3 ( a -- a )
a [let :> a [let [ a ] :> b [let 3 :> a b ] ] ] ;
:: let-test-4 ( a -- b )
a [let 1 :> a :> b a b 2array ] ;
-[ { 1 2 } ] [ 2 let-test-4 ] unit-test
+{ { 1 2 } } [ 2 let-test-4 ] unit-test
:: let-test-5 ( a b -- b )
a b [let :> a :> b a b 2array ] ;
-[ { 2 1 } ] [ 1 2 let-test-5 ] unit-test
+{ { 2 1 } } [ 1 2 let-test-5 ] unit-test
:: let-test-6 ( a -- b )
a [let :> a 1 :> b a b 2array ] ;
-[ { 2 1 } ] [ 2 let-test-6 ] unit-test
+{ { 2 1 } } [ 2 let-test-6 ] unit-test
-[ -1 ] [ -1 let-test-3 call ] unit-test
+{ -1 } [ -1 let-test-3 call ] unit-test
:: write-test-1 ( n! -- q )
[| i | n i + dup n! ] ;
{ 1 1 } "q" get must-infer-as
-[ 1 ] [ 1 "q" get call ] unit-test
+{ 1 } [ 1 "q" get call ] unit-test
-[ 2 ] [ 1 "q" get call ] unit-test
+{ 2 } [ 1 "q" get call ] unit-test
-[ 3 ] [ 1 "q" get call ] unit-test
+{ 3 } [ 1 "q" get call ] unit-test
-[ 5 ] [ 2 "q" get call ] unit-test
+{ 5 } [ 2 "q" get call ] unit-test
:: write-test-2 ( -- q )
[let 0 :> n! [| i | n i + dup n! ] ] ;
write-test-2 "q" set
-[ 1 ] [ 1 "q" get call ] unit-test
+{ 1 } [ 1 "q" get call ] unit-test
-[ 2 ] [ 1 "q" get call ] unit-test
+{ 2 } [ 1 "q" get call ] unit-test
-[ 3 ] [ 1 "q" get call ] unit-test
+{ 3 } [ 1 "q" get call ] unit-test
-[ 5 ] [ 2 "q" get call ] unit-test
+{ 5 } [ 2 "q" get call ] unit-test
-[ 10 20 ]
+{ 10 20 }
[
20 10 [| a! | [| b! | a b ] ] call call
] unit-test
:: write-test-3 ( a! -- q ) [| b | b a! ] ;
-[ ] [ 1 2 write-test-3 call ] unit-test
+{ } [ 1 2 write-test-3 call ] unit-test
:: write-test-4 ( x! -- q ) [ [let 0 :> y! f x! ] ] ;
-[ ] [ 5 write-test-4 drop ] unit-test
+{ } [ 5 write-test-4 drop ] unit-test
:: let-let-test ( n -- n ) [let n 3 + :> n n ] ;
-[ 13 ] [ 10 let-let-test ] unit-test
+{ 13 } [ 10 let-let-test ] unit-test
GENERIC: lambda-generic ( a b -- c )
M:: string lambda-generic ( a b -- c ) a b lambda-generic-2 ;
-[ 10 ] [ 5 2 lambda-generic ] unit-test
+{ 10 } [ 5 2 lambda-generic ] unit-test
-[ "abab" ] [ "aba" "b" lambda-generic ] unit-test
+{ "abab" } [ "aba" "b" lambda-generic ] unit-test
-[ "abaxxx" ] [ "aba" 3 lambda-generic ] unit-test
+{ "abaxxx" } [ "aba" 3 lambda-generic ] unit-test
-[ "xaba" ] [ 1 "aba" lambda-generic ] unit-test
+{ "xaba" } [ 1 "aba" lambda-generic ] unit-test
-[ ] [ \ lambda-generic-1 see ] unit-test
+{ } [ \ lambda-generic-1 see ] unit-test
-[ ] [ \ lambda-generic-2 see ] unit-test
+{ } [ \ lambda-generic-2 see ] unit-test
-[ ] [ \ lambda-generic see ] unit-test
+{ } [ \ lambda-generic see ] unit-test
:: unparse-test-1 ( a -- ) [let 3 :> a! 4 :> b ] ;
-[ "[let 3 :> a! 4 :> b ]" ] [
+{ "[let 3 :> a! 4 :> b ]" } [
\ unparse-test-1 "lambda" word-prop body>> first unparse
] unit-test
:: unparse-test-3 ( -- b ) [| a! | ] ;
-[ "[| a! | ]" ] [
+{ "[| a! | ]" } [
\ unparse-test-3 "lambda" word-prop body>> first unparse
] unit-test
DEFER: xyzzy
-[ ] [
+{ } [
"IN: locals.tests USE: math GENERIC: xyzzy ( a -- b ) M: integer xyzzy ;"
<string-reader> "lambda-generic-test" parse-stream drop
] unit-test
-[ 10 ] [ 10 xyzzy ] unit-test
+{ 10 } [ 10 xyzzy ] unit-test
-[ ] [
+{ } [
"IN: locals.tests USE: math USE: locals GENERIC: xyzzy ( a -- b ) M:: integer xyzzy ( n -- x ) 5 ;"
<string-reader> "lambda-generic-test" parse-stream drop
] unit-test
-[ 5 ] [ 10 xyzzy ] unit-test
+{ 5 } [ 10 xyzzy ] unit-test
GENERIC: next-method-test ( a -- b )
M:: fixnum next-method-test ( a -- b ) a call-next-method 1 + ;
-[ 5 ] [ 1 next-method-test ] unit-test
+{ 5 } [ 1 next-method-test ] unit-test
: no-with-locals-test ( -- seq ) { 1 2 3 } [| x | x 3 + ] map ;
-[ { 4 5 6 } ] [ no-with-locals-test ] unit-test
+{ { 4 5 6 } } [ no-with-locals-test ] unit-test
{ 3 0 } [| a b c | ] must-infer-as
-[ ] [ 1 [let :> a ] ] unit-test
+[ ] { 1 [let :> a } ] unit-test
-[ 3 ] [ 1 [let :> a 3 ] ] unit-test
+[ 3 ] { 1 [let :> a 3 } ] unit-test
-[ ] [ 1 2 [let :> a :> b ] ] unit-test
+[ ] { 1 2 [let :> a :> b } ] unit-test
:: a-word-with-locals ( a b -- ) ;
CONSTANT: new-definition "USING: math ;\nIN: locals.tests\n: a-word-with-locals ( -- x ) 2 3 + ;\n"
-[ ] [ new-definition eval( -- ) ] unit-test
+{ } [ new-definition eval( -- ) ] unit-test
-[ t ] [
+{ t } [
[ \ a-word-with-locals see ] with-string-writer
new-definition =
] unit-test
M:: sequence method-with-locals ( a -- y ) a reverse ;
-[ t ] [
+{ t } [
[ \ sequence \ method-with-locals lookup-method see ] with-string-writer
method-definition =
] unit-test
\ cond-test def>> must-infer
-[ 3 ] [ 1 2 cond-test ] unit-test
-[ 4 ] [ 2 2 cond-test ] unit-test
-[ 5 ] [ 3 2 cond-test ] unit-test
+{ 3 } [ 1 2 cond-test ] unit-test
+{ 4 } [ 2 2 cond-test ] unit-test
+{ 5 } [ 3 2 cond-test ] unit-test
:: 0&&-test ( a -- ? )
{ [ a integer? ] [ a even? ] [ a 10 > ] } 0&& ;
\ 0&&-test def>> must-infer
-[ f ] [ 1.5 0&&-test ] unit-test
-[ f ] [ 3 0&&-test ] unit-test
-[ f ] [ 8 0&&-test ] unit-test
-[ t ] [ 12 0&&-test ] unit-test
+{ f } [ 1.5 0&&-test ] unit-test
+{ f } [ 3 0&&-test ] unit-test
+{ f } [ 8 0&&-test ] unit-test
+{ t } [ 12 0&&-test ] unit-test
:: &&-test ( a -- ? )
{ [ a integer? ] [ a even? ] [ a 10 > ] } && ;
\ &&-test def>> must-infer
-[ f ] [ 1.5 &&-test ] unit-test
-[ f ] [ 3 &&-test ] unit-test
-[ f ] [ 8 &&-test ] unit-test
-[ t ] [ 12 &&-test ] unit-test
+{ f } [ 1.5 &&-test ] unit-test
+{ f } [ 3 &&-test ] unit-test
+{ f } [ 8 &&-test ] unit-test
+{ t } [ 12 &&-test ] unit-test
:: let-and-cond-test-1 ( -- a )
[let 10 :> a
\ let-and-cond-test-1 def>> must-infer
-[ 20 ] [ let-and-cond-test-1 ] unit-test
+{ 20 } [ let-and-cond-test-1 ] unit-test
:: let-and-cond-test-2 ( -- pair )
[let 10 :> A
\ let-and-cond-test-2 def>> must-infer
-[ { 10 20 } ] [ let-and-cond-test-2 ] unit-test
+{ { 10 20 } } [ let-and-cond-test-2 ] unit-test
-[ { 10 } ] [ 10 [| a | { a } ] call ] unit-test
-[ { 10 20 } ] [ 10 20 [| a b | { a b } ] call ] unit-test
-[ { 10 20 30 } ] [ 10 20 30 [| a b c | { a b c } ] call ] unit-test
+{ { 10 } } [ 10 [| a | { a } ] call ] unit-test
+{ { 10 20 } } [ 10 20 [| a b | { a b } ] call ] unit-test
+{ { 10 20 30 } } [ 10 20 30 [| a b c | { a b c } ] call ] unit-test
-[ { 10 20 30 } ] [ [let 10 :> a 20 :> b 30 :> c { a b c } ] ] unit-test
+[ { 10 20 30 } ] { [let 10 :> a 20 :> b 30 :> c { a b c } } ] unit-test
-[ V{ 10 20 30 } ] [ 10 20 30 [| a b c | V{ a b c } ] call ] unit-test
+{ V{ 10 20 30 } } [ 10 20 30 [| a b c | V{ a b c } ] call ] unit-test
-[ H{ { 10 "a" } { 20 "b" } { 30 "c" } } ]
+{ H{ { 10 "a" } { 20 "b" } { 30 "c" } } }
[ 10 20 30 [| a b c | H{ { a "a" } { b "b" } { c "c" } } ] call ] unit-test
-[ T{ slice f 0 3 "abc" } ]
+{ T{ slice f 0 3 "abc" } }
[ 0 3 "abc" [| from to seq | T{ slice f from to seq } ] call ] unit-test
{ 3 1 } [| from to seq | T{ slice f from to seq } ] must-infer-as
ERROR: punned-class x ;
-[ T{ punned-class f 3 } ] [ 3 [| a | T{ punned-class f a } ] call ] unit-test
+{ T{ punned-class f 3 } } [ 3 [| a | T{ punned-class f a } ] call ] unit-test
:: literal-identity-test ( -- a b )
{ 1 } V{ } ;
-[ t t ] [
+{ t t } [
literal-identity-test
literal-identity-test
[ eq? ] [ eq? ] bi-curry* bi*
:: mutable-local-in-literal-test ( a! -- b ) a 1 + a! { a } ;
-[ { 4 } ] [ 3 mutable-local-in-literal-test ] unit-test
+{ { 4 } } [ 3 mutable-local-in-literal-test ] unit-test
:: compare-case ( obj1 obj2 lt-quot eq-quot gt-quot -- )
obj1 obj2 <=> {
\ big-case-test def>> must-infer
-[ 9 ] [ 3 big-case-test ] unit-test
+{ 9 } [ 3 big-case-test ] unit-test
! Dan found this problem
: littledan-case-problem-1 ( a -- b )
\ littledan-case-problem-1 def>> must-infer
-[ "howdy" ] [ -12 \ littledan-case-problem-1 def>> call ] unit-test
-[ "howdy" ] [ -12 littledan-case-problem-1 ] unit-test
+{ "howdy" } [ -12 \ littledan-case-problem-1 def>> call ] unit-test
+{ "howdy" } [ -12 littledan-case-problem-1 ] unit-test
:: littledan-case-problem-2 ( a -- b )
a {
\ littledan-case-problem-2 def>> must-infer
-[ "howdy" ] [ -12 \ littledan-case-problem-2 def>> call ] unit-test
-[ "howdy" ] [ -12 littledan-case-problem-2 ] unit-test
+{ "howdy" } [ -12 \ littledan-case-problem-2 def>> call ] unit-test
+{ "howdy" } [ -12 littledan-case-problem-2 ] unit-test
:: littledan-cond-problem-1 ( a -- b )
a {
\ littledan-cond-problem-1 def>> must-infer
-[ f ] [ -12 \ littledan-cond-problem-1 def>> call ] unit-test
-[ 4 ] [ 12 \ littledan-cond-problem-1 def>> call ] unit-test
-[ "howdy" ] [ 0 \ littledan-cond-problem-1 def>> call ] unit-test
-[ f ] [ -12 littledan-cond-problem-1 ] unit-test
-[ 4 ] [ 12 littledan-cond-problem-1 ] unit-test
-[ "howdy" ] [ 0 littledan-cond-problem-1 ] unit-test
+{ f } [ -12 \ littledan-cond-problem-1 def>> call ] unit-test
+{ 4 } [ 12 \ littledan-cond-problem-1 def>> call ] unit-test
+{ "howdy" } [ 0 \ littledan-cond-problem-1 def>> call ] unit-test
+{ f } [ -12 littledan-cond-problem-1 ] unit-test
+{ 4 } [ 12 littledan-cond-problem-1 ] unit-test
+{ "howdy" } [ 0 littledan-cond-problem-1 ] unit-test
/*
:: littledan-case-problem-3 ( a quot -- b )
quot
} case ; inline
-[ f ] [ t [ ] littledan-case-problem-3 ] unit-test
-[ 144 ] [ 12 [ sq ] littledan-case-problem-3 ] unit-test
+{ f } [ t [ ] littledan-case-problem-3 ] unit-test
+{ 144 } [ 12 [ sq ] littledan-case-problem-3 ] unit-test
[| | [| a | a ] littledan-case-problem-3 ] must-infer
: littledan-case-problem-4 ( a -- b )
M:: integer lambda-method-forget-test ( a -- b ) a ;
-[ ] [ [ M\ integer lambda-method-forget-test forget ] with-compilation-unit ] unit-test
+{ } [ [ M\ integer lambda-method-forget-test forget ] with-compilation-unit ] unit-test
-[ 10 ] [ 10 [| A | { [ A ] } ] call first call ] unit-test
+{ 10 } [ 10 [| A | { [ A ] } ] call first call ] unit-test
[
"USING: locals fry math ; 1 '[ [let 10 :> A A _ + ] ]"
\ funny-macro-test def>> must-infer
-[ t ] [ 3 funny-macro-test ] unit-test
-[ f ] [ 2 funny-macro-test ] unit-test
+{ t } [ 3 funny-macro-test ] unit-test
+{ f } [ 2 funny-macro-test ] unit-test
[ "USE: locals [let" eval( -- ) ] [ error>> unexpected-eof? ] must-fail-with
[ "USE: locals [|" eval( -- ) ] [ error>> unexpected-eof? ] must-fail-with
-[ 25 ] [ 5 [| a | { [ a sq ] } cond ] call ] unit-test
-[ 25 ] [ 5 [| | { [| a | a sq ] } ] call first call ] unit-test
+{ 25 } [ 5 [| a | { [ a sq ] } cond ] call ] unit-test
+{ 25 } [ 5 [| | { [| a | a sq ] } ] call first call ] unit-test
:: FAILdog-1 ( -- b ) { [| c | c ] } ;
\ FAILdog-2 def>> must-infer
-[ 3 ] [ 3 [| a | \ a ] call ] unit-test
+{ 3 } [ 3 [| a | \ a ] call ] unit-test
[ "USE: locals [| | { [let 0 :> a a ] } ]" eval( -- ) ] must-fail
[ "USE: locals 3 :> a" eval( -- ) ] must-fail
-[ 3 ] [ 3 [| | :> a a ] call ] unit-test
+{ 3 } [ 3 [| | :> a a ] call ] unit-test
-[ 3 ] [ 3 [| | :> a! a ] call ] unit-test
+{ 3 } [ 3 [| | :> a! a ] call ] unit-test
-[ 3 ] [ 2 [| | :> a! a 1 + a! a ] call ] unit-test
+{ 3 } [ 2 [| | :> a! a 1 + a! a ] call ] unit-test
: fry-locals-test-1 ( -- n )
[let 6 '[ [let 4 :> A A _ + ] ] call ] ;
\ fry-locals-test-1 def>> must-infer
-[ 10 ] [ fry-locals-test-1 ] unit-test
+{ 10 } [ fry-locals-test-1 ] unit-test
:: fry-locals-test-2 ( -- n )
[let 6 '[ [let 4 :> A A _ + ] ] call ] ;
\ fry-locals-test-2 def>> must-infer
-[ 10 ] [ fry-locals-test-2 ] unit-test
+{ 10 } [ fry-locals-test-2 ] unit-test
-[ 1 ] [ 3 4 [| | '[ [ _ swap - ] call ] call ] call ] unit-test
-[ -1 ] [ 3 4 [| | [| a | a - ] call ] call ] unit-test
-[ -1 ] [ 3 4 [| | [| a | a - ] curry call ] call ] unit-test
-[ -1 ] [ 3 4 [| a | a - ] curry call ] unit-test
-[ 1 ] [ 3 4 [| | '[ [| a | _ a - ] call ] call ] call ] unit-test
-[ -1 ] [ 3 4 [| | '[ [| a | a _ - ] call ] call ] call ] unit-test
+{ 1 } [ 3 4 [| | '[ [ _ swap - ] call ] call ] call ] unit-test
+{ -1 } [ 3 4 [| | [| a | a - ] call ] call ] unit-test
+{ -1 } [ 3 4 [| | [| a | a - ] curry call ] call ] unit-test
+{ -1 } [ 3 4 [| a | a - ] curry call ] unit-test
+{ 1 } [ 3 4 [| | '[ [| a | _ a - ] call ] call ] call ] unit-test
+{ -1 } [ 3 4 [| | '[ [| a | a _ - ] call ] call ] call ] unit-test
-[ { 1 2 3 4 } ] [
+{ { 1 2 3 4 } } [
1 3 2 4
[| | '[ [| a b | a _ b _ 4array ] call ] call ] call
] unit-test
[ 10 ] [
- [| | 0 '[ [let 10 :> A A _ + ] ] call ] call
+ [| | 0 '[ [let 10 :> A A _ + ] ] call ] }
] unit-test
! littledan found this problem
-[ "bar" ] [ [let [let "bar" :> foo foo ] :> a a ] ] unit-test
-[ 10 ] [ [let 10 :> a [let a :> b b ] ] ] unit-test
+[ "bar" ] [ [let [let "bar" :> foo foo ] :> a a } ] unit-test
+[ 10 ] [ [let 10 :> a [let a :> b b ] } ] unit-test
-[ { \ + } ] [ [let \ + :> x { \ x } ] ] unit-test
+[ { \ + } ] { [let \ + :> x { \ x } } ] unit-test
-[ { \ + 3 } ] [ [let 3 :> a { \ + a } ] ] unit-test
+[ { \ + 3 } ] { [let 3 :> a { \ + a } } ] unit-test
-[ 3 ] [ [let \ + :> a 1 2 [ \ a execute ] ] call ] unit-test
+[ 3 ] [ [let \ + :> a 1 2 [ \ a execute ] ] } ] unit-test
! erg found this problem
:: erg's-:>-bug ( n ? -- n ) ? [ n :> n n ] [ n :> b b ] if ;
-[ 3 ] [ 3 f erg's-:>-bug ] unit-test
+{ 3 } [ 3 f erg's-:>-bug ] unit-test
-[ 3 ] [ 3 t erg's-:>-bug ] unit-test
+{ 3 } [ 3 t erg's-:>-bug ] unit-test
:: erg's-:>-bug-2 ( n ? -- n ) ? n '[ _ :> n n ] [ n :> b b ] if ;
-[ 3 ] [ 3 f erg's-:>-bug-2 ] unit-test
+{ 3 } [ 3 f erg's-:>-bug-2 ] unit-test
-[ 3 ] [ 3 t erg's-:>-bug-2 ] unit-test
+{ 3 } [ 3 t erg's-:>-bug-2 ] unit-test
! dharmatech found this problem
GENERIC: ed's-bug ( a -- b )
:: ed's-test-case ( a -- b )
{ [ a ed's-bug ] } && ;
-[ t ] [ \ ed's-test-case optimized? ] unit-test
+{ t } [ \ ed's-test-case optimized? ] unit-test
! multiple bind
-[ 3 1 2 ] [ [let 1 2 3 :> ( a b c ) c a b ] ] unit-test
+[ 3 1 2 ] { [let 1 2 3 :> ( a b c ) c a b } ] unit-test
! Test smart combinators and locals interaction
:: smart-combinator-locals ( a b c -- seq ) [ a b c ] output>array ;
-[ { 1 2 3 } ] [ 1 2 3 smart-combinator-locals ] unit-test
+{ { 1 2 3 } } [ 1 2 3 smart-combinator-locals ] 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
MACRO: see-test ( a b -- quot ) + ;
-[ t ] [ \ see-test macro? ] unit-test
+{ t } [ \ see-test macro? ] unit-test
-[ "USING: macros math ;\nIN: macros.tests\nMACRO: see-test ( a b -- quot ) + ;\n" ]
+{ "USING: macros math ;\nIN: macros.tests\nMACRO: see-test ( a b -- quot ) + ;\n" }
[ [ \ see-test see ] with-string-writer ]
unit-test
-[ t ] [ \ see-test macro? ] unit-test
+{ t } [ \ see-test macro? ] unit-test
-[ t ] [
+{ t } [
"USING: math ;\nIN: macros.tests\n: see-test ( a b -- c ) - ;\n" dup eval( -- )
[ \ see-test see ] with-string-writer =
] unit-test
-[ f ] [ \ see-test macro? ] unit-test
+{ f } [ \ see-test macro? ] unit-test
-[ ] [ "USING: macros stack-checker kernel ; IN: hanging-macro MACRO: c ( quot -- ) infer drop [ ] ;" eval( -- ) ] unit-test
-[ ] [ "USING: macros kernel ; IN: hanging-macro : a ( -- ) [ a ] c ;" eval( -- ) ] unit-test
+{ } [ "USING: macros stack-checker kernel ; IN: hanging-macro MACRO: c ( quot -- ) infer drop [ ] ;" eval( -- ) ] unit-test
+{ } [ "USING: macros kernel ; IN: hanging-macro : a ( -- ) [ a ] c ;" eval( -- ) ] unit-test
-[ ] [ [ "hanging-macro" forget-vocab ] with-compilation-unit ] unit-test
+{ } [ [ "hanging-macro" forget-vocab ] with-compilation-unit ] unit-test
-[ ] [ "IN: macros.tests USE: macros MACRO: foo ( -- x ) [ ] ;" eval( -- ) ] unit-test
+{ } [ "IN: macros.tests USE: macros MACRO: foo ( -- x ) [ ] ;" eval( -- ) ] unit-test
[ "IN: macros.tests USE: macros MACRO: foo ( -- x ) [ ] ; inline" eval( -- ) ] must-fail
! The macro expander code should infer
[ [ 0 bad-macro ] infer ] must-fail
-[ ] [ [ \ bad-macro forget ] with-compilation-unit ] unit-test
+{ } [ [ \ bad-macro forget ] with-compilation-unit ] unit-test
MATCH-VARS: ?a ?b ;
-[ f ] [ { ?a ?a } { 1 2 } match ] unit-test
+{ f } [ { ?a ?a } { 1 2 } match ] unit-test
-[ H{ { ?a 1 } { ?b 2 } } ] [
+{ H{ { ?a 1 } { ?b 2 } } } [
{ ?a ?b } { 1 2 } match
] unit-test
-[ { 1 2 } ] [
+{ { 1 2 } } [
{ 1 2 }
{
{ { ?a ?b } [ ?a ?b 2array ] }
} match-cond
] unit-test
-[ t ] [
+{ t } [
{ 1 2 }
{
{ { 1 2 } [ t ] }
} match-cond
] unit-test
-[ t ] [
+{ t } [
{ 1 3 }
{
{ { 1 2 } [ t ] }
} match-cond
] unit-test
-[ f ] [
+{ f } [
{ 1 5 }
{
{ { 1 2 } [ t ] }
\ ?a \ ?a match
] unit-test
-[ "match" ] [
+{ "match" } [
"abcd" {
{ ?a [ "match" ] }
} match-cond
TUPLE: match-replace-test a b ;
-[
+{
T{ match-replace-test f 2 1 }
-] [
+} [
T{ match-replace-test f 1 2 }
T{ match-replace-test f ?a ?b }
T{ match-replace-test f ?b ?a }
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
: test-fp-exception-compiled ( exception inputs quot -- quot' )
'[ _ @ [ _ collect-fp-exceptions ] compile-call nip member? ] ;
-[ t ] +fp-zero-divide+ [ 1.0 0.0 ] [ /f ] test-fp-exception unit-test
-[ t ] +fp-inexact+ [ 1.0 3.0 ] [ /f ] test-fp-exception unit-test
-[ t ] +fp-overflow+ [ 1.0e250 1.0e100 ] [ * ] test-fp-exception unit-test
-[ t ] +fp-underflow+ [ 1.0e-250 1.0e-100 ] [ * ] test-fp-exception unit-test
-[ t ] +fp-overflow+ [ 2.0 100,000.0 ] [ fpow ] test-fp-exception unit-test
-[ t ] +fp-invalid-operation+ [ 0.0 0.0 ] [ /f ] test-fp-exception unit-test
-[ t ] +fp-invalid-operation+ [ -1.0 ] [ fsqrt ] test-fp-exception unit-test
-
-[ t ] +fp-zero-divide+ [ 1.0 0.0 ] [ /f ] test-fp-exception-compiled unit-test
-[ t ] +fp-inexact+ [ 1.0 3.0 ] [ /f ] test-fp-exception-compiled unit-test
-[ t ] +fp-overflow+ [ 1.0e250 1.0e100 ] [ * ] test-fp-exception-compiled unit-test
-[ t ] +fp-underflow+ [ 1.0e-250 1.0e-100 ] [ * ] test-fp-exception-compiled unit-test
-[ t ] +fp-overflow+ [ 2.0 100,000.0 ] [ fpow ] test-fp-exception-compiled unit-test
-[ t ] +fp-invalid-operation+ [ 2.0 0/0. 1.0e-9 ] [ ~ ] test-fp-exception-compiled unit-test
+[ t ] +fp-zero-divide+ [ 1.0 0.0 ] { /f } test-fp-exception unit-test
+[ t ] +fp-inexact+ [ 1.0 3.0 ] { /f } test-fp-exception unit-test
+[ t ] +fp-overflow+ [ 1.0e250 1.0e100 ] { * } test-fp-exception unit-test
+[ t ] +fp-underflow+ [ 1.0e-250 1.0e-100 ] { * } test-fp-exception unit-test
+[ t ] +fp-overflow+ [ 2.0 100,000.0 ] { fpow } test-fp-exception unit-test
+[ t ] +fp-invalid-operation+ [ 0.0 0.0 ] { /f } test-fp-exception unit-test
+[ t ] +fp-invalid-operation+ [ -1.0 ] { fsqrt } test-fp-exception unit-test
+
+[ t ] +fp-zero-divide+ [ 1.0 0.0 ] { /f } test-fp-exception-compiled unit-test
+[ t ] +fp-inexact+ [ 1.0 3.0 ] { /f } test-fp-exception-compiled unit-test
+[ t ] +fp-overflow+ [ 1.0e250 1.0e100 ] { * } test-fp-exception-compiled unit-test
+[ t ] +fp-underflow+ [ 1.0e-250 1.0e-100 ] { * } test-fp-exception-compiled unit-test
+[ t ] +fp-overflow+ [ 2.0 100,000.0 ] { fpow } test-fp-exception-compiled unit-test
+[ t ] +fp-invalid-operation+ [ 2.0 0/0. 1.0e-9 ] { ~ } test-fp-exception-compiled unit-test
! No underflow on Linux with this test, just inexact. Reported as an Ubuntu bug:
! https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/429113
[ t ] +fp-underflow+ [ 2.0 -100,000.0 ] [ fpow ] test-fp-exception-compiled unit-test
] unless
-[ t ] +fp-invalid-operation+ [ 0.0 0.0 ] [ /f ] test-fp-exception-compiled unit-test
-[ t ] +fp-invalid-operation+ [ -1.0 ] [ fsqrt ] test-fp-exception-compiled unit-test
+[ t ] +fp-invalid-operation+ [ 0.0 0.0 ] { /f } test-fp-exception-compiled unit-test
+[ t ] +fp-invalid-operation+ [ -1.0 ] { fsqrt } test-fp-exception-compiled unit-test
-[
+{
0x3fd5,5555,5555,5555
0x3fc9,9999,9999,999a
0xbfc9,9999,9999,999a
0xbfd5,5555,5555,5555
-] [
+} [
+round-nearest+ [
1.0 3.0 /f double>bits
1.0 5.0 /f double>bits
] with-rounding-mode
] unit-test
-[
+{
0x3fd5,5555,5555,5555
0x3fc9,9999,9999,9999
0xbfc9,9999,9999,999a
0xbfd5,5555,5555,5556
-] [
+} [
+round-down+ [
1.0 3.0 /f double>bits
1.0 5.0 /f double>bits
] with-rounding-mode
] unit-test
-[
+{
0x3fd5,5555,5555,5556
0x3fc9,9999,9999,999a
0xbfc9,9999,9999,9999
0xbfd5,5555,5555,5555
-] [
+} [
+round-up+ [
1.0 3.0 /f double>bits
1.0 5.0 /f double>bits
] with-rounding-mode
] unit-test
-[
+{
0x3fd5,5555,5555,5555
0x3fc9,9999,9999,9999
0xbfc9,9999,9999,9999
0xbfd5,5555,5555,5555
-] [
+} [
+round-zero+ [
1.0 3.0 /f double>bits
1.0 5.0 /f double>bits
] unit-test
! ensure rounding mode is restored to +round-nearest+
-[
+{
0x3fd5,5555,5555,5555
0x3fc9,9999,9999,999a
0xbfc9,9999,9999,999a
0xbfd5,5555,5555,5555
-] [
+} [
1.0 3.0 /f double>bits
1.0 5.0 /f double>bits
-1.0 5.0 /f double>bits
] when
! Ensure traps get cleared
-[ 1/0. ] [ 1.0 0.0 /f ] unit-test
+{ 1/0. } [ 1.0 0.0 /f ] unit-test
! Ensure state is back to normal
-[ +round-nearest+ ] [ rounding-mode ] unit-test
-[ +denormal-keep+ ] [ denormal-mode ] unit-test
-[ { } ] [ fp-traps ] unit-test
+{ +round-nearest+ } [ rounding-mode ] unit-test
+{ +denormal-keep+ } [ denormal-mode ] unit-test
+{ { } } [ fp-traps ] unit-test
-[ ] [
+{ } [
all-fp-exceptions [ compact-gc ] with-fp-traps
] 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 } } [
MEMO: x ( a b c d e -- f g h i j )
[ 1 + ] 4 ndip ;
-[ 89 ] [ 10 fib ] unit-test
+{ 89 } [ 10 fib ] unit-test
-[
+{
1 0 0 0 0
1 0 0 0 0
-] [
+} [
0 0 0 0 0 x
0 0 0 0 0 x
] unit-test
MEMO: see-test ( a -- b ) reverse ;
-[ "USING: memoize sequences ;\nIN: memoize.tests\nMEMO: see-test ( a -- b ) reverse ;\n" ]
+{ "USING: memoize sequences ;\nIN: memoize.tests\nMEMO: see-test ( a -- b ) reverse ;\n" }
[ [ \ see-test see ] with-string-writer ]
unit-test
-[ ] [ "IN: memoize.tests : fib ( -- ) ;" eval( -- ) ] unit-test
+{ } [ "IN: memoize.tests : fib ( -- ) ;" eval( -- ) ] unit-test
-[ "IN: memoize.tests\n: fib ( -- ) ;\n" ] [ [ \ fib see ] with-string-writer ] unit-test
+{ "IN: memoize.tests\n: fib ( -- ) ;\n" } [ [ \ fib see ] with-string-writer ] unit-test
[ sq ] ( a -- b ) memoize-quot "q" set
-[ 9 ] [ 3 "q" get call ] unit-test
+{ 9 } [ 3 "q" get call ] unit-test
[ t ] [
{ 1/8 1/8 1/8 1/8 1/16 1/16 1/16 }
[ MEMO[ seconds sleep ] each ] benchmark
- 0.18e9 0.25e9 between?
+ 0.18e9 0.25e9 }
] unit-test
"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
C: <foo> foo
-[ 2 ] [ 1 2 <foo> <mirror> assoc-size ] unit-test
+{ 2 } [ 1 2 <foo> <mirror> assoc-size ] unit-test
-[ { "bar" "baz" } ] [ 1 2 <foo> <mirror> keys ] unit-test
+{ { "bar" "baz" } } [ 1 2 <foo> <mirror> keys ] unit-test
-[ 1 t ] [ "bar" 1 2 <foo> <mirror> at* ] unit-test
+{ 1 t } [ "bar" 1 2 <foo> <mirror> at* ] unit-test
-[ f f ] [ "hi" 1 2 <foo> <mirror> at* ] unit-test
+{ f f } [ "hi" 1 2 <foo> <mirror> at* ] unit-test
-[ 3 ] [
+{ 3 } [
3 "baz" 1 2 <foo> [ <mirror> set-at ] keep baz>>
] unit-test
[ 3 "numerator" 1/2 <mirror> set-at ] must-fail
-[ "foo" ] [
+{ "foo" } [
gensym [
<mirror> [
"foo" "name" set
TUPLE: declared-mirror-test
{ a integer initial: 0 } ;
-[ 5 ] [
+{ 5 } [
3 declared-mirror-test boa <mirror> [
5 "a" set
"a" get
{ green integer }
{ blue integer } ;
-[ T{ color f 0 0 0 } ] [
+{ T{ color f 0 0 0 } } [
1 2 3 color boa [ <mirror> clear-assoc ] keep
] unit-test
! Test reshaping with a mirror
1 2 3 color boa <mirror> "mirror" set
-[ ] [ "IN: mirrors.tests USE: math TUPLE: color { green integer } { red integer } { blue integer } ;" eval( -- ) ] unit-test
+{ } [ "IN: mirrors.tests USE: math TUPLE: color { green integer } { red integer } { blue integer } ;" eval( -- ) ] unit-test
-[ 1 ] [ "red" "mirror" get at ] unit-test
+{ 1 } [ "red" "mirror" get at ] unit-test
{ 3 } [ { 1 2 3 } make-mirror assoc-size ] unit-test
{ 2 } [ "asdf" make-mirror assoc-size ] 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
M: model-tester model-changed nip t >>hit? drop ;
-[ T{ model-tester f t } ]
+{ T{ model-tester f t } }
[
T{ model-tester f f } clone 3 <model> 2dup add-connection
5 swap set-model
"model-a" get "model-b" get 2array <product> "model-c" set
"model-c" get activate-model
-[ { 3 4 } ] [ "model-c" get value>> ] unit-test
+{ { 3 4 } } [ "model-c" get value>> ] unit-test
"model-c" get deactivate-model
T{ model-tester f f } "tester" set
-[ T{ model-tester f t } { 6 4 } ]
+{ T{ model-tester f t } { 6 4 } }
[
"tester" get "model-c" get add-connection
6 "model-a" get set-model
"model-c" get value>>
] unit-test
-[ T{ model-tester f t } V{ 5 } ]
+{ T{ model-tester f t } V{ 5 } }
[
T{ model-tester f f } clone V{ } clone <model> 2dup add-connection
5 swap [ push-model ] [ value>> ] bi
] unit-test
-[ T{ model-tester f t } 5 V{ } ]
+{ T{ model-tester f t } 5 V{ } }
[
T{ model-tester f f } clone V{ 5 } clone <model> 2dup add-connection
[ pop-model ] [ value>> ] bi
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
"OH HAI" m1 set-model
o1 i>>
o2 i>>
- ]
+ }
] unit-test
: 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
;
-[ "foo\nbar\n" ] [ test-it ] unit-test
+{ "foo\nbar\n" } [ test-it ] unit-test
! HEREDOC:
-[ "foo\nbar\n" ] [ HEREDOC: END
+{ "foo\nbar\n" } [ HEREDOC: END
foo
bar
END
] unit-test
-[ "" ] [ HEREDOC: END
+{ "" } [ HEREDOC: END
END
] unit-test
-[ " END\n" ] [ HEREDOC: END
+{ " END\n" } [ HEREDOC: END
END
END
] unit-test
-[ "\n" ] [ HEREDOC: END
+{ "\n" } [ HEREDOC: END
END
] unit-test
-[ "x\n" ] [ HEREDOC: END
+{ "x\n" } [ HEREDOC: END
x
END
] unit-test
-[ "x\n" ] [ HEREDOC: END
+{ "x\n" } [ HEREDOC: END
x
END
] unit-test
-[ "xyz \n" ] [ HEREDOC: END
+{ "xyz \n" } [ HEREDOC: END
xyz
END
] unit-test
-[ "} ! * # \" «\n" ] [ HEREDOC: END
+{ "} ! * # \" «\n" } [ HEREDOC: END
} ! * # " «
END
] unit-test
-[ 21 "foo\nbar\n" " HEREDOC: FOO\n FOO\n" 22 ] [ 21 HEREDOC: X
+{ 21 "foo\nbar\n" " HEREDOC: FOO\n FOO\n" 22 } [ 21 HEREDOC: X
foo
bar
X
END
22 ] unit-test
-[ "lol\n xyz\n" ]
+{ "lol\n xyz\n" }
[
HEREDOC: xyz
lol
] unit-test
-[ "lol" ]
+{ "lol" }
[ DELIMITED: aol
lolaol ] unit-test
-[ "whoa" ]
+{ "whoa" }
[ DELIMITED: factor blows my mind
whoafactor blows my mind ] unit-test
SYNTAX: MULTILINE-LITERAL: parse-here suffix! ;
>>
-[ { "bar" } ]
+{ { "bar" } }
[
CONSTANT: foo { MULTILINE-LITERAL:
bar
[ -1 <nibble-array> ] [ T{ bad-array-length f -1 } = ] must-fail-with
-[ t ] [ 16 iota dup >nibble-array sequence= ] unit-test
-[ N{ 4 2 1 3 } ] [ N{ 3 1 2 4 } reverse ] unit-test
-[ N{ 1 4 9 0 9 4 } ] [ N{ 1 2 3 4 5 6 } [ sq ] map ] unit-test
+{ t } [ 16 iota dup >nibble-array sequence= ] unit-test
+{ N{ 4 2 1 3 } } [ N{ 3 1 2 4 } reverse ] unit-test
+{ N{ 1 4 9 0 9 4 } } [ N{ 1 2 3 4 5 6 } [ sq ] map ] unit-test
IN: nmake.tests
USING: nmake kernel tools.test ;
-[ ] [ [ ] { } nmake ] unit-test
+{ } [ [ ] { } nmake ] unit-test
-[ { 1 } { 2 } ] [ [ 1 0, 2 1, ] { { } { } } nmake ] unit-test
+{ { 1 } { 2 } } [ [ 1 0, 2 1, ] { { } { } } nmake ] unit-test
[ [ ] [ call ] curry { { } } nmake ] must-infer
"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
pack strings tools.test pack.private ;
IN: pack.tests
-[ B{ 1 0 2 0 0 3 0 0 0 4 0 0 0 0 0 0 0 5 } ] [
+{ B{ 1 0 2 0 0 3 0 0 0 4 0 0 0 0 0 0 0 5 } } [
{ 1 2 3 4 5 }
"cstiq" pack-be
] unit-test
-[ { 1 2 3 4 5 } ] [
+{ { 1 2 3 4 5 } } [
{ 1 2 3 4 5 }
"cstiq" [ pack-be ] keep unpack-be
] unit-test
-[ B{ 1 2 0 3 0 0 4 0 0 0 5 0 0 0 0 0 0 0 } ] [
+{ B{ 1 2 0 3 0 0 4 0 0 0 5 0 0 0 0 0 0 0 } } [
{ 1 2 3 4 5 } "cstiq" pack-le
] unit-test
-[ { 1 2 3 4 5 } ] [
+{ { 1 2 3 4 5 } } [
{ 1 2 3 4 5 }
"cstiq" [ pack-le ] keep unpack-le
] unit-test
-[ { -1 -2 -3 -4 -5 } ] [
+{ { -1 -2 -3 -4 -5 } } [
{ -1 -2 -3 -4 -5 }
"cstiq" [ pack-le ] keep unpack-le
] unit-test
-[ { -1 -2 -3 -4 -5 3.14 } ] [
+{ { -1 -2 -3 -4 -5 3.14 } } [
{ -1 -2 -3 -4 -5 3.14 }
"cstiqd" [ pack-be ] keep unpack-be
] unit-test
-[ { -1 -2 -3 -4 -5 } ] [
+{ { -1 -2 -3 -4 -5 } } [
{ -1 -2 -3 -4 -5 }
"cstiq" [ pack-native ] keep unpack-native
] unit-test
{ B{ 1 2 3 4 5 0 0 0 } } [ { 1 2 3 4 5 } "4ci" pack-le ] unit-test
{ { 1 2 3 4 5 } } [ B{ 1 2 3 4 5 0 0 0 } "4ci" unpack-le ] unit-test
-[ 9 ] [ "iic" packed-length ] unit-test
+{ 9 } [ "iic" packed-length ] unit-test
[ "iii" read-packed-le ] must-infer
[ "iii" read-packed-be ] must-infer
[ "iii" read-packed-native ] must-infer
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
sequences peg peg.private peg.parsers words math accessors ;
IN: peg.tests
-[ ] [ reset-pegs ] unit-test
+{ } [ reset-pegs ] unit-test
[
"endbegin" "begin" token parse
USE: compiler
-[ ] [ disable-optimizer ] unit-test
+{ } [ disable-optimizer ] unit-test
-[ ] [ "" epsilon parse drop ] unit-test
+{ } [ "" epsilon parse drop ] unit-test
-[ ] [ enable-optimizer ] unit-test
+{ } [ enable-optimizer ] unit-test
-[ [ ] ] [ "" epsilon [ drop [ [ ] ] call ] action parse ] unit-test
+{ [ ] } [ "" epsilon [ drop [ [ ] ] call ] action parse ] unit-test
{
T{ parse-error
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: arrays io kernel porter-stemmer sequences tools.test
io.files io.encodings.utf8 ;
-[ 0 ] [ "xa" consonant-seq ] unit-test
-[ 0 ] [ "xxaa" consonant-seq ] unit-test
-[ 1 ] [ "xaxa" consonant-seq ] unit-test
-[ 2 ] [ "xaxaxa" consonant-seq ] unit-test
-[ 3 ] [ "xaxaxaxa" consonant-seq ] unit-test
-[ 3 ] [ "zzzzxaxaxaxaeee" consonant-seq ] unit-test
+{ 0 } [ "xa" consonant-seq ] unit-test
+{ 0 } [ "xxaa" consonant-seq ] unit-test
+{ 1 } [ "xaxa" consonant-seq ] unit-test
+{ 2 } [ "xaxaxa" consonant-seq ] unit-test
+{ 3 } [ "xaxaxaxa" consonant-seq ] unit-test
+{ 3 } [ "zzzzxaxaxaxaeee" consonant-seq ] unit-test
-[ t ] [ 0 "fish" consonant? ] unit-test
-[ f ] [ 0 "and" consonant? ] unit-test
-[ t ] [ 0 "yes" consonant? ] unit-test
-[ f ] [ 1 "gym" consonant? ] unit-test
+{ t } [ 0 "fish" consonant? ] unit-test
+{ f } [ 0 "and" consonant? ] unit-test
+{ t } [ 0 "yes" consonant? ] unit-test
+{ f } [ 1 "gym" consonant? ] unit-test
-[ t ] [ 5 "splitting" double-consonant? ] unit-test
-[ f ] [ 2 "feel" double-consonant? ] unit-test
+{ t } [ 5 "splitting" double-consonant? ] unit-test
+{ f } [ 2 "feel" double-consonant? ] unit-test
-[ f ] [ "xxxz" stem-vowel? ] unit-test
-[ t ] [ "baobab" stem-vowel? ] unit-test
+{ f } [ "xxxz" stem-vowel? ] unit-test
+{ t } [ "baobab" stem-vowel? ] unit-test
-[ t ] [ "hop" cvc? ] unit-test
-[ t ] [ "cav" cvc? ] unit-test
-[ t ] [ "lov" cvc? ] unit-test
-[ t ] [ "crim" cvc? ] unit-test
-[ f ] [ "show" cvc? ] unit-test
-[ f ] [ "box" cvc? ] unit-test
-[ f ] [ "tray" cvc? ] unit-test
-[ f ] [ "meet" cvc? ] unit-test
+{ t } [ "hop" cvc? ] unit-test
+{ t } [ "cav" cvc? ] unit-test
+{ t } [ "lov" cvc? ] unit-test
+{ t } [ "crim" cvc? ] unit-test
+{ f } [ "show" cvc? ] unit-test
+{ f } [ "box" cvc? ] unit-test
+{ f } [ "tray" cvc? ] unit-test
+{ f } [ "meet" cvc? ] unit-test
-[ "caress" ] [ "caresses" step1a step1b "" like ] unit-test
-[ "poni" ] [ "ponies" step1a step1b "" like ] unit-test
-[ "ti" ] [ "ties" step1a step1b "" like ] unit-test
-[ "caress" ] [ "caress" step1a step1b "" like ] unit-test
-[ "cat" ] [ "cats" step1a step1b "" like ] unit-test
-[ "feed" ] [ "feed" step1a step1b "" like ] unit-test
-[ "agree" ] [ "agreed" step1a step1b "" like ] unit-test
-[ "disable" ] [ "disabled" step1a step1b "" like ] unit-test
-[ "mat" ] [ "matting" step1a step1b "" like ] unit-test
-[ "mate" ] [ "mating" step1a step1b "" like ] unit-test
-[ "meet" ] [ "meeting" step1a step1b "" like ] unit-test
-[ "mill" ] [ "milling" step1a step1b "" like ] unit-test
-[ "mess" ] [ "messing" step1a step1b "" like ] unit-test
-[ "meet" ] [ "meetings" step1a step1b "" like ] unit-test
+{ "caress" } [ "caresses" step1a step1b "" like ] unit-test
+{ "poni" } [ "ponies" step1a step1b "" like ] unit-test
+{ "ti" } [ "ties" step1a step1b "" like ] unit-test
+{ "caress" } [ "caress" step1a step1b "" like ] unit-test
+{ "cat" } [ "cats" step1a step1b "" like ] unit-test
+{ "feed" } [ "feed" step1a step1b "" like ] unit-test
+{ "agree" } [ "agreed" step1a step1b "" like ] unit-test
+{ "disable" } [ "disabled" step1a step1b "" like ] unit-test
+{ "mat" } [ "matting" step1a step1b "" like ] unit-test
+{ "mate" } [ "mating" step1a step1b "" like ] unit-test
+{ "meet" } [ "meeting" step1a step1b "" like ] unit-test
+{ "mill" } [ "milling" step1a step1b "" like ] unit-test
+{ "mess" } [ "messing" step1a step1b "" like ] unit-test
+{ "meet" } [ "meetings" step1a step1b "" like ] unit-test
-[ "fishi" ] [ "fishy" step1c ] unit-test
-[ "by" ] [ "by" step1c ] unit-test
+{ "fishi" } [ "fishy" step1c ] unit-test
+{ "by" } [ "by" step1c ] unit-test
-[ "realizat" ] [ "realization" step4 ] unit-test
-[ "ion" ] [ "ion" step4 ] unit-test
-[ "able" ] [ "able" step4 ] unit-test
+{ "realizat" } [ "realization" step4 ] unit-test
+{ "ion" } [ "ion" step4 ] unit-test
+{ "able" } [ "able" step4 ] unit-test
-[ "fear" ] [ "feare" step5 "" like ] unit-test
-[ "mate" ] [ "mate" step5 "" like ] unit-test
-[ "hell" ] [ "hell" step5 "" like ] unit-test
-[ "mate" ] [ "mate" step5 "" like ] unit-test
+{ "fear" } [ "feare" step5 "" like ] unit-test
+{ "mate" } [ "mate" step5 "" like ] unit-test
+{ "hell" } [ "hell" step5 "" like ] unit-test
+{ "mate" } [ "mate" step5 "" like ] unit-test
-[ { } ] [
+{ { } } [
"vocab:porter-stemmer/test/voc.txt" utf8 file-lines
[ stem ] map
"vocab:porter-stemmer/test/output.txt" utf8 file-lines
tools.test vectors vocabs.parser words ;
IN: prettyprint.tests
-[ "4" ] [ 4 unparse ] unit-test
-[ "4096" ] [ 4096 unparse ] unit-test
-[ "0b1000000000000" ] [ 2 number-base [ 4096 unparse ] with-variable ] unit-test
-[ "0o10000" ] [ 8 number-base [ 4096 unparse ] with-variable ] unit-test
-[ "0x1000" ] [ 16 number-base [ 4096 unparse ] with-variable ] unit-test
-[ "1.0" ] [ 1.0 unparse ] unit-test
-[ "8.0" ] [ 8.0 unparse ] unit-test
-[ "8.0" ] [ 2 number-base [ 8.0 unparse ] with-variable ] unit-test
-[ "8.0" ] [ 8 number-base [ 8.0 unparse ] with-variable ] unit-test
-[ "0x1.0p3" ] [ 16 number-base [ 8.0 unparse ] with-variable ] unit-test
-[ "1267650600228229401496703205376" ] [ 1 100 shift unparse ] unit-test
+{ "4" } [ 4 unparse ] unit-test
+{ "4096" } [ 4096 unparse ] unit-test
+{ "0b1000000000000" } [ 2 number-base [ 4096 unparse ] with-variable ] unit-test
+{ "0o10000" } [ 8 number-base [ 4096 unparse ] with-variable ] unit-test
+{ "0x1000" } [ 16 number-base [ 4096 unparse ] with-variable ] unit-test
+{ "1.0" } [ 1.0 unparse ] unit-test
+{ "8.0" } [ 8.0 unparse ] unit-test
+{ "8.0" } [ 2 number-base [ 8.0 unparse ] with-variable ] unit-test
+{ "8.0" } [ 8 number-base [ 8.0 unparse ] with-variable ] unit-test
+{ "0x1.0p3" } [ 16 number-base [ 8.0 unparse ] with-variable ] unit-test
+{ "1267650600228229401496703205376" } [ 1 100 shift unparse ] unit-test
-[ "+" ] [ \ + unparse ] unit-test
+{ "+" } [ \ + unparse ] unit-test
-[ "\\ +" ] [ [ \ + ] first unparse ] unit-test
+{ "\\ +" } [ [ \ + ] first unparse ] unit-test
-[ "{ }" ] [ { } unparse ] unit-test
+{ "{ }" } [ { } unparse ] unit-test
-[ "{ 1 2 3 }" ] [ { 1 2 3 } unparse ] unit-test
+{ "{ 1 2 3 }" } [ { 1 2 3 } unparse ] unit-test
-[ "\"hello\\\\backslash\"" ]
+{ "\"hello\\\\backslash\"" }
[ "hello\\backslash" unparse ]
unit-test
! [ "\u123456" unparse ]
! unit-test
-[ "\"\\e\"" ]
+{ "\"\\e\"" }
[ "\e" unparse ]
unit-test
-[ "\"\\x01\"" ]
+{ "\"\\x01\"" }
[ 1 1string unparse ]
unit-test
-[ "f" ] [ f unparse ] unit-test
-[ "t" ] [ t unparse ] unit-test
+{ "f" } [ f unparse ] unit-test
+{ "t" } [ t unparse ] unit-test
-[ "SBUF\" hello world\"" ] [ SBUF" hello world" unparse ] unit-test
+{ "SBUF\" hello world\"" } [ SBUF" hello world" unparse ] unit-test
-[ "W{ \\ + }" ] [ [ W{ \ + } ] first unparse ] unit-test
+{ "W{ \\ + }" } [ [ W{ \ + } ] first unparse ] unit-test
-[ ] [ \ fixnum see ] unit-test
+{ } [ \ fixnum see ] unit-test
-[ ] [ \ integer see ] unit-test
+{ } [ \ integer see ] unit-test
-[ ] [ \ generic see ] unit-test
+{ } [ \ generic see ] unit-test
-[ ] [ \ duplex-stream see ] unit-test
+{ } [ \ duplex-stream see ] unit-test
-[ "[ \\ + ]" ] [ [ \ + ] unparse ] unit-test
-[ "[ \\ [ ]" ] [ [ \ [ ] unparse ] unit-test
+{ "[ \\ + ]" } [ [ \ + ] unparse ] unit-test
+{ "[ \\ [ ]" } [ [ \ [ ] unparse ] unit-test
-[ t ] [
+{ t } [
100 \ dup <array> unparse-short
"{" head?
] unit-test
: foo ( a -- b ) dup * ; inline
-[ "USING: kernel math ;\nIN: prettyprint.tests\n: foo ( a -- b ) dup * ; inline\n" ]
+{ "USING: kernel math ;\nIN: prettyprint.tests\n: foo ( a -- b ) dup * ; inline\n" }
[ [ \ foo see ] with-string-writer ] unit-test
: bar ( x -- y ) 2 + ;
-[ "USING: math ;\nIN: prettyprint.tests\n: bar ( x -- y ) 2 + ;\n" ]
+{ "USING: math ;\nIN: prettyprint.tests\n: bar ( x -- y ) 2 + ;\n" }
[ [ \ bar see ] with-string-writer ] unit-test
: blah ( a a a a a a a a a a a a a a a a a a a a -- )
drop
drop ;
-[ "drop ;" ] [
+{ "drop ;" } [
[ \ blah see ] with-string-writer "\n" ?tail drop 6 tail*
] unit-test
M: object method-layout ;
-[
+{
{
"USING: kernel math prettyprint.tests ;"
"M: complex method-layout"
"M: object method-layout ;"
""
}
-] [
+} [
[ \ method-layout see-methods ] with-string-writer "\n" split
] unit-test
" ] [ 2drop f ] if ;"
} ;
-[ t ] [
+{ t } [
"soft-break-layout" soft-break-test check-see
] unit-test
" [ <reversed> \"hello world foo\" suffix ] [ ] make ;"
} ;
-[ t ] [
+{ t } [
"another-soft-break-layout" another-soft-break-test
check-see
] unit-test
} ;
-[ t ] [
+{ t } [
"string-layout-test" string-layout check-see
] unit-test
" } cond ;"
} ;
-[ t ] [
+{ t } [
"narrow-layout" narrow-test check-see
] unit-test
" } ;"
} ;
-[ t ] [
+{ t } [
"another-narrow-layout" another-narrow-test check-see
] unit-test
USING: prettyprint.tests ;
M: class-see-layout class-see-layout ;
-[
+{
{
"IN: prettyprint.tests"
"TUPLE: class-see-layout ;"
"GENERIC: class-see-layout ( x -- y )"
""
}
-] [
+} [
[ \ class-see-layout see ] with-string-writer "\n" split
] unit-test
-[
+{
{
"USING: prettyprint.tests ;"
"M: class-see-layout class-see-layout ;"
""
}
-] [
+} [
[ \ class-see-layout see-methods ] with-string-writer "\n" split
] unit-test
-[ ] [ \ in>> synopsis drop ] unit-test
+{ } [ \ in>> synopsis drop ] unit-test
! Regression
-[ t ] [
+{ t } [
"IN: prettyprint.tests\nGENERIC: generic-decl-test ( a -- b ) flushable\n"
dup eval( -- )
"generic-decl-test" "prettyprint.tests" lookup-word
[ see ] with-string-writer =
] unit-test
-[ [ + ] ] [ [ \ + (step-into-execute) ] (remove-breakpoints) ] unit-test
+{ [ + ] } [ [ \ + (step-into-execute) ] (remove-breakpoints) ] unit-test
-[ [ (step-into-execute) ] ] [ [ (step-into-execute) ] (remove-breakpoints) ] unit-test
+{ [ (step-into-execute) ] } [ [ (step-into-execute) ] (remove-breakpoints) ] unit-test
-[ [ 2 2 + . ] ] [
+{ [ 2 2 + . ] } [
[ 2 2 \ + (step-into-execute) . ] (remove-breakpoints)
] unit-test
-[ [ 2 2 + . ] ] [
+{ [ 2 2 + . ] } [
[ 2 break 2 \ + (step-into-execute) . ] (remove-breakpoints)
] unit-test
M: f generic-see-test-with-f ;
-[ "USING: prettyprint.tests ;\nM: f generic-see-test-with-f ;\n" ] [
+{ "USING: prettyprint.tests ;\nM: f generic-see-test-with-f ;\n" } [
[ M\ f generic-see-test-with-f see ] with-string-writer
] unit-test
PREDICATE: predicate-see-test < integer even? ;
-[ "USING: math ;\nIN: prettyprint.tests\nPREDICATE: predicate-see-test < integer even? ;\n" ] [
+{ "USING: math ;\nIN: prettyprint.tests\nPREDICATE: predicate-see-test < integer even? ;\n" } [
[ \ predicate-see-test see ] with-string-writer
] unit-test
INTERSECTION: intersection-see-test sequence number ;
-[ "USING: math sequences ;\nIN: prettyprint.tests\nINTERSECTION: intersection-see-test sequence number ;\n" ] [
+{ "USING: math sequences ;\nIN: prettyprint.tests\nINTERSECTION: intersection-see-test sequence number ;\n" } [
[ \ intersection-see-test see ] with-string-writer
] unit-test
-[ ] [ \ compose see ] unit-test
-[ ] [ \ curry see ] unit-test
+{ } [ \ compose see ] unit-test
+{ } [ \ curry see ] unit-test
-[ "POSTPONE: [" ] [ \ [ unparse ] unit-test
+{ "POSTPONE: [" } [ \ [ unparse ] unit-test
TUPLE: started-out-hustlin' ;
M: started-out-hustlin' ended-up-ballin' ; inline
-[ "USING: prettyprint.tests ;\nM: started-out-hustlin' ended-up-ballin' ; inline\n" ] [
+{ "USING: prettyprint.tests ;\nM: started-out-hustlin' ended-up-ballin' ; inline\n" } [
[ M\ started-out-hustlin' ended-up-ballin' see ] with-string-writer
] unit-test
TUPLE: tuple-with-declared-slot { x integer } ;
-[
+{
{
"USING: math ;"
"IN: prettyprint.tests"
"TUPLE: tuple-with-declared-slot { x integer initial: 0 } ;"
""
}
-] [
+} [
[ \ tuple-with-declared-slot see ] with-string-writer "\n" split
] unit-test
TUPLE: tuple-with-read-only-slot { x read-only } ;
-[
+{
{
"IN: prettyprint.tests"
"TUPLE: tuple-with-read-only-slot { x read-only } ;"
""
}
-] [
+} [
[ \ tuple-with-read-only-slot see ] with-string-writer "\n" split
] unit-test
TUPLE: tuple-with-initial-slot { x initial: 123 } ;
-[
+{
{
"IN: prettyprint.tests"
"TUPLE: tuple-with-initial-slot { x initial: 123 } ;"
""
}
-] [
+} [
[ \ tuple-with-initial-slot see ] with-string-writer "\n" split
] unit-test
TUPLE: tuple-with-initial-declared-slot { x integer initial: 123 } ;
-[
+{
{
"USING: math ;"
"IN: prettyprint.tests"
" { x integer initial: 123 } ;"
""
}
-] [
+} [
[ \ tuple-with-initial-declared-slot see ] with-string-writer "\n" split
] unit-test
TUPLE: final-tuple ; final
-[
+{
{
"IN: prettyprint.tests"
"TUPLE: final-tuple ; final"
""
}
-] [
+} [
[ \ final-tuple see ] with-string-writer "\n" split
] unit-test
-[ "H{ { 1 2 } }\n" ] [ [ H{ { 1 2 } } short. ] with-string-writer ] unit-test
+{ "H{ { 1 2 } }\n" } [ [ H{ { 1 2 } } short. ] with-string-writer ] unit-test
-[ "H{ { 1 ~array~ } }\n" ] [ [ H{ { 1 { 2 } } } short. ] with-string-writer ] unit-test
+{ "H{ { 1 ~array~ } }\n" } [ [ H{ { 1 { 2 } } } short. ] with-string-writer ] unit-test
-[ "{ ~array~ }\n" ] [ [ { { 1 2 } } short. ] with-string-writer ] unit-test
+{ "{ ~array~ }\n" } [ [ { { 1 2 } } short. ] with-string-writer ] unit-test
-[ "H{ { 1 { 2 3 } } }\n" ] [
+{ "H{ { 1 { 2 3 } } }\n" } [
f nesting-limit [
[ H{ { 1 { 2 3 } } } . ] with-string-writer
] with-variable
] unit-test
-[ "maybe{ integer }\n" ] [ [ maybe{ integer } . ] with-string-writer ] unit-test
+{ "maybe{ integer }\n" } [ [ maybe{ integer } . ] with-string-writer ] unit-test
TUPLE: bob a b ;
-[ "maybe{ bob }\n" ] [ [ maybe{ bob } . ] with-string-writer ] unit-test
-[ "maybe{ word }\n" ] [ [ maybe{ word } . ] with-string-writer ] unit-test
+{ "maybe{ bob }\n" } [ [ maybe{ bob } . ] with-string-writer ] unit-test
+{ "maybe{ word }\n" } [ [ maybe{ word } . ] with-string-writer ] unit-test
TUPLE: har a ;
GENERIC: harhar ( obj -- obj )
M: maybe{ har } harhar ;
M: integer harhar M\ integer harhar drop ;
-[
+{
"""USING: prettyprint.tests ;
M: maybe{ har } harhar ;
USING: kernel math prettyprint.tests ;
M: integer harhar M\\ integer harhar drop ;\n"""
-] [
+} [
[ \ harhar see-methods ] with-string-writer
] unit-test
TUPLE: mo { a union{ float integer } } ;
TUPLE: fo { a intersection{ fixnum integer } } ;
-[
+{
"""USING: math ;
IN: prettyprint.tests
TUPLE: mo { a union{ integer float } initial: 0 } ;
"""
-] [
+} [
[ \ mo see ] with-string-writer
] unit-test
-[
+{
"""USING: math ;
IN: prettyprint.tests
TUPLE: fo { a intersection{ integer fixnum } initial: 0 } ;
"""
-] [
+} [
[ \ fo see ] with-string-writer
] unit-test
-[
+{
"""union{ intersection{ string hashtable } union{ integer float } }\n"""
-] [ [ union{ union{ float integer } intersection{ string hashtable } } . ] with-string-writer ] unit-test
+} [ [ union{ union{ float integer } intersection{ string hashtable } } . ] with-string-writer ] unit-test
-[
+{
"""intersection{
intersection{ string hashtable }
union{ integer float }
}
"""
-] [ [ intersection{ union{ float integer } intersection{ string hashtable } } . ] with-string-writer ] unit-test
+} [ [ intersection{ union{ float integer } intersection{ string hashtable } } . ] with-string-writer ] unit-test
-[
+{
"""maybe{ union{ integer float } }\n"""
-] [
+} [
[ maybe{ union{ float integer } } . ] with-string-writer
] unit-test
-[
+{
"""maybe{ maybe{ integer } }\n"""
-] [
+} [
[ maybe{ maybe{ integer } } . ] with-string-writer
] unit-test
[ CHAR: a <string> text "b" text ] with-pprint
] with-string-writer ;
-[
+{
"""aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa b"""
-] [ margin get 3 - margin-test ] unit-test
+} [ margin get 3 - margin-test ] unit-test
-[
+{
"""aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa b"""
-] [ margin get 2 - margin-test ] unit-test
+} [ margin get 2 - margin-test ] unit-test
-[
+{
"""aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
b"""
-] [ margin get 1 - margin-test ] unit-test
+} [ margin get 1 - margin-test ] unit-test
LAZY: lazy-test ( a -- b ) 1 + ;
{ 1 1 } [ lazy-test ] must-infer-as
-[ 3 ] [ 2 lazy-test force ] unit-test
+{ 3 } [ 2 lazy-test force ] unit-test
sequences splitting kernel io.encodings.8-bit.latin2 ;
IN: quoted-printable.tests
-[ """José was the
+{ """José was the
person who knew how to write the letters:
ő and ü
-and we didn't know hów tö do thât""" ]
+and we didn't know hów tö do thât""" }
[ """Jos=E9 was the
person who knew how to write the letters:
=F5 and =FC=20
and w=
e didn't know h=F3w t=F6 do th=E2t""" quoted> latin2 decode ] unit-test
-[ """Jos=E9 was the=0Aperson who knew how to write the letters:=0A =F5 and =FC=0Aand we didn't know h=F3w t=F6 do th=E2t""" ]
+{ """Jos=E9 was the=0Aperson who knew how to write the letters:=0A =F5 and =FC=0Aand we didn't know h=F3w t=F6 do th=E2t""" }
[ """José was the
person who knew how to write the letters:
ő and ü
: message ( -- str )
55 [ "hello" ] replicate concat ;
-[ f ] [ message >quoted "=\r\n" swap subseq? ] unit-test
-[ 1 ] [ message >quoted string-lines length ] unit-test
-[ t ] [ message >quoted-lines "=\r\n" swap subseq? ] unit-test
-[ 4 ] [ message >quoted-lines string-lines length ] unit-test
-[ "===o" ] [ message >quoted-lines string-lines [ last ] "" map-as ] unit-test
+{ f } [ message >quoted "=\r\n" swap subseq? ] unit-test
+{ 1 } [ message >quoted string-lines length ] unit-test
+{ t } [ message >quoted-lines "=\r\n" swap subseq? ] unit-test
+{ 4 } [ message >quoted-lines string-lines length ] unit-test
+{ "===o" } [ message >quoted-lines string-lines [ last ] "" map-as ] unit-test
USING: tools.test quoting ;
IN: quoting.tests
-[ f ] [ "" quoted? ] unit-test
-[ t ] [ "''" quoted? ] unit-test
-[ t ] [ "\"\"" quoted? ] unit-test
-[ t ] [ "\"Circus Maximus\"" quoted? ] unit-test
-[ t ] [ "'Circus Maximus'" quoted? ] unit-test
-[ f ] [ "Circus Maximus" quoted? ] unit-test
+{ f } [ "" quoted? ] unit-test
+{ t } [ "''" quoted? ] unit-test
+{ t } [ "\"\"" quoted? ] unit-test
+{ t } [ "\"Circus Maximus\"" quoted? ] unit-test
+{ t } [ "'Circus Maximus'" quoted? ] unit-test
+{ f } [ "Circus Maximus" quoted? ] unit-test
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 =
math.functions sets grouping random.private math.statistics ;
IN: random.tests
-[ 4 ] [ 4 random-bytes length ] unit-test
-[ 7 ] [ 7 random-bytes length ] unit-test
+{ 4 } [ 4 random-bytes length ] unit-test
+{ 7 } [ 7 random-bytes length ] unit-test
-[ 4 ] [ [ 4 random-bytes length ] with-secure-random ] unit-test
-[ 7 ] [ [ 7 random-bytes length ] with-secure-random ] unit-test
+{ 4 } [ [ 4 random-bytes length ] with-secure-random ] unit-test
+{ 7 } [ [ 7 random-bytes length ] with-secure-random ] unit-test
-[ 2 ] [ V{ 10 20 30 } [ delete-random drop ] keep length ] unit-test
+{ 2 } [ V{ 10 20 30 } [ delete-random drop ] keep length ] unit-test
[ V{ } [ delete-random drop ] keep length ] must-fail
-[ t ] [ 10000 [ iota 0 [ drop 187 random + ] reduce ] keep / 2 * 187 10 ~ ] unit-test
-[ t ] [ 10000 [ iota 0 [ drop 400 random + ] reduce ] keep / 2 * 400 10 ~ ] unit-test
+{ t } [ 10000 [ iota 0 [ drop 187 random + ] reduce ] keep / 2 * 187 10 ~ ] unit-test
+{ t } [ 10000 [ iota 0 [ drop 400 random + ] reduce ] keep / 2 * 400 10 ~ ] unit-test
-[ t ] [ 1000 [ 400 random ] replicate members length 256 > ] unit-test
+{ t } [ 1000 [ 400 random ] replicate members length 256 > ] unit-test
-[ f ] [ 0 random ] unit-test
+{ f } [ 0 random ] unit-test
-[ { } ] [ { } randomize ] unit-test
-[ { 1 } ] [ { 1 } randomize ] unit-test
+{ { } } [ { } randomize ] unit-test
+{ { 1 } } [ { 1 } randomize ] unit-test
-[ f ]
+{ f }
[ 100 [ { 0 1 } random ] replicate all-equal? ] unit-test
-[ 49 ] [ 50 random-bits* log2 ] unit-test
+{ 49 } [ 50 random-bits* log2 ] unit-test
[ { 1 2 } 3 sample ] [ too-many-samples? ] must-fail-with
-[ 3 ] [ { 1 2 3 4 } 3 sample members length ] unit-test
-[ 99 ] [ 100 iota 99 sample members length ] unit-test
+{ 3 } [ { 1 2 3 4 } 3 sample members length ] unit-test
+{ 99 } [ 100 iota 99 sample members length ] unit-test
-[ ]
+{ }
[ [ 100 random-bytes ] with-system-random drop ] unit-test
{ t t }
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* ]
IN: refs.tests
! assoc-refs
-[ 3 ] [
+{ 3 } [
H{ { "a" 3 } } "a" <value-ref> get-ref
] unit-test
-[ 4 ] [
+{ 4 } [
4 H{ { "a" 3 } } clone "a" <value-ref>
[ set-ref ] keep
get-ref
] unit-test
-[ "a" ] [
+{ "a" } [
H{ { "a" 3 } } "a" <key-ref> get-ref
] unit-test
-[ H{ { "b" 3 } } ] [
+{ H{ { "b" 3 } } } [
"b" H{ { "a" 3 } } clone [
"a" <key-ref>
set-ref
SYMBOLS: lion giraffe elephant rabbit ;
! obj-refs
-[ rabbit ] [ rabbit <obj-ref> get-ref ] unit-test
-[ rabbit ] [ f <obj-ref> rabbit set-ref* get-ref ] unit-test
-[ rabbit ] [ rabbit <obj-ref> take ] unit-test
-[ rabbit f ] [ rabbit <obj-ref> [ take ] keep get-ref ] unit-test
-[ lion ] [ rabbit <obj-ref> dup [ drop lion ] change-ref get-ref ] unit-test
+{ rabbit } [ rabbit <obj-ref> get-ref ] unit-test
+{ rabbit } [ f <obj-ref> rabbit set-ref* get-ref ] unit-test
+{ rabbit } [ rabbit <obj-ref> take ] unit-test
+{ rabbit f } [ rabbit <obj-ref> [ take ] keep get-ref ] unit-test
+{ lion } [ rabbit <obj-ref> dup [ drop lion ] change-ref get-ref ] unit-test
! var-refs
-[ giraffe ] [ [ giraffe rabbit set rabbit <var-ref> get-ref ] with-scope ] unit-test
+{ giraffe } [ [ giraffe rabbit set rabbit <var-ref> get-ref ] with-scope ] unit-test
-[ rabbit ]
+{ rabbit }
[
[
lion rabbit set [
] with-scope
] unit-test
-[ rabbit ] [
+{ rabbit } [
rabbit <var-ref>
[
lion rabbit set [
] with-scope
] unit-test
-[ elephant ] [
+{ elephant } [
rabbit <var-ref>
[
elephant rabbit set [
] with-scope
] unit-test
-[ rabbit ] [
+{ rabbit } [
rabbit <var-ref>
[
elephant set-ref* [
] with-scope
] unit-test
-[ elephant ] [
+{ elephant } [
rabbit <var-ref>
[
elephant set-ref* [
] unit-test
! Top Hats
-[ lion ] [ lion rabbit set-global rabbit <global-var-ref> get-ref ] unit-test
-[ giraffe ] [ rabbit <global-var-ref> giraffe set-ref* get-ref ] unit-test
+{ lion } [ lion rabbit set-global rabbit <global-var-ref> get-ref ] unit-test
+{ giraffe } [ rabbit <global-var-ref> giraffe set-ref* get-ref ] unit-test
! Tuple refs
TUPLE: foo bar ;
: test-slot-ref ( -- slot-ref )
test-tuple 2 <slot-ref> ; ! hack!
-[ rabbit ] [ test-slot-ref get-ref ] unit-test
-[ lion ] [ test-slot-ref lion set-ref* get-ref ] unit-test
+{ rabbit } [ test-slot-ref get-ref ] unit-test
+{ lion } [ test-slot-ref lion set-ref* get-ref ] unit-test
! Boxes as refs
-[ rabbit ] [ <box> rabbit set-ref* get-ref ] unit-test
+{ rabbit } [ <box> rabbit set-ref* get-ref ] unit-test
[ <box> rabbit set-ref* lion set-ref* ] must-fail
[ <box> get-ref ] must-fail
! 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{
regexp.private eval strings multiline accessors ;
IN: regexp-tests
-[ f ] [ "b" "a*" <regexp> matches? ] unit-test
-[ t ] [ "" "a*" <regexp> matches? ] unit-test
-[ t ] [ "a" "a*" <regexp> matches? ] unit-test
-[ t ] [ "aaaaaaa" "a*" <regexp> matches? ] unit-test
-[ f ] [ "ab" "a*" <regexp> matches? ] unit-test
-
-[ t ] [ "abc" "abc" <regexp> matches? ] unit-test
-[ t ] [ "a" "a|b|c" <regexp> matches? ] unit-test
-[ t ] [ "b" "a|b|c" <regexp> matches? ] unit-test
-[ t ] [ "c" "a|b|c" <regexp> matches? ] unit-test
-[ f ] [ "c" "d|e|f" <regexp> matches? ] unit-test
-
-[ t ] [ "b" "|b" <regexp> matches? ] unit-test
-[ t ] [ "b" "b|" <regexp> matches? ] unit-test
-[ t ] [ "" "b|" <regexp> matches? ] unit-test
-[ t ] [ "" "b|" <regexp> matches? ] unit-test
-[ t ] [ "" "|" <regexp> matches? ] unit-test
-[ t ] [ "" "|||||||" <regexp> matches? ] unit-test
-
-[ f ] [ "aa" "a|b|c" <regexp> matches? ] unit-test
-[ f ] [ "bb" "a|b|c" <regexp> matches? ] unit-test
-[ f ] [ "cc" "a|b|c" <regexp> matches? ] unit-test
-[ f ] [ "cc" "d|e|f" <regexp> matches? ] unit-test
-
-[ f ] [ "" "a+" <regexp> matches? ] unit-test
-[ t ] [ "a" "a+" <regexp> matches? ] unit-test
-[ t ] [ "aa" "a+" <regexp> matches? ] unit-test
-
-[ t ] [ "" "a?" <regexp> matches? ] unit-test
-[ t ] [ "a" "a?" <regexp> matches? ] unit-test
-[ f ] [ "aa" "a?" <regexp> matches? ] unit-test
-
-[ f ] [ "" "." <regexp> matches? ] unit-test
-[ t ] [ "a" "." <regexp> matches? ] unit-test
-[ t ] [ "." "." <regexp> matches? ] unit-test
+{ f } [ "b" "a*" <regexp> matches? ] unit-test
+{ t } [ "" "a*" <regexp> matches? ] unit-test
+{ t } [ "a" "a*" <regexp> matches? ] unit-test
+{ t } [ "aaaaaaa" "a*" <regexp> matches? ] unit-test
+{ f } [ "ab" "a*" <regexp> matches? ] unit-test
+
+{ t } [ "abc" "abc" <regexp> matches? ] unit-test
+{ t } [ "a" "a|b|c" <regexp> matches? ] unit-test
+{ t } [ "b" "a|b|c" <regexp> matches? ] unit-test
+{ t } [ "c" "a|b|c" <regexp> matches? ] unit-test
+{ f } [ "c" "d|e|f" <regexp> matches? ] unit-test
+
+{ t } [ "b" "|b" <regexp> matches? ] unit-test
+{ t } [ "b" "b|" <regexp> matches? ] unit-test
+{ t } [ "" "b|" <regexp> matches? ] unit-test
+{ t } [ "" "b|" <regexp> matches? ] unit-test
+{ t } [ "" "|" <regexp> matches? ] unit-test
+{ t } [ "" "|||||||" <regexp> matches? ] unit-test
+
+{ f } [ "aa" "a|b|c" <regexp> matches? ] unit-test
+{ f } [ "bb" "a|b|c" <regexp> matches? ] unit-test
+{ f } [ "cc" "a|b|c" <regexp> matches? ] unit-test
+{ f } [ "cc" "d|e|f" <regexp> matches? ] unit-test
+
+{ f } [ "" "a+" <regexp> matches? ] unit-test
+{ t } [ "a" "a+" <regexp> matches? ] unit-test
+{ t } [ "aa" "a+" <regexp> matches? ] unit-test
+
+{ t } [ "" "a?" <regexp> matches? ] unit-test
+{ t } [ "a" "a?" <regexp> matches? ] unit-test
+{ f } [ "aa" "a?" <regexp> matches? ] unit-test
+
+{ f } [ "" "." <regexp> matches? ] unit-test
+{ t } [ "a" "." <regexp> matches? ] unit-test
+{ t } [ "." "." <regexp> matches? ] unit-test
! Dotall mode -- when on, . matches newlines.
! Off by default.
-[ f ] [ "\n" "." <regexp> matches? ] unit-test
-[ t ] [ "\n" "(?s:.)" <regexp> matches? ] unit-test
-[ t ] [ "\n" R/ ./s matches? ] unit-test
-[ f ] [ "\n\n" "(?s:.)." <regexp> matches? ] unit-test
-
-[ f ] [ "" ".+" <regexp> matches? ] unit-test
-[ t ] [ "a" ".+" <regexp> matches? ] unit-test
-[ t ] [ "ab" ".+" <regexp> matches? ] unit-test
-
-[ t ] [ " " "[\\s]" <regexp> matches? ] unit-test
-[ f ] [ "a" "[\\s]" <regexp> matches? ] unit-test
-[ f ] [ " " "[\\S]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[\\S]" <regexp> matches? ] unit-test
-[ f ] [ " " "[\\w]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[\\w]" <regexp> matches? ] unit-test
-[ t ] [ " " "[\\W]" <regexp> matches? ] unit-test
-[ f ] [ "a" "[\\W]" <regexp> matches? ] unit-test
-
-[ t ] [ "/" "\\/" <regexp> matches? ] unit-test
-
-[ t ] [ "a" R' a'i matches? ] unit-test
-
-[ t ] [ "" "a|b*|c+|d?" <regexp> matches? ] unit-test
-[ t ] [ "a" "a|b*|c+|d?" <regexp> matches? ] unit-test
-[ t ] [ "c" "a|b*|c+|d?" <regexp> matches? ] unit-test
-[ t ] [ "cc" "a|b*|c+|d?" <regexp> matches? ] unit-test
-[ f ] [ "ccd" "a|b*|c+|d?" <regexp> matches? ] unit-test
-[ t ] [ "d" "a|b*|c+|d?" <regexp> matches? ] unit-test
-
-[ t ] [ "foo" "foo|bar" <regexp> matches? ] unit-test
-[ t ] [ "bar" "foo|bar" <regexp> matches? ] unit-test
-[ f ] [ "foobar" "foo|bar" <regexp> matches? ] unit-test
-
-[ f ] [ "" "(a)" <regexp> matches? ] unit-test
-[ t ] [ "a" "(a)" <regexp> matches? ] unit-test
-[ f ] [ "aa" "(a)" <regexp> matches? ] unit-test
-[ t ] [ "aa" "(a*)" <regexp> matches? ] unit-test
-
-[ f ] [ "aababaaabbac" "(a|b)+" <regexp> matches? ] unit-test
-[ t ] [ "ababaaabba" "(a|b)+" <regexp> matches? ] unit-test
-
-[ f ] [ "" "a{1}" <regexp> matches? ] unit-test
-[ t ] [ "a" "a{1}" <regexp> matches? ] unit-test
-[ f ] [ "aa" "a{1}" <regexp> matches? ] unit-test
-
-[ f ] [ "a" "a{2,}" <regexp> matches? ] unit-test
-[ t ] [ "aaa" "a{2,}" <regexp> matches? ] unit-test
-[ t ] [ "aaaa" "a{2,}" <regexp> matches? ] unit-test
-[ t ] [ "aaaaa" "a{2,}" <regexp> matches? ] unit-test
-
-[ t ] [ "" "a{,2}" <regexp> matches? ] unit-test
-[ t ] [ "a" "a{,2}" <regexp> matches? ] unit-test
-[ t ] [ "aa" "a{,2}" <regexp> matches? ] unit-test
-[ f ] [ "aaa" "a{,2}" <regexp> matches? ] unit-test
-[ f ] [ "aaaa" "a{,2}" <regexp> matches? ] unit-test
-[ f ] [ "aaaaa" "a{,2}" <regexp> matches? ] unit-test
-
-[ f ] [ "" "a{1,3}" <regexp> matches? ] unit-test
-[ t ] [ "a" "a{1,3}" <regexp> matches? ] unit-test
-[ t ] [ "aa" "a{1,3}" <regexp> matches? ] unit-test
-[ t ] [ "aaa" "a{1,3}" <regexp> matches? ] unit-test
-[ f ] [ "aaaa" "a{1,3}" <regexp> matches? ] unit-test
-
-[ f ] [ "" "[a]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[a]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[abc]" <regexp> matches? ] unit-test
-[ f ] [ "b" "[a]" <regexp> matches? ] unit-test
-[ f ] [ "d" "[abc]" <regexp> matches? ] unit-test
-[ t ] [ "ab" "[abc]{1,2}" <regexp> matches? ] unit-test
-[ f ] [ "abc" "[abc]{1,2}" <regexp> matches? ] unit-test
-
-[ f ] [ "" "[^a]" <regexp> matches? ] unit-test
-[ f ] [ "a" "[^a]" <regexp> matches? ] unit-test
-[ f ] [ "a" "[^abc]" <regexp> matches? ] unit-test
-[ t ] [ "b" "[^a]" <regexp> matches? ] unit-test
-[ t ] [ "d" "[^abc]" <regexp> matches? ] unit-test
-[ f ] [ "ab" "[^abc]{1,2}" <regexp> matches? ] unit-test
-[ f ] [ "abc" "[^abc]{1,2}" <regexp> matches? ] unit-test
-
-[ t ] [ "]" "[]]" <regexp> matches? ] unit-test
-[ f ] [ "]" "[^]]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[^]]" <regexp> matches? ] unit-test
+{ f } [ "\n" "." <regexp> matches? ] unit-test
+{ t } [ "\n" "(?s:.)" <regexp> matches? ] unit-test
+{ t } [ "\n" R/ ./s matches? ] unit-test
+{ f } [ "\n\n" "(?s:.)." <regexp> matches? ] unit-test
+
+{ f } [ "" ".+" <regexp> matches? ] unit-test
+{ t } [ "a" ".+" <regexp> matches? ] unit-test
+{ t } [ "ab" ".+" <regexp> matches? ] unit-test
+
+{ t } [ " " "[\\s]" <regexp> matches? ] unit-test
+{ f } [ "a" "[\\s]" <regexp> matches? ] unit-test
+{ f } [ " " "[\\S]" <regexp> matches? ] unit-test
+{ t } [ "a" "[\\S]" <regexp> matches? ] unit-test
+{ f } [ " " "[\\w]" <regexp> matches? ] unit-test
+{ t } [ "a" "[\\w]" <regexp> matches? ] unit-test
+{ t } [ " " "[\\W]" <regexp> matches? ] unit-test
+{ f } [ "a" "[\\W]" <regexp> matches? ] unit-test
+
+{ t } [ "/" "\\/" <regexp> matches? ] unit-test
+
+{ t } [ "a" R' a'i matches? ] unit-test
+
+{ t } [ "" "a|b*|c+|d?" <regexp> matches? ] unit-test
+{ t } [ "a" "a|b*|c+|d?" <regexp> matches? ] unit-test
+{ t } [ "c" "a|b*|c+|d?" <regexp> matches? ] unit-test
+{ t } [ "cc" "a|b*|c+|d?" <regexp> matches? ] unit-test
+{ f } [ "ccd" "a|b*|c+|d?" <regexp> matches? ] unit-test
+{ t } [ "d" "a|b*|c+|d?" <regexp> matches? ] unit-test
+
+{ t } [ "foo" "foo|bar" <regexp> matches? ] unit-test
+{ t } [ "bar" "foo|bar" <regexp> matches? ] unit-test
+{ f } [ "foobar" "foo|bar" <regexp> matches? ] unit-test
+
+{ f } [ "" "(a)" <regexp> matches? ] unit-test
+{ t } [ "a" "(a)" <regexp> matches? ] unit-test
+{ f } [ "aa" "(a)" <regexp> matches? ] unit-test
+{ t } [ "aa" "(a*)" <regexp> matches? ] unit-test
+
+{ f } [ "aababaaabbac" "(a|b)+" <regexp> matches? ] unit-test
+{ t } [ "ababaaabba" "(a|b)+" <regexp> matches? ] unit-test
+
+{ f } [ "" "a{1}" <regexp> matches? ] unit-test
+{ t } [ "a" "a{1}" <regexp> matches? ] unit-test
+{ f } [ "aa" "a{1}" <regexp> matches? ] unit-test
+
+{ f } [ "a" "a{2,}" <regexp> matches? ] unit-test
+{ t } [ "aaa" "a{2,}" <regexp> matches? ] unit-test
+{ t } [ "aaaa" "a{2,}" <regexp> matches? ] unit-test
+{ t } [ "aaaaa" "a{2,}" <regexp> matches? ] unit-test
+
+{ t } [ "" "a{,2}" <regexp> matches? ] unit-test
+{ t } [ "a" "a{,2}" <regexp> matches? ] unit-test
+{ t } [ "aa" "a{,2}" <regexp> matches? ] unit-test
+{ f } [ "aaa" "a{,2}" <regexp> matches? ] unit-test
+{ f } [ "aaaa" "a{,2}" <regexp> matches? ] unit-test
+{ f } [ "aaaaa" "a{,2}" <regexp> matches? ] unit-test
+
+{ f } [ "" "a{1,3}" <regexp> matches? ] unit-test
+{ t } [ "a" "a{1,3}" <regexp> matches? ] unit-test
+{ t } [ "aa" "a{1,3}" <regexp> matches? ] unit-test
+{ t } [ "aaa" "a{1,3}" <regexp> matches? ] unit-test
+{ f } [ "aaaa" "a{1,3}" <regexp> matches? ] unit-test
+
+{ f } [ "" "[a]" <regexp> matches? ] unit-test
+{ t } [ "a" "[a]" <regexp> matches? ] unit-test
+{ t } [ "a" "[abc]" <regexp> matches? ] unit-test
+{ f } [ "b" "[a]" <regexp> matches? ] unit-test
+{ f } [ "d" "[abc]" <regexp> matches? ] unit-test
+{ t } [ "ab" "[abc]{1,2}" <regexp> matches? ] unit-test
+{ f } [ "abc" "[abc]{1,2}" <regexp> matches? ] unit-test
+
+{ f } [ "" "[^a]" <regexp> matches? ] unit-test
+{ f } [ "a" "[^a]" <regexp> matches? ] unit-test
+{ f } [ "a" "[^abc]" <regexp> matches? ] unit-test
+{ t } [ "b" "[^a]" <regexp> matches? ] unit-test
+{ t } [ "d" "[^abc]" <regexp> matches? ] unit-test
+{ f } [ "ab" "[^abc]{1,2}" <regexp> matches? ] unit-test
+{ f } [ "abc" "[^abc]{1,2}" <regexp> matches? ] unit-test
+
+{ t } [ "]" "[]]" <regexp> matches? ] unit-test
+{ f } [ "]" "[^]]" <regexp> matches? ] unit-test
+{ t } [ "a" "[^]]" <regexp> matches? ] unit-test
[ "^" "[^]" <regexp> matches? ] must-fail
-[ t ] [ "^" "[]^]" <regexp> matches? ] unit-test
-[ t ] [ "]" "[]^]" <regexp> matches? ] unit-test
-
-[ t ] [ "[" "[[]" <regexp> matches? ] unit-test
-[ f ] [ "^" "[^^]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[^^]" <regexp> matches? ] unit-test
-
-[ t ] [ "-" "[-]" <regexp> matches? ] unit-test
-[ f ] [ "a" "[-]" <regexp> matches? ] unit-test
-[ f ] [ "-" "[^-]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[^-]" <regexp> matches? ] unit-test
-
-[ t ] [ "-" "[-a]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[-a]" <regexp> matches? ] unit-test
-[ t ] [ "-" "[a-]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[a-]" <regexp> matches? ] unit-test
-[ f ] [ "b" "[a-]" <regexp> matches? ] unit-test
-[ f ] [ "-" "[^-]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[^-]" <regexp> matches? ] unit-test
-
-[ f ] [ "-" "[a-c]" <regexp> matches? ] unit-test
-[ t ] [ "-" "[^a-c]" <regexp> matches? ] unit-test
-[ t ] [ "b" "[a-c]" <regexp> matches? ] unit-test
-[ f ] [ "b" "[^a-c]" <regexp> matches? ] unit-test
-
-[ t ] [ "-" "[a-c-]" <regexp> matches? ] unit-test
-[ f ] [ "-" "[^a-c-]" <regexp> matches? ] unit-test
-
-[ t ] [ "\\" "[\\\\]" <regexp> matches? ] unit-test
-[ f ] [ "a" "[\\\\]" <regexp> matches? ] unit-test
-[ f ] [ "\\" "[^\\\\]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[^\\\\]" <regexp> matches? ] unit-test
-
-[ t ] [ "0" "[\\d]" <regexp> matches? ] unit-test
-[ f ] [ "a" "[\\d]" <regexp> matches? ] unit-test
-[ f ] [ "0" "[^\\d]" <regexp> matches? ] unit-test
-[ t ] [ "a" "[^\\d]" <regexp> matches? ] unit-test
-
-[ t ] [ "a" "[a-z]{1,}|[A-Z]{2,4}|b*|c|(f|g)*" <regexp> matches? ] unit-test
-[ t ] [ "a" "[a-z]{1,2}|[A-Z]{3,3}|b*|c|(f|g)*" <regexp> matches? ] unit-test
-[ t ] [ "a" "[a-z]{1,2}|[A-Z]{3,3}" <regexp> matches? ] unit-test
-
-[ t ] [ "1000" "\\d{4,6}" <regexp> matches? ] unit-test
-[ t ] [ "1000" "[0-9]{4,6}" <regexp> matches? ] unit-test
-
-[ t ] [ "abc" "\\p{Lower}{3}" <regexp> matches? ] unit-test
-[ f ] [ "ABC" "\\p{Lower}{3}" <regexp> matches? ] unit-test
-[ t ] [ "ABC" "\\p{Upper}{3}" <regexp> matches? ] unit-test
-[ f ] [ "abc" "\\p{Upper}{3}" <regexp> matches? ] unit-test
-[ f ] [ "abc" "[\\p{Upper}]{3}" <regexp> matches? ] unit-test
-[ t ] [ "ABC" "[\\p{Upper}]{3}" <regexp> matches? ] unit-test
-
-[ t ] [ "" "\\Q\\E" <regexp> matches? ] unit-test
-[ f ] [ "a" "\\Q\\E" <regexp> matches? ] unit-test
-[ t ] [ "|*+" "\\Q|*+\\E" <regexp> matches? ] unit-test
-[ f ] [ "abc" "\\Q|*+\\E" <regexp> matches? ] unit-test
-[ t ] [ "s" "\\Qs\\E" <regexp> matches? ] unit-test
-
-[ t ] [ "S" "\\0123" <regexp> matches? ] unit-test
-[ t ] [ "SXY" "\\0123XY" <regexp> matches? ] unit-test
-[ t ] [ "x" "\\x78" <regexp> matches? ] unit-test
-[ f ] [ "y" "\\x78" <regexp> matches? ] unit-test
-[ t ] [ "x" "\\u0078" <regexp> matches? ] unit-test
-[ f ] [ "y" "\\u0078" <regexp> matches? ] unit-test
-
-[ t ] [ "ab" "a+b" <regexp> matches? ] unit-test
-[ f ] [ "b" "a+b" <regexp> matches? ] unit-test
-[ t ] [ "aab" "a+b" <regexp> matches? ] unit-test
-[ f ] [ "abb" "a+b" <regexp> matches? ] unit-test
-
-[ t ] [ "abbbb" "ab*" <regexp> matches? ] unit-test
-[ t ] [ "a" "ab*" <regexp> matches? ] unit-test
-[ f ] [ "abab" "ab*" <regexp> matches? ] unit-test
-
-[ f ] [ "x" "\\." <regexp> matches? ] unit-test
-[ t ] [ "." "\\." <regexp> matches? ] unit-test
-
-[ t ] [ "aaaab" "a+ab" <regexp> matches? ] unit-test
-[ f ] [ "aaaxb" "a+ab" <regexp> matches? ] unit-test
-[ t ] [ "aaacb" "a+cb" <regexp> matches? ] unit-test
-
-[ "aaa" ] [ "aaacb" "a*" <regexp> first-match >string ] unit-test
-[ "aa" ] [ "aaacb" "aa?" <regexp> first-match >string ] unit-test
-
-[ t ] [ "aaa" R/ AAA/i matches? ] unit-test
-[ f ] [ "aax" R/ AAA/i matches? ] unit-test
-[ t ] [ "aaa" R/ A*/i matches? ] unit-test
-[ f ] [ "aaba" R/ A*/i matches? ] unit-test
-[ t ] [ "b" R/ [AB]/i matches? ] unit-test
-[ f ] [ "c" R/ [AB]/i matches? ] unit-test
-[ t ] [ "c" R/ [A-Z]/i matches? ] unit-test
-[ f ] [ "3" R/ [A-Z]/i matches? ] unit-test
-
-[ t ] [ "a" "(?i:a)" <regexp> matches? ] unit-test
-[ t ] [ "a" "(?i:a)" <regexp> matches? ] unit-test
-[ t ] [ "A" "(?i:a)" <regexp> matches? ] unit-test
-[ t ] [ "A" "(?i:a)" <regexp> matches? ] unit-test
-
-[ t ] [ "a" R/ (?-i:a)/i matches? ] unit-test
-[ t ] [ "a" R/ (?-i:a)/i matches? ] unit-test
-[ f ] [ "A" R/ (?-i:a)/i matches? ] unit-test
-[ f ] [ "A" R/ (?-i:a)/i matches? ] unit-test
-
-[ f ] [ "A" "[a-z]" <regexp> matches? ] unit-test
-[ t ] [ "A" R/ [a-z]/i matches? ] unit-test
-
-[ f ] [ "A" "\\p{Lower}" <regexp> matches? ] unit-test
-[ t ] [ "A" R/ \p{Lower}/i matches? ] unit-test
-
-[ t ] [ "abc" R/ abc/r matches? ] unit-test
-[ t ] [ "abc" R/ a[bB][cC]/r matches? ] unit-test
-
-[ t ] [ 3 "xabc" R/ abc/r match-index-from >boolean ] unit-test
-[ t ] [ 3 "xabc" R/ a[bB][cC]/r match-index-from >boolean ] unit-test
-
-[ 2 ] [ 0 "llamallol" R/ ll/ match-index-from ] unit-test
-[ 5 ] [ 8 "lolmallol" R/ lol/r match-index-from ] unit-test
-
-[ t ] [ "s@f" "[a-z.-]@[a-z]" <regexp> matches? ] unit-test
-[ f ] [ "a" "[a-z.-]@[a-z]" <regexp> matches? ] unit-test
-[ t ] [ ".o" "\\.[a-z]" <regexp> matches? ] unit-test
-
-[ t ] [ "abc*" "[^\\*]*\\*" <regexp> matches? ] unit-test
-[ t ] [ "bca" "[^a]*a" <regexp> matches? ] unit-test
-
-[ ] [
+{ t } [ "^" "[]^]" <regexp> matches? ] unit-test
+{ t } [ "]" "[]^]" <regexp> matches? ] unit-test
+
+{ t } [ "[" "[[]" <regexp> matches? ] unit-test
+{ f } [ "^" "[^^]" <regexp> matches? ] unit-test
+{ t } [ "a" "[^^]" <regexp> matches? ] unit-test
+
+{ t } [ "-" "[-]" <regexp> matches? ] unit-test
+{ f } [ "a" "[-]" <regexp> matches? ] unit-test
+{ f } [ "-" "[^-]" <regexp> matches? ] unit-test
+{ t } [ "a" "[^-]" <regexp> matches? ] unit-test
+
+{ t } [ "-" "[-a]" <regexp> matches? ] unit-test
+{ t } [ "a" "[-a]" <regexp> matches? ] unit-test
+{ t } [ "-" "[a-]" <regexp> matches? ] unit-test
+{ t } [ "a" "[a-]" <regexp> matches? ] unit-test
+{ f } [ "b" "[a-]" <regexp> matches? ] unit-test
+{ f } [ "-" "[^-]" <regexp> matches? ] unit-test
+{ t } [ "a" "[^-]" <regexp> matches? ] unit-test
+
+{ f } [ "-" "[a-c]" <regexp> matches? ] unit-test
+{ t } [ "-" "[^a-c]" <regexp> matches? ] unit-test
+{ t } [ "b" "[a-c]" <regexp> matches? ] unit-test
+{ f } [ "b" "[^a-c]" <regexp> matches? ] unit-test
+
+{ t } [ "-" "[a-c-]" <regexp> matches? ] unit-test
+{ f } [ "-" "[^a-c-]" <regexp> matches? ] unit-test
+
+{ t } [ "\\" "[\\\\]" <regexp> matches? ] unit-test
+{ f } [ "a" "[\\\\]" <regexp> matches? ] unit-test
+{ f } [ "\\" "[^\\\\]" <regexp> matches? ] unit-test
+{ t } [ "a" "[^\\\\]" <regexp> matches? ] unit-test
+
+{ t } [ "0" "[\\d]" <regexp> matches? ] unit-test
+{ f } [ "a" "[\\d]" <regexp> matches? ] unit-test
+{ f } [ "0" "[^\\d]" <regexp> matches? ] unit-test
+{ t } [ "a" "[^\\d]" <regexp> matches? ] unit-test
+
+{ t } [ "a" "[a-z]{1,}|[A-Z]{2,4}|b*|c|(f|g)*" <regexp> matches? ] unit-test
+{ t } [ "a" "[a-z]{1,2}|[A-Z]{3,3}|b*|c|(f|g)*" <regexp> matches? ] unit-test
+{ t } [ "a" "[a-z]{1,2}|[A-Z]{3,3}" <regexp> matches? ] unit-test
+
+{ t } [ "1000" "\\d{4,6}" <regexp> matches? ] unit-test
+{ t } [ "1000" "[0-9]{4,6}" <regexp> matches? ] unit-test
+
+{ t } [ "abc" "\\p{Lower}{3}" <regexp> matches? ] unit-test
+{ f } [ "ABC" "\\p{Lower}{3}" <regexp> matches? ] unit-test
+{ t } [ "ABC" "\\p{Upper}{3}" <regexp> matches? ] unit-test
+{ f } [ "abc" "\\p{Upper}{3}" <regexp> matches? ] unit-test
+{ f } [ "abc" "[\\p{Upper}]{3}" <regexp> matches? ] unit-test
+{ t } [ "ABC" "[\\p{Upper}]{3}" <regexp> matches? ] unit-test
+
+{ t } [ "" "\\Q\\E" <regexp> matches? ] unit-test
+{ f } [ "a" "\\Q\\E" <regexp> matches? ] unit-test
+{ t } [ "|*+" "\\Q|*+\\E" <regexp> matches? ] unit-test
+{ f } [ "abc" "\\Q|*+\\E" <regexp> matches? ] unit-test
+{ t } [ "s" "\\Qs\\E" <regexp> matches? ] unit-test
+
+{ t } [ "S" "\\0123" <regexp> matches? ] unit-test
+{ t } [ "SXY" "\\0123XY" <regexp> matches? ] unit-test
+{ t } [ "x" "\\x78" <regexp> matches? ] unit-test
+{ f } [ "y" "\\x78" <regexp> matches? ] unit-test
+{ t } [ "x" "\\u0078" <regexp> matches? ] unit-test
+{ f } [ "y" "\\u0078" <regexp> matches? ] unit-test
+
+{ t } [ "ab" "a+b" <regexp> matches? ] unit-test
+{ f } [ "b" "a+b" <regexp> matches? ] unit-test
+{ t } [ "aab" "a+b" <regexp> matches? ] unit-test
+{ f } [ "abb" "a+b" <regexp> matches? ] unit-test
+
+{ t } [ "abbbb" "ab*" <regexp> matches? ] unit-test
+{ t } [ "a" "ab*" <regexp> matches? ] unit-test
+{ f } [ "abab" "ab*" <regexp> matches? ] unit-test
+
+{ f } [ "x" "\\." <regexp> matches? ] unit-test
+{ t } [ "." "\\." <regexp> matches? ] unit-test
+
+{ t } [ "aaaab" "a+ab" <regexp> matches? ] unit-test
+{ f } [ "aaaxb" "a+ab" <regexp> matches? ] unit-test
+{ t } [ "aaacb" "a+cb" <regexp> matches? ] unit-test
+
+{ "aaa" } [ "aaacb" "a*" <regexp> first-match >string ] unit-test
+{ "aa" } [ "aaacb" "aa?" <regexp> first-match >string ] unit-test
+
+{ t } [ "aaa" R/ AAA/i matches? ] unit-test
+{ f } [ "aax" R/ AAA/i matches? ] unit-test
+{ t } [ "aaa" R/ A*/i matches? ] unit-test
+{ f } [ "aaba" R/ A*/i matches? ] unit-test
+{ t } [ "b" R/ [AB]/i matches? ] unit-test
+{ f } [ "c" R/ [AB]/i matches? ] unit-test
+{ t } [ "c" R/ [A-Z]/i matches? ] unit-test
+{ f } [ "3" R/ [A-Z]/i matches? ] unit-test
+
+{ t } [ "a" "(?i:a)" <regexp> matches? ] unit-test
+{ t } [ "a" "(?i:a)" <regexp> matches? ] unit-test
+{ t } [ "A" "(?i:a)" <regexp> matches? ] unit-test
+{ t } [ "A" "(?i:a)" <regexp> matches? ] unit-test
+
+{ t } [ "a" R/ (?-i:a)/i matches? ] unit-test
+{ t } [ "a" R/ (?-i:a)/i matches? ] unit-test
+{ f } [ "A" R/ (?-i:a)/i matches? ] unit-test
+{ f } [ "A" R/ (?-i:a)/i matches? ] unit-test
+
+{ f } [ "A" "[a-z]" <regexp> matches? ] unit-test
+{ t } [ "A" R/ [a-z]/i matches? ] unit-test
+
+{ f } [ "A" "\\p{Lower}" <regexp> matches? ] unit-test
+{ t } [ "A" R/ \p{Lower}/i matches? ] unit-test
+
+{ t } [ "abc" R/ abc/r matches? ] unit-test
+{ t } [ "abc" R/ a[bB][cC]/r matches? ] unit-test
+
+{ t } [ 3 "xabc" R/ abc/r match-index-from >boolean ] unit-test
+{ t } [ 3 "xabc" R/ a[bB][cC]/r match-index-from >boolean ] unit-test
+
+{ 2 } [ 0 "llamallol" R/ ll/ match-index-from ] unit-test
+{ 5 } [ 8 "lolmallol" R/ lol/r match-index-from ] unit-test
+
+{ t } [ "s@f" "[a-z.-]@[a-z]" <regexp> matches? ] unit-test
+{ f } [ "a" "[a-z.-]@[a-z]" <regexp> matches? ] unit-test
+{ t } [ ".o" "\\.[a-z]" <regexp> matches? ] unit-test
+
+{ t } [ "abc*" "[^\\*]*\\*" <regexp> matches? ] unit-test
+{ t } [ "bca" "[^a]*a" <regexp> matches? ] unit-test
+
+{ } [
"(0[lL]?|[1-9]\\d{0,9}(\\d{0,9}[lL])?|0[xX]\\p{XDigit}{1,8}(\\p{XDigit}{0,8}[lL])?|0[0-7]{1,11}([0-7]{0,11}[lL])?|([0-9]+\\.[0-9]*|\\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?|[0-9]+([eE][+-]?[0-9]+[fFdD]?|([eE][+-]?[0-9]+)?[fFdD]))"
<regexp> drop
] unit-test
-[ ] [ "(\\$[\\p{XDigit}]|[\\p{Digit}])" <regexp> drop ] unit-test
+{ } [ "(\\$[\\p{XDigit}]|[\\p{Digit}])" <regexp> drop ] unit-test
! Comment inside a regular expression
-[ t ] [ "ac" "a(?#boo)c" <regexp> matches? ] unit-test
+{ t } [ "ac" "a(?#boo)c" <regexp> matches? ] unit-test
-[ ] [ "USING: regexp kernel ; R' -{3}[+]{1,6}(?:!!)?\\s' drop" eval( -- ) ] unit-test
+{ } [ "USING: regexp kernel ; R' -{3}[+]{1,6}(?:!!)?\\s' drop" eval( -- ) ] unit-test
-[ ] [ "USING: regexp kernel ; R' (ftp|http|https)://(\\w+:?\\w*@)?(\\S+)(:[0-9]+)?(/|/([\\w#!:.?+=&%@!\\-/]))?' drop" eval( -- ) ] unit-test
+{ } [ "USING: regexp kernel ; R' (ftp|http|https)://(\\w+:?\\w*@)?(\\S+)(:[0-9]+)?(/|/([\\w#!:.?+=&%@!\\-/]))?' drop" eval( -- ) ] unit-test
-[ ] [ "USING: regexp kernel ; R' \\*[^\s*][^*]*\\*' drop" eval( -- ) ] unit-test
+{ } [ "USING: regexp kernel ; R' \\*[^\s*][^*]*\\*' drop" eval( -- ) ] unit-test
-[ "ab" ] [ "ab" "(a|ab)(bc)?" <regexp> first-match >string ] unit-test
-[ "abc" ] [ "abc" "(a|ab)(bc)?" <regexp> first-match >string ] unit-test
+{ "ab" } [ "ab" "(a|ab)(bc)?" <regexp> first-match >string ] unit-test
+{ "abc" } [ "abc" "(a|ab)(bc)?" <regexp> first-match >string ] unit-test
-[ "ab" ] [ "ab" "(ab|a)(bc)?" <regexp> first-match >string ] unit-test
-[ "abc" ] [ "abc" "(ab|a)(bc)?" <regexp> first-match >string ] unit-test
+{ "ab" } [ "ab" "(ab|a)(bc)?" <regexp> first-match >string ] unit-test
+{ "abc" } [ "abc" "(ab|a)(bc)?" <regexp> first-match >string ] unit-test
-[ "b" ] [ "aaaaaaaaaaaaaaaaaaaaaaab" "((a*)*b)*b" <regexp> first-match >string ] unit-test
+{ "b" } [ "aaaaaaaaaaaaaaaaaaaaaaab" "((a*)*b)*b" <regexp> first-match >string ] unit-test
-[ T{ slice { from 5 } { to 10 } { seq "hellohello" } } ]
+{ T{ slice { from 5 } { to 10 } { seq "hellohello" } } }
[ "hellohello" R/ hello/r first-match ]
unit-test
-[ { "1" "2" "3" "4" } ]
+{ { "1" "2" "3" "4" } }
[ "1ABC2DEF3GHI4" R/ [A-Z]+/ re-split [ >string ] map ] unit-test
-[ { "1" "2" "3" "4" "" } ]
+{ { "1" "2" "3" "4" "" } }
[ "1ABC2DEF3GHI4JK" R/ [A-Z]+/ re-split [ >string ] map ] unit-test
-[ { "" } ] [ "" R/ =/ re-split [ >string ] map ] unit-test
+{ { "" } } [ "" R/ =/ re-split [ >string ] map ] unit-test
-[ { "a" "" } ] [ "a=" R/ =/ re-split [ >string ] map ] unit-test
+{ { "a" "" } } [ "a=" R/ =/ re-split [ >string ] map ] unit-test
-[ { "he" "o" } ] [ "hello" R/ l+/ re-split [ >string ] map ] unit-test
+{ { "he" "o" } } [ "hello" R/ l+/ re-split [ >string ] map ] unit-test
-[ { "h" "llo" } ] [ "hello" R/ e+/ re-split [ >string ] map ] unit-test
+{ { "h" "llo" } } [ "hello" R/ e+/ re-split [ >string ] map ] unit-test
-[ { "" "h" "" "l" "l" "o" "" } ] [ "hello" R/ e*/ re-split [ >string ] map ] unit-test
+{ { "" "h" "" "l" "l" "o" "" } } [ "hello" R/ e*/ re-split [ >string ] map ] unit-test
-[ { { 0 5 "hellohello" } { 5 10 "hellohello" } } ]
+{ { { 0 5 "hellohello" } { 5 10 "hellohello" } } }
[ "hellohello" R/ hello/ [ 3array ] map-matches ]
unit-test
-[ { { 5 10 "hellohello" } { 0 5 "hellohello" } } ]
+{ { { 5 10 "hellohello" } { 0 5 "hellohello" } } }
[ "hellohello" R/ hello/r [ 3array ] map-matches ]
unit-test
-[ { "ABC" "DEF" "GHI" } ]
+{ { "ABC" "DEF" "GHI" } }
[ "1ABC2DEF3GHI4" R/ [A-Z]+/ all-matching-subseqs ] unit-test
-[ { "ee" "e" } ] [ "heellohello" R/ e+/ all-matching-subseqs ] unit-test
-[ { "e" "ee" } ] [ "heellohello" R/ e+/r all-matching-subseqs ] unit-test
+{ { "ee" "e" } } [ "heellohello" R/ e+/ all-matching-subseqs ] unit-test
+{ { "e" "ee" } } [ "heellohello" R/ e+/r all-matching-subseqs ] unit-test
-[ 3 ] [ "1ABC2DEF3GHI4" R/ [A-Z]+/ count-matches ] unit-test
+{ 3 } [ "1ABC2DEF3GHI4" R/ [A-Z]+/ count-matches ] unit-test
-[ 3 ] [ "1ABC2DEF3GHI4" R/ [A-Z]+/r count-matches ] unit-test
+{ 3 } [ "1ABC2DEF3GHI4" R/ [A-Z]+/r count-matches ] unit-test
-[ 1 ] [ "" R/ / count-matches ] unit-test
+{ 1 } [ "" R/ / count-matches ] unit-test
-[ 1 ] [ "" R/ /r count-matches ] unit-test
+{ 1 } [ "" R/ /r count-matches ] unit-test
-[ 0 ] [ "123" R/ [A-Z]+/ count-matches ] unit-test
+{ 0 } [ "123" R/ [A-Z]+/ count-matches ] unit-test
-[ 0 ] [ "123" R/ [A-Z]+/r count-matches ] unit-test
+{ 0 } [ "123" R/ [A-Z]+/r count-matches ] unit-test
-[ 6 ] [ "hello" R/ e*/ count-matches ] unit-test
+{ 6 } [ "hello" R/ e*/ count-matches ] unit-test
-[ 6 ] [ "hello" R/ e*/r count-matches ] unit-test
+{ 6 } [ "hello" R/ e*/r count-matches ] unit-test
-[ 11 ] [ "hello world" R/ l*/ count-matches ] unit-test
+{ 11 } [ "hello world" R/ l*/ count-matches ] unit-test
-[ 11 ] [ "hello world" R/ l*/r count-matches ] unit-test
+{ 11 } [ "hello world" R/ l*/r count-matches ] unit-test
-[ 1 ] [ "hello" R/ e+/ count-matches ] unit-test
+{ 1 } [ "hello" R/ e+/ count-matches ] unit-test
-[ 2 ] [ "hello world" R/ l+/r count-matches ] unit-test
+{ 2 } [ "hello world" R/ l+/r count-matches ] unit-test
-[ "1.2.3.4." ] [ "1ABC2DEF3GHI4JK" R/ [A-Z]+/ "." re-replace ] unit-test
-[ "XhXXlXlXoX XwXoXrXlXdX" ] [ "hello world" R/ e*/ "X" re-replace ] unit-test
-[ "-- title --" ] [ "== title ==" R/ =/ "-" re-replace ] unit-test
+{ "1.2.3.4." } [ "1ABC2DEF3GHI4JK" R/ [A-Z]+/ "." re-replace ] unit-test
+{ "XhXXlXlXoX XwXoXrXlXdX" } [ "hello world" R/ e*/ "X" re-replace ] unit-test
+{ "-- title --" } [ "== title ==" R/ =/ "-" re-replace ] unit-test
-[ "" ] [ "ab" "a(?!b)" <regexp> first-match >string ] unit-test
-[ "a" ] [ "ac" "a(?!b)" <regexp> first-match >string ] unit-test
-[ t ] [ "fxxbar" ".{3}(?!foo)bar" <regexp> matches? ] unit-test
-[ t ] [ "foobar" ".{3}(?!foo)bar" <regexp> matches? ] unit-test
-[ t ] [ "fxxbar" "(?!foo).{3}bar" <regexp> matches? ] unit-test
-[ f ] [ "foobar" "(?!foo).{3}bar" <regexp> matches? ] unit-test
-[ "a" ] [ "ab" "a(?=b)(?=b)" <regexp> first-match >string ] unit-test
-[ "a" ] [ "ba" "(?<=b)(?<=b)a" <regexp> first-match >string ] unit-test
-[ "a" ] [ "cab" "(?<=c)a(?=b)" <regexp> first-match >string ] unit-test
+{ "" } [ "ab" "a(?!b)" <regexp> first-match >string ] unit-test
+{ "a" } [ "ac" "a(?!b)" <regexp> first-match >string ] unit-test
+{ t } [ "fxxbar" ".{3}(?!foo)bar" <regexp> matches? ] unit-test
+{ t } [ "foobar" ".{3}(?!foo)bar" <regexp> matches? ] unit-test
+{ t } [ "fxxbar" "(?!foo).{3}bar" <regexp> matches? ] unit-test
+{ f } [ "foobar" "(?!foo).{3}bar" <regexp> matches? ] unit-test
+{ "a" } [ "ab" "a(?=b)(?=b)" <regexp> first-match >string ] unit-test
+{ "a" } [ "ba" "(?<=b)(?<=b)a" <regexp> first-match >string ] unit-test
+{ "a" } [ "cab" "(?<=c)a(?=b)" <regexp> first-match >string ] unit-test
-[ 3 ] [ "foobar" "foo(?=bar)" <regexp> first-match length ] unit-test
-[ f ] [ "foobxr" "foo(?=bar)" <regexp> first-match ] unit-test
+{ 3 } [ "foobar" "foo(?=bar)" <regexp> first-match length ] unit-test
+{ f } [ "foobxr" "foo(?=bar)" <regexp> first-match ] unit-test
! Bug in parsing word
-[ t ] [ "a" R' a' matches? ] unit-test
+{ t } [ "a" R' a' matches? ] unit-test
! Testing negation
-[ f ] [ "a" R/ (?~a)/ matches? ] unit-test
-[ t ] [ "aa" R/ (?~a)/ matches? ] unit-test
-[ t ] [ "bb" R/ (?~a)/ matches? ] unit-test
-[ t ] [ "" R/ (?~a)/ matches? ] unit-test
+{ f } [ "a" R/ (?~a)/ matches? ] unit-test
+{ t } [ "aa" R/ (?~a)/ matches? ] unit-test
+{ t } [ "bb" R/ (?~a)/ matches? ] unit-test
+{ t } [ "" R/ (?~a)/ matches? ] unit-test
-[ f ] [ "a" R/ (?~a+|b)/ matches? ] unit-test
-[ f ] [ "aa" R/ (?~a+|b)/ matches? ] unit-test
-[ t ] [ "bb" R/ (?~a+|b)/ matches? ] unit-test
-[ f ] [ "b" R/ (?~a+|b)/ matches? ] unit-test
-[ t ] [ "" R/ (?~a+|b)/ matches? ] unit-test
+{ f } [ "a" R/ (?~a+|b)/ matches? ] unit-test
+{ f } [ "aa" R/ (?~a+|b)/ matches? ] unit-test
+{ t } [ "bb" R/ (?~a+|b)/ matches? ] unit-test
+{ f } [ "b" R/ (?~a+|b)/ matches? ] unit-test
+{ t } [ "" R/ (?~a+|b)/ matches? ] unit-test
! Intersecting classes
-[ t ] [ "ab" R/ ac|\p{Lower}b/ matches? ] unit-test
-[ t ] [ "ab" R/ ac|[a-z]b/ matches? ] unit-test
-[ t ] [ "ac" R/ ac|\p{Lower}b/ matches? ] unit-test
-[ t ] [ "ac" R/ ac|[a-z]b/ matches? ] unit-test
-[ t ] [ "ac" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
-[ t ] [ "ab" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
-[ t ] [ "πb" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
-[ f ] [ "πc" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
-[ f ] [ "Ab" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
-
-[ t ] [ "aaaa" R/ .*a./ matches? ] unit-test
-
-[ f ] [ "ab" R/ (?~ac|\p{Lower}b)/ matches? ] unit-test
-[ f ] [ "ab" R/ (?~ac|[a-z]b)/ matches? ] unit-test
-[ f ] [ "ac" R/ (?~ac|\p{Lower}b)/ matches? ] unit-test
-[ f ] [ "ac" R/ (?~ac|[a-z]b)/ matches? ] unit-test
-[ f ] [ "ac" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
-[ f ] [ "ab" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
-[ f ] [ "πb" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
-[ t ] [ "πc" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
-[ t ] [ "Ab" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
+{ t } [ "ab" R/ ac|\p{Lower}b/ matches? ] unit-test
+{ t } [ "ab" R/ ac|[a-z]b/ matches? ] unit-test
+{ t } [ "ac" R/ ac|\p{Lower}b/ matches? ] unit-test
+{ t } [ "ac" R/ ac|[a-z]b/ matches? ] unit-test
+{ t } [ "ac" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
+{ t } [ "ab" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
+{ t } [ "πb" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
+{ f } [ "πc" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
+{ f } [ "Ab" R/ [a-zA-Z]c|\p{Lower}b/ matches? ] unit-test
+
+{ t } [ "aaaa" R/ .*a./ matches? ] unit-test
+
+{ f } [ "ab" R/ (?~ac|\p{Lower}b)/ matches? ] unit-test
+{ f } [ "ab" R/ (?~ac|[a-z]b)/ matches? ] unit-test
+{ f } [ "ac" R/ (?~ac|\p{Lower}b)/ matches? ] unit-test
+{ f } [ "ac" R/ (?~ac|[a-z]b)/ matches? ] unit-test
+{ f } [ "ac" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
+{ f } [ "ab" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
+{ f } [ "πb" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
+{ t } [ "πc" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
+{ t } [ "Ab" R/ (?~[a-zA-Z]c|\p{Lower}b)/ matches? ] unit-test
! DFA is compiled when needed, or when literal
-[ regexp-initial-word ] [ "foo" <regexp> dfa>> ] unit-test
-[ f ] [ R/ foo/ dfa>> \ regexp-initial-word = ] unit-test
-
-[ t ] [ "a" R/ ^a/ matches? ] unit-test
-[ f ] [ "\na" R/ ^a/ matches? ] unit-test
-[ f ] [ "\r\na" R/ ^a/ matches? ] unit-test
-[ f ] [ "\ra" R/ ^a/ matches? ] unit-test
-
-[ 1 ] [ "a" R/ ^a/ count-matches ] unit-test
-[ 0 ] [ "\na" R/ ^a/ count-matches ] unit-test
-[ 0 ] [ "\r\na" R/ ^a/ count-matches ] unit-test
-[ 0 ] [ "\ra" R/ ^a/ count-matches ] unit-test
-
-[ t ] [ "a" R/ a$/ matches? ] unit-test
-[ f ] [ "a\n" R/ a$/ matches? ] unit-test
-[ f ] [ "a\r" R/ a$/ matches? ] unit-test
-[ f ] [ "a\r\n" R/ a$/ matches? ] unit-test
-
-[ 1 ] [ "a" R/ a$/ count-matches ] unit-test
-[ 0 ] [ "a\n" R/ a$/ count-matches ] unit-test
-[ 0 ] [ "a\r" R/ a$/ count-matches ] unit-test
-[ 0 ] [ "a\r\n" R/ a$/ count-matches ] unit-test
-
-[ t ] [ "a" R/ a$|b$/ matches? ] unit-test
-[ t ] [ "b" R/ a$|b$/ matches? ] unit-test
-[ f ] [ "ab" R/ a$|b$/ matches? ] unit-test
-[ t ] [ "ba" R/ ba$|b$/ matches? ] unit-test
-
-[ t ] [ "a" R/ \Aa/ matches? ] unit-test
-[ f ] [ "\na" R/ \Aaa/ matches? ] unit-test
-[ f ] [ "\r\na" R/ \Aa/ matches? ] unit-test
-[ f ] [ "\ra" R/ \Aa/ matches? ] unit-test
-
-[ t ] [ "a" R/ \Aa/m matches? ] unit-test
-[ f ] [ "\na" R/ \Aaa/m matches? ] unit-test
-[ f ] [ "\r\na" R/ \Aa/m matches? ] unit-test
-[ f ] [ "\ra" R/ \Aa/m matches? ] unit-test
-[ 0 ] [ "\ra" R/ \Aa/m count-matches ] unit-test
-
-[ f ] [ "\r\n\n\n\nam" R/ ^am/m matches? ] unit-test
-[ 1 ] [ "\r\n\n\n\nam" R/ ^am/m count-matches ] unit-test
-
-[ t ] [ "a" R/ \Aa\z/m matches? ] unit-test
-[ f ] [ "a\n" R/ \Aa\z/m matches? ] unit-test
-
-[ f ] [ "a\r\n" R/ \Aa\Z/m matches? ] unit-test
-[ f ] [ "a\n" R/ \Aa\Z/m matches? ] unit-test
-[ 1 ] [ "a\r\n" R/ \Aa\Z/m count-matches ] unit-test
-[ 1 ] [ "a\n" R/ \Aa\Z/m count-matches ] unit-test
-
-[ t ] [ "a" R/ \Aa\Z/m matches? ] unit-test
-[ f ] [ "\na" R/ \Aaa\Z/m matches? ] unit-test
-[ f ] [ "\r\na" R/ \Aa\Z/m matches? ] unit-test
-[ f ] [ "\ra" R/ \Aa\Z/m matches? ] unit-test
-
-[ 1 ] [ "a" R/ \Aa\Z/m count-matches ] unit-test
-[ 0 ] [ "\na" R/ \Aaa\Z/m count-matches ] unit-test
-[ 0 ] [ "\r\na" R/ \Aa\Z/m count-matches ] unit-test
-[ 0 ] [ "\ra" R/ \Aa\Z/m count-matches ] unit-test
-
-[ t ] [ "a" R/ ^a/m matches? ] unit-test
-[ f ] [ "\na" R/ ^a/m matches? ] unit-test
-[ 1 ] [ "\na" R/ ^a/m count-matches ] unit-test
-[ 1 ] [ "\r\na" R/ ^a/m count-matches ] unit-test
-[ 1 ] [ "\ra" R/ ^a/m count-matches ] unit-test
-
-[ t ] [ "a" R/ a$/m matches? ] unit-test
-[ f ] [ "a\n" R/ a$/m matches? ] unit-test
-[ 1 ] [ "a\n" R/ a$/m count-matches ] unit-test
-[ 1 ] [ "a\r" R/ a$/m count-matches ] unit-test
-[ 1 ] [ "a\r\n" R/ a$/m count-matches ] unit-test
-
-[ f ] [ "foobxr" "foo\\z" <regexp> first-match ] unit-test
-[ 3 ] [ "foo" "foo\\z" <regexp> first-match length ] unit-test
-
-[ t ] [ "a foo b" R/ foo/ re-contains? ] unit-test
-[ f ] [ "a bar b" R/ foo/ re-contains? ] unit-test
-[ t ] [ "foo" R/ foo/ re-contains? ] unit-test
-
-[ { "foo" "fxx" "fab" } ] [ "fab fxx foo" R/ f../r all-matching-subseqs ] unit-test
-
-[ t ] [ "foo" "\\bfoo\\b" <regexp> re-contains? ] unit-test
-[ t ] [ "afoob" "\\Bfoo\\B" <regexp> re-contains? ] unit-test
-[ f ] [ "afoob" "\\bfoo\\b" <regexp> re-contains? ] unit-test
-[ f ] [ "foo" "\\Bfoo\\B" <regexp> re-contains? ] unit-test
-
-[ 3 ] [ "foo bar" "foo\\b" <regexp> first-match length ] unit-test
-[ f ] [ "fooxbar" "foo\\b" <regexp> re-contains? ] unit-test
-[ t ] [ "foo" "foo\\b" <regexp> re-contains? ] unit-test
-[ t ] [ "foo bar" "foo\\b bar" <regexp> matches? ] unit-test
-[ f ] [ "fooxbar" "foo\\bxbar" <regexp> matches? ] unit-test
-[ f ] [ "foo" "foo\\bbar" <regexp> matches? ] unit-test
-
-[ f ] [ "foo bar" "foo\\B" <regexp> re-contains? ] unit-test
-[ 3 ] [ "fooxbar" "foo\\B" <regexp> first-match length ] unit-test
-[ f ] [ "foo" "foo\\B" <regexp> re-contains? ] unit-test
-[ f ] [ "foo bar" "foo\\B bar" <regexp> matches? ] unit-test
-[ t ] [ "fooxbar" "foo\\Bxbar" <regexp> matches? ] unit-test
-[ f ] [ "foo" "foo\\Bbar" <regexp> matches? ] unit-test
-
-[ t ] [ "ab" "a(?=b*)" <regexp> re-contains? ] unit-test
-[ t ] [ "abbbbbc" "a(?=b*c)" <regexp> re-contains? ] unit-test
-[ f ] [ "abbbbb" "a(?=b*c)" <regexp> re-contains? ] unit-test
-[ t ] [ "ab" "a(?=b*)" <regexp> re-contains? ] unit-test
-
-[ "az" ] [ "baz" "(?<=b)(az)" <regexp> first-match >string ] unit-test
-[ f ] [ "chaz" "(?<=b)(az)" <regexp> re-contains? ] unit-test
-[ "a" ] [ "cbaz" "(?<=b*)a" <regexp> first-match >string ] unit-test
-[ f ] [ "baz" "a(?<=b)" <regexp> re-contains? ] unit-test
-
-[ f ] [ "baz" "(?<!b)a" <regexp> re-contains? ] unit-test
-[ t ] [ "caz" "(?<!b)a" <regexp> re-contains? ] unit-test
-
-[ "abcd" ] [ "abcdefg" "a(?=bcdefg)bcd" <regexp> first-match >string ] unit-test
-[ t ] [ "abcdefg" "a(?#bcdefg)bcd" <regexp> re-contains? ] unit-test
-[ t ] [ "abcdefg" "a(?:bcdefg)" <regexp> matches? ] unit-test
-
-[ 3 ] [ "caba" "(?<=b)a" <regexp> first-match from>> ] unit-test
-
-[ t ] [ "\ra" R/ .^a/ms matches? ] unit-test
-[ f ] [ "\ra" R/ .^a/mds matches? ] unit-test
-[ t ] [ "\na" R/ .^a/ms matches? ] unit-test
-[ t ] [ "\na" R/ .^a/mds matches? ] unit-test
-
-[ t ] [ "a\r" R/ a$./ms matches? ] unit-test
-[ f ] [ "a\r" R/ a$./mds matches? ] unit-test
-[ t ] [ "a\n" R/ a$./ms matches? ] unit-test
-[ t ] [ "a\n" R/ a$./mds matches? ] unit-test
+{ regexp-initial-word } [ "foo" <regexp> dfa>> ] unit-test
+{ f } [ R/ foo/ dfa>> \ regexp-initial-word = ] unit-test
+
+{ t } [ "a" R/ ^a/ matches? ] unit-test
+{ f } [ "\na" R/ ^a/ matches? ] unit-test
+{ f } [ "\r\na" R/ ^a/ matches? ] unit-test
+{ f } [ "\ra" R/ ^a/ matches? ] unit-test
+
+{ 1 } [ "a" R/ ^a/ count-matches ] unit-test
+{ 0 } [ "\na" R/ ^a/ count-matches ] unit-test
+{ 0 } [ "\r\na" R/ ^a/ count-matches ] unit-test
+{ 0 } [ "\ra" R/ ^a/ count-matches ] unit-test
+
+{ t } [ "a" R/ a$/ matches? ] unit-test
+{ f } [ "a\n" R/ a$/ matches? ] unit-test
+{ f } [ "a\r" R/ a$/ matches? ] unit-test
+{ f } [ "a\r\n" R/ a$/ matches? ] unit-test
+
+{ 1 } [ "a" R/ a$/ count-matches ] unit-test
+{ 0 } [ "a\n" R/ a$/ count-matches ] unit-test
+{ 0 } [ "a\r" R/ a$/ count-matches ] unit-test
+{ 0 } [ "a\r\n" R/ a$/ count-matches ] unit-test
+
+{ t } [ "a" R/ a$|b$/ matches? ] unit-test
+{ t } [ "b" R/ a$|b$/ matches? ] unit-test
+{ f } [ "ab" R/ a$|b$/ matches? ] unit-test
+{ t } [ "ba" R/ ba$|b$/ matches? ] unit-test
+
+{ t } [ "a" R/ \Aa/ matches? ] unit-test
+{ f } [ "\na" R/ \Aaa/ matches? ] unit-test
+{ f } [ "\r\na" R/ \Aa/ matches? ] unit-test
+{ f } [ "\ra" R/ \Aa/ matches? ] unit-test
+
+{ t } [ "a" R/ \Aa/m matches? ] unit-test
+{ f } [ "\na" R/ \Aaa/m matches? ] unit-test
+{ f } [ "\r\na" R/ \Aa/m matches? ] unit-test
+{ f } [ "\ra" R/ \Aa/m matches? ] unit-test
+{ 0 } [ "\ra" R/ \Aa/m count-matches ] unit-test
+
+{ f } [ "\r\n\n\n\nam" R/ ^am/m matches? ] unit-test
+{ 1 } [ "\r\n\n\n\nam" R/ ^am/m count-matches ] unit-test
+
+{ t } [ "a" R/ \Aa\z/m matches? ] unit-test
+{ f } [ "a\n" R/ \Aa\z/m matches? ] unit-test
+
+{ f } [ "a\r\n" R/ \Aa\Z/m matches? ] unit-test
+{ f } [ "a\n" R/ \Aa\Z/m matches? ] unit-test
+{ 1 } [ "a\r\n" R/ \Aa\Z/m count-matches ] unit-test
+{ 1 } [ "a\n" R/ \Aa\Z/m count-matches ] unit-test
+
+{ t } [ "a" R/ \Aa\Z/m matches? ] unit-test
+{ f } [ "\na" R/ \Aaa\Z/m matches? ] unit-test
+{ f } [ "\r\na" R/ \Aa\Z/m matches? ] unit-test
+{ f } [ "\ra" R/ \Aa\Z/m matches? ] unit-test
+
+{ 1 } [ "a" R/ \Aa\Z/m count-matches ] unit-test
+{ 0 } [ "\na" R/ \Aaa\Z/m count-matches ] unit-test
+{ 0 } [ "\r\na" R/ \Aa\Z/m count-matches ] unit-test
+{ 0 } [ "\ra" R/ \Aa\Z/m count-matches ] unit-test
+
+{ t } [ "a" R/ ^a/m matches? ] unit-test
+{ f } [ "\na" R/ ^a/m matches? ] unit-test
+{ 1 } [ "\na" R/ ^a/m count-matches ] unit-test
+{ 1 } [ "\r\na" R/ ^a/m count-matches ] unit-test
+{ 1 } [ "\ra" R/ ^a/m count-matches ] unit-test
+
+{ t } [ "a" R/ a$/m matches? ] unit-test
+{ f } [ "a\n" R/ a$/m matches? ] unit-test
+{ 1 } [ "a\n" R/ a$/m count-matches ] unit-test
+{ 1 } [ "a\r" R/ a$/m count-matches ] unit-test
+{ 1 } [ "a\r\n" R/ a$/m count-matches ] unit-test
+
+{ f } [ "foobxr" "foo\\z" <regexp> first-match ] unit-test
+{ 3 } [ "foo" "foo\\z" <regexp> first-match length ] unit-test
+
+{ t } [ "a foo b" R/ foo/ re-contains? ] unit-test
+{ f } [ "a bar b" R/ foo/ re-contains? ] unit-test
+{ t } [ "foo" R/ foo/ re-contains? ] unit-test
+
+{ { "foo" "fxx" "fab" } } [ "fab fxx foo" R/ f../r all-matching-subseqs ] unit-test
+
+{ t } [ "foo" "\\bfoo\\b" <regexp> re-contains? ] unit-test
+{ t } [ "afoob" "\\Bfoo\\B" <regexp> re-contains? ] unit-test
+{ f } [ "afoob" "\\bfoo\\b" <regexp> re-contains? ] unit-test
+{ f } [ "foo" "\\Bfoo\\B" <regexp> re-contains? ] unit-test
+
+{ 3 } [ "foo bar" "foo\\b" <regexp> first-match length ] unit-test
+{ f } [ "fooxbar" "foo\\b" <regexp> re-contains? ] unit-test
+{ t } [ "foo" "foo\\b" <regexp> re-contains? ] unit-test
+{ t } [ "foo bar" "foo\\b bar" <regexp> matches? ] unit-test
+{ f } [ "fooxbar" "foo\\bxbar" <regexp> matches? ] unit-test
+{ f } [ "foo" "foo\\bbar" <regexp> matches? ] unit-test
+
+{ f } [ "foo bar" "foo\\B" <regexp> re-contains? ] unit-test
+{ 3 } [ "fooxbar" "foo\\B" <regexp> first-match length ] unit-test
+{ f } [ "foo" "foo\\B" <regexp> re-contains? ] unit-test
+{ f } [ "foo bar" "foo\\B bar" <regexp> matches? ] unit-test
+{ t } [ "fooxbar" "foo\\Bxbar" <regexp> matches? ] unit-test
+{ f } [ "foo" "foo\\Bbar" <regexp> matches? ] unit-test
+
+{ t } [ "ab" "a(?=b*)" <regexp> re-contains? ] unit-test
+{ t } [ "abbbbbc" "a(?=b*c)" <regexp> re-contains? ] unit-test
+{ f } [ "abbbbb" "a(?=b*c)" <regexp> re-contains? ] unit-test
+{ t } [ "ab" "a(?=b*)" <regexp> re-contains? ] unit-test
+
+{ "az" } [ "baz" "(?<=b)(az)" <regexp> first-match >string ] unit-test
+{ f } [ "chaz" "(?<=b)(az)" <regexp> re-contains? ] unit-test
+{ "a" } [ "cbaz" "(?<=b*)a" <regexp> first-match >string ] unit-test
+{ f } [ "baz" "a(?<=b)" <regexp> re-contains? ] unit-test
+
+{ f } [ "baz" "(?<!b)a" <regexp> re-contains? ] unit-test
+{ t } [ "caz" "(?<!b)a" <regexp> re-contains? ] unit-test
+
+{ "abcd" } [ "abcdefg" "a(?=bcdefg)bcd" <regexp> first-match >string ] unit-test
+{ t } [ "abcdefg" "a(?#bcdefg)bcd" <regexp> re-contains? ] unit-test
+{ t } [ "abcdefg" "a(?:bcdefg)" <regexp> matches? ] unit-test
+
+{ 3 } [ "caba" "(?<=b)a" <regexp> first-match from>> ] unit-test
+
+{ t } [ "\ra" R/ .^a/ms matches? ] unit-test
+{ f } [ "\ra" R/ .^a/mds matches? ] unit-test
+{ t } [ "\na" R/ .^a/ms matches? ] unit-test
+{ t } [ "\na" R/ .^a/mds matches? ] unit-test
+
+{ t } [ "a\r" R/ a$./ms matches? ] unit-test
+{ f } [ "a\r" R/ a$./mds matches? ] unit-test
+{ t } [ "a\n" R/ a$./ms matches? ] unit-test
+{ t } [ "a\n" R/ a$./mds matches? ] unit-test
! Unicode categories
-[ t ] [ "a" R/ \p{L}/ matches? ] unit-test
-[ t ] [ "A" R/ \p{L}/ matches? ] unit-test
-[ f ] [ " " R/ \p{L}/ matches? ] unit-test
-[ f ] [ "a" R/ \P{L}/ matches? ] unit-test
-[ f ] [ "A" R/ \P{L}/ matches? ] unit-test
-[ t ] [ " " R/ \P{L}/ matches? ] unit-test
-
-[ t ] [ "a" R/ \p{Ll}/ matches? ] unit-test
-[ f ] [ "A" R/ \p{Ll}/ matches? ] unit-test
-[ f ] [ " " R/ \p{Ll}/ matches? ] unit-test
-[ f ] [ "a" R/ \P{Ll}/ matches? ] unit-test
-[ t ] [ "A" R/ \P{Ll}/ matches? ] unit-test
-[ t ] [ " " R/ \P{Ll}/ matches? ] unit-test
-
-[ t ] [ "a" R/ \p{script=Latin}/ matches? ] unit-test
-[ f ] [ " " R/ \p{script=Latin}/ matches? ] unit-test
-[ f ] [ "a" R/ \P{script=Latin}/ matches? ] unit-test
-[ t ] [ " " R/ \P{script=Latin}/ matches? ] unit-test
+{ t } [ "a" R/ \p{L}/ matches? ] unit-test
+{ t } [ "A" R/ \p{L}/ matches? ] unit-test
+{ f } [ " " R/ \p{L}/ matches? ] unit-test
+{ f } [ "a" R/ \P{L}/ matches? ] unit-test
+{ f } [ "A" R/ \P{L}/ matches? ] unit-test
+{ t } [ " " R/ \P{L}/ matches? ] unit-test
+
+{ t } [ "a" R/ \p{Ll}/ matches? ] unit-test
+{ f } [ "A" R/ \p{Ll}/ matches? ] unit-test
+{ f } [ " " R/ \p{Ll}/ matches? ] unit-test
+{ f } [ "a" R/ \P{Ll}/ matches? ] unit-test
+{ t } [ "A" R/ \P{Ll}/ matches? ] unit-test
+{ t } [ " " R/ \P{Ll}/ matches? ] unit-test
+
+{ t } [ "a" R/ \p{script=Latin}/ matches? ] unit-test
+{ f } [ " " R/ \p{script=Latin}/ matches? ] unit-test
+{ f } [ "a" R/ \P{script=Latin}/ matches? ] unit-test
+{ t } [ " " R/ \P{script=Latin}/ matches? ] unit-test
! These should be case-insensitive
-[ f ] [ " " R/ \p{l}/ matches? ] unit-test
-[ f ] [ "a" R/ \P{l}/ matches? ] unit-test
-[ f ] [ "a" R/ \P{ll}/ matches? ] unit-test
-[ t ] [ " " R/ \P{LL}/ matches? ] unit-test
-[ f ] [ "a" R/ \P{sCriPt = latin}/ matches? ] unit-test
-[ t ] [ " " R/ \P{SCRIPT = laTIn}/ matches? ] unit-test
+{ f } [ " " R/ \p{l}/ matches? ] unit-test
+{ f } [ "a" R/ \P{l}/ matches? ] unit-test
+{ f } [ "a" R/ \P{ll}/ matches? ] unit-test
+{ t } [ " " R/ \P{LL}/ matches? ] unit-test
+{ f } [ "a" R/ \P{sCriPt = latin}/ matches? ] unit-test
+{ t } [ " " R/ \P{SCRIPT = laTIn}/ matches? ] unit-test
! Logical operators
-[ t ] [ "a" R/ [\p{script=latin}\p{lower}]/ matches? ] unit-test
-[ t ] [ "π" R/ [\p{script=latin}\p{lower}]/ matches? ] unit-test
-[ t ] [ "A" R/ [\p{script=latin}\p{lower}]/ matches? ] unit-test
-[ f ] [ "3" R/ [\p{script=latin}\p{lower}]/ matches? ] unit-test
-
-[ t ] [ "a" R/ [\p{script=latin}||\p{lower}]/ matches? ] unit-test
-[ t ] [ "π" R/ [\p{script=latin}||\p{lower}]/ matches? ] unit-test
-[ t ] [ "A" R/ [\p{script=latin}||\p{lower}]/ matches? ] unit-test
-[ f ] [ "3" R/ [\p{script=latin}||\p{lower}]/ matches? ] unit-test
-
-[ t ] [ "a" R/ [\p{script=latin}&&\p{lower}]/ matches? ] unit-test
-[ f ] [ "π" R/ [\p{script=latin}&&\p{lower}]/ matches? ] unit-test
-[ f ] [ "A" R/ [\p{script=latin}&&\p{lower}]/ matches? ] unit-test
-[ f ] [ "3" R/ [\p{script=latin}&&\p{lower}]/ matches? ] unit-test
-
-[ f ] [ "a" R/ [\p{script=latin}~~\p{lower}]/ matches? ] unit-test
-[ t ] [ "π" R/ [\p{script=latin}~~\p{lower}]/ matches? ] unit-test
-[ t ] [ "A" R/ [\p{script=latin}~~\p{lower}]/ matches? ] unit-test
-[ f ] [ "3" R/ [\p{script=latin}~~\p{lower}]/ matches? ] unit-test
-
-[ f ] [ "a" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
-[ f ] [ "π" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
-[ t ] [ "A" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
-[ f ] [ "3" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
-
-[ t ] [ " " R/ \P{alpha}/ matches? ] unit-test
-[ f ] [ "" R/ \P{alpha}/ matches? ] unit-test
-[ f ] [ "a " R/ \P{alpha}/ matches? ] unit-test
-[ f ] [ "a" R/ \P{alpha}/ matches? ] unit-test
+{ t } [ "a" R/ [\p{script=latin}\p{lower}]/ matches? ] unit-test
+{ t } [ "π" R/ [\p{script=latin}\p{lower}]/ matches? ] unit-test
+{ t } [ "A" R/ [\p{script=latin}\p{lower}]/ matches? ] unit-test
+{ f } [ "3" R/ [\p{script=latin}\p{lower}]/ matches? ] unit-test
+
+{ t } [ "a" R/ [\p{script=latin}||\p{lower}]/ matches? ] unit-test
+{ t } [ "π" R/ [\p{script=latin}||\p{lower}]/ matches? ] unit-test
+{ t } [ "A" R/ [\p{script=latin}||\p{lower}]/ matches? ] unit-test
+{ f } [ "3" R/ [\p{script=latin}||\p{lower}]/ matches? ] unit-test
+
+{ t } [ "a" R/ [\p{script=latin}&&\p{lower}]/ matches? ] unit-test
+{ f } [ "π" R/ [\p{script=latin}&&\p{lower}]/ matches? ] unit-test
+{ f } [ "A" R/ [\p{script=latin}&&\p{lower}]/ matches? ] unit-test
+{ f } [ "3" R/ [\p{script=latin}&&\p{lower}]/ matches? ] unit-test
+
+{ f } [ "a" R/ [\p{script=latin}~~\p{lower}]/ matches? ] unit-test
+{ t } [ "π" R/ [\p{script=latin}~~\p{lower}]/ matches? ] unit-test
+{ t } [ "A" R/ [\p{script=latin}~~\p{lower}]/ matches? ] unit-test
+{ f } [ "3" R/ [\p{script=latin}~~\p{lower}]/ matches? ] unit-test
+
+{ f } [ "a" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
+{ f } [ "π" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
+{ t } [ "A" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
+{ f } [ "3" R/ [\p{script=latin}--\p{lower}]/ matches? ] unit-test
+
+{ t } [ " " R/ \P{alpha}/ matches? ] unit-test
+{ f } [ "" R/ \P{alpha}/ matches? ] unit-test
+{ f } [ "a " R/ \P{alpha}/ matches? ] unit-test
+{ f } [ "a" R/ \P{alpha}/ matches? ] unit-test
USING: arrays kernel math roman roman.private sequences tools.test ;
-[ "i" ] [ 1 >roman ] unit-test
-[ "ii" ] [ 2 >roman ] unit-test
-[ "iii" ] [ 3 >roman ] unit-test
-[ "iv" ] [ 4 >roman ] unit-test
-[ "v" ] [ 5 >roman ] unit-test
-[ "vi" ] [ 6 >roman ] unit-test
-[ "vii" ] [ 7 >roman ] unit-test
-[ "viii" ] [ 8 >roman ] unit-test
-[ "ix" ] [ 9 >roman ] unit-test
-[ "x" ] [ 10 >roman ] unit-test
-[ "mdclxvi" ] [ 1666 >roman ] unit-test
-[ "mmmcdxliv" ] [ 3444 >roman ] unit-test
-[ "mmmcmxcix" ] [ 3999 >roman ] unit-test
-[ "MMMCMXCIX" ] [ 3999 >ROMAN ] unit-test
-[ 3999 ] [ 3999 >ROMAN roman> ] unit-test
-[ 1 ] [ 1 >roman roman> ] unit-test
-[ 2 ] [ 2 >roman roman> ] unit-test
-[ 3 ] [ 3 >roman roman> ] unit-test
-[ 4 ] [ 4 >roman roman> ] unit-test
-[ 5 ] [ 5 >roman roman> ] unit-test
-[ 6 ] [ 6 >roman roman> ] unit-test
-[ 7 ] [ 7 >roman roman> ] unit-test
-[ 8 ] [ 8 >roman roman> ] unit-test
-[ 9 ] [ 9 >roman roman> ] unit-test
-[ 10 ] [ 10 >roman roman> ] unit-test
-[ 1666 ] [ 1666 >roman roman> ] unit-test
-[ 3444 ] [ 3444 >roman roman> ] unit-test
-[ 3999 ] [ 3999 >roman roman> ] unit-test
+{ "i" } [ 1 >roman ] unit-test
+{ "ii" } [ 2 >roman ] unit-test
+{ "iii" } [ 3 >roman ] unit-test
+{ "iv" } [ 4 >roman ] unit-test
+{ "v" } [ 5 >roman ] unit-test
+{ "vi" } [ 6 >roman ] unit-test
+{ "vii" } [ 7 >roman ] unit-test
+{ "viii" } [ 8 >roman ] unit-test
+{ "ix" } [ 9 >roman ] unit-test
+{ "x" } [ 10 >roman ] unit-test
+{ "mdclxvi" } [ 1666 >roman ] unit-test
+{ "mmmcdxliv" } [ 3444 >roman ] unit-test
+{ "mmmcmxcix" } [ 3999 >roman ] unit-test
+{ "MMMCMXCIX" } [ 3999 >ROMAN ] unit-test
+{ 3999 } [ 3999 >ROMAN roman> ] unit-test
+{ 1 } [ 1 >roman roman> ] unit-test
+{ 2 } [ 2 >roman roman> ] unit-test
+{ 3 } [ 3 >roman roman> ] unit-test
+{ 4 } [ 4 >roman roman> ] unit-test
+{ 5 } [ 5 >roman roman> ] unit-test
+{ 6 } [ 6 >roman roman> ] unit-test
+{ 7 } [ 7 >roman roman> ] unit-test
+{ 8 } [ 8 >roman roman> ] unit-test
+{ 9 } [ 9 >roman roman> ] unit-test
+{ 10 } [ 10 >roman roman> ] unit-test
+{ 1666 } [ 1666 >roman roman> ] unit-test
+{ 3444 } [ 3444 >roman roman> ] unit-test
+{ 3999 } [ 3999 >roman roman> ] unit-test
[ 0 >roman ] must-fail
[ 40000 >roman ] must-fail
-[ "vi" ] [ "iii" "iii" roman+ ] unit-test
-[ "viii" ] [ "x" "ii" roman- ] unit-test
-[ "ix" ] [ "iii" "iii" roman* ] unit-test
-[ "i" ] [ "iii" "ii" roman/i ] unit-test
-[ "i" "ii" ] [ "v" "iii" roman/mod ] unit-test
+{ "vi" } [ "iii" "iii" roman+ ] unit-test
+{ "viii" } [ "x" "ii" roman- ] unit-test
+{ "ix" } [ "iii" "iii" roman* ] unit-test
+{ "i" } [ "iii" "ii" roman/i ] unit-test
+{ "i" "ii" } [ "v" "iii" roman/mod ] unit-test
[ "iii" "iii" roman- ] must-fail
-[ 30 ] [ ROMAN: xxx ] unit-test
+{ 30 } [ ROMAN: xxx ] unit-test
[ roman+ ] must-infer
[ roman- ] must-infer
<hashed-dlist> "h" set
-[ t ] [ "h" get deque-empty? ] unit-test
+{ t } [ "h" get deque-empty? ] unit-test
-[ ] [ 3 "h" get push-front* "1" set ] unit-test
-[ ] [ 1 "h" get push-front ] unit-test
-[ ] [ 3 "h" get push-front* "2" set ] unit-test
-[ ] [ 3 "h" get push-front* "3" set ] unit-test
-[ ] [ 7 "h" get push-front ] unit-test
+{ } [ 3 "h" get push-front* "1" set ] unit-test
+{ } [ 1 "h" get push-front ] unit-test
+{ } [ 3 "h" get push-front* "2" set ] unit-test
+{ } [ 3 "h" get push-front* "3" set ] unit-test
+{ } [ 7 "h" get push-front ] unit-test
-[ t ] [ "1" get "2" get eq? ] unit-test
-[ t ] [ "2" get "3" get eq? ] unit-test
+{ t } [ "1" get "2" get eq? ] unit-test
+{ t } [ "2" get "3" get eq? ] unit-test
-[ t ] [ 7 "h" get deque-member? ] unit-test
+{ t } [ 7 "h" get deque-member? ] unit-test
-[ 3 ] [ "1" get node-value ] unit-test
-[ ] [ "1" get "h" get delete-node ] unit-test
+{ 3 } [ "1" get node-value ] unit-test
+{ } [ "1" get "h" get delete-node ] unit-test
-[ 1 ] [ "h" get pop-back ] unit-test
-[ 7 ] [ "h" get pop-back ] unit-test
+{ 1 } [ "h" get pop-back ] unit-test
+{ 7 } [ "h" get pop-back ] unit-test
-[ f ] [ 7 "h" get deque-member? ] unit-test
+{ f } [ 7 "h" get deque-member? ] unit-test
-[ ] [
+{ } [
<hashed-dlist>
[ all-words swap [ push-front ] curry each ]
[ [ drop ] slurp-deque ]
CONSTANT: test-const 10
-[ "IN: see.tests\nCONSTANT: test-const 10 inline\n" ]
+{ "IN: see.tests\nCONSTANT: test-const 10 inline\n" }
[ [ \ test-const see ] with-string-writer ] unit-test
ALIAS: test-alias +
-[ "USING: math ;\nIN: see.tests\nALIAS: test-alias + inline\n" ]
+{ "USING: math ;\nIN: see.tests\nALIAS: test-alias + inline\n" }
[ [ \ test-alias see ] with-string-writer ] unit-test
-[ "IN: see.tests ALIAS: test-alias ( x y -- z )" ]
+{ "IN: see.tests ALIAS: test-alias ( x y -- z )" }
[ \ test-alias summary ] unit-test
-[ ] [ gensym see ] unit-test
+{ } [ gensym see ] unit-test
: 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
binary [ serialize-cell ] with-byte-writer
binary [ deserialize-cell ] with-byte-reader = ;
-[ t ] [
+{ t } [
100 [
drop
{
first2 eq?
] if ;
-[ t ] [ objects [ check-serialize-1 ] all? ] unit-test
+{ t } [ objects [ check-serialize-1 ] all? ] unit-test
-[ t ] [ objects [ check-serialize-2 ] all? ] unit-test
+{ t } [ objects [ check-serialize-2 ] all? ] unit-test
-[ t ] [ pi check-serialize-1 ] unit-test
+{ t } [ pi check-serialize-1 ] unit-test
[ serialize ] must-infer
[ deserialize ] must-infer
-[ t ] [
+{ t } [
V{ } dup dup push
object>bytes
bytes>object
dup first eq?
] unit-test
-[ t ] [
+{ t } [
H{ } dup dup dup set-at
object>bytes
bytes>object
USING: shuffle tools.test ;
IN: shuffle.tests
-[ 1 2 3 4 ] [ 3 4 1 2 2swap ] unit-test
+{ 1 2 3 4 } [ 3 4 1 2 2swap ] unit-test
-[ 4 2 3 ] [ 1 2 3 4 shuffle( a b c d -- d b c ) ] unit-test
+{ 4 2 3 } [ 1 2 3 4 shuffle( a b c d -- d b c ) ] unit-test
-[ 2 3 4 1 ] [ 1 2 3 4 roll ] unit-test
-[ 1 2 3 4 ] [ 2 3 4 1 -roll ] unit-test
+{ 2 3 4 1 } [ 1 2 3 4 roll ] unit-test
+{ 1 2 3 4 } [ 2 3 4 1 -roll ] unit-test
"vocab:simple-flat-file/test1.txt" flat-file>biassoc ;
-[ 0 ] [ 0 <test1> at ] unit-test
-[ 0 ] [ 0 <test1> value-at ] unit-test
+{ 0 } [ 0 <test1> at ] unit-test
+{ 0 } [ 0 <test1> value-at ] unit-test
-[ 3 ] [ 3 <test1> at ] unit-test
-[ 3 ] [ 3 <test1> value-at ] unit-test
+{ 3 } [ 3 <test1> at ] unit-test
+{ 3 } [ 3 <test1> value-at ] unit-test
-[ 0xAD2A ] [ 0x8253 <test1> at ] unit-test
-[ 0x8253 ] [ 0xAD2A <test1> value-at ] unit-test
+{ 0xAD2A } [ 0x8253 <test1> at ] unit-test
+{ 0x8253 } [ 0xAD2A <test1> value-at ] unit-test
-[ 0xAD31 ] [ 0x8258 <test1> at ] unit-test
-[ 0x8258 ] [ 0xAD31 <test1> value-at ] unit-test
+{ 0xAD31 } [ 0x8258 <test1> at ] unit-test
+{ 0x8258 } [ 0xAD31 <test1> value-at ] unit-test
[ "" tokenize ] must-fail
[ " " tokenize ] must-fail
-[ V{ "a" } ] [ "a" tokenize ] unit-test
-[ V{ "abc" } ] [ "abc" tokenize ] unit-test
-[ V{ "abc" } ] [ "abc " tokenize ] unit-test
-[ V{ "abc" } ] [ " abc" tokenize ] unit-test
-[ V{ "abc" "def" } ] [ "abc def" tokenize ] unit-test
-[ V{ "abc def" } ] [ "abc\\ def" tokenize ] unit-test
-[ V{ "abc\\" "def" } ] [ "abc\\\\ def" tokenize ] unit-test
-[ V{ "abc\\ def" } ] [ "\"abc\\\\ def\"" tokenize ] unit-test
-[ V{ "abc\\ def" } ] [ " \"abc\\\\ def\"" tokenize ] unit-test
-[ V{ "abc\\ def" "hey" } ] [ "\"abc\\\\ def\" hey" tokenize ] unit-test
-[ V{ "abc def" "hey" } ] [ "\"abc def\" \"hey\"" tokenize ] unit-test
+{ V{ "a" } } [ "a" tokenize ] unit-test
+{ V{ "abc" } } [ "abc" tokenize ] unit-test
+{ V{ "abc" } } [ "abc " tokenize ] unit-test
+{ V{ "abc" } } [ " abc" tokenize ] unit-test
+{ V{ "abc" "def" } } [ "abc def" tokenize ] unit-test
+{ V{ "abc def" } } [ "abc\\ def" tokenize ] unit-test
+{ V{ "abc\\" "def" } } [ "abc\\\\ def" tokenize ] unit-test
+{ V{ "abc\\ def" } } [ "\"abc\\\\ def\"" tokenize ] unit-test
+{ V{ "abc\\ def" } } [ " \"abc\\\\ def\"" tokenize ] unit-test
+{ V{ "abc\\ def" "hey" } } [ "\"abc\\\\ def\" hey" tokenize ] unit-test
+{ V{ "abc def" "hey" } } [ "\"abc def\" \"hey\"" tokenize ] unit-test
[ "\"abc def\" \"hey" tokenize ] must-fail
[ "\"abc def" tokenize ] must-fail
-[ V{ "abc def" "h\"ey" } ] [ "\"abc def\" \"h\\\"ey\" " tokenize ] unit-test
+{ V{ "abc def" "h\"ey" } } [ "\"abc def\" \"h\\\"ey\" " tokenize ] unit-test
-[
+{
V{
"Hello world.app/Contents/MacOS/hello-ui"
"-i=boot.macosx-ppc.image"
"-no-stack-traces"
"-no-user-init"
}
-] [
+} [
"\"Hello world.app/Contents/MacOS/hello-ui\" -i=boot.macosx-ppc.image \"-include= math compiler ui\" -deploy-vocab=hello-ui \"-output-image=Hello world.app/Contents/Resources/hello-ui.image\" -no-stack-traces -no-user-init" tokenize
] unit-test
[ "hello\nworld" validate-address ] must-fail
-[ "slava@factorcode.org" ]
+{ "slava@factorcode.org" }
[ "slava@factorcode.org" validate-address ] unit-test
-[ "aGVsbG8Kd29ybGQ=\r\n.\r\n" ] [
+{ "aGVsbG8Kd29ybGQ=\r\n.\r\n" } [
T{ email { body "hello\nworld" } } [ send-body ] with-string-writer
] unit-test
[ { "500 syntax error" } <response> check-response ]
[ smtp-error? ] must-fail-with
-[ ] [ { "220 success" } <response> check-response ] unit-test
+{ } [ { "220 success" } <response> check-response ] unit-test
-[ T{ response f 220 { "220 success" } } ] [
+{ T{ response f 220 { "220 success" } } } [
"220 success" [ receive-response ] with-string-reader
] unit-test
-[
+{
T{ response f 220 {
"220-a multiline response"
"250-another line"
"220 the end"
} }
-] [
+} [
"220-a multiline response\r\n250-another line\r\n220 the end"
[ receive-response ] with-string-reader
] unit-test
-[ ] [
+{ } [
"220-a multiline response\r\n250-another line\r\n220 the end"
[ get-ok ] with-string-reader
] unit-test
"Subject:\r\nsecurity hole" validate-header
] must-fail
-[
+{
{
{ "Content-Transfer-Encoding" "base64" }
{ "Content-Type" "text/plain; charset=UTF-8" }
}
{ "slava@factorcode.org" "dharmatech@factorcode.org" }
"erg@factorcode.org"
-] [
+} [
[
<email>
"Factor rules" >>subject
] with-test-smtp-config
] unit-test
-[ ] [
+{ } [
<secure-config> f >>verify [
[
<email>
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
IN: soundex.tests
USING: soundex tools.test ;
-[ "S162" ] [ "supercalifrag" soundex ] unit-test
-[ "M000" ] [ "M" soundex ] unit-test
+{ "S162" } [ "supercalifrag" soundex ] unit-test
+{ "M000" } [ "M" soundex ] unit-test
SPECIALIZED-ARRAY: int
SPECIALIZED-ARRAYS: bool uchar ushort char uint float ulonglong ;
-[ t ] [ { 1 2 3 } int >c-array int-array? ] unit-test
+{ t } [ { 1 2 3 } int >c-array int-array? ] unit-test
-[ t ] [ int-array{ 1 2 3 } int-array? ] unit-test
+{ t } [ int-array{ 1 2 3 } int-array? ] unit-test
-[ 2 ] [ int-array{ 1 2 3 } second ] unit-test
+{ 2 } [ int-array{ 1 2 3 } second ] unit-test
-[ t ] [
+{ t } [
{ t f t } bool >c-array underlying>>
{ 1 0 1 } bool heap-size {
{ 1 [ char >c-array ] }
} case underlying>> =
] unit-test
-[ ushort-array{ 1234 } ] [
+{ ushort-array{ 1234 } } [
little-endian? B{ 210 4 } B{ 4 210 } ? ushort cast-array
] unit-test
[ B{ 210 4 1 } ushort cast-array ] must-fail
-[ { 3 1 3 3 7 } ] [
+{ { 3 1 3 3 7 } } [
int-array{ 3 1 3 3 7 } malloc-byte-array [ &free 5 int <c-direct-array> >array ] with-destructors
] unit-test
-[ float-array{ 0x1.222,222p0 0x1.111,112p0 } ]
+{ float-array{ 0x1.222,222p0 0x1.111,112p0 } }
[ float-array{ 0x1.222,222,2p0 0x1.111,111,1p0 } ] unit-test
-[ f ] [ float-array{ 4 3 2 1 } dup clone [ underlying>> ] bi@ eq? ] unit-test
+{ f } [ float-array{ 4 3 2 1 } dup clone [ underlying>> ] bi@ eq? ] unit-test
-[ f ] [ [ float-array{ 4 3 2 1 } dup clone [ underlying>> ] bi@ eq? ] compile-call ] unit-test
+{ f } [ [ float-array{ 4 3 2 1 } dup clone [ underlying>> ] bi@ eq? ] compile-call ] unit-test
-[ ushort-array{ 0 0 0 } ] [
+{ ushort-array{ 0 0 0 } } [
3 ALIEN: 123 100 <direct-ushort-array> new-sequence
[ drop 0 ] map!
] unit-test
SPECIALIZED-ARRAY: test-struct
-[ 1 ] [
+{ 1 } [
1 test-struct-array{ } new-sequence length
] unit-test
-[ V{ test-struct } ] [
+{ V{ test-struct } } [
[ [ test-struct-array <struct> ] test-struct-array{ } output>sequence first ] final-classes
] unit-test
: make-point ( x y -- struct )
test-struct <struct-boa> ;
-[ 5/4 ] [
+{ 5/4 } [
2 <test-struct-array>
1 2 make-point over set-first
3 4 make-point over set-second
0 [ [ x>> ] [ y>> ] bi / + ] reduce
] unit-test
-[ 5/4 ] [
+{ 5/4 } [
[
2 \ test-struct malloc-array
dup &free drop
] with-destructors
] unit-test
-[ ] [ ALIEN: 123 10 <direct-test-struct-array> drop ] unit-test
+{ } [ ALIEN: 123 10 <direct-test-struct-array> drop ] unit-test
-[ ] [
+{ } [
[
10 \ test-struct malloc-array
&free drop
] with-destructors
] unit-test
-[ 15 ] [ 15 10 <test-struct-array> resize length ] unit-test
+{ 15 } [ 15 10 <test-struct-array> resize length ] unit-test
-[ S{ test-struct f 12 20 } ] [
+{ S{ test-struct f 12 20 } } [
test-struct-array{
S{ test-struct f 4 20 }
S{ test-struct f 12 20 }
} second
] unit-test
-[ ] [
+{ } [
[
test-struct specialized-array-vocab forget-vocab
] with-compilation-unit
SPECIALIZED-ARRAY: fixed-string
-[ { ALIEN: 100 ALIEN: 140 ALIEN: 180 ALIEN: 1c0 } ] [
+{ { ALIEN: 100 ALIEN: 140 ALIEN: 180 ALIEN: 1c0 } } [
ALIEN: 100 4 <direct-fixed-string-array> [ (underlying)>> ] { } map-as
] unit-test
! Ensure that byte-length works with direct arrays
-[ 400 ] [
+{ 400 } [
ALIEN: 123 100 <direct-int-array> byte-length
] unit-test
-[ ] [
+{ } [
[
fixed-string specialized-array-vocab forget-vocab
] with-compilation-unit
] unit-test
! Test prettyprinting
-[ "int-array{ 1 2 3 }" ] [ int-array{ 1 2 3 } unparse ] unit-test
-[ "c-array@ int f 100" ] [ f 100 <direct-int-array> unparse ] unit-test
+{ "int-array{ 1 2 3 }" } [ int-array{ 1 2 3 } unparse ] unit-test
+{ "c-array@ int f 100" } [ f 100 <direct-int-array> unparse ] unit-test
! If the C type doesn't exist, don't generate a vocab
SYMBOL: __does_not_exist__
SPECIALIZED-ARRAY: __does_not_exist__ """ eval( -- )
] must-fail
-[ ] [
+{ } [
"""
IN: specialized-arrays.tests
USING: alien.c-types classes.struct specialized-arrays ;
""" eval( -- )
] unit-test
-[ f ] [
+{ f } [
"__does_not_exist__-array{"
__does_not_exist__ specialized-array-vocab lookup-word
deferred?
] unit-test
-[ ] [
+{ } [
[
\ __does_not_exist__ forget
__does_not_exist__ specialized-array-vocab forget-vocab
SPECIALIZED-ARRAY: struct-resize-test
-[ 40 ] [ 10 <struct-resize-test-array> byte-length ] unit-test
+{ 40 } [ 10 <struct-resize-test-array> byte-length ] unit-test
: struct-resize-test-usage ( seq -- seq )
[ struct-resize-test <struct> swap >>x ] map
\ struct-resize-test >c-array
[ x>> ] { } map-as ;
-[ { 10 20 30 } ] [ { 10 20 30 } struct-resize-test-usage ] unit-test
+{ { 10 20 30 } } [ { 10 20 30 } struct-resize-test-usage ] unit-test
-[ ] [ "IN: specialized-arrays.tests USE: classes.struct USE: alien.c-types STRUCT: struct-resize-test { x int } { y int } ;" eval( -- ) ] unit-test
+{ } [ "IN: specialized-arrays.tests USE: classes.struct USE: alien.c-types STRUCT: struct-resize-test { x int } { y int } ;" eval( -- ) ] unit-test
-[ 80 ] [ 10 <struct-resize-test-array> byte-length ] unit-test
+{ 80 } [ 10 <struct-resize-test-array> byte-length ] unit-test
-[ { 10 20 30 } ] [ { 10 20 30 } struct-resize-test-usage ] unit-test
+{ { 10 20 30 } } [ { 10 20 30 } struct-resize-test-usage ] unit-test
-[ ] [
+{ } [
[
struct-resize-test specialized-array-vocab forget-vocab
\ struct-resize-test-usage forget
] with-compilation-unit
] unit-test
-[ int-array{ 4 5 6 } ] [ 3 6 int-array{ 1 2 3 4 5 6 7 8 } direct-slice ] unit-test
-[ int-array{ 1 2 3 } ] [ int-array{ 1 2 3 4 5 6 7 8 } 3 direct-head ] unit-test
-[ int-array{ 1 2 3 4 5 } ] [ int-array{ 1 2 3 4 5 6 7 8 } 3 direct-head* ] unit-test
-[ int-array{ 4 5 6 7 8 } ] [ int-array{ 1 2 3 4 5 6 7 8 } 3 direct-tail ] unit-test
-[ int-array{ 6 7 8 } ] [ int-array{ 1 2 3 4 5 6 7 8 } 3 direct-tail* ] unit-test
+{ int-array{ 4 5 6 } } [ 3 6 int-array{ 1 2 3 4 5 6 7 8 } direct-slice ] unit-test
+{ int-array{ 1 2 3 } } [ int-array{ 1 2 3 4 5 6 7 8 } 3 direct-head ] unit-test
+{ int-array{ 1 2 3 4 5 } } [ int-array{ 1 2 3 4 5 6 7 8 } 3 direct-head* ] unit-test
+{ int-array{ 4 5 6 7 8 } } [ int-array{ 1 2 3 4 5 6 7 8 } 3 direct-tail ] unit-test
+{ int-array{ 6 7 8 } } [ int-array{ 1 2 3 4 5 6 7 8 } 3 direct-tail* ] unit-test
-[ uchar-array{ 0 1 255 } ] [ 3 6 B{ 1 1 1 0 1 255 2 2 2 } direct-slice ] unit-test
+{ uchar-array{ 0 1 255 } } [ 3 6 B{ 1 1 1 0 1 255 2 2 2 } direct-slice ] unit-test
-[ int-array{ 1 2 3 4 55555 6 7 8 } ] [
+{ int-array{ 1 2 3 4 55555 6 7 8 } } [
int-array{ 1 2 3 4 5 6 7 8 }
3 6 pick direct-slice [ 55555 1 ] dip set-nth
] unit-test
SPECIALIZED-ARRAY: float
SPECIALIZED-VECTORS: float double ;
-[ 3 ] [ double-vector{ 1 2 } 3 suffix! length ] unit-test
+{ 3 } [ double-vector{ 1 2 } 3 suffix! length ] unit-test
-[ t ] [ 10 float-array{ } new-resizable float-vector? ] unit-test
+{ t } [ 10 float-array{ } new-resizable float-vector? ] 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
GENERIC: potential-hang ( obj -- obj )
M: fixnum potential-hang dup [ potential-hang ] when ;
-[ ] [ [ 5 potential-hang ] infer drop ] unit-test
+{ } [ [ 5 potential-hang ] infer drop ] unit-test
TUPLE: funny-cons car cdr ;
GENERIC: iterate ( obj -- )
ERROR: custom-error ;
-[ T{ effect f { } { } t } ] [
+{ T{ effect f { } { } t } } [
[ custom-error ] infer
] unit-test
: funny-throw ( a -- * ) throw ; inline
-[ T{ effect f { } { } t } ] [
+{ T{ effect f { } { } t } } [
[ 3 funny-throw ] infer
] unit-test
-[ T{ effect f { } { } t } ] [
+{ T{ effect f { } { } t } } [
[ custom-error inference-error ] infer
] unit-test
-[ T{ effect f { "x" } { "x" "x" } t } ] [
+{ T{ effect f { "x" } { "x" "x" } t } } [
[ dup [ 3 throw ] dip ] infer
] unit-test
dup bad-recursion-6 call ; inline recursive
[ [ [ drop f ] bad-recursion-6 ] infer ] must-fail
-[ ] [ [ \ bad-recursion-6 forget ] with-compilation-unit ] unit-test
+{ } [ [ \ bad-recursion-6 forget ] with-compilation-unit ] unit-test
{ 3 0 } [ [ 2drop "A" throw ] [ ] if 2drop ] must-infer-as
{ 2 0 } [ drop f f [ 2drop "A" throw ] [ ] if 2drop ] must-infer-as
[ [ eee' ] infer ] [ inference-error? ] must-fail-with
-[ ] [ [ \ ddd' forget ] with-compilation-unit ] unit-test
-[ ] [ [ \ eee' forget ] with-compilation-unit ] unit-test
+{ } [ [ \ ddd' forget ] with-compilation-unit ] unit-test
+{ } [ [ \ eee' forget ] with-compilation-unit ] unit-test
: bogus-error ( x -- )
dup "A" throw [ bogus-error ] [ drop ] if ; inline recursive
: forget-test ( -- ) ;
[ forget-test ] must-infer
-[ ] [ [ \ forget-test forget ] with-compilation-unit ] unit-test
+{ } [ [ \ forget-test forget ] with-compilation-unit ] unit-test
[ forget-test ] must-infer
[ [ cond ] infer ] [ T{ unknown-macro-input f cond } = ] must-fail-with
[ [ execute-effect ] infer ] [ T{ unknown-macro-input f execute-effect } = ] must-fail-with
[ \ set-datastack def>> infer ] [ T{ do-not-compile f do-primitive } = ] must-fail-with
-[ ] [ [ \ set-datastack def>> infer ] try ] unit-test
+{ } [ [ \ set-datastack def>> infer ] try ] unit-test
! Make sure all primitives are covered
-[ { } ] [
+{ { } } [
all-words [ primitive? ] filter
[ "default-output-classes" word-prop ] reject
[ "special" word-prop ] reject
: inputs-test1 ( x -- n )
[ + ] curry inputs ;
-[ 1 ] [ inputs-test0 ] unit-test
-[ 1 ] [ 10 inputs-test1 ] unit-test
+{ 1 } [ inputs-test0 ] unit-test
+{ 1 } [ 10 inputs-test1 ] 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
IN: suffix-arrays.tests
! built from [ all-words 10 head [ name>> ] map ]
-[ ] [
+{ } [
{
"run-tests"
"must-fail-with"
} >suffix-array "suffix-array" set
] unit-test
-[ t ]
+{ t }
[ "suffix-array" get "" swap query empty? not ] unit-test
-[ { } ]
+{ { } }
[ SA{ } "something" swap query ] unit-test
-[ { "unit-test" "(unit-test)" } ]
+{ { "unit-test" "(unit-test)" } }
[ "suffix-array" get "unit-test" swap query ] unit-test
-[ t ]
+{ t }
[ "suffix-array" get "something else" swap query empty? ] unit-test
-[ { "rofl" } ] [ SA{ "rofl" } "r" swap query ] unit-test
-[ { "rofl" } ] [ SA{ "rofl" } "o" swap query ] unit-test
-[ { "rofl" } ] [ SA{ "rofl" } "f" swap query ] unit-test
-[ { "rofl" } ] [ SA{ "rofl" } "l" swap query ] unit-test
-[ { } ] [ SA{ "rofl" } "t" swap query ] unit-test
+{ { "rofl" } } [ SA{ "rofl" } "r" swap query ] unit-test
+{ { "rofl" } } [ SA{ "rofl" } "o" swap query ] unit-test
+{ { "rofl" } } [ SA{ "rofl" } "f" swap query ] unit-test
+{ { "rofl" } } [ SA{ "rofl" } "l" swap query ] unit-test
+{ { } } [ SA{ "rofl" } "t" swap query ] unit-test
#! it as an feed tuple.
binary file-contents parse-feed ;
-[ T{
+{ T{
feed
f
"Meerkat"
f
}
}
-} ] [ "vocab:syndication/test/rss1.xml" load-news-file ] unit-test
-[ T{
+} } [ "vocab:syndication/test/rss1.xml" load-news-file ] unit-test
+{ T{
feed
f
"dive into mark"
T{ timestamp f 2003 12 13 8 29 29 T{ duration f 0 0 0 -4 0 0 } }
}
}
-} ] [ "vocab:syndication/test/atom.xml" load-news-file ] unit-test
-[ t ] [ "vocab:syndication/test/atom.xml" load-news-file dup feed>xml xml>feed = ] unit-test
+} } [ "vocab:syndication/test/atom.xml" load-news-file ] unit-test
+{ t } [ "vocab:syndication/test/atom.xml" load-news-file dup feed>xml xml>feed = ] unit-test
3 "x" set
[ 2 "x" set ] "Test" spawn drop
-[ 2 ] [ yield "x" get ] unit-test
-[ ] [ [ flush ] "flush test" spawn drop flush ] unit-test
-[ ] [ [ "Errors, errors" throw ] "error test" spawn drop ] unit-test
+{ 2 } [ yield "x" get ] unit-test
+{ } [ [ flush ] "flush test" spawn drop flush ] unit-test
+{ } [ [ "Errors, errors" throw ] "error test" spawn drop ] unit-test
yield
-[ ] [ 0.3 sleep ] unit-test
+{ } [ 0.3 sleep ] unit-test
[ "hey" sleep ] must-fail
-[ 3 ] [ 3 self resume-with "Test suspend" suspend ] unit-test
+{ 3 } [ 3 self resume-with "Test suspend" suspend ] unit-test
-[ f ] [ f get-global ] unit-test
+{ f } [ f get-global ] unit-test
{ { 0 3 6 9 12 15 18 21 24 27 } } [
10 iota [
] with-variable
p ?promise g eq? ;
-[ t ] [ spawn-namespace-test ] unit-test
+{ t } [ spawn-namespace-test ] unit-test
[ "a" [ 1 1 + ] spawn 100 sleep ] must-fail
-[ ] [ 0.1 seconds sleep ] unit-test
+{ } [ 0.1 seconds sleep ] unit-test
! Test thread-local variables
<promise> "p" set
5 "x" tset
-[ 5 ] [ "x" tget ] unit-test
+{ 5 } [ "x" tget ] unit-test
-[ ] [ "x" [ 1 + ] tchange ] unit-test
+{ } [ "x" [ 1 + ] tchange ] unit-test
-[ 6 ] [ "x" tget ] unit-test
+{ 6 } [ "x" tget ] unit-test
! Are they truly thread-local?
[ "x" tget "p" get fulfill ] in-thread
-[ f ] [ "p" get ?promise ] unit-test
+{ f } [ "p" get ?promise ] unit-test
! Test system traps inside threads
-[ ] [ [ dup ] in-thread yield ] unit-test
+{ } [ [ dup ] in-thread yield ] unit-test
! The start-context-and-delete primitive wasn't rewinding the
! callstack properly.
! The unit test asserts that the callstack is empty from the
! quotation passed to start-context-and-delete.
-[ 3 ] [
+{ 3 } [
<promise> [
'[
_ [
threads tools.test tools.time ;
IN: timers.tests
-[ ] [
+{ } [
1 <count-down>
{ f } clone 2dup
[ first stop-timer count-down ] 2curry 1 seconds later
await
] unit-test
-[ ] [
+{ } [
self [ resume ] curry instant later drop
"test" suspend drop
] unit-test
-[ t ] [
+{ t } [
[
<promise>
[ '[ t _ fulfill ] 2 seconds later drop ]
] benchmark 1,500,000,000 2,500,000,000 between?
] unit-test
-[ { 3 } ] [
+{ { 3 } } [
{ 3 } dup
'[ 4 _ set-first ] 2 seconds later
1/2 seconds sleep
stop-timer
] unit-test
-[ { 1 } ] [
+{ { 1 } } [
{ 0 }
dup '[ 0 _ [ 1 + ] change-nth ] 3 seconds later
[ stop-timer ] [ start-timer ] bi
4 seconds sleep
] unit-test
-[ { 0 } ] [
+{ { 0 } } [
{ 0 }
dup '[ 3 seconds sleep 1 _ set-first ] 1 seconds later
2 seconds sleep stop-timer
1/2 seconds sleep
] unit-test
-[ { 0 } ] [
+{ { 0 } } [
{ 0 }
dup '[ 1 _ set-first ] 300 milliseconds later
150 milliseconds sleep
[ restart-timer ] [ 200 milliseconds sleep stop-timer ] bi
] unit-test
-[ { 1 } ] [
+{ { 1 } } [
{ 0 }
dup '[ 0 _ [ 1 + ] change-nth ] 200 milliseconds later
100 milliseconds sleep restart-timer 300 milliseconds sleep
] unit-test
-[ { 4 } ] [
+{ { 4 } } [
{ 0 }
dup '[ 0 _ [ 1 + ] change-nth ] 300 milliseconds 300 milliseconds
<timer> dup start-timer
: 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
TR: tr-test ch>upper "ABC" "XYZ" ;
-[ "XXYY" ] [ "aabb" tr-test ] unit-test
-[ "XXYY" ] [ "AABB" tr-test ] unit-test
-[ { 12345 } ] [ { 12345 } tr-test ] unit-test
+{ "XXYY" } [ "aabb" tr-test ] unit-test
+{ "XXYY" } [ "AABB" tr-test ] unit-test
+{ { 12345 } } [ { 12345 } tr-test ] unit-test
C: <foo> foo
TUPLE-ARRAY: foo
-[ 2 ] [ 2 <foo-array> dup mat set length ] unit-test
-[ T{ foo } ] [ mat get first ] unit-test
-[ T{ foo f 2 } ] [ T{ foo f 2 } 0 mat get [ set-nth ] keep first ] unit-test
-[ t ] [ { T{ foo f 1 } T{ foo f 2 } } >foo-array dup mat set foo-array? ] unit-test
-[ T{ foo f 3 } t ]
+{ 2 } [ 2 <foo-array> dup mat set length ] unit-test
+{ T{ foo } } [ mat get first ] unit-test
+{ T{ foo f 2 } } [ T{ foo f 2 } 0 mat get [ set-nth ] keep first ] unit-test
+{ t } [ { T{ foo f 1 } T{ foo f 2 } } >foo-array dup mat set foo-array? ] unit-test
+{ T{ foo f 3 } t }
[ mat get [ bar>> 2 + <foo> ] map [ first ] keep foo-array? ] unit-test
-[ 2 ] [ 2 <foo-array> dup mat set length ] unit-test
-[ T{ foo } ] [ mat get first ] unit-test
-[ T{ foo f 1 } ] [ T{ foo f 1 } 0 mat get [ set-nth ] keep first ] unit-test
+{ 2 } [ 2 <foo-array> dup mat set length ] unit-test
+{ T{ foo } } [ mat get first ] unit-test
+{ T{ foo f 1 } } [ T{ foo f 1 } 0 mat get [ set-nth ] keep first ] unit-test
TUPLE: baz { bing integer } bong ; final
TUPLE-ARRAY: baz
-[ 0 ] [ 1 <baz-array> first bing>> ] unit-test
-[ f ] [ 1 <baz-array> first bong>> ] unit-test
+{ 0 } [ 1 <baz-array> first bing>> ] unit-test
+{ f } [ 1 <baz-array> first bong>> ] unit-test
TUPLE: broken x ; final
: broken ( -- ) ;
TUPLE-ARRAY: broken
-[ 100 ] [ 100 <broken-array> length ] unit-test
+{ 100 } [ 100 <broken-array> length ] unit-test
! Can't define a tuple array for a non-tuple class
[ "IN: tuple-arrays.tests USING: tuple-arrays words ; TUPLE-ARRAY: word" eval( -- ) ]
TUPLE-ARRAY: empty-tuple
-[ 100 ] [ 100 <empty-tuple-array> length ] unit-test
-[ T{ empty-tuple } ] [ 100 <empty-tuple-array> first ] unit-test
-[ ] [ T{ empty-tuple } 100 <empty-tuple-array> set-first ] unit-test
+{ 100 } [ 100 <empty-tuple-array> length ] unit-test
+{ T{ empty-tuple } } [ 100 <empty-tuple-array> first ] unit-test
+{ } [ T{ empty-tuple } 100 <empty-tuple-array> set-first ] unit-test
! Changing a tuple into a struct shouldn't break the tuple array to the point
! of crashing Factor
TUPLE-ARRAY: tuple-to-struct
-[ f ] [ tuple-to-struct struct-class? ] unit-test
+{ f } [ tuple-to-struct struct-class? ] unit-test
! This shouldn't crash
-[ ] [
+{ } [
"IN: tuple-arrays.tests
USING: alien.c-types classes.struct ;
STRUCT: tuple-to-struct { x int } ;"
eval( -- )
] unit-test
-[ t ] [ tuple-to-struct struct-class? ] unit-test
+{ t } [ tuple-to-struct struct-class? ] unit-test
TYPED: f+ ( a: float b: float -- c: float )
+ ;
-[ 3.5 ]
+{ 3.5 }
[ 2 1+1/2 f+ ] unit-test
TYPED: fix+ ( a: fixnum b: fixnum -- c: fixnum )
TYPED:: f+locals ( a: float b: float -- c: float )
a b + ;
-[ 3.5 ] [ 2 1+1/2 f+locals ] unit-test
+{ 3.5 } [ 2 1+1/2 f+locals ] unit-test
TUPLE: unboxable
{ x fixnum read-only }
TYPED: unboxy ( in: unboxable -- out: unboxable2 )
dup [ x>> ] [ y>> ] bi - unboxable2 boa ;
-[ ( in: fixnum in: fixnum -- out: fixnum out: fixnum out: fixnum ) ]
+{ ( in: fixnum in: fixnum -- out: fixnum out: fixnum out: fixnum ) }
[ \ unboxy "typed-word" word-prop stack-effect ] unit-test
-[ T{ unboxable2 { u T{ unboxable { x 12 } { y 3 } } } { xy 9 } } ]
+{ T{ unboxable2 { u T{ unboxable { x 12 } { y 3 } } } { xy 9 } } }
[ T{ unboxable { x 12 } { y 3 } } unboxy ] unit-test
-[ 9 ]
+{ 9 }
[
"""
USING: kernel math ;
TYPED: no-inputs ( -- out: integer )
1 ;
-[ 1 ] [ no-inputs ] unit-test
+{ 1 } [ no-inputs ] unit-test
TUPLE: unboxable3
{ x read-only } ; final
TYPED: no-inputs-unboxable-output ( -- out: unboxable3 )
T{ unboxable3 } ;
-[ T{ unboxable3 } ] [ no-inputs-unboxable-output ] unit-test
+{ T{ unboxable3 } } [ no-inputs-unboxable-output ] unit-test
-[ f ] [ no-inputs-unboxable-output no-inputs-unboxable-output eq? ] unit-test
+{ f } [ no-inputs-unboxable-output no-inputs-unboxable-output eq? ] unit-test
SYMBOL: buh
TYPED: no-outputs ( x: integer -- )
buh set ;
-[ 2 ] [ 2 no-outputs buh get ] unit-test
+{ 2 } [ 2 no-outputs buh get ] unit-test
TYPED: no-outputs-unboxable-input ( x: unboxable3 -- )
buh set ;
-[ T{ unboxable3 } ] [ T{ unboxable3 } no-outputs-unboxable-input buh get ] unit-test
+{ T{ unboxable3 } } [ T{ unboxable3 } no-outputs-unboxable-input buh get ] unit-test
-[ f ] [
+{ f } [
T{ unboxable3 } no-outputs-unboxable-input buh get
T{ unboxable3 } no-outputs-unboxable-input buh get
eq?
TYPED: unbox-fail ( a: superclass -- ? ) subclass? ;
-[ t ] [ subclass new unbox-fail ] unit-test
+{ t } [ subclass new unbox-fail ] unit-test
! If a final class becomes non-final, typed words need to be recompiled
TYPED: recompile-fail ( a: subclass -- ? ) buh get eq? ;
-[ f ] [ subclass new [ buh set ] [ recompile-fail ] bi ] unit-test
+{ f } [ subclass new [ buh set ] [ recompile-fail ] bi ] unit-test
-[ ] [ "IN: typed.tests TUPLE: subclass < superclass { y read-only } ;" eval( -- ) ] unit-test
+{ } [ "IN: typed.tests TUPLE: subclass < superclass { y read-only } ;" eval( -- ) ] unit-test
-[ t ] [ subclass new [ buh set ] [ recompile-fail ] bi ] unit-test
+{ t } [ subclass new [ buh set ] [ recompile-fail ] bi ] unit-test
! Make sure that foldable and flushable work on typed words
TYPED: add ( a: integer b: integer -- c: integer ) + ; foldable
-[ [ 3 ] ] [ [ 1 2 add ] cleaned-up-tree nodes>quot ] unit-test
+{ [ 3 ] } [ [ 1 2 add ] cleaned-up-tree nodes>quot ] unit-test
TYPED: flush-test ( s: symbol -- ? ) on t ; flushable
SYMBOL: a-symbol
-[ f ] [
+{ f } [
f a-symbol [
a-symbol flush-print-1
a-symbol get
] with-variable
] unit-test
-[ t ] [
+{ t } [
f a-symbol [
a-symbol flush-print-2
a-symbol get
TYPED: forget-fail ( a: forget-class -- ) drop ;
-[ ] [ [ \ forget-class forget ] with-compilation-unit ] unit-test
+{ } [ [ \ forget-class forget ] with-compilation-unit ] unit-test
-[ ] [ [ \ forget-fail forget ] with-compilation-unit ] unit-test
+{ } [ [ \ forget-fail forget ] with-compilation-unit ] unit-test
TYPED: typed-maybe ( x: maybe{ integer } -- ? ) >boolean ;
-[ f ] [ f typed-maybe ] unit-test
-[ t ] [ 30 typed-maybe ] unit-test
+{ f } [ f typed-maybe ] unit-test
+{ t } [ 30 typed-maybe ] unit-test
[ 30.0 typed-maybe ] [ input-mismatch-error? ] must-fail-with
TYPED: typed-union ( x: union{ integer string } -- ? ) >boolean ;
-[ t ] [ 3 typed-union ] unit-test
-[ t ] [ "asdf" typed-union ] unit-test
+{ t } [ 3 typed-union ] unit-test
+{ t } [ "asdf" typed-union ] unit-test
[ 3.3 typed-union ] [ input-mismatch-error? ] must-fail-with
TYPED: typed-intersection ( x: intersection{ integer bignum } -- ? ) >boolean ;
-[ t ] [ 5555555555555555555555555555555555555555555555555555 typed-intersection ] unit-test
+{ t } [ 5555555555555555555555555555555555555555555555555555 typed-intersection ] unit-test
[ 0 typed-intersection ] [ input-mismatch-error? ] must-fail-with
[
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
random prettyprint grouping math ;
IN: unrolled-lists.tests
-[ 1 ] [ <unrolled-list> 1 over push-front pop-front ] unit-test
-[ 1 ] [ <unrolled-list> 1 over push-front pop-back ] unit-test
-[ 1 ] [ <unrolled-list> 1 over push-back pop-front ] unit-test
-[ 1 ] [ <unrolled-list> 1 over push-back pop-back ] unit-test
+{ 1 } [ <unrolled-list> 1 over push-front pop-front ] unit-test
+{ 1 } [ <unrolled-list> 1 over push-front pop-back ] unit-test
+{ 1 } [ <unrolled-list> 1 over push-back pop-front ] unit-test
+{ 1 } [ <unrolled-list> 1 over push-back pop-back ] unit-test
-[ 1 2 ] [
+{ 1 2 } [
<unrolled-list> 1 over push-back 2 over push-back
[ pop-front ] [ pop-front ] bi
] unit-test
-[ 2 1 ] [
+{ 2 1 } [
<unrolled-list> 1 over push-back 2 over push-back
[ pop-back ] [ pop-back ] bi
] unit-test
-[ 1 2 3 ] [
+{ 1 2 3 } [
<unrolled-list>
1 over push-back
2 over push-back
[ pop-front ] [ pop-front ] [ pop-front ] tri
] unit-test
-[ 3 2 1 ] [
+{ 3 2 1 } [
<unrolled-list>
1 over push-back
2 over push-back
[ pop-back ] [ pop-back ] [ pop-back ] tri
] unit-test
-[ { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 } ] [
+{ { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 } } [
<unrolled-list>
32 [ over push-front ] each-integer
32 [ dup pop-back ] replicate
nip
] unit-test
-[ { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 } ] [
+{ { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 } } [
<unrolled-list>
32 [ over push-front ] each-integer
32 [ dup pop-front ] replicate reverse
nip
] unit-test
-[ t ] [
+{ t } [
<unrolled-list>
1000 [ 1000 random ] replicate
[ [ over push-front ] each ]
nip
] unit-test
-[ t ] [
+{ t } [
<unrolled-list>
1000 [ 1000 random ] replicate
[
nip
] unit-test
-[ t ] [ <unrolled-list> deque-empty? ] unit-test
+{ t } [ <unrolled-list> deque-empty? ] unit-test
-[ t ] [
+{ t } [
<unrolled-list>
1 over push-front
dup pop-front*
deque-empty?
] unit-test
-[ t ] [
+{ t } [
<unrolled-list>
1 over push-back
dup pop-front*
deque-empty?
] unit-test
-[ t ] [
+{ t } [
<unrolled-list>
1 over push-front
dup pop-back*
deque-empty?
] unit-test
-[ t ] [
+{ t } [
<unrolled-list>
1 over push-back
dup pop-back*
deque-empty?
] unit-test
-[ t ] [
+{ t } [
<unrolled-list>
21 over push-front
22 over push-front
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
swap [ 1array ] [ [ present ] curry ] bi* unit-test
] assoc-each
-[ "b" ] [ "a" "b" url-append-path ] unit-test
+{ "b" } [ "a" "b" url-append-path ] unit-test
-[ "a/b" ] [ "a/c" "b" url-append-path ] unit-test
+{ "a/b" } [ "a/c" "b" url-append-path ] unit-test
-[ "a/b" ] [ "a/" "b" url-append-path ] unit-test
+{ "a/b" } [ "a/" "b" url-append-path ] unit-test
-[ "/b" ] [ "a" "/b" url-append-path ] unit-test
+{ "/b" } [ "a" "/b" url-append-path ] unit-test
-[ "/b" ] [ "a/b/" "/b" url-append-path ] unit-test
+{ "/b" } [ "a/b/" "/b" url-append-path ] unit-test
-[ "/xxx/bar" ] [ "/xxx/baz" "bar" url-append-path ] unit-test
+{ "/xxx/bar" } [ "/xxx/baz" "bar" url-append-path ] unit-test
-[
+{
T{ url
{ protocol "http" }
{ host "www.apple.com" }
{ port 1234 }
{ path "/a/path" }
}
-] [
+} [
T{ url
{ protocol "http" }
{ host "www.apple.com" }
derive-url
] unit-test
-[
+{
T{ url
{ protocol "http" }
{ host "www.apple.com" }
{ query H{ { "a" "b" } } }
{ anchor "foo" }
}
-] [
+} [
T{ url
{ protocol "http" }
{ host "www.apple.com" }
derive-url
] unit-test
-[
+{
T{ url
{ protocol "http" }
{ host "www.apple.com" }
{ query H{ { "a" "b" } } }
{ anchor "foo" }
}
-] [
+} [
T{ url
{ protocol "http" }
{ host "www.apple.com" }
derive-url
] unit-test
-[
+{
T{ url
{ protocol "http" }
{ host "www.apple.com" }
{ path "/xxx/baz" }
}
-] [
+} [
T{ url
{ protocol "http" }
{ host "www.apple.com" }
derive-url
] unit-test
-[
+{
T{ url
{ protocol "https" }
{ host "www.apple.com" }
}
-] [
+} [
T{ url
{ protocol "http" }
{ host "www.apple.com" }
] unit-test
! Support //foo.com, which has the same protocol as the url we derive from
-[ URL" http://foo.com" ]
+{ URL" http://foo.com" }
[ URL" http://google.com" URL" //foo.com" derive-url ] unit-test
-[ URL" https://foo.com" ]
+{ URL" https://foo.com" }
[ URL" https://google.com" URL" //foo.com" derive-url ] unit-test
-[ "a" ] [
+{ "a" } [
<url> "a" "b" set-query-param "b" query-param
] unit-test
-[ "foo#3" ] [ URL" foo" clone 3 >>anchor present ] unit-test
+{ "foo#3" } [ URL" foo" clone 3 >>anchor present ] unit-test
-[ "http://www.foo.com/" ] [ "http://www.foo.com:80" >url present ] unit-test
+{ "http://www.foo.com/" } [ "http://www.foo.com:80" >url present ] unit-test
-[ f ] [ URL" /gp/redirect.html/002-7009742-0004012?location=http://advantage.amazon.com/gp/vendor/public/join%26token%3d77E3769AB3A5B6CF611699E150DC33010761CE12" protocol>> ] unit-test
+{ f } [ URL" /gp/redirect.html/002-7009742-0004012?location=http://advantage.amazon.com/gp/vendor/public/join%26token%3d77E3769AB3A5B6CF611699E150DC33010761CE12" protocol>> ] unit-test
-[
+{
T{ url
{ protocol "http" }
{ host "localhost" }
{ query H{ { "foo" "bar" } } }
{ path "/" }
}
-]
+}
[ "http://localhost?foo=bar" >url ] unit-test
-[
+{
T{ url
{ protocol "http" }
{ host "localhost" }
{ query H{ { "foo" "bar" } } }
{ path "/" }
}
-]
+}
[ "http://localhost/?foo=bar" >url ] unit-test
-[ "/" ] [ "http://www.jedit.org" >url path>> ] unit-test
+{ "/" } [ "http://www.jedit.org" >url path>> ] unit-test
-[ "USING: urls ;\nURL\" foo\"" ] [ URL" foo" unparse-use ] unit-test
+{ "USING: urls ;\nURL\" foo\"" } [ URL" foo" unparse-use ] unit-test
-[ T{ inet { host "google.com" } { port 80 } } ]
+{ T{ inet { host "google.com" } { port 80 } } }
[ URL" http://google.com/" url-addr ] unit-test
-[
+{
T{ secure
{ addrspec T{ inet { host "google.com" } { port 443 } } }
}
-]
+}
[ URL" https://google.com/" url-addr ] unit-test
IN: uuid.tests
-[ t ] [ NAMESPACE_DNS [ uuid-parse uuid-unparse ] keep = ] unit-test
-[ t ] [ NAMESPACE_URL [ uuid-parse uuid-unparse ] keep = ] unit-test
-[ t ] [ NAMESPACE_OID [ uuid-parse uuid-unparse ] keep = ] unit-test
-[ t ] [ NAMESPACE_X500 [ uuid-parse uuid-unparse ] keep = ] unit-test
+{ t } [ NAMESPACE_DNS [ uuid-parse uuid-unparse ] keep = ] unit-test
+{ t } [ NAMESPACE_URL [ uuid-parse uuid-unparse ] keep = ] unit-test
+{ t } [ NAMESPACE_OID [ uuid-parse uuid-unparse ] keep = ] unit-test
+{ t } [ NAMESPACE_X500 [ uuid-parse uuid-unparse ] keep = ] unit-test
-[ t ] [ NAMESPACE_URL "ABCD" uuid3
+{ t } [ NAMESPACE_URL "ABCD" uuid3
"2e10e403-d7fa-3ffb-808f-ab834a46890e" = ] unit-test
-[ t ] [ NAMESPACE_URL "ABCD" uuid5
+{ t } [ NAMESPACE_URL "ABCD" uuid5
"0aa883d6-7953-57e7-a8f0-66db29ce5a91" = ] unit-test
USING: kernel sequences tools.test validators accessors
namespaces assocs ;
-[ t ] [ "on" v-checkbox ] unit-test
-[ f ] [ "off" v-checkbox ] unit-test
+{ t } [ "on" v-checkbox ] unit-test
+{ f } [ "off" v-checkbox ] unit-test
-[ "default test" ] [ "" "default test" v-default ] unit-test
-[ "blah" ] [ "blah" "default test" v-default ] unit-test
+{ "default test" } [ "" "default test" v-default ] unit-test
+{ "blah" } [ "blah" "default test" v-default ] unit-test
[ "foo" v-number ] must-fail
-[ 123 ] [ "123" v-number ] unit-test
-[ 123 ] [ "123" v-integer ] unit-test
+{ 123 } [ "123" v-number ] unit-test
+{ 123 } [ "123" v-integer ] unit-test
[ "1.0" v-integer ] [ "must be an integer" = ] must-fail-with
-[ "slava@factorcode.org" ] [
+{ "slava@factorcode.org" } [
"slava@factorcode.org" v-email
] unit-test
-[ "slava+foo@factorcode.org" ] [
+{ "slava+foo@factorcode.org" } [
"slava+foo@factorcode.org" v-email
] unit-test
[ "slava@factorcodeorg" v-email ]
[ "invalid e-mail" = ] must-fail-with
-[ "http://www.factorcode.org" ]
+{ "http://www.factorcode.org" }
[ "http://www.factorcode.org" v-url ] unit-test
[ "http:/www.factorcode.org" v-url ]
[ "invalid URL" = ] must-fail-with
[ "" v-one-line ] must-fail
-[ "hello world" ] [ "hello world" v-one-line ] unit-test
+{ "hello world" } [ "hello world" v-one-line ] unit-test
[ "hello\nworld" v-one-line ] must-fail
[ "" v-one-word ] must-fail
-[ "hello" ] [ "hello" v-one-word ] unit-test
+{ "hello" } [ "hello" v-one-word ] unit-test
[ "hello world" v-one-word ] must-fail
-[ 4561261212345467 ] [ "4561261212345467" v-credit-card ] unit-test
+{ 4561261212345467 } [ "4561261212345467" v-credit-card ] unit-test
-[ 4561261212345467 ] [ "4561-2612-1234-5467" v-credit-card ] unit-test
+{ 4561261212345467 } [ "4561-2612-1234-5467" v-credit-card ] unit-test
-[ 0 ] [ "0000000000000000" v-credit-card ] unit-test
+{ 0 } [ "0000000000000000" v-credit-card ] unit-test
[ "000000000" v-credit-card ] must-fail
[ "4561-2621-1234-5467" v-credit-card ] must-fail
-[ t ] [ "http://double.co.nz/w?v=foo" dup v-url = ] unit-test
+{ t } [ "http://double.co.nz/w?v=foo" dup v-url = ] unit-test
namespaces accessors sequences assocs ;
IN: vlists.tests
-[ { "hi" "there" } ]
+{ { "hi" "there" } }
[ VL{ } "hi" swap ppush "there" swap ppush >array ] unit-test
-[ VL{ "hi" "there" "foo" } VL{ "hi" "there" "bar" } t ]
+{ VL{ "hi" "there" "foo" } VL{ "hi" "there" "bar" } t }
[
VL{ } "hi" swap ppush "there" swap ppush "v" set
"foo" "v" get ppush
dup "baz" over ppush [ vector>> ] bi@ eq?
] unit-test
-[ "foo" VL{ "hi" "there" } t ]
+{ "foo" VL{ "hi" "there" } t }
[
VL{ "hi" "there" "foo" } dup "v" set
[ last ] [ ppop ] bi
[ 4 VL{ "hi" } set-first ] must-fail
-[ 5 t ] [
+{ 5 t } [
"rice" VA{ { "rice" 5 } { "beans" 10 } } at*
] unit-test
-[ 6 t ] [
+{ 6 t } [
"rice" VA{ { "rice" 5 } { "beans" 10 } { "rice" 6 } } at*
] unit-test
-[ 3 ] [
+{ 3 } [
VA{ { "rice" 5 } { "beans" 10 } { "rice" 6 } } assoc-size
] unit-test
-[ f f ] [
+{ f f } [
"meat" VA{ { "rice" 5 } { "beans" 10 } { "rice" 6 } } at*
] 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 }
! See http://factorcode.org/license.txt for BSD license.
USING: wrap tools.test ;
-[ { } ] [ { } 10 10 wrap ] unit-test
+{ { } } [ { } 10 10 wrap ] unit-test
USING: xml-rpc tools.test ;
-[ T{ rpc-method f "blah" { 1 H{ { "2" 3 } { "5" t } } } } ]
+{ T{ rpc-method f "blah" { 1 H{ { "2" 3 } { "5" t } } } } }
[ "blah" { 1 H{ { "2" 3 } { "5" t } } }
<rpc-method> send-rpc receive-rpc ] unit-test
: 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>> ]
<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>
XML> pprint-xml>string
- ]
+ }
] 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
FROM: namespaces => set ;
IN: alien.tests
-[ t ] [ -1 <alien> alien-address 0 > ] unit-test
+{ t } [ -1 <alien> alien-address 0 > ] unit-test
-[ t ] [ 0 <alien> 0 <alien> = ] unit-test
-[ f ] [ 0 <alien> 1024 <alien> = ] unit-test
-[ f ] [ "hello" 1024 <alien> = ] unit-test
-[ f ] [ 0 <alien> ] unit-test
-[ f ] [ 0 f <displaced-alien> ] unit-test
+{ t } [ 0 <alien> 0 <alien> = ] unit-test
+{ f } [ 0 <alien> 1024 <alien> = ] unit-test
+{ f } [ "hello" 1024 <alien> = ] unit-test
+{ f } [ 0 <alien> ] unit-test
+{ f } [ 0 f <displaced-alien> ] unit-test
! Testing the various bignum accessor
10 <byte-array> "dump" set
[ "dump" get alien-address ] must-fail
-[ 123 ] [
+{ 123 } [
123 "dump" get 0 set-alien-signed-1
"dump" get 0 alien-signed-1
] unit-test
-[ 12345 ] [
+{ 12345 } [
12345 "dump" get 0 set-alien-signed-2
"dump" get 0 alien-signed-2
] unit-test
-[ 12345678 ] [
+{ 12345678 } [
12345678 "dump" get 0 set-alien-signed-4
"dump" get 0 alien-signed-4
] unit-test
-[ 12345678901234567 ] [
+{ 12345678901234567 } [
12345678901234567 "dump" get 0 set-alien-signed-8
"dump" get 0 alien-signed-8
] unit-test
-[ -1 ] [
+{ -1 } [
-1 "dump" get 0 set-alien-signed-8
"dump" get 0 alien-signed-8
] unit-test
] unit-test
] when
-[ "ALIEN: 1234" ] [ 0x1234 <alien> unparse ] unit-test
+{ "ALIEN: 1234" } [ 0x1234 <alien> unparse ] unit-test
-[ ] [ 0 B{ 1 2 3 } <displaced-alien> drop ] unit-test
+{ } [ 0 B{ 1 2 3 } <displaced-alien> drop ] unit-test
[ 0 B{ 1 2 3 } <displaced-alien> alien-address ] must-fail
[ 1 1 <displaced-alien> ] must-fail
-[ f ] [ 1 B{ 1 2 3 } <displaced-alien> pinned-c-ptr? ] unit-test
+{ f } [ 1 B{ 1 2 3 } <displaced-alien> pinned-c-ptr? ] unit-test
-[ f ] [ 2 B{ 1 2 3 } <displaced-alien> 1 swap <displaced-alien> pinned-c-ptr? ] unit-test
+{ f } [ 2 B{ 1 2 3 } <displaced-alien> 1 swap <displaced-alien> pinned-c-ptr? ] unit-test
-[ t ] [ 0 B{ 1 2 3 } <displaced-alien> 1 swap <displaced-alien> underlying>> byte-array? ] unit-test
+{ t } [ 0 B{ 1 2 3 } <displaced-alien> 1 swap <displaced-alien> underlying>> byte-array? ] unit-test
-[ "( displaced alien )" ] [ 1 B{ 1 2 3 } <displaced-alien> unparse ] unit-test
+{ "( displaced alien )" } [ 1 B{ 1 2 3 } <displaced-alien> unparse ] unit-test
SYMBOL: initialize-test
f initialize-test set-global
-[ 31337 ] [ initialize-test [ 31337 ] initialize-alien ] unit-test
+{ 31337 } [ initialize-test [ 31337 ] initialize-alien ] unit-test
-[ 31337 ] [ initialize-test [ 69 ] initialize-alien ] unit-test
+{ 31337 } [ initialize-test [ 69 ] initialize-alien ] unit-test
-[ ] [ initialize-test get BAD-ALIEN >>alien drop ] unit-test
+{ } [ initialize-test get BAD-ALIEN >>alien drop ] unit-test
-[ 7575 ] [ initialize-test [ 7575 ] initialize-alien ] unit-test
+{ 7575 } [ initialize-test [ 7575 ] initialize-alien ] unit-test
-[ { BAD-ALIEN } ] [ { BAD-ALIEN BAD-ALIEN BAD-ALIEN } members ] unit-test
+{ { BAD-ALIEN } } [ { BAD-ALIEN BAD-ALIEN BAD-ALIEN } members ] unit-test
! Generate callbacks until the whole callback-heap is full, then free
! them. Do it ten times in a row for good measure.
io.encodings.ascii alien io.encodings.string io.encodings.8-bit.latin1 ;
IN: alien.strings.tests
-[ "\u0000ff" ]
+{ "\u0000ff" }
[ "\u0000ff" latin1 string>alien latin1 alien>string ]
unit-test
-[ "hello world" ]
+{ "hello world" }
[ "hello world" latin1 string>alien latin1 alien>string ]
unit-test
-[ "hello\u00abcdworld" ]
+{ "hello\u00abcdworld" }
[ "hello\u00abcdworld" utf16le string>alien utf16le alien>string ]
unit-test
-[ t ] [ f expired? ] unit-test
+{ t } [ f expired? ] unit-test
-[ "hello world" ] [
+{ "hello world" } [
"hello world" ascii malloc-string
dup ascii alien>string swap free
] unit-test
-[ "hello world" ] [
+{ "hello world" } [
"hello world" utf16n malloc-string
dup utf16n alien>string swap free
] unit-test
-[ f ] [ f utf8 alien>string ] unit-test
+{ f } [ f utf8 alien>string ] unit-test
-[ "hello" ] [ "hello" utf16 encode utf16 decode ] unit-test
+{ "hello" } [ "hello" utf16 encode utf16 decode ] unit-test
-[ "hello" ] [ "hello" utf16 string>alien utf16 alien>string ] unit-test
+{ "hello" } [ "hello" utf16 string>alien utf16 alien>string ] unit-test
[ 10 { "a" "b" "c" } nth ] must-fail
[ "hi" -2 { "a" "b" "c" } set-nth ] must-fail
[ "hi" 10 { "a" "b" "c" } set-nth ] must-fail
-[ f ] [ { "a" "b" "c" } dup clone eq? ] unit-test
-[ "hi" ] [ "hi" 1 { "a" "b" "c" } clone [ set-nth ] keep second ] unit-test
-[ V{ "a" "b" "c" } ] [ { "a" "b" "c" } >vector ] unit-test
-[ f ] [ { "a" "b" "c" } dup >array eq? ] unit-test
-[ t ] [ { "a" "b" "c" } dup { } like eq? ] unit-test
-[ t ] [ { "a" "b" "c" } dup dup length vector boa underlying>> eq? ] unit-test
-[ V{ "a" "b" "c" } ] [ { "a" "b" "c" } V{ } like ] unit-test
-[ { "a" "b" "c" } ] [ { "a" } { "b" "c" } append ] unit-test
-[ { "a" "b" "c" "d" "e" } ]
+{ f } [ { "a" "b" "c" } dup clone eq? ] unit-test
+{ "hi" } [ "hi" 1 { "a" "b" "c" } clone [ set-nth ] keep second ] unit-test
+{ V{ "a" "b" "c" } } [ { "a" "b" "c" } >vector ] unit-test
+{ f } [ { "a" "b" "c" } dup >array eq? ] unit-test
+{ t } [ { "a" "b" "c" } dup { } like eq? ] unit-test
+{ t } [ { "a" "b" "c" } dup dup length vector boa underlying>> eq? ] unit-test
+{ V{ "a" "b" "c" } } [ { "a" "b" "c" } V{ } like ] unit-test
+{ { "a" "b" "c" } } [ { "a" } { "b" "c" } append ] unit-test
+{ { "a" "b" "c" "d" "e" } }
[ { "a" } { "b" "c" } { "d" "e" } 3append ] unit-test
[ -1 f <array> ] must-fail
SPECIALIZED-ARRAY: double
IN: assocs.tests
-[ t ] [ H{ } dup assoc-subset? ] unit-test
-[ f ] [ H{ { 1 3 } } H{ } assoc-subset? ] unit-test
-[ t ] [ H{ } H{ { 1 3 } } assoc-subset? ] unit-test
-[ t ] [ H{ { 1 3 } } H{ { 1 3 } } assoc-subset? ] unit-test
-[ f ] [ H{ { 1 3 } } H{ { 1 "hey" } } assoc-subset? ] unit-test
-[ f ] [ H{ { 1 f } } H{ } assoc-subset? ] unit-test
-[ t ] [ H{ { 1 f } } H{ { 1 f } } assoc-subset? ] unit-test
+{ t } [ H{ } dup assoc-subset? ] unit-test
+{ f } [ H{ { 1 3 } } H{ } assoc-subset? ] unit-test
+{ t } [ H{ } H{ { 1 3 } } assoc-subset? ] unit-test
+{ t } [ H{ { 1 3 } } H{ { 1 3 } } assoc-subset? ] unit-test
+{ f } [ H{ { 1 3 } } H{ { 1 "hey" } } assoc-subset? ] unit-test
+{ f } [ H{ { 1 f } } H{ } assoc-subset? ] unit-test
+{ t } [ H{ { 1 f } } H{ { 1 f } } assoc-subset? ] unit-test
! Test some combinators
-[
+{
{ 4 14 32 }
-] [
+} [
[
H{
{ 1 2 }
] { } make
] unit-test
-[ t ] [ H{ } [ 2drop f ] assoc-all? ] unit-test
-[ t ] [ H{ { 1 1 } } [ = ] assoc-all? ] unit-test
-[ f ] [ H{ { 1 2 } } [ = ] assoc-all? ] unit-test
-[ t ] [ H{ { 1 1 } { 2 2 } } [ = ] assoc-all? ] unit-test
-[ f ] [ H{ { 1 2 } { 2 2 } } [ = ] assoc-all? ] unit-test
+{ t } [ H{ } [ 2drop f ] assoc-all? ] unit-test
+{ t } [ H{ { 1 1 } } [ = ] assoc-all? ] unit-test
+{ f } [ H{ { 1 2 } } [ = ] assoc-all? ] unit-test
+{ t } [ H{ { 1 1 } { 2 2 } } [ = ] assoc-all? ] unit-test
+{ f } [ H{ { 1 2 } { 2 2 } } [ = ] assoc-all? ] unit-test
-[ H{ } ] [ H{ { t f } { f t } } [ 2drop f ] assoc-filter ] unit-test
-[ H{ } ] [ H{ { t f } { f t } } clone dup [ 2drop f ] assoc-filter! drop ] unit-test
-[ H{ } ] [ H{ { t f } { f t } } clone [ 2drop f ] assoc-filter! ] unit-test
+{ H{ } } [ H{ { t f } { f t } } [ 2drop f ] assoc-filter ] unit-test
+{ H{ } } [ H{ { t f } { f t } } clone dup [ 2drop f ] assoc-filter! drop ] unit-test
+{ H{ } } [ H{ { t f } { f t } } clone [ 2drop f ] assoc-filter! ] unit-test
-[ H{ { 3 4 } { 4 5 } { 6 7 } } ] [
+{ H{ { 3 4 } { 4 5 } { 6 7 } } } [
H{ { 1 2 } { 2 3 } { 3 4 } { 4 5 } { 6 7 } }
[ drop 3 >= ] assoc-filter
] unit-test
-[ H{ { 3 4 } { 4 5 } { 6 7 } } ] [
+{ H{ { 3 4 } { 4 5 } { 6 7 } } } [
H{ { 1 2 } { 2 3 } { 3 4 } { 4 5 } { 6 7 } } clone
[ drop 3 >= ] assoc-filter!
] unit-test
-[ H{ { 3 4 } { 4 5 } { 6 7 } } ] [
+{ H{ { 3 4 } { 4 5 } { 6 7 } } } [
H{ { 1 2 } { 2 3 } { 3 4 } { 4 5 } { 6 7 } } clone dup
[ drop 3 >= ] assoc-filter! drop
] unit-test
-[ H{ { 1 2 } { 2 3 } } ] [
+{ H{ { 1 2 } { 2 3 } } } [
H{ { 1 2 } { 2 3 } { 3 4 } { 4 5 } { 6 7 } }
[ drop 3 >= ] assoc-reject
] unit-test
-[ H{ { 1 2 } { 2 3 } } ] [
+{ H{ { 1 2 } { 2 3 } } } [
H{ { 1 2 } { 2 3 } { 3 4 } { 4 5 } { 6 7 } } clone
[ drop 3 >= ] assoc-reject!
] unit-test
-[ 21 ] [
+{ 21 } [
0 H{
{ 1 2 }
{ 3 4 }
H{ } clone "cache-test" set
-[ 4 ] [ 1 "cache-test" get [ 3 + ] cache ] unit-test
-[ 5 ] [ 2 "cache-test" get [ 3 + ] cache ] unit-test
-[ 4 ] [ 1 "cache-test" get [ 3 + ] cache ] unit-test
-[ 5 ] [ 2 "cache-test" get [ 3 + ] cache ] unit-test
+{ 4 } [ 1 "cache-test" get [ 3 + ] cache ] unit-test
+{ 5 } [ 2 "cache-test" get [ 3 + ] cache ] unit-test
+{ 4 } [ 1 "cache-test" get [ 3 + ] cache ] unit-test
+{ 5 } [ 2 "cache-test" get [ 3 + ] cache ] unit-test
-[
+{
H{ { "factor" "rocks" } { 3 4 } }
-] [
+} [
H{ { "factor" "rocks" } { "dup" "sq" } { 3 4 } }
H{ { "factor" "rocks" } { 1 2 } { 2 3 } { 3 4 } }
assoc-intersect
] unit-test
-[
+{
H{ { 1 2 } { 2 3 } { 6 5 } }
-] [
+} [
H{ { 2 4 } { 6 5 } } H{ { 1 2 } { 2 3 } }
assoc-union
] unit-test
-[
+{
H{ { 1 2 } { 2 3 } { 6 5 } }
-] [
+} [
H{ { 2 4 } { 6 5 } } clone dup H{ { 1 2 } { 2 3 } }
assoc-union! drop
] unit-test
-[
+{
H{ { 1 2 } { 2 3 } { 6 5 } }
-] [
+} [
H{ { 2 4 } { 6 5 } } clone H{ { 1 2 } { 2 3 } }
assoc-union!
] unit-test
-[ H{ { 1 2 } { 2 3 } } t ] [
+{ H{ { 1 2 } { 2 3 } } t } [
f H{ { 1 2 } { 2 3 } } [ assoc-union ] 2keep swap assoc-union dupd =
] unit-test
-[
+{
H{ { 1 f } }
-] [
+} [
H{ { 1 f } } H{ { 1 f } } assoc-intersect
] unit-test
-[
+{
H{ { 3 4 } }
-] [
+} [
H{ { 1 2 } { 3 4 } } H{ { 1 3 } } assoc-diff
] unit-test
-[
+{
H{ { 3 4 } }
-] [
+} [
H{ { 1 2 } { 3 4 } } clone dup H{ { 1 3 } } assoc-diff! drop
] unit-test
-[
+{
H{ { 3 4 } }
-] [
+} [
H{ { 1 2 } { 3 4 } } clone H{ { 1 3 } } assoc-diff!
] unit-test
-[ H{ { "hi" 2 } { 3 4 } } ]
+{ H{ { "hi" 2 } { 3 4 } } }
[ "hi" 1 H{ { 1 2 } { 3 4 } } clone [ rename-at ] keep ]
unit-test
-[ H{ { 1 2 } { 3 4 } } ]
+{ H{ { 1 2 } { 3 4 } } }
[ "hi" 5 H{ { 1 2 } { 3 4 } } clone [ rename-at ] keep ]
unit-test
-[
+{
H{ { 1.0 1.0 } { 2.0 2.0 } }
-] [
+} [
double-array{ 1.0 2.0 } [ dup ] H{ } map>assoc
] unit-test
-[ { 3 } ] [
+{ { 3 } } [
[
3
H{ } clone
] { } make
] unit-test
-[
+{
H{
{ "bangers" "mash" }
{ "fries" "onion rings" }
}
-] [
+} [
{ "bangers" "fries" } H{
{ "fish" "chips" }
{ "bangers" "mash" }
} extract-keys
] unit-test
-[ H{ { "b" [ 2 ] } { "d" [ 4 ] } } H{ { "a" [ 1 ] } { "c" [ 3 ] } } ] [
+{ H{ { "b" [ 2 ] } { "d" [ 4 ] } } H{ { "a" [ 1 ] } { "c" [ 3 ] } } } [
H{
{ "a" [ 1 ] }
{ "b" [ 2 ] }
} [ nip first even? ] assoc-partition
] unit-test
-[ 1 f ] [ 1 H{ } ?at ] unit-test
-[ 2 t ] [ 1 H{ { 1 2 } } ?at ] unit-test
+{ 1 f } [ 1 H{ } ?at ] unit-test
+{ 2 t } [ 1 H{ { 1 2 } } ?at ] unit-test
-[ f ] [ 1 2 H{ { 2 1 } } maybe-set-at ] unit-test
-[ t ] [ 1 3 H{ { 2 1 } } clone maybe-set-at ] unit-test
-[ t ] [ 3 2 H{ { 2 1 } } clone maybe-set-at ] unit-test
+{ f } [ 1 2 H{ { 2 1 } } maybe-set-at ] unit-test
+{ t } [ 1 3 H{ { 2 1 } } clone maybe-set-at ] unit-test
+{ t } [ 3 2 H{ { 2 1 } } clone maybe-set-at ] unit-test
-[ H{ { 1 2 } { 2 3 } } ] [
+{ H{ { 1 2 } { 2 3 } } } [
{
H{ { 1 3 } }
H{ { 2 3 } }
} assoc-combine
] unit-test
-[ H{ { 1 7 } } ] [
+{ H{ { 1 7 } } } [
{
H{ { 1 2 } { 2 4 } { 5 6 } }
H{ { 1 3 } { 2 5 } }
} assoc-refine
] unit-test
-[ f ] [ "a" { } assoc-stack ] unit-test
-[ 1 ] [ "a" { H{ { "a" 1 } } H{ { "b" 2 } } } assoc-stack ] unit-test
-[ 2 ] [ "b" { H{ { "a" 1 } } H{ { "b" 2 } } } assoc-stack ] unit-test
-[ f ] [ "c" { H{ { "a" 1 } } H{ { "b" 2 } } } assoc-stack ] unit-test
+{ f } [ "a" { } assoc-stack ] unit-test
+{ 1 } [ "a" { H{ { "a" 1 } } H{ { "b" 2 } } } assoc-stack ] unit-test
+{ 2 } [ "b" { H{ { "a" 1 } } H{ { "b" 2 } } } assoc-stack ] unit-test
+{ f } [ "c" { H{ { "a" 1 } } H{ { "b" 2 } } } assoc-stack ] unit-test
{
tools.test ;
IN: byte-arrays.tests
-[ 6 B{ 1 2 3 } ] [
+{ 6 B{ 1 2 3 } } [
6 B{ 1 2 3 } resize-byte-array
[ length ] [ 3 head ] bi
] unit-test
-[ B{ 1 2 } ] [ 2 B{ 1 2 3 4 5 6 7 8 9 } resize-byte-array ] unit-test
+{ B{ 1 2 } } [ 2 B{ 1 2 3 4 5 6 7 8 9 } resize-byte-array ] unit-test
[ -10 B{ } resize-byte-array ] must-fail
-[ B{ 123 } ] [ 123 1byte-array ] unit-test
+{ B{ 123 } } [ 123 1byte-array ] unit-test
-[ B{ 123 } ] [ 123 0 B{ 0 } [ set-nth ] keep ] unit-test
+{ B{ 123 } } [ 123 0 B{ 0 } [ set-nth ] keep ] unit-test
-[ B{ 123 } ] [ 123 >bignum 0 B{ 0 } [ set-nth ] keep ] unit-test
+{ B{ 123 } } [ 123 >bignum 0 B{ 0 } [ set-nth ] keep ] unit-test
[ 1.5 B{ 1 2 3 } nth-unsafe ] must-fail
[ 0 1.5 B{ 1 2 3 } set-nth-unsafe ] must-fail
prettyprint math ;
IN: byte-vectors.tests
-[ 0 ] [ 123 <byte-vector> length ] unit-test
+{ 0 } [ 123 <byte-vector> length ] unit-test
: do-it ( seq -- seq )
123 [ suffix! ] each-integer ;
-[ t ] [
+{ t } [
3 <byte-vector> do-it
3 <vector> do-it sequence=
] unit-test
-[ t ] [ BV{ } byte-vector? ] unit-test
+{ t } [ BV{ } byte-vector? ] unit-test
-[ "BV{ }" ] [ BV{ } unparse ] unit-test
+{ "BV{ }" } [ BV{ } unparse ] unit-test
USING: checksums checksums.crc32 kernel math tools.test namespaces ;
-[ B{ 0 0 0 0 } ] [ "" crc32 checksum-bytes ] unit-test
+{ B{ 0 0 0 0 } } [ "" crc32 checksum-bytes ] unit-test
-[ B{ 0xcb 0xf4 0x39 0x26 } ] [ "123456789" crc32 checksum-bytes ] unit-test
+{ B{ 0xcb 0xf4 0x39 0x26 } } [ "123456789" crc32 checksum-bytes ] unit-test
INSTANCE: union-with-one-member mixin-with-one-member
! class<=
-[ t ] [ \ fixnum \ integer class<= ] unit-test
-[ t ] [ \ fixnum \ fixnum class<= ] unit-test
-[ f ] [ \ integer \ fixnum class<= ] unit-test
-[ t ] [ \ integer \ object class<= ] unit-test
-[ f ] [ \ integer \ null class<= ] unit-test
-[ t ] [ \ null \ object class<= ] unit-test
+{ t } [ \ fixnum \ integer class<= ] unit-test
+{ t } [ \ fixnum \ fixnum class<= ] unit-test
+{ f } [ \ integer \ fixnum class<= ] unit-test
+{ t } [ \ integer \ object class<= ] unit-test
+{ f } [ \ integer \ null class<= ] unit-test
+{ t } [ \ null \ object class<= ] unit-test
-[ t ] [ \ generic \ word class<= ] unit-test
-[ f ] [ \ word \ generic class<= ] unit-test
+{ t } [ \ generic \ word class<= ] unit-test
+{ f } [ \ word \ generic class<= ] unit-test
-[ f ] [ \ reversed \ slice class<= ] unit-test
-[ f ] [ \ slice \ reversed class<= ] unit-test
+{ f } [ \ reversed \ slice class<= ] unit-test
+{ f } [ \ slice \ reversed class<= ] unit-test
-[ t ] [ no-docs no-docs-union class<= ] unit-test
-[ f ] [ no-docs-union no-docs class<= ] unit-test
+{ t } [ no-docs no-docs-union class<= ] unit-test
+{ f } [ no-docs-union no-docs class<= ] unit-test
-[ t ] [ \ c \ tuple class<= ] unit-test
-[ f ] [ \ tuple \ c class<= ] unit-test
+{ t } [ \ c \ tuple class<= ] unit-test
+{ f } [ \ tuple \ c class<= ] unit-test
-[ t ] [ \ tuple-class \ class class<= ] unit-test
-[ f ] [ \ class \ tuple-class class<= ] unit-test
+{ t } [ \ tuple-class \ class class<= ] unit-test
+{ f } [ \ class \ tuple-class class<= ] unit-test
-[ t ] [ \ null \ tuple-example class<= ] unit-test
-[ f ] [ \ object \ tuple-example class<= ] unit-test
-[ f ] [ \ object \ tuple-example class<= ] unit-test
-[ t ] [ \ tuple-example \ tuple class<= ] unit-test
-[ f ] [ \ tuple \ tuple-example class<= ] unit-test
+{ t } [ \ null \ tuple-example class<= ] unit-test
+{ f } [ \ object \ tuple-example class<= ] unit-test
+{ f } [ \ object \ tuple-example class<= ] unit-test
+{ t } [ \ tuple-example \ tuple class<= ] unit-test
+{ f } [ \ tuple \ tuple-example class<= ] unit-test
-[ f ] [ z1 x1 y1 class-and class<= ] unit-test
+{ f } [ z1 x1 y1 class-and class<= ] unit-test
-[ t ] [ x1 y1 class-and a1 class<= ] unit-test
+{ t } [ x1 y1 class-and a1 class<= ] unit-test
-[ f ] [ b1 c1 class-or a1 b1 class-or a1 c1 class-and class-and class<= ] unit-test
+{ f } [ b1 c1 class-or a1 b1 class-or a1 c1 class-and class-and class<= ] unit-test
-[ t ] [ a1 b1 class-or a1 c1 class-or class-and a1 class<= ] unit-test
+{ t } [ a1 b1 class-or a1 c1 class-or class-and a1 class<= ] unit-test
-[ f ] [ growable tuple sequence class-and class<= ] unit-test
+{ f } [ growable tuple sequence class-and class<= ] unit-test
-[ f ] [ growable assoc class-and tuple class<= ] unit-test
+{ f } [ growable assoc class-and tuple class<= ] unit-test
-[ t ] [ object \ f \ f class-not class-or class<= ] unit-test
+{ t } [ object \ f \ f class-not class-or class<= ] unit-test
-[ t ] [ fixnum class-not integer class-and bignum class= ] unit-test
+{ t } [ fixnum class-not integer class-and bignum class= ] unit-test
-[ t ] [ array number class-not class<= ] unit-test
+{ t } [ array number class-not class<= ] unit-test
-[ f ] [ bignum number class-not class<= ] unit-test
+{ f } [ bignum number class-not class<= ] unit-test
-[ t ] [ fixnum fixnum bignum class-or class<= ] unit-test
+{ t } [ fixnum fixnum bignum class-or class<= ] unit-test
-[ f ] [ fixnum class-not integer class-and array class<= ] unit-test
+{ f } [ fixnum class-not integer class-and array class<= ] unit-test
-[ f ] [ fixnum class-not integer class<= ] unit-test
+{ f } [ fixnum class-not integer class<= ] unit-test
-[ f ] [ number class-not array class<= ] unit-test
+{ f } [ number class-not array class<= ] unit-test
-[ f ] [ fixnum class-not array class<= ] unit-test
+{ f } [ fixnum class-not array class<= ] unit-test
-[ t ] [ number class-not integer class-not class<= ] unit-test
+{ t } [ number class-not integer class-not class<= ] unit-test
-[ f ] [ fixnum class-not integer class<= ] unit-test
+{ f } [ fixnum class-not integer class<= ] unit-test
-[ t ] [ object empty-intersection class<= ] unit-test
-[ t ] [ empty-intersection object class<= ] unit-test
-[ t ] [ \ f class-not empty-intersection class<= ] unit-test
-[ f ] [ empty-intersection \ f class-not class<= ] unit-test
-[ t ] [ \ number empty-intersection class<= ] unit-test
-[ t ] [ empty-intersection class-not null class<= ] unit-test
-[ t ] [ null empty-intersection class-not class<= ] unit-test
+{ t } [ object empty-intersection class<= ] unit-test
+{ t } [ empty-intersection object class<= ] unit-test
+{ t } [ \ f class-not empty-intersection class<= ] unit-test
+{ f } [ empty-intersection \ f class-not class<= ] unit-test
+{ t } [ \ number empty-intersection class<= ] unit-test
+{ t } [ empty-intersection class-not null class<= ] unit-test
+{ t } [ null empty-intersection class-not class<= ] unit-test
-[ t ] [ \ f class-not \ f class-or empty-intersection class<= ] unit-test
-[ t ] [ empty-intersection \ f class-not \ f class-or class<= ] unit-test
+{ t } [ \ f class-not \ f class-or empty-intersection class<= ] unit-test
+{ t } [ empty-intersection \ f class-not \ f class-or class<= ] unit-test
-[ t ] [ object \ f class-not \ f class-or class<= ] unit-test
+{ t } [ object \ f class-not \ f class-or class<= ] unit-test
-[ t ] [
+{ t } [
fixnum class-not
fixnum fixnum class-not class-or
class<=
] unit-test
-[ t ] [ generic-class generic class<= ] unit-test
-[ t ] [ generic-class \ class class<= ] unit-test
+{ t } [ generic-class generic class<= ] unit-test
+{ t } [ generic-class \ class class<= ] unit-test
-[ t ] [ a union-with-one-member class<= ] unit-test
-[ f ] [ union-with-one-member class-not integer class<= ] unit-test
+{ t } [ a union-with-one-member class<= ] unit-test
+{ f } [ union-with-one-member class-not integer class<= ] unit-test
MIXIN: empty-mixin
-[ f ] [ empty-mixin class-not null class<= ] unit-test
-[ f ] [ empty-mixin null class<= ] unit-test
+{ f } [ empty-mixin class-not null class<= ] unit-test
+{ f } [ empty-mixin null class<= ] unit-test
-[ t ] [ empty-mixin class-not object class<= ] unit-test
-[ t ] [ empty-mixin object class<= ] unit-test
+{ t } [ empty-mixin class-not object class<= ] unit-test
+{ t } [ empty-mixin object class<= ] unit-test
-[ t ] [ empty-mixin class-not object class<= ] unit-test
-[ t ] [ empty-mixin object class<= ] unit-test
+{ t } [ empty-mixin class-not object class<= ] unit-test
+{ t } [ empty-mixin object class<= ] unit-test
-[ t ] [ object empty-mixin class-not class<= ] unit-test
+{ t } [ object empty-mixin class-not class<= ] unit-test
-[ t ] [ array sequence vector class-not class-and class<= ] unit-test
-[ f ] [ vector sequence vector class-not class-and class<= ] unit-test
+{ t } [ array sequence vector class-not class-and class<= ] unit-test
+{ f } [ vector sequence vector class-not class-and class<= ] unit-test
! class-and
: class-and* ( cls1 cls2 cls3 -- ? ) [ class-and ] dip class= ;
-[ t ] [ object object object class-and* ] unit-test
-[ t ] [ fixnum object fixnum class-and* ] unit-test
-[ t ] [ object fixnum fixnum class-and* ] unit-test
-[ t ] [ fixnum fixnum fixnum class-and* ] unit-test
-[ t ] [ fixnum integer fixnum class-and* ] unit-test
-[ t ] [ integer fixnum fixnum class-and* ] unit-test
+{ t } [ object object object class-and* ] unit-test
+{ t } [ fixnum object fixnum class-and* ] unit-test
+{ t } [ object fixnum fixnum class-and* ] unit-test
+{ t } [ fixnum fixnum fixnum class-and* ] unit-test
+{ t } [ fixnum integer fixnum class-and* ] unit-test
+{ t } [ integer fixnum fixnum class-and* ] unit-test
-[ t ] [ vector fixnum null class-and* ] unit-test
-[ t ] [ number object number class-and* ] unit-test
-[ t ] [ object number number class-and* ] unit-test
-[ t ] [ slice reversed null class-and* ] unit-test
-[ t ] [ \ f class-not \ f null class-and* ] unit-test
+{ t } [ vector fixnum null class-and* ] unit-test
+{ t } [ number object number class-and* ] unit-test
+{ t } [ object number number class-and* ] unit-test
+{ t } [ slice reversed null class-and* ] unit-test
+{ t } [ \ f class-not \ f null class-and* ] unit-test
-[ t ] [ vector array class-not vector class-and* ] unit-test
+{ t } [ vector array class-not vector class-and* ] unit-test
-[ object ] [ object empty-mixin class-not class-and ] unit-test
-[ object ] [ empty-mixin class-not object class-and ] unit-test
+{ object } [ object empty-mixin class-not class-and ] unit-test
+{ object } [ empty-mixin class-not object class-and ] unit-test
! class-or
: class-or* ( cls1 cls2 cls3 -- ? ) [ class-or ] dip class= ;
-[ t ] [ \ f class-not \ f object class-or* ] unit-test
+{ t } [ \ f class-not \ f object class-or* ] unit-test
-[ object ] [ object empty-mixin class-not class-or ] unit-test
-[ object ] [ empty-mixin class-not object class-or ] unit-test
+{ object } [ object empty-mixin class-not class-or ] unit-test
+{ object } [ empty-mixin class-not object class-or ] unit-test
! class-not
-[ vector ] [ vector class-not class-not ] unit-test
+{ vector } [ vector class-not class-not ] unit-test
! classes-intersect?
-[ t ] [ both tuple classes-intersect? ] unit-test
-[ t ] [ tuple both classes-intersect? ] unit-test
+{ t } [ both tuple classes-intersect? ] unit-test
+{ t } [ tuple both classes-intersect? ] unit-test
-[ f ] [ vector virtual-sequence classes-intersect? ] unit-test
-[ f ] [ virtual-sequence vector classes-intersect? ] unit-test
+{ f } [ vector virtual-sequence classes-intersect? ] unit-test
+{ f } [ virtual-sequence vector classes-intersect? ] unit-test
-[ t ] [ number vector class-or sequence classes-intersect? ] unit-test
-[ t ] [ sequence number vector class-or classes-intersect? ] unit-test
+{ t } [ number vector class-or sequence classes-intersect? ] unit-test
+{ t } [ sequence number vector class-or classes-intersect? ] unit-test
-[ f ] [ number vector class-and sequence classes-intersect? ] unit-test
-[ f ] [ sequence number vector class-and classes-intersect? ] unit-test
+{ f } [ number vector class-and sequence classes-intersect? ] unit-test
+{ f } [ sequence number vector class-and classes-intersect? ] unit-test
-[ f ] [ y1 z1 class-and x1 classes-intersect? ] unit-test
-[ f ] [ x1 y1 z1 class-and classes-intersect? ] unit-test
+{ f } [ y1 z1 class-and x1 classes-intersect? ] unit-test
+{ f } [ x1 y1 z1 class-and classes-intersect? ] unit-test
-[ f ] [ a1 c1 class-or b1 c1 class-or class-and a1 b1 class-or classes-intersect? ] unit-test
-[ f ] [ a1 b1 class-or a1 c1 class-or b1 c1 class-or class-and classes-intersect? ] unit-test
+{ f } [ a1 c1 class-or b1 c1 class-or class-and a1 b1 class-or classes-intersect? ] unit-test
+{ f } [ a1 b1 class-or a1 c1 class-or b1 c1 class-or class-and classes-intersect? ] unit-test
-[ f ] [ integer integer class-not classes-intersect? ] unit-test
-[ f ] [ integer class-not integer classes-intersect? ] unit-test
+{ f } [ integer integer class-not classes-intersect? ] unit-test
+{ f } [ integer class-not integer classes-intersect? ] unit-test
-[ f ] [ fixnum class-not number class-and array classes-intersect? ] unit-test
-[ f ] [ array fixnum class-not number class-and classes-intersect? ] unit-test
+{ f } [ fixnum class-not number class-and array classes-intersect? ] unit-test
+{ f } [ array fixnum class-not number class-and classes-intersect? ] unit-test
-[ t ] [ \ word generic-class classes-intersect? ] unit-test
-[ t ] [ generic-class \ word classes-intersect? ] unit-test
-[ f ] [ number generic-class classes-intersect? ] unit-test
-[ f ] [ generic-class number classes-intersect? ] unit-test
+{ t } [ \ word generic-class classes-intersect? ] unit-test
+{ t } [ generic-class \ word classes-intersect? ] unit-test
+{ f } [ number generic-class classes-intersect? ] unit-test
+{ f } [ generic-class number classes-intersect? ] unit-test
-[ f ] [ sa sb classes-intersect? ] unit-test
-[ f ] [ sb sa classes-intersect? ] unit-test
+{ f } [ sa sb classes-intersect? ] unit-test
+{ f } [ sb sa classes-intersect? ] unit-test
-[ t ] [ a union-with-one-member classes-intersect? ] unit-test
-[ f ] [ fixnum union-with-one-member classes-intersect? ] unit-test
-[ t ] [ object union-with-one-member classes-intersect? ] unit-test
+{ t } [ a union-with-one-member classes-intersect? ] unit-test
+{ f } [ fixnum union-with-one-member classes-intersect? ] unit-test
+{ t } [ object union-with-one-member classes-intersect? ] unit-test
-[ t ] [ union-with-one-member a classes-intersect? ] unit-test
-[ f ] [ union-with-one-member fixnum classes-intersect? ] unit-test
-[ t ] [ union-with-one-member object classes-intersect? ] unit-test
+{ t } [ union-with-one-member a classes-intersect? ] unit-test
+{ f } [ union-with-one-member fixnum classes-intersect? ] unit-test
+{ t } [ union-with-one-member object classes-intersect? ] unit-test
-[ t ] [ a mixin-with-one-member classes-intersect? ] unit-test
-[ f ] [ fixnum mixin-with-one-member classes-intersect? ] unit-test
-[ t ] [ object mixin-with-one-member classes-intersect? ] unit-test
+{ t } [ a mixin-with-one-member classes-intersect? ] unit-test
+{ f } [ fixnum mixin-with-one-member classes-intersect? ] unit-test
+{ t } [ object mixin-with-one-member classes-intersect? ] unit-test
-[ t ] [ mixin-with-one-member a classes-intersect? ] unit-test
-[ f ] [ mixin-with-one-member fixnum classes-intersect? ] unit-test
-[ t ] [ mixin-with-one-member object classes-intersect? ] unit-test
+{ t } [ mixin-with-one-member a classes-intersect? ] unit-test
+{ f } [ mixin-with-one-member fixnum classes-intersect? ] unit-test
+{ t } [ mixin-with-one-member object classes-intersect? ] unit-test
-[ f ] [ null object classes-intersect? ] unit-test
-[ f ] [ object null classes-intersect? ] unit-test
+{ f } [ null object classes-intersect? ] unit-test
+{ f } [ object null classes-intersect? ] unit-test
-[ t ] [ null class-not object class= ] unit-test
+{ t } [ null class-not object class= ] unit-test
-[ t ] [ object class-not null class= ] unit-test
+{ t } [ object class-not null class= ] unit-test
-[ f ] [ object class-not object class= ] unit-test
+{ f } [ object class-not object class= ] unit-test
-[ f ] [ null class-not null class= ] unit-test
+{ f } [ null class-not null class= ] unit-test
! smallest-class etc
-[ real ] [ { real sequence } smallest-class ] unit-test
-[ real ] [ { sequence real } smallest-class ] unit-test
+{ real } [ { real sequence } smallest-class ] unit-test
+{ real } [ { sequence real } smallest-class ] unit-test
: min-class ( class classes -- class/f )
interesting-classes smallest-class ;
-[ f ] [ fixnum { } min-class ] unit-test
+{ f } [ fixnum { } min-class ] unit-test
-[ string ] [
+{ string } [
\ string
[ integer string array reversed sbuf
slice vector quotation ]
sort-classes min-class
] unit-test
-[ fixnum ] [
+{ fixnum } [
\ fixnum
[ fixnum integer object ]
sort-classes min-class
] unit-test
-[ integer ] [
+{ integer } [
\ fixnum
[ integer float object ]
sort-classes min-class
] unit-test
-[ object ] [
+{ object } [
\ word
[ integer float object ]
sort-classes min-class
] unit-test
-[ reversed ] [
+{ reversed } [
\ reversed
[ integer reversed slice ]
sort-classes min-class
] unit-test
-[ f ] [ null { number fixnum null } min-class ] unit-test
+{ f } [ null { number fixnum null } min-class ] unit-test
! Test for hangs?
: random-class ( -- class ) classes random ;
SINGLETON: xxx
UNION: yyy xxx ;
-[ { yyy xxx } ] [ { xxx yyy } sort-classes ] unit-test
-[ { yyy xxx } ] [ { yyy xxx } sort-classes ] unit-test
+{ { yyy xxx } } [ { xxx yyy } sort-classes ] unit-test
+{ { yyy xxx } } [ { yyy xxx } sort-classes ] unit-test
-[ { number ratio integer } ] [ { ratio number integer } sort-classes ] unit-test
-[ { sequence number ratio } ] [ { ratio number sequence } sort-classes ] unit-test
+{ { number ratio integer } } [ { ratio number integer } sort-classes ] unit-test
+{ { sequence number ratio } } [ { ratio number sequence } sort-classes ] unit-test
TUPLE: xa ;
TUPLE: xb ;
TUPLE: xg < xb ;
TUPLE: xh < xb ;
-[ t ] [ { xa xb xc xd xe xf xg xh } sort-classes dup sort-classes = ] unit-test
+{ t } [ { xa xb xc xd xe xf xg xh } sort-classes dup sort-classes = ] unit-test
-[ H{ { word word } } ] [
+{ H{ { word word } } } [
generic-class flatten-class
] unit-test
-[ sa ] [ sa { sa sb sc } min-class ] unit-test
+{ sa } [ sa { sa sb sc } min-class ] unit-test
[ \ + flatten-class ] must-fail
USING: tools.test words sequences kernel memory accessors ;
IN: classes.builtin.tests
-[ f ] [
+{ f } [
[ word? ] instances
[
[ name>> "f?" = ]
kernel.private sorting vocabs memory eval accessors sets ;
IN: classes.tests
-[ t ] [ 3 object instance? ] unit-test
-[ t ] [ 3 fixnum instance? ] unit-test
-[ f ] [ 3 float instance? ] unit-test
-[ t ] [ 3 number instance? ] unit-test
-[ f ] [ 3 null instance? ] unit-test
+{ t } [ 3 object instance? ] unit-test
+{ t } [ 3 fixnum instance? ] unit-test
+{ f } [ 3 float instance? ] unit-test
+{ t } [ 3 number instance? ] unit-test
+{ f } [ 3 null instance? ] unit-test
! Regression
GENERIC: method-forget-test ( obj -- obj )
TUPLE: method-forget-class ;
M: method-forget-class method-forget-test ;
-[ f ] [ \ method-forget-test "methods" word-prop assoc-empty? ] unit-test
-[ ] [ [ \ method-forget-class forget ] with-compilation-unit ] unit-test
-[ t ] [ \ method-forget-test "methods" word-prop assoc-empty? ] unit-test
+{ f } [ \ method-forget-test "methods" word-prop assoc-empty? ] unit-test
+{ } [ [ \ method-forget-class forget ] with-compilation-unit ] unit-test
+{ t } [ \ method-forget-test "methods" word-prop assoc-empty? ] unit-test
-[ { } { } ] [
+{ { } { } } [
all-words [ class? ] filter
implementors-map get keys
[ natural-sort ] bi@
USE: multiline
! So the user has some code...
-[ ] [
+{ } [
"""IN: classes.test.a
GENERIC: g ( a -- b )
TUPLE: x ;
] unit-test
! Note that q inlines M: x g ;
-[ ] [
+{ } [
"""IN: classes.test.b
USE: classes.test.a
USE: kernel
] unit-test
! Now, the user removes the z class and adds a method,
-[ ] [
+{ } [
"""IN: classes.test.a
GENERIC: g ( a -- b )
TUPLE: x ;
] unit-test
! And changes the definition of q
-[ ] [
+{ } [
"""IN: classes.test.b
USE: classes.test.a
USE: kernel
] unit-test
! Similar problem, but with anonymous classes
-[ ] [
+{ } [
"""IN: classes.test.c
USE: kernel
GENERIC: g ( a -- b )
"class-intersect-no-method-c" parse-stream drop
] unit-test
-[ ] [
+{ } [
"""IN: classes.test.d
USE: classes.test.c
USE: kernel
] unit-test
! Now, the user removes the z class and adds a method,
-[ ] [
+{ } [
"""IN: classes.test.c
USE: kernel
GENERIC: g ( a -- b )
TUPLE: forgotten-predicate-test ;
-[ ] [ [ \ forgotten-predicate-test forget ] with-compilation-unit ] unit-test
-[ f ] [ \ forgotten-predicate-test? predicate? ] unit-test
+{ } [ [ \ forgotten-predicate-test forget ] with-compilation-unit ] unit-test
+{ f } [ \ forgotten-predicate-test? predicate? ] unit-test
GENERIC: generic-predicate? ( a -- b )
-[ ] [ "IN: classes.tests TUPLE: generic-predicate ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tests TUPLE: generic-predicate ;" eval( -- ) ] unit-test
-[ f ] [ \ generic-predicate? generic? ] unit-test
+{ f } [ \ generic-predicate? generic? ] unit-test
M: c x drop c ;
M: a x drop a ;
-[ a ] [ T{ a } x ] unit-test
-[ a ] [ T{ a1 } x ] unit-test
-[ a ] [ T{ a2 } x ] unit-test
+{ a } [ T{ a } x ] unit-test
+{ a } [ T{ a1 } x ] unit-test
+{ a } [ T{ a2 } x ] unit-test
-[ t ] [ T{ a3 } c? ] unit-test
-[ t ] [ T{ a3 } \ x effective-method M\ c x eq? nip ] unit-test
-[ c ] [ T{ a3 } x ] unit-test
+{ t } [ T{ a3 } c? ] unit-test
+{ t } [ T{ a3 } \ x effective-method M\ c x eq? nip ] unit-test
+{ c } [ T{ a3 } x ] unit-test
! More complex case
TUPLE: t1 ;
M: i g drop i ;
M: t4 g drop t4 ;
-[ t4 ] [ T{ t4 } g ] unit-test
-[ i ] [ T{ t5 } g ] unit-test
+{ t4 } [ T{ t4 } g ] unit-test
+{ i } [ T{ t5 } g ] unit-test
PREDICATE: odd-integer < integer odd? ;
TUPLE: omg { a intersection{ fixnum odd-integer } initial: 1 } ;
-[ 1 ] [ omg new a>> ] unit-test
-[ 3 ] [ omg new 3 >>a a>> ] unit-test
+{ 1 } [ omg new a>> ] unit-test
+{ 3 } [ omg new 3 >>a a>> ] unit-test
[ omg new 1.2 >>a a>> ] [ bad-slot-value? ] must-fail-with
PREDICATE: odd/float-between-10-20 < union{ odd-integer float }
10 20 between? ;
-[ t ] [ 17 odd/float-between-10-20? ] unit-test
-[ t ] [ 17.4 odd/float-between-10-20? ] unit-test
-[ f ] [ 18 odd/float-between-10-20? ] unit-test
-[ f ] [ 5 odd/float-between-10-20? ] unit-test
-[ f ] [ 5.75 odd/float-between-10-20? ] unit-test
+{ t } [ 17 odd/float-between-10-20? ] unit-test
+{ t } [ 17.4 odd/float-between-10-20? ] unit-test
+{ f } [ 18 odd/float-between-10-20? ] unit-test
+{ f } [ 5 odd/float-between-10-20? ] unit-test
+{ f } [ 5.75 odd/float-between-10-20? ] unit-test
classes.algebra.private ;
IN: classes.maybe.tests
-[ t ] [ 3 maybe{ integer } instance? ] unit-test
-[ t ] [ f maybe{ integer } instance? ] unit-test
-[ f ] [ 3.0 maybe{ integer } instance? ] unit-test
+{ t } [ 3 maybe{ integer } instance? ] unit-test
+{ t } [ f maybe{ integer } instance? ] unit-test
+{ f } [ 3.0 maybe{ integer } instance? ] unit-test
TUPLE: maybe-integer-container { something maybe{ integer } } ;
-[ f ] [ maybe-integer-container new something>> ] unit-test
-[ 3 ] [ maybe-integer-container new 3 >>something something>> ] unit-test
+{ f } [ maybe-integer-container new something>> ] unit-test
+{ 3 } [ maybe-integer-container new 3 >>something something>> ] unit-test
[ maybe-integer-container new 3.0 >>something ] [ bad-slot-value? ] must-fail-with
TUPLE: self-pointer { next maybe{ self-pointer } } ;
-[ T{ self-pointer { next T{ self-pointer } } } ]
+{ T{ self-pointer { next T{ self-pointer } } } }
[ self-pointer new self-pointer new >>next ] unit-test
-[ t ] [ f maybe{ POSTPONE: f } instance? ] unit-test
+{ t } [ f maybe{ POSTPONE: f } instance? ] unit-test
PREDICATE: natural < maybe{ integer }
0 > ;
-[ f ] [ -1 natural? ] unit-test
-[ f ] [ 0 natural? ] unit-test
-[ t ] [ 1 natural? ] unit-test
+{ f } [ -1 natural? ] unit-test
+{ f } [ 0 natural? ] unit-test
+{ t } [ 1 natural? ] unit-test
-[ t ] [ f maybe{ maybe{ integer } } instance? ] unit-test
-[ t ] [ 3 maybe{ maybe{ integer } } instance? ] unit-test
-[ f ] [ 3.03 maybe{ maybe{ integer } } instance? ] unit-test
+{ t } [ f maybe{ maybe{ integer } } instance? ] unit-test
+{ t } [ 3 maybe{ maybe{ integer } } instance? ] unit-test
+{ f } [ 3.03 maybe{ maybe{ integer } } instance? ] unit-test
INTERSECTION: only-f maybe{ integer } POSTPONE: f ;
-[ t ] [ f only-f instance? ] unit-test
-[ f ] [ t only-f instance? ] unit-test
-[ f ] [ 30 only-f instance? ] unit-test
+{ t } [ f only-f instance? ] unit-test
+{ f } [ t only-f instance? ] unit-test
+{ f } [ 30 only-f instance? ] unit-test
UNION: ?integer-float maybe{ integer } maybe{ float } ;
-[ t ] [ 30 ?integer-float instance? ] unit-test
-[ t ] [ 30.0 ?integer-float instance? ] unit-test
-[ t ] [ f ?integer-float instance? ] unit-test
-[ f ] [ t ?integer-float instance? ] unit-test
+{ t } [ 30 ?integer-float instance? ] unit-test
+{ t } [ 30.0 ?integer-float instance? ] unit-test
+{ t } [ f ?integer-float instance? ] unit-test
+{ f } [ t ?integer-float instance? ] unit-test
TUPLE: foo ;
GENERIC: lol ( obj -- string )
M: maybe{ foo } lol drop "lol" ;
-[ "lol" ] [ foo new lol ] unit-test
-[ "lol" ] [ f lol ] unit-test
+{ "lol" } [ foo new lol ] unit-test
+{ "lol" } [ f lol ] unit-test
[ 3 lol ] [ no-method? ] must-fail-with
TUPLE: foo2 a ;
M: maybe{ foo } lol2 drop "lol2" ;
M: f lol2 drop "lol22" ;
-[ "lol2" ] [ foo new lol2 ] unit-test
-[ "lol22" ] [ f lol2 ] unit-test
+{ "lol2" } [ foo new lol2 ] unit-test
+{ "lol22" } [ f lol2 ] unit-test
[ 3 lol2 ] [ no-method? ] must-fail-with
-[ t ] [ \ + <maybe> classoid? ] unit-test
-[ f ] [ \ + <maybe> valid-classoid? ] unit-test
+{ t } [ \ + <maybe> classoid? ] unit-test
+{ f } [ \ + <maybe> valid-classoid? ] unit-test
[ "IN: classes-tests maybe{ 1 2 3 }" eval( -- ) ]
[ error>> not-classoids? ] must-fail-with
M: assoc-mixin collection-size assoc-size ;
-[ t ] [ array sequence-mixin class<= ] unit-test
-[ t ] [ { 1 2 3 } sequence-mixin? ] unit-test
-[ 3 ] [ { 1 2 3 } collection-size ] unit-test
-[ f ] [ H{ { 1 2 } { 2 3 } } sequence-mixin? ] unit-test
-[ t ] [ H{ { 1 2 } { 2 3 } } assoc-mixin? ] unit-test
-[ 2 ] [ H{ { 1 2 } { 2 3 } } collection-size ] unit-test
+{ t } [ array sequence-mixin class<= ] unit-test
+{ t } [ { 1 2 3 } sequence-mixin? ] unit-test
+{ 3 } [ { 1 2 3 } collection-size ] unit-test
+{ f } [ H{ { 1 2 } { 2 3 } } sequence-mixin? ] unit-test
+{ t } [ H{ { 1 2 } { 2 3 } } assoc-mixin? ] unit-test
+{ 2 } [ H{ { 1 2 } { 2 3 } } collection-size ] unit-test
! Test mixing in of new classes after the fact
DEFER: mx1
INSTANCE: integer mx1
-[ t ] [ integer mx1 class<= ] unit-test
-[ f ] [ mx1 integer class<= ] unit-test
-[ f ] [ mx1 number class<= ] unit-test
+{ t } [ integer mx1 class<= ] unit-test
+{ f } [ mx1 integer class<= ] unit-test
+{ f } [ mx1 number class<= ] unit-test
"IN: classes.mixin.tests USE: arrays INSTANCE: array mx1" eval( -- )
-[ t ] [ array mx1 class<= ] unit-test
-[ f ] [ mx1 number class<= ] unit-test
+{ t } [ array mx1 class<= ] unit-test
+{ f } [ mx1 number class<= ] unit-test
[ \ mx1 forget ] with-compilation-unit
MIXIN: flat-mx-2 INSTANCE: flat-mx-2 flat-mx-1
TUPLE: flat-mx-2-1 ; INSTANCE: flat-mx-2-1 flat-mx-2
-[ t ] [ T{ flat-mx-2-1 } flat-mx-1? ] unit-test
+{ t } [ T{ flat-mx-2-1 } flat-mx-1? ] unit-test
! Too eager with reset-class
-[ ] [ "IN: classes.mixin.tests MIXIN: blah SINGLETON: boo INSTANCE: boo blah" <string-reader> "mixin-reset-test" parse-stream drop ] unit-test
+{ } [ "IN: classes.mixin.tests MIXIN: blah SINGLETON: boo INSTANCE: boo blah" <string-reader> "mixin-reset-test" parse-stream drop ] unit-test
-[ t ] [ "blah" "classes.mixin.tests" lookup-word mixin-class? ] unit-test
+{ t } [ "blah" "classes.mixin.tests" lookup-word mixin-class? ] unit-test
-[ ] [ "IN: classes.mixin.tests MIXIN: blah" <string-reader> "mixin-reset-test" parse-stream drop ] unit-test
+{ } [ "IN: classes.mixin.tests MIXIN: blah" <string-reader> "mixin-reset-test" parse-stream drop ] unit-test
-[ t ] [ "blah" "classes.mixin.tests" lookup-word mixin-class? ] unit-test
+{ t } [ "blah" "classes.mixin.tests" lookup-word mixin-class? ] unit-test
MIXIN: empty-mixin
-[ f ] [ "hi" empty-mixin? ] unit-test
+{ f } [ "hi" empty-mixin? ] unit-test
MIXIN: move-instance-declaration-mixin
-[ ] [ "IN: classes.mixin.tests.a USE: strings USE: classes.mixin.tests INSTANCE: string move-instance-declaration-mixin" <string-reader> "move-mixin-test-1" parse-stream drop ] unit-test
+{ } [ "IN: classes.mixin.tests.a USE: strings USE: classes.mixin.tests INSTANCE: string move-instance-declaration-mixin" <string-reader> "move-mixin-test-1" parse-stream drop ] unit-test
-[ ] [ "IN: classes.mixin.tests.b USE: strings USE: classes.mixin.tests INSTANCE: string move-instance-declaration-mixin" <string-reader> "move-mixin-test-2" parse-stream drop ] unit-test
+{ } [ "IN: classes.mixin.tests.b USE: strings USE: classes.mixin.tests INSTANCE: string move-instance-declaration-mixin" <string-reader> "move-mixin-test-2" parse-stream drop ] unit-test
-[ ] [ "IN: classes.mixin.tests.a" <string-reader> "move-mixin-test-1" parse-stream drop ] unit-test
+{ } [ "IN: classes.mixin.tests.a" <string-reader> "move-mixin-test-1" parse-stream drop ] unit-test
-[ { string } ] [ move-instance-declaration-mixin members ] unit-test
+{ { string } } [ move-instance-declaration-mixin members ] unit-test
MIXIN: silly-mixin
SYMBOL: not-a-class
M: metaclass-change-mixin metaclass-change-generic ;
-[ T{ metaclass-change } ] [ T{ metaclass-change } metaclass-change-generic ] unit-test
+{ T{ metaclass-change } } [ T{ metaclass-change } metaclass-change-generic ] unit-test
-[ ] [ "IN: classes.mixin.tests USE: math UNION: metaclass-change integer ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.mixin.tests USE: math UNION: metaclass-change integer ;" eval( -- ) ] unit-test
-[ 0 ] [ 0 metaclass-change-generic ] unit-test
+{ 0 } [ 0 metaclass-change-generic ] unit-test
! Forgetting a mixin member class should remove it from the mixin
-[ ] [ [ metaclass-change forget-class ] with-compilation-unit ] unit-test
+{ } [ [ metaclass-change forget-class ] with-compilation-unit ] unit-test
-[ t ] [ metaclass-change-mixin members empty? ] unit-test
+{ t } [ metaclass-change-mixin members empty? ] unit-test
PREDICATE: negative < integer 0 < ;
PREDICATE: positive < integer 0 > ;
-[ t ] [ negative integer class< ] unit-test
-[ t ] [ positive integer class< ] unit-test
-[ f ] [ integer negative class< ] unit-test
-[ f ] [ integer positive class< ] unit-test
-[ f ] [ negative negative class< ] unit-test
-[ f ] [ positive negative class< ] unit-test
+{ t } [ negative integer class< ] unit-test
+{ t } [ positive integer class< ] unit-test
+{ f } [ integer negative class< ] unit-test
+{ f } [ integer positive class< ] unit-test
+{ f } [ negative negative class< ] unit-test
+{ f } [ positive negative class< ] unit-test
GENERIC: abs ( n -- n )
M: integer abs ;
M: negative abs -1 * ;
M: positive abs ;
-[ 10 ] [ -10 abs ] unit-test
-[ 10 ] [ 10 abs ] unit-test
-[ 0 ] [ 0 abs ] unit-test
+{ 10 } [ -10 abs ] unit-test
+{ 10 } [ 10 abs ] unit-test
+{ 0 } [ 0 abs ] unit-test
! Bug report from Bruno Deferrari
TUPLE: tuple-a slot ;
M: tuple-a ptest drop tuple-a ;
M: tuple-c ptest drop tuple-c ;
-[ tuple-a ] [ tuple-b new ptest ] unit-test
-[ tuple-c ] [ tuple-b new t >>slot ptest ] unit-test
+{ tuple-a } [ tuple-b new ptest ] unit-test
+{ tuple-c } [ tuple-b new t >>slot ptest ] unit-test
PREDICATE: tuple-d < tuple-a slot>> ;
M: tuple-a ptest' drop tuple-a ;
M: tuple-d ptest' drop tuple-d ;
-[ tuple-a ] [ tuple-b new ptest' ] unit-test
-[ tuple-d ] [ tuple-b new t >>slot ptest' ] unit-test
+{ tuple-a } [ tuple-b new ptest' ] unit-test
+{ tuple-d } [ tuple-b new t >>slot ptest' ] unit-test
PREDICATE: bad-inheritance-predicate < string ;
[
PREDICATE: tup < string ;
UNION: u tup ;
-[ ] [ "IN: classes.predicate.tests PREDICATE: u < tup ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.predicate.tests PREDICATE: u < tup ;" eval( -- ) ] unit-test
! Changing the metaclass of the predicate superclass should work
GENERIC: change-meta-test ( a -- b )
M: change-meta-test-predicate change-meta-test length>> ;
-[ f ] [ \ change-meta-test "methods" word-prop assoc-empty? ] unit-test
+{ f } [ \ change-meta-test "methods" word-prop assoc-empty? ] unit-test
[ T{ change-meta-test-class f 0 } change-meta-test ] [ no-method? ] must-fail-with
-[ 7 ] [ T{ change-meta-test-class f 7 } change-meta-test ] unit-test
+{ 7 } [ T{ change-meta-test-class f 7 } change-meta-test ] unit-test
-[ ] [ "IN: classes.predicate.tests USE: arrays UNION: change-meta-test-class array ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.predicate.tests USE: arrays UNION: change-meta-test-class array ;" eval( -- ) ] unit-test
! Should not have changed
-[ change-meta-test-class ] [ change-meta-test-predicate superclass ] unit-test
+{ change-meta-test-class } [ change-meta-test-predicate superclass ] unit-test
[ { } change-meta-test ] [ no-method? ] must-fail-with
-[ 4 ] [ { 1 2 3 4 } change-meta-test ] unit-test
+{ 4 } [ { 1 2 3 4 } change-meta-test ] unit-test
-[ ] [ [ \ change-meta-test-class forget-class ] with-compilation-unit ] unit-test
+{ } [ [ \ change-meta-test-class forget-class ] with-compilation-unit ] unit-test
-[ f ] [ change-meta-test-predicate class? ] unit-test
+{ f } [ change-meta-test-predicate class? ] unit-test
-[ t ] [ \ change-meta-test "methods" word-prop assoc-empty? ] unit-test
+{ t } [ \ change-meta-test "methods" word-prop assoc-empty? ] unit-test
USING: kernel classes.singleton tools.test prettyprint io.streams.string see ;
IN: classes.singleton.tests
-[ ] [ SINGLETON: bzzt ] unit-test
-[ t ] [ bzzt bzzt? ] unit-test
-[ t ] [ bzzt bzzt eq? ] unit-test
+{ } [ SINGLETON: bzzt ] unit-test
+{ t } [ bzzt bzzt? ] unit-test
+{ t } [ bzzt bzzt eq? ] unit-test
GENERIC: zammo ( obj -- str )
-[ ] [ M: bzzt zammo drop "yes!" ; ] unit-test
-[ "yes!" ] [ bzzt zammo ] unit-test
-[ ] [ SINGLETON: omg ] unit-test
-[ t ] [ omg singleton-class? ] unit-test
-[ "IN: classes.singleton.tests\nSINGLETON: omg\n" ] [ [ omg see ] with-string-writer ] unit-test
+{ } [ M: bzzt zammo drop "yes!" ; ] unit-test
+{ "yes!" } [ bzzt zammo ] unit-test
+{ } [ SINGLETON: omg ] unit-test
+{ t } [ omg singleton-class? ] unit-test
+{ "IN: classes.singleton.tests\nSINGLETON: omg\n" } [ [ omg see ] with-string-writer ] unit-test
SINGLETON: word-and-singleton
: word-and-singleton ( -- x ) 3 ;
-[ t ] [ \ word-and-singleton word-and-singleton? ] unit-test
-[ 3 ] [ word-and-singleton ] unit-test
+{ t } [ \ word-and-singleton word-and-singleton? ] unit-test
+{ 3 } [ word-and-singleton ] unit-test
TUPLE: test-1 ;
-[ t ] [ test-1 "slots" word-prop empty? ] unit-test
+{ t } [ test-1 "slots" word-prop empty? ] unit-test
TUPLE: test-2 < test-1 ;
-[ t ] [ test-2 "slots" word-prop empty? ] unit-test
-[ test-1 ] [ test-2 superclass ] unit-test
+{ t } [ test-2 "slots" word-prop empty? ] unit-test
+{ test-1 } [ test-2 superclass ] unit-test
TUPLE: test-3 a ;
-[ { "a" } ] [ test-3 "slots" word-prop [ name>> ] map ] unit-test
+{ { "a" } } [ test-3 "slots" word-prop [ name>> ] map ] unit-test
-[ object ] [ "a" test-3 "slots" word-prop slot-named class>> ] unit-test
+{ object } [ "a" test-3 "slots" word-prop slot-named class>> ] unit-test
TUPLE: test-4 < test-3 b ;
-[ { "b" } ] [ test-4 "slots" word-prop [ name>> ] map ] unit-test
+{ { "b" } } [ test-4 "slots" word-prop [ name>> ] map ] unit-test
TUPLE: test-5 { a integer } ;
-[ { { "a" integer } } ]
+{ { { "a" integer } } }
[
test-5 "slots" word-prop
[ [ name>> ] [ class>> ] bi 2array ] map
TUPLE: test-6 < test-5 { b integer } ;
-[ integer ] [ "b" test-6 "slots" word-prop slot-named class>> ] unit-test
+{ integer } [ "b" test-6 "slots" word-prop slot-named class>> ] unit-test
-[ { { "b" integer } } ]
+{ { { "b" integer } } }
[
test-6 "slots" word-prop
[ [ name>> ] [ class>> ] bi 2array ] map
TUPLE: test-7 { b integer initial: 3 } ;
-[ 3 ] [ "b" test-7 "slots" word-prop slot-named initial>> ] unit-test
+{ 3 } [ "b" test-7 "slots" word-prop slot-named initial>> ] unit-test
TUPLE: test-8 { b integer read-only } ;
-[ t ] [ "b" test-8 "slots" word-prop slot-named read-only>> ] unit-test
+{ t } [ "b" test-8 "slots" word-prop slot-named read-only>> ] unit-test
DEFER: foo
[ error>> duplicate-slot-names? ]
must-fail-with
-[ f ] [ \ foo tuple-class? ] unit-test
+{ f } [ \ foo tuple-class? ] unit-test
-[ ] [
+{ } [
[
{ test-1 test-2 test-3 test-4 test-5 test-6 test-7 test-8 foo }
[ dup class? [ forget-class ] [ drop ] if ] each
TUPLE: syntax-test bar baz ;
-[ T{ syntax-test } ] [ T{ syntax-test } ] unit-test
-[ T{ syntax-test f { 2 3 } { 4 { 5 } } } ]
+{ T{ syntax-test } } [ T{ syntax-test } ] unit-test
+{ T{ syntax-test f { 2 3 } { 4 { 5 } } } }
[ T{ syntax-test { bar { 2 3 } } { baz { 4 { 5 } } } } ] unit-test
! Corner case
TUPLE: parsing-corner-case x ;
-[ T{ parsing-corner-case f 3 } ] [
+{ T{ parsing-corner-case f 3 } } [
{
"USE: classes.tuple.parser.tests"
"T{ parsing-corner-case"
} "\n" join eval( -- tuple )
] unit-test
-[ T{ parsing-corner-case f 3 } ] [
+{ T{ parsing-corner-case f 3 } } [
{
"USE: classes.tuple.parser.tests"
"T{ parsing-corner-case"
} "\n" join eval( -- tuple )
] unit-test
-[ T{ parsing-corner-case f 3 } ] [
+{ T{ parsing-corner-case f 3 } } [
{
"USE: classes.tuple.parser.tests"
"T{ parsing-corner-case {"
TUPLE: tup ;
UNION: u tup ;
-[ ] [ "IN: classes.tuple.parser.tests TUPLE: u < tup ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.parser.tests TUPLE: u < tup ;" eval( -- ) ] unit-test
-[ t ] [ u new tup? ] unit-test
+{ t } [ u new tup? ] unit-test
: move ( x rect -- rect )
[ + ] change-x ;
-[ f ] [ 10 20 30 40 <rect> dup clone 5 swap move = ] unit-test
+{ f } [ 10 20 30 40 <rect> dup clone 5 swap move = ] unit-test
-[ t ] [ 10 20 30 40 <rect> dup clone 0 swap move = ] unit-test
+{ t } [ 10 20 30 40 <rect> dup clone 0 swap move = ] unit-test
! Make sure we handle tuple class redefinition
TUPLE: redefinition-test ;
<redefinition-test> "redefinition-test" set
-[ t ] [ "redefinition-test" get redefinition-test? ] unit-test
+{ t } [ "redefinition-test" get redefinition-test? ] unit-test
"IN: classes.tuple.tests TUPLE: redefinition-test ;" eval( -- )
-[ t ] [ "redefinition-test" get redefinition-test? ] unit-test
+{ t } [ "redefinition-test" get redefinition-test? ] unit-test
! Make sure we handle changing shapes!
TUPLE: point x y ;
-[ ] [ 100 200 point boa "p" set ] unit-test
+{ } [ 100 200 point boa "p" set ] unit-test
! Use eval to sequence parsing explicitly
-[ ] [ "IN: classes.tuple.tests TUPLE: point x y z ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: point x y z ;" eval( -- ) ] unit-test
-[ 100 ] [ "p" get x>> ] unit-test
-[ 200 ] [ "p" get y>> ] unit-test
-[ f ] [ "p" get "z>>" "accessors" lookup-word execute ] unit-test
+{ 100 } [ "p" get x>> ] unit-test
+{ 200 } [ "p" get y>> ] unit-test
+{ f } [ "p" get "z>>" "accessors" lookup-word execute ] unit-test
-[ ] [ "p" get 300 ">>z" "accessors" lookup-word execute drop ] unit-test
+{ } [ "p" get 300 ">>z" "accessors" lookup-word execute drop ] unit-test
-[ 3 ] [ "p" get tuple-size ] unit-test
+{ 3 } [ "p" get tuple-size ] unit-test
-[ 300 ] [ "p" get "z>>" "accessors" lookup-word execute ] unit-test
+{ 300 } [ "p" get "z>>" "accessors" lookup-word execute ] unit-test
-[ ] [ "IN: classes.tuple.tests TUPLE: point z y ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: point z y ;" eval( -- ) ] unit-test
-[ 2 ] [ "p" get tuple-size ] unit-test
+{ 2 } [ "p" get tuple-size ] unit-test
[ "p" get x>> ] must-fail
-[ 200 ] [ "p" get y>> ] unit-test
-[ 300 ] [ "p" get "z>>" "accessors" lookup-word execute ] unit-test
+{ 200 } [ "p" get y>> ] unit-test
+{ 300 } [ "p" get "z>>" "accessors" lookup-word execute ] unit-test
TUPLE: slotty a b c ;
-[ T{ slotty } ] [ H{ } slotty from-slots ] unit-test
-[ T{ slotty f 1 2 f } ] [ H{ { "a" 1 } { "b" 2 } } slotty from-slots ] unit-test
+{ T{ slotty } } [ H{ } slotty from-slots ] unit-test
+{ T{ slotty f 1 2 f } } [ H{ { "a" 1 } { "b" 2 } } slotty from-slots ] unit-test
[ H{ { "d" 0 } } slotty new set-slots ] must-fail
TUPLE: predicate-test ;
: predicate-test ( a -- ? ) drop f ;
-[ t ] [ <predicate-test> predicate-test? ] unit-test
+{ t } [ <predicate-test> predicate-test? ] unit-test
PREDICATE: silly-pred < tuple
class-of \ rect = ;
TUPLE: circle radius ;
M: circle area radius>> sq pi * ;
-[ 200 ] [ T{ rect f 0 0 10 20 } area ] unit-test
+{ 200 } [ T{ rect f 0 0 10 20 } area ] unit-test
! Hashcode breakage
TUPLE: empty ;
C: <empty> empty
-[ t ] [ <empty> hashcode fixnum? ] unit-test
+{ t } [ <empty> hashcode fixnum? ] unit-test
! Compiler regression
[ t length ] [ object>> t eq? ] must-fail-with
-[ "<constructor-test>" ]
+{ "<constructor-test>" }
[ "IN: classes.tuple.test TUPLE: constructor-test ; C: <constructor-test> constructor-test" eval( -- ) last-word name>> ] unit-test
TUPLE: size-test a b c d ;
-[ t ] [
+{ t } [
T{ size-test } tuple-size
size-test tuple-layout second =
] unit-test
TUPLE: yo-momma ;
-[ ] [ "IN: classes.tuple.tests C: <yo-momma> yo-momma" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests C: <yo-momma> yo-momma" eval( -- ) ] unit-test
-[ f ] [ \ <yo-momma> generic? ] unit-test
+{ f } [ \ <yo-momma> generic? ] unit-test
! Test forget
[
TUPLE: loc-recording ;
-[ f ] [ \ loc-recording where not ] unit-test
+{ f } [ \ loc-recording where not ] unit-test
! 'forget' wasn't robust enough
C: <t4> t4
-[ 1 ] [ 1 <t4> m1 ] unit-test
-[ 1 ] [ <t4> 1 m2 ] unit-test
+{ 1 } [ 1 <t4> m1 ] unit-test
+{ 1 } [ <t4> 1 m2 ] unit-test
! another combination issue
GENERIC: silly ( obj -- obj obj )
M: vector silly "z" ;
-[ "zz" ] [ 123 <reversed> silly nip ] unit-test
+{ "zz" } [ 123 <reversed> silly nip ] unit-test
! Typo
SYMBOL: not-a-tuple-class
TUPLE: computer cpu ram ;
C: <computer> computer
-[ "TUPLE: computer cpu ram ;" ] [
+{ "TUPLE: computer cpu ram ;" } [
[ \ computer see ] with-string-writer string-lines second
] unit-test
TUPLE: laptop < computer battery ;
C: <laptop> laptop
-[ t ] [ laptop tuple-class? ] unit-test
-[ t ] [ laptop tuple class<= ] unit-test
-[ t ] [ laptop computer class<= ] unit-test
-[ t ] [ laptop computer classes-intersect? ] unit-test
+{ t } [ laptop tuple-class? ] unit-test
+{ t } [ laptop tuple class<= ] unit-test
+{ t } [ laptop computer class<= ] unit-test
+{ t } [ laptop computer classes-intersect? ] unit-test
-[ ] [ "Pentium" 128 3 hours <laptop> "laptop" set ] unit-test
-[ t ] [ "laptop" get laptop? ] unit-test
-[ t ] [ "laptop" get computer? ] unit-test
-[ t ] [ "laptop" get tuple? ] unit-test
+{ } [ "Pentium" 128 3 hours <laptop> "laptop" set ] unit-test
+{ t } [ "laptop" get laptop? ] unit-test
+{ t } [ "laptop" get computer? ] unit-test
+{ t } [ "laptop" get tuple? ] unit-test
: test-laptop-slot-values ( -- )
[ laptop ] [ "laptop" get class-of ] unit-test
test-laptop-slot-values
-[ "TUPLE: laptop < computer battery ;" ] [
+{ "TUPLE: laptop < computer battery ;" } [
[ \ laptop see ] with-string-writer string-lines second
] unit-test
-[ { tuple computer laptop } ] [ laptop superclasses ] unit-test
+{ { tuple computer laptop } } [ laptop superclasses ] unit-test
TUPLE: server < computer rackmount ;
C: <server> server
-[ t ] [ server tuple-class? ] unit-test
-[ t ] [ server tuple class<= ] unit-test
-[ t ] [ server computer class<= ] unit-test
-[ t ] [ server computer classes-intersect? ] unit-test
+{ t } [ server tuple-class? ] unit-test
+{ t } [ server tuple class<= ] unit-test
+{ t } [ server computer class<= ] unit-test
+{ t } [ server computer classes-intersect? ] unit-test
-[ ] [ "PowerPC" 64 "1U" <server> "server" set ] unit-test
-[ t ] [ "server" get server? ] unit-test
-[ t ] [ "server" get computer? ] unit-test
-[ t ] [ "server" get tuple? ] unit-test
+{ } [ "PowerPC" 64 "1U" <server> "server" set ] unit-test
+{ t } [ "server" get server? ] unit-test
+{ t } [ "server" get computer? ] unit-test
+{ t } [ "server" get tuple? ] unit-test
: test-server-slot-values ( -- )
[ server ] [ "server" get class-of ] unit-test
test-server-slot-values
-[ f ] [ "server" get laptop? ] unit-test
-[ f ] [ "laptop" get server? ] unit-test
+{ f } [ "server" get laptop? ] unit-test
+{ f } [ "laptop" get server? ] unit-test
-[ f ] [ server laptop class<= ] unit-test
-[ f ] [ laptop server class<= ] unit-test
-[ f ] [ laptop server classes-intersect? ] unit-test
+{ f } [ server laptop class<= ] unit-test
+{ f } [ laptop server class<= ] unit-test
+{ f } [ laptop server classes-intersect? ] unit-test
-[ f ] [ 1 2 <computer> laptop? ] unit-test
-[ f ] [ \ + server? ] unit-test
+{ f } [ 1 2 <computer> laptop? ] unit-test
+{ f } [ \ + server? ] unit-test
-[ "TUPLE: server < computer rackmount ;" ] [
+{ "TUPLE: server < computer rackmount ;" } [
[ \ server see ] with-string-writer string-lines second
] unit-test
: computer?' ( a -- b ) computer? ;
-[ t ] [ laptop new computer?' ] unit-test
+{ t } [ laptop new computer?' ] unit-test
-[ ] [ "IN: classes.tuple.tests TUPLE: computer < electronic-device cpu ram ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: computer < electronic-device cpu ram ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
-[ t ] [ laptop new computer?' ] unit-test
+{ t } [ laptop new computer?' ] unit-test
-[ f ] [ electronic-device laptop class<= ] unit-test
-[ t ] [ server electronic-device class<= ] unit-test
-[ t ] [ laptop server class-or electronic-device class<= ] unit-test
+{ f } [ electronic-device laptop class<= ] unit-test
+{ t } [ server electronic-device class<= ] unit-test
+{ t } [ laptop server class-or electronic-device class<= ] unit-test
-[ t ] [ "laptop" get electronic-device? ] unit-test
-[ t ] [ "laptop" get computer? ] unit-test
-[ t ] [ "laptop" get laptop? ] unit-test
-[ f ] [ "laptop" get server? ] unit-test
+{ t } [ "laptop" get electronic-device? ] unit-test
+{ t } [ "laptop" get computer? ] unit-test
+{ t } [ "laptop" get laptop? ] unit-test
+{ f } [ "laptop" get server? ] unit-test
-[ t ] [ "server" get electronic-device? ] unit-test
-[ t ] [ "server" get computer? ] unit-test
-[ f ] [ "server" get laptop? ] unit-test
-[ t ] [ "server" get server? ] unit-test
+{ t } [ "server" get electronic-device? ] unit-test
+{ t } [ "server" get computer? ] unit-test
+{ f } [ "server" get laptop? ] unit-test
+{ t } [ "server" get server? ] unit-test
-[ ] [ "IN: classes.tuple.tests TUPLE: computer cpu ram ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: computer cpu ram ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
-[ f ] [ "laptop" get electronic-device? ] unit-test
-[ t ] [ "laptop" get computer? ] unit-test
+{ f } [ "laptop" get electronic-device? ] unit-test
+{ t } [ "laptop" get computer? ] unit-test
-[ ] [ "IN: classes.tuple.tests TUPLE: computer < electronic-device cpu ram disk ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: computer < electronic-device cpu ram disk ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
test-laptop-slot-values
test-server-slot-values
-[ ] [ "IN: classes.tuple.tests TUPLE: electronic-device voltage ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: electronic-device voltage ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
test-laptop-slot-values
test-server-slot-values
TUPLE: make-me-some-accessors voltage grounded? ;
-[ f ] [ "laptop" get voltage>> ] unit-test
-[ f ] [ "server" get voltage>> ] unit-test
+{ f } [ "laptop" get voltage>> ] unit-test
+{ f } [ "server" get voltage>> ] unit-test
-[ ] [ "laptop" get 220 >>voltage drop ] unit-test
-[ ] [ "server" get 110 >>voltage drop ] unit-test
+{ } [ "laptop" get 220 >>voltage drop ] unit-test
+{ } [ "server" get 110 >>voltage drop ] unit-test
-[ ] [ "IN: classes.tuple.tests TUPLE: electronic-device voltage grounded? ; C: <computer> computer" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: electronic-device voltage grounded? ; C: <computer> computer" eval( -- ) ] unit-test
test-laptop-slot-values
test-server-slot-values
-[ 220 ] [ "laptop" get voltage>> ] unit-test
-[ 110 ] [ "server" get voltage>> ] unit-test
+{ 220 } [ "laptop" get voltage>> ] unit-test
+{ 110 } [ "server" get voltage>> ] unit-test
-[ ] [ "IN: classes.tuple.tests TUPLE: electronic-device grounded? voltage ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: electronic-device grounded? voltage ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
test-laptop-slot-values
test-server-slot-values
-[ 220 ] [ "laptop" get voltage>> ] unit-test
-[ 110 ] [ "server" get voltage>> ] unit-test
+{ 220 } [ "laptop" get voltage>> ] unit-test
+{ 110 } [ "server" get voltage>> ] unit-test
! Reshaping superclass and subclass simultaneously
-[ ] [ "IN: classes.tuple.tests TUPLE: electronic-device voltage ; TUPLE: computer < electronic-device cpu ram ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: electronic-device voltage ; TUPLE: computer < electronic-device cpu ram ; C: <computer> computer C: <laptop> laptop C: <server> server" eval( -- ) ] unit-test
test-laptop-slot-values
test-server-slot-values
-[ 220 ] [ "laptop" get voltage>> ] unit-test
-[ 110 ] [ "server" get voltage>> ] unit-test
+{ 220 } [ "laptop" get voltage>> ] unit-test
+{ 110 } [ "server" get voltage>> ] unit-test
! Reshape crash
TUPLE: test1 a ; TUPLE: test2 < test1 b ;
test-a/b
-[ ] [ "IN: classes.tuple.tests TUPLE: test1 a x ; TUPLE: test2 < test1 b y ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: test1 a x ; TUPLE: test2 < test1 b y ;" eval( -- ) ] unit-test
test-a/b
-[ ] [ "IN: classes.tuple.tests TUPLE: test1 a ; TUPLE: test2 < test1 b ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: test1 a ; TUPLE: test2 < test1 b ;" eval( -- ) ] unit-test
test-a/b
test-move-up
-[ ] [ "IN: classes.tuple.tests TUPLE: move-up-1 a b c ; TUPLE: move-up-2 < move-up-1 ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: move-up-1 a b c ; TUPLE: move-up-2 < move-up-1 ;" eval( -- ) ] unit-test
test-move-up
-[ ] [ "IN: classes.tuple.tests TUPLE: move-up-1 a c ; TUPLE: move-up-2 < move-up-1 b ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: move-up-1 a c ; TUPLE: move-up-2 < move-up-1 b ;" eval( -- ) ] unit-test
test-move-up
-[ ] [ "IN: classes.tuple.tests TUPLE: move-up-1 c ; TUPLE: move-up-2 < move-up-1 b a ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: move-up-1 c ; TUPLE: move-up-2 < move-up-1 b a ;" eval( -- ) ] unit-test
test-move-up
-[ ] [ "IN: classes.tuple.tests TUPLE: move-up-1 ; TUPLE: move-up-2 < move-up-1 a b c ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: move-up-1 ; TUPLE: move-up-2 < move-up-1 a b c ;" eval( -- ) ] unit-test
! Constructors must be recompiled when changing superclass
TUPLE: constructor-update-1 xxx ;
{ 3 1 } [ <constructor-update-2> ] must-infer-as
-[ ] [ "IN: classes.tuple.tests TUPLE: constructor-update-1 xxx ttt www ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: constructor-update-1 xxx ttt www ;" eval( -- ) ] unit-test
{ 3 1 } [ <constructor-update-2> ] must-infer-as
[ 1 2 3 4 5 <constructor-update-2> ] [ not-compiled? ] must-fail-with
-[ ] [ [ \ <constructor-update-2> forget ] with-compilation-unit ] unit-test
+{ } [ [ \ <constructor-update-2> forget ] with-compilation-unit ] unit-test
! Redefinition problem
TUPLE: redefinition-problem ;
UNION: redefinition-problem' redefinition-problem integer ;
-[ t ] [ 3 redefinition-problem'? ] unit-test
+{ t } [ 3 redefinition-problem'? ] unit-test
TUPLE: redefinition-problem-2 ;
"IN: classes.tuple.tests TUPLE: redefinition-problem < redefinition-problem-2 ;" eval( -- )
-[ t ] [ 3 redefinition-problem'? ] unit-test
+{ t } [ 3 redefinition-problem'? ] unit-test
! Hardcore unit tests
\ thread "slots" word-prop "slots" set
-[ ] [
+{ } [
[
\ thread tuple { "xxx" } "slots" get append
define-tuple-class
\ vocab "slots" word-prop "slots" set
-[ ] [
+{ } [
[
\ vocab identity-tuple { "xxx" } "slots" get append
define-tuple-class
must-fail-with
! Accessors not being forgotten...
-[ [ ] ] [
+{ [ ] } [
"IN: classes.tuple.tests TUPLE: forget-accessors-test x y z ;"
<string-reader>
"forget-accessors-test" parse-stream
] unit-test
-[ t ] [ "forget-accessors-test" "classes.tuple.tests" lookup-word class? ] unit-test
+{ t } [ "forget-accessors-test" "classes.tuple.tests" lookup-word class? ] unit-test
: accessor-exists? ( name -- ? )
[ "forget-accessors-test" "classes.tuple.tests" lookup-word ] dip
">>" append "accessors" lookup-word ?lookup-method >boolean ;
-[ t ] [ "x" accessor-exists? ] unit-test
-[ t ] [ "y" accessor-exists? ] unit-test
-[ t ] [ "z" accessor-exists? ] unit-test
+{ t } [ "x" accessor-exists? ] unit-test
+{ t } [ "y" accessor-exists? ] unit-test
+{ t } [ "z" accessor-exists? ] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: classes.tuple.tests GENERIC: forget-accessors-test ( a -- b )"
<string-reader>
"forget-accessors-test" parse-stream
] unit-test
-[ f ] [ "forget-accessors-test" "classes.tuple.tests" lookup-word class? ] unit-test
+{ f } [ "forget-accessors-test" "classes.tuple.tests" lookup-word class? ] unit-test
-[ f ] [ "x" accessor-exists? ] unit-test
-[ f ] [ "y" accessor-exists? ] unit-test
-[ f ] [ "z" accessor-exists? ] unit-test
+{ f } [ "x" accessor-exists? ] unit-test
+{ f } [ "y" accessor-exists? ] unit-test
+{ f } [ "z" accessor-exists? ] unit-test
TUPLE: another-forget-accessors-test ;
-[ [ ] ] [
+{ [ ] } [
"IN: classes.tuple.tests GENERIC: another-forget-accessors-test ( a -- b )"
<string-reader>
"another-forget-accessors-test" parse-stream
] unit-test
-[ t ] [ \ another-forget-accessors-test class? ] unit-test
+{ t } [ \ another-forget-accessors-test class? ] unit-test
! Shadowing test
-[ f ] [
+{ f } [
f parser-quiet? [
[
"IN: classes.tuple.tests TUPLE: shadow-1 a b ; TUPLE: shadow-2 < shadow-1 a b ;" eval( -- )
! Check type declarations
TUPLE: declared-types { n fixnum } { m string } ;
-[ T{ declared-types f 0 "hi" } ]
+{ T{ declared-types f 0 "hi" } }
[ { declared-types 0 "hi" } >tuple ]
unit-test
[ declared-types new 0.0 >>n n>> ] [ T{ no-method f 0.0 integer>fixnum-strict } = ] must-fail-with
-[ T{ declared-types f 33333 "asdf" } ]
+{ T{ declared-types f 33333 "asdf" } }
[ 33333 >bignum "asdf" declared-types boa ] unit-test
[ 444444444444444444444444444444444444444444444444433333 >bignum "asdf" declared-types boa ]
! Check bignum coercer
TUPLE: bignum-coercer { n bignum initial: $[ 0 >bignum ] } ;
-[ 13 bignum ] [ 13.5 bignum-coercer boa n>> dup class-of ] unit-test
+{ 13 bignum } [ 13.5 bignum-coercer boa n>> dup class-of ] unit-test
-[ 13 bignum ] [ bignum-coercer new 13.5 >>n n>> dup class-of ] unit-test
+{ 13 bignum } [ bignum-coercer new 13.5 >>n n>> dup class-of ] unit-test
! Check float coercer
TUPLE: float-coercer { n float } ;
-[ 13.0 float ] [ 13 float-coercer boa n>> dup class-of ] unit-test
+{ 13.0 float } [ 13 float-coercer boa n>> dup class-of ] unit-test
-[ 13.0 float ] [ float-coercer new 13 >>n n>> dup class-of ] unit-test
+{ 13.0 float } [ float-coercer new 13 >>n n>> dup class-of ] unit-test
! Check integer coercer
TUPLE: integer-coercer { n integer } ;
[ T{ bad-slot-value f { } string } = ]
must-fail-with
-[ T{ declared-types f 0 "" } ] [ declared-types new ] unit-test
+{ T{ declared-types f 0 "" } } [ declared-types new ] unit-test
: blah ( -- vec ) vector new ;
[ vector new ] must-infer
-[ V{ } ] [ blah ] unit-test
+{ V{ } } [ blah ] unit-test
! Test reshaping with type declarations and slot attributes
TUPLE: reshape-test x ;
T{ reshape-test f "hi" } "tuple" set
-[ ] [ "IN: classes.tuple.tests TUPLE: reshape-test { x read-only } ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: reshape-test { x read-only } ;" eval( -- ) ] unit-test
-[ f ] [ \ reshape-test \ x<< ?lookup-method ] unit-test
+{ f } [ \ reshape-test \ x<< ?lookup-method ] unit-test
[ "tuple" get 5 >>x ] must-fail
-[ "hi" ] [ "tuple" get x>> ] unit-test
+{ "hi" } [ "tuple" get x>> ] unit-test
-[ ] [ "IN: classes.tuple.tests USE: math TUPLE: reshape-test { x integer read-only } ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests USE: math TUPLE: reshape-test { x integer read-only } ;" eval( -- ) ] unit-test
-[ 0 ] [ "tuple" get x>> ] unit-test
+{ 0 } [ "tuple" get x>> ] unit-test
-[ ] [ "IN: classes.tuple.tests USE: math TUPLE: reshape-test { x fixnum initial: 4 read-only } ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests USE: math TUPLE: reshape-test { x fixnum initial: 4 read-only } ;" eval( -- ) ] unit-test
-[ 0 ] [ "tuple" get x>> ] unit-test
+{ 0 } [ "tuple" get x>> ] unit-test
TUPLE: boa-coercer-test { x array-capacity } ;
-[ fixnum ] [ 0 >bignum boa-coercer-test boa x>> class-of ] unit-test
+{ fixnum } [ 0 >bignum boa-coercer-test boa x>> class-of ] unit-test
-[ T{ boa-coercer-test f 0 } ] [ T{ boa-coercer-test } ] unit-test
+{ T{ boa-coercer-test f 0 } } [ T{ boa-coercer-test } ] unit-test
! Test error classes
ERROR: error-class-test a b c ;
-[ "( a b c -- * )" ] [ \ error-class-test stack-effect effect>string ] unit-test
-[ f ] [ \ error-class-test "inline" word-prop ] unit-test
+{ "( a b c -- * )" } [ \ error-class-test stack-effect effect>string ] unit-test
+{ f } [ \ error-class-test "inline" word-prop ] unit-test
[ "IN: classes.tuple.tests ERROR: error-x ; : error-x 3 ;" eval( -- ) ]
[ error>> error>> redefine-error? ] must-fail-with
DEFER: error-y
-[ ] [ [ \ error-y dup class? [ forget-class ] [ drop ] if ] with-compilation-unit ] unit-test
+{ } [ [ \ error-y dup class? [ forget-class ] [ drop ] if ] with-compilation-unit ] unit-test
-[ ] [ "IN: classes.tuple.tests GENERIC: error-y ( a -- b )" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests GENERIC: error-y ( a -- b )" eval( -- ) ] unit-test
-[ f ] [ \ error-y tuple-class? ] unit-test
+{ f } [ \ error-y tuple-class? ] unit-test
-[ f ] [ \ error-y error-class? ] unit-test
+{ f } [ \ error-y error-class? ] unit-test
-[ t ] [ \ error-y generic? ] unit-test
+{ t } [ \ error-y generic? ] unit-test
-[ ] [ "IN: classes.tuple.tests ERROR: error-y ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests ERROR: error-y ;" eval( -- ) ] unit-test
-[ t ] [ \ error-y tuple-class? ] unit-test
+{ t } [ \ error-y tuple-class? ] unit-test
-[ t ] [ \ error-y error-class? ] unit-test
+{ t } [ \ error-y error-class? ] unit-test
-[ f ] [ \ error-y generic? ] unit-test
+{ f } [ \ error-y generic? ] unit-test
-[ ] [
+{ } [
"IN: classes.tuple.tests TUPLE: forget-subclass-test ; TUPLE: forget-subclass-test' < forget-subclass-test ;"
<string-reader> "forget-subclass-test" parse-stream
drop
] unit-test
-[ ] [ "forget-subclass-test'" "classes.tuple.tests" lookup-word new "bad-object" set ] unit-test
+{ } [ "forget-subclass-test'" "classes.tuple.tests" lookup-word new "bad-object" set ] unit-test
-[ ] [
+{ } [
"IN: classes.tuple.tests TUPLE: forget-subclass-test a ;"
<string-reader> "forget-subclass-test" parse-stream
drop
] unit-test
-[ ] [
+{ } [
"IN: sequences TUPLE: reversed { seq read-only } ;" eval( -- )
] unit-test
M: bogus-hashcode-1 hashcode* 2drop 0 >bignum ;
-[ ] [ T{ bogus-hashcode-2 f T{ bogus-hashcode-1 } } hashcode drop ] unit-test
+{ } [ T{ bogus-hashcode-2 f T{ bogus-hashcode-1 } } hashcode drop ] unit-test
DEFER: change-slot-test
SLOT: kex
-[ ] [
+{ } [
"IN: classes.tuple.tests USING: kernel accessors ; TUPLE: change-slot-test ; SLOT: kex M: change-slot-test kex>> drop 3 ;"
<string-reader> "change-slot-test" parse-stream
drop
] unit-test
-[ t ] [ \ change-slot-test \ kex>> ?lookup-method >boolean ] unit-test
+{ t } [ \ change-slot-test \ kex>> ?lookup-method >boolean ] unit-test
-[ ] [
+{ } [
"IN: classes.tuple.tests USING: kernel accessors ; TUPLE: change-slot-test kex ;"
<string-reader> "change-slot-test" parse-stream
drop
] unit-test
-[ t ] [ \ change-slot-test \ kex>> ?lookup-method >boolean ] unit-test
+{ t } [ \ change-slot-test \ kex>> ?lookup-method >boolean ] unit-test
-[ ] [
+{ } [
"IN: classes.tuple.tests USING: kernel accessors ; TUPLE: change-slot-test ; SLOT: kex M: change-slot-test kex>> drop 3 ;"
<string-reader> "change-slot-test" parse-stream
drop
] unit-test
-[ t ] [ \ change-slot-test \ kex>> ?lookup-method >boolean ] unit-test
-[ f ] [ \ change-slot-test \ kex>> ?lookup-method "reading" word-prop ] unit-test
+{ t } [ \ change-slot-test \ kex>> ?lookup-method >boolean ] unit-test
+{ f } [ \ change-slot-test \ kex>> ?lookup-method "reading" word-prop ] unit-test
DEFER: redefine-tuple-twice
-[ ] [ "IN: classes.tuple.tests TUPLE: redefine-tuple-twice ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: redefine-tuple-twice ;" eval( -- ) ] unit-test
-[ t ] [ \ redefine-tuple-twice symbol? ] unit-test
+{ t } [ \ redefine-tuple-twice symbol? ] unit-test
-[ ] [ "IN: classes.tuple.tests DEFER: redefine-tuple-twice" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests DEFER: redefine-tuple-twice" eval( -- ) ] unit-test
-[ t ] [ \ redefine-tuple-twice deferred? ] unit-test
+{ t } [ \ redefine-tuple-twice deferred? ] unit-test
-[ ] [ "IN: classes.tuple.tests TUPLE: redefine-tuple-twice ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: redefine-tuple-twice ;" eval( -- ) ] unit-test
-[ t ] [ \ redefine-tuple-twice symbol? ] unit-test
+{ t } [ \ redefine-tuple-twice symbol? ] unit-test
ERROR: base-error x y ;
ERROR: derived-error < base-error z ;
-[ ( x y z -- * ) ] [ \ derived-error stack-effect ] unit-test
+{ ( x y z -- * ) } [ \ derived-error stack-effect ] unit-test
! Make sure that tuple reshaping updates code heap roots
TUPLE: code-heap-ref ;
: code-heap-ref' ( -- a ) T{ code-heap-ref } ;
! Push foo's literal to tenured space
-[ ] [ gc ] unit-test
+{ } [ gc ] unit-test
! Reshape!
-[ ] [ "IN: classes.tuple.tests USE: math TUPLE: code-heap-ref { x integer initial: 5 } ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests USE: math TUPLE: code-heap-ref { x integer initial: 5 } ;" eval( -- ) ] unit-test
! Code heap reference
-[ t ] [ code-heap-ref' code-heap-ref? ] unit-test
-[ 5 ] [ code-heap-ref' x>> ] unit-test
+{ t } [ code-heap-ref' code-heap-ref? ] unit-test
+{ 5 } [ code-heap-ref' x>> ] unit-test
! Data heap reference
-[ t ] [ \ code-heap-ref' def>> first code-heap-ref? ] unit-test
-[ 5 ] [ \ code-heap-ref' def>> first x>> ] unit-test
+{ t } [ \ code-heap-ref' def>> first code-heap-ref? ] unit-test
+{ 5 } [ \ code-heap-ref' def>> first x>> ] unit-test
! If the metaclass of a superclass changes into something other
! than a tuple class, the tuple needs to have its superclass reset
TUPLE: metaclass-change ;
TUPLE: metaclass-change-subclass < metaclass-change ;
-[ metaclass-change ] [ metaclass-change-subclass superclass ] unit-test
+{ metaclass-change } [ metaclass-change-subclass superclass ] unit-test
-[ ] [ "IN: classes.tuple.tests MIXIN: metaclass-change" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests MIXIN: metaclass-change" eval( -- ) ] unit-test
-[ t ] [ metaclass-change-subclass tuple-class? ] unit-test
-[ tuple ] [ metaclass-change-subclass superclass ] unit-test
+{ t } [ metaclass-change-subclass tuple-class? ] unit-test
+{ tuple } [ metaclass-change-subclass superclass ] unit-test
! Reshaping bug related to the above
TUPLE: a-g ;
TUPLE: g < a-g ;
-[ ] [ g new "g" set ] unit-test
+{ } [ g new "g" set ] unit-test
-[ ] [ "IN: classes.tuple.tests MIXIN: a-g TUPLE: g ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests MIXIN: a-g TUPLE: g ;" eval( -- ) ] unit-test
-[ t ] [ g new layout-of "g" get layout-of eq? ] unit-test
+{ t } [ g new layout-of "g" get layout-of eq? ] unit-test
! Joe Groff discovered this bug
DEFER: factor-crashes-anymore
-[ ] [
+{ } [
"IN: classes.tuple.tests
TUPLE: unsafe-slot-access ;
CONSTANT: unsafe-slot-access' T{ unsafe-slot-access }" eval( -- )
] unit-test
-[ ] [
+{ } [
"IN: classes.tuple.tests
USE: accessors
TUPLE: unsafe-slot-access { x read-only initial: 31337 } ;
: factor-crashes-anymore ( -- x ) unsafe-slot-access' x>> ;" eval( -- )
] unit-test
-[ 31337 ] [ factor-crashes-anymore ] unit-test
+{ 31337 } [ factor-crashes-anymore ] unit-test
TUPLE: tuple-predicate-redefine-test ;
-[ ] [ "IN: classes.tuple.tests TUPLE: tuple-predicate-redefine-test ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: tuple-predicate-redefine-test ;" eval( -- ) ] unit-test
-[ t ] [ \ tuple-predicate-redefine-test? predicate? ] unit-test
+{ t } [ \ tuple-predicate-redefine-test? predicate? ] unit-test
! Final classes
TUPLE: final-superclass ;
TUPLE: final-subclass < final-superclass ;
-[ final-superclass ] [ final-subclass superclass ] unit-test
+{ final-superclass } [ final-subclass superclass ] unit-test
! Making the superclass final should change the superclass of the subclass
-[ ] [ "IN: classes.tuple.tests TUPLE: final-superclass ; final" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: final-superclass ; final" eval( -- ) ] unit-test
-[ tuple ] [ final-subclass superclass ] unit-test
+{ tuple } [ final-subclass superclass ] unit-test
-[ f ] [ \ final-subclass final-class? ] unit-test
+{ f } [ \ final-subclass final-class? ] unit-test
! Subclassing a final class should fail
[ "IN: classes.tuple.tests TUPLE: final-subclass < final-superclass ;" eval( -- ) ]
[ error>> bad-superclass? ] must-fail-with
! Making a final class non-final should work
-[ ] [ "IN: classes.tuple.tests TUPLE: final-superclass ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: final-superclass ;" eval( -- ) ] unit-test
-[ ] [ "IN: classes.tuple.tests TUPLE: final-subclass < final-superclass ; final" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: final-subclass < final-superclass ; final" eval( -- ) ] unit-test
! Changing a superclass should not change the final status of a subclass
-[ ] [ "IN: classes.tuple.tests TUPLE: final-superclass x ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: final-superclass x ;" eval( -- ) ] unit-test
-[ t ] [ \ final-subclass final-class? ] unit-test
+{ t } [ \ final-subclass final-class? ] unit-test
! Test reset-class on tuples
! Should forget all accessors on rclasstest
TUPLE: rclasstest a b ;
-[ ] [ [ \ rclasstest reset-class ] with-compilation-unit ] unit-test
-[ f ] [ \ rclasstest \ a>> ?lookup-method ] unit-test
-[ f ] [ \ rclasstest \ a<< ?lookup-method ] unit-test
-[ f ] [ \ rclasstest \ b>> ?lookup-method ] unit-test
-[ f ] [ \ rclasstest \ b<< ?lookup-method ] unit-test
+{ } [ [ \ rclasstest reset-class ] with-compilation-unit ] unit-test
+{ f } [ \ rclasstest \ a>> ?lookup-method ] unit-test
+{ f } [ \ rclasstest \ a<< ?lookup-method ] unit-test
+{ f } [ \ rclasstest \ b>> ?lookup-method ] unit-test
+{ f } [ \ rclasstest \ b<< ?lookup-method ] unit-test
<< \ rclasstest forget >>
DEFER: initial-slot
-[ ] [ "IN: classes.tuple.tests TUPLE: initial-slot { x initial-class } ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.tuple.tests TUPLE: initial-slot { x initial-class } ;" eval( -- ) ] unit-test
-[ t ] [ initial-slot new x>> initial-class? ] unit-test
+{ t } [ initial-slot new x>> initial-class? ] unit-test
[ "IN: classes.tuple.tests TUPLE: initial-slot { x initial-class initial: f } ;" eval( -- ) ]
[ error>> T{ bad-initial-value f "x" f initial-class } = ] must-fail-with
! DEFER: bah
! FORGET: bah
UNION: bah fixnum alien ;
-[ bah ] [ \ bah? "predicating" word-prop ] unit-test
+{ bah } [ \ bah? "predicating" word-prop ] unit-test
-[ "USING: alien math ;\nIN: classes.union.tests\nUNION: bah fixnum alien ;\n" ]
+{ "USING: alien math ;\nIN: classes.union.tests\nUNION: bah fixnum alien ;\n" }
[ [ \ bah see ] with-string-writer ] unit-test
! Test redefinition of classes
M: union-1 generic-update-test drop "union-1" ;
-[ f ] [ bignum union-1 class<= ] unit-test
-[ t ] [ union-1 number class<= ] unit-test
-[ "union-1" ] [ 1.0 generic-update-test ] unit-test
+{ f } [ bignum union-1 class<= ] unit-test
+{ t } [ union-1 number class<= ] unit-test
+{ "union-1" } [ 1.0 generic-update-test ] unit-test
"IN: classes.union.tests USE: math USE: arrays UNION: union-1 rational array ;" eval( -- )
-[ t ] [ bignum union-1 class<= ] unit-test
-[ f ] [ union-1 number class<= ] unit-test
-[ "union-1" ] [ { 1.0 } generic-update-test ] unit-test
+{ t } [ bignum union-1 class<= ] unit-test
+{ f } [ union-1 number class<= ] unit-test
+{ "union-1" } [ { 1.0 } generic-update-test ] unit-test
"IN: classes.union.tests USE: math PREDICATE: union-1 < integer even? ;" eval( -- )
-[ f ] [ union-1 union-class? ] unit-test
-[ t ] [ union-1 predicate-class? ] unit-test
-[ "union-1" ] [ 8 generic-update-test ] unit-test
+{ f } [ union-1 union-class? ] unit-test
+{ t } [ union-1 predicate-class? ] unit-test
+{ "union-1" } [ 8 generic-update-test ] unit-test
[ -7 generic-update-test ] must-fail
! Empty unions were causing problems
M: empty-union-2 empty-union-test ;
-[ [ drop f ] ] [ \ empty-union-1? def>> ] unit-test
+{ [ drop f ] } [ \ empty-union-1? def>> ] unit-test
! Redefining a class didn't update containing unions
UNION: redefine-bug-1 fixnum ;
UNION: redefine-bug-2 redefine-bug-1 quotation ;
-[ t ] [ fixnum redefine-bug-2 class<= ] unit-test
-[ t ] [ quotation redefine-bug-2 class<= ] unit-test
+{ t } [ fixnum redefine-bug-2 class<= ] unit-test
+{ t } [ quotation redefine-bug-2 class<= ] unit-test
-[ ] [ "IN: classes.union.tests USE: math UNION: redefine-bug-1 bignum ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.union.tests USE: math UNION: redefine-bug-1 bignum ;" eval( -- ) ] unit-test
-[ t ] [ bignum redefine-bug-1 class<= ] unit-test
-[ f ] [ fixnum redefine-bug-2 class<= ] unit-test
-[ t ] [ bignum redefine-bug-2 class<= ] unit-test
+{ t } [ bignum redefine-bug-1 class<= ] unit-test
+{ f } [ fixnum redefine-bug-2 class<= ] unit-test
+{ t } [ bignum redefine-bug-2 class<= ] unit-test
! Too eager with reset-class
-[ ] [ "IN: classes.union.tests SINGLETON: foo UNION: blah foo ;" <string-reader> "union-reset-test" parse-stream drop ] unit-test
+{ } [ "IN: classes.union.tests SINGLETON: foo UNION: blah foo ;" <string-reader> "union-reset-test" parse-stream drop ] unit-test
-[ t ] [ "blah" "classes.union.tests" lookup-word union-class? ] unit-test
+{ t } [ "blah" "classes.union.tests" lookup-word union-class? ] unit-test
-[ t ] [ "foo?" "classes.union.tests" lookup-word predicate? ] unit-test
+{ t } [ "foo?" "classes.union.tests" lookup-word predicate? ] unit-test
-[ ] [ "IN: classes.union.tests USE: math UNION: blah integer ;" <string-reader> "union-reset-test" parse-stream drop ] unit-test
+{ } [ "IN: classes.union.tests USE: math UNION: blah integer ;" <string-reader> "union-reset-test" parse-stream drop ] unit-test
-[ t ] [ "blah" "classes.union.tests" lookup-word union-class? ] unit-test
+{ t } [ "blah" "classes.union.tests" lookup-word union-class? ] unit-test
-[ f ] [ "foo?" "classes.union.tests" lookup-word predicate? ] unit-test
+{ f } [ "foo?" "classes.union.tests" lookup-word predicate? ] unit-test
GENERIC: test-generic ( x -- y )
M: a-union test-generic ;
-[ f ] [ \ test-generic "methods" word-prop assoc-empty? ] unit-test
+{ f } [ \ test-generic "methods" word-prop assoc-empty? ] unit-test
-[ ] [ [ \ a-tuple forget-class ] with-compilation-unit ] unit-test
+{ } [ [ \ a-tuple forget-class ] with-compilation-unit ] unit-test
-[ t ] [ \ test-generic "methods" word-prop assoc-empty? ] unit-test
+{ t } [ \ test-generic "methods" word-prop assoc-empty? ] unit-test
! Fast union predicates
-[ t ] [ integer union-of-builtins? ] unit-test
+{ t } [ integer union-of-builtins? ] unit-test
-[ t ] [ \ integer? def>> \ fixnum-bitand swap member? ] unit-test
+{ t } [ \ integer? def>> \ fixnum-bitand swap member? ] unit-test
-[ ] [ "IN: classes.union.tests USE: math UNION: fast-union-1 fixnum ; UNION: fast-union-2 fast-union-1 bignum ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.union.tests USE: math UNION: fast-union-1 fixnum ; UNION: fast-union-2 fast-union-1 bignum ;" eval( -- ) ] unit-test
-[ t ] [ "fast-union-2?" "classes.union.tests" lookup-word def>> \ fixnum-bitand swap member? ] unit-test
+{ t } [ "fast-union-2?" "classes.union.tests" lookup-word def>> \ fixnum-bitand swap member? ] unit-test
-[ ] [ "IN: classes.union.tests USE: vectors UNION: fast-union-1 vector ;" eval( -- ) ] unit-test
+{ } [ "IN: classes.union.tests USE: vectors UNION: fast-union-1 vector ;" eval( -- ) ] unit-test
-[ f ] [ "fast-union-2?" "classes.union.tests" lookup-word def>> \ fixnum-bitand swap member? ] unit-test
+{ f } [ "fast-union-2?" "classes.union.tests" lookup-word def>> \ fixnum-bitand swap member? ] unit-test
! Test union{
TUPLE: stuff { a union{ integer string } } ;
-[ 0 ] [ stuff new a>> ] unit-test
-[ 3 ] [ stuff new 3 >>a a>> ] unit-test
-[ "asdf" ] [ stuff new "asdf" >>a a>> ] unit-test
+{ 0 } [ stuff new a>> ] unit-test
+{ 3 } [ stuff new 3 >>a a>> ] unit-test
+{ "asdf" } [ stuff new "asdf" >>a a>> ] unit-test
[ stuff new 3.4 >>a a>> ] [ bad-slot-value? ] must-fail-with
TUPLE: things { a union{ integer float } } ;
-[ 0 ] [ stuff new a>> ] unit-test
-[ 3 ] [ stuff new 3 >>a a>> ] unit-test
-[ "asdf" ] [ stuff new "asdf" >>a a>> ] unit-test
+{ 0 } [ stuff new a>> ] unit-test
+{ 3 } [ stuff new 3 >>a a>> ] unit-test
+{ "asdf" } [ stuff new "asdf" >>a a>> ] unit-test
[ stuff new 3.4 >>a a>> ] [ bad-slot-value? ] must-fail-with
PREDICATE: numba-ova-10 < union{ float integer }
10 > ;
-[ f ] [ 100/3 numba-ova-10? ] unit-test
-[ t ] [ 100 numba-ova-10? ] unit-test
-[ t ] [ 100.0 numba-ova-10? ] unit-test
-[ f ] [ 5 numba-ova-10? ] unit-test
-[ f ] [ 5.75 numba-ova-10? ] unit-test
+{ f } [ 100/3 numba-ova-10? ] unit-test
+{ t } [ 100 numba-ova-10? ] unit-test
+{ t } [ 100.0 numba-ova-10? ] unit-test
+{ f } [ 5 numba-ova-10? ] unit-test
+{ f } [ 5.75 numba-ova-10? ] unit-test
! Issue #420 lol
[ "IN: issue-420 UNION: omg omg ;" eval( -- ) ]
math.functions arrays combinators.private stack-checker ;
IN: combinators.tests
-[ 3 ] [ 1 2 [ + ] call( x y -- z ) ] unit-test
+{ 3 } [ 1 2 [ + ] call( x y -- z ) ] unit-test
[ 1 2 [ + ] call( -- z ) ] must-fail
[ 1 2 [ + ] call( x y -- z a ) ] must-fail
-[ 1 2 3 { 1 2 3 4 } ] [ 1 2 3 4 [ datastack nip ] call( x -- y ) ] unit-test
+{ 1 2 3 { 1 2 3 4 } } [ 1 2 3 4 [ datastack nip ] call( x -- y ) ] unit-test
[ [ + ] call( x y -- z ) ] must-infer
-[ 3 ] [ 1 2 \ + execute( x y -- z ) ] unit-test
+{ 3 } [ 1 2 \ + execute( x y -- z ) ] unit-test
[ 1 2 \ + execute( -- z ) ] must-fail
[ 1 2 \ + execute( x y -- z a ) ] must-fail
[ \ + execute( x y -- z ) ] must-infer
: compile-execute(-test-1 ( a b -- c ) \ + execute( a b -- c ) ;
-[ t ] [ \ compile-execute(-test-1 optimized? ] unit-test
-[ 4 ] [ 1 3 compile-execute(-test-1 ] unit-test
+{ t } [ \ compile-execute(-test-1 optimized? ] unit-test
+{ 4 } [ 1 3 compile-execute(-test-1 ] unit-test
: compile-execute(-test-2 ( a b w -- c ) execute( a b -- c ) ;
-[ t ] [ \ compile-execute(-test-2 optimized? ] unit-test
-[ 4 ] [ 1 3 \ + compile-execute(-test-2 ] unit-test
-[ 5 ] [ 1 4 \ + compile-execute(-test-2 ] unit-test
-[ -3 ] [ 1 4 \ - compile-execute(-test-2 ] unit-test
-[ 5 ] [ 1 4 \ + compile-execute(-test-2 ] unit-test
+{ t } [ \ compile-execute(-test-2 optimized? ] unit-test
+{ 4 } [ 1 3 \ + compile-execute(-test-2 ] unit-test
+{ 5 } [ 1 4 \ + compile-execute(-test-2 ] unit-test
+{ -3 } [ 1 4 \ - compile-execute(-test-2 ] unit-test
+{ 5 } [ 1 4 \ + compile-execute(-test-2 ] unit-test
: compile-call(-test-1 ( a b q -- c ) call( a b -- c ) ;
-[ t ] [ \ compile-call(-test-1 optimized? ] unit-test
-[ 4 ] [ 1 3 [ + ] compile-call(-test-1 ] unit-test
-[ 7 ] [ 1 3 2 [ * + ] curry compile-call(-test-1 ] unit-test
-[ 7 ] [ 1 3 [ 2 * ] [ + ] compose compile-call(-test-1 ] unit-test
-[ 4 ] [ 1 3 [ { + } [ ] like call ] compile-call(-test-1 ] unit-test
+{ t } [ \ compile-call(-test-1 optimized? ] unit-test
+{ 4 } [ 1 3 [ + ] compile-call(-test-1 ] unit-test
+{ 7 } [ 1 3 2 [ * + ] curry compile-call(-test-1 ] unit-test
+{ 7 } [ 1 3 [ 2 * ] [ + ] compose compile-call(-test-1 ] unit-test
+{ 4 } [ 1 3 [ { + } [ ] like call ] compile-call(-test-1 ] unit-test
[ [ ] call( -- * ) ] must-fail
\ cond-test-1 def>> must-infer
-[ "even" ] [ 2 cond-test-1 ] unit-test
-[ "even" ] [ 2 \ cond-test-1 def>> call ] unit-test
-[ "odd" ] [ 3 cond-test-1 ] unit-test
-[ "odd" ] [ 3 \ cond-test-1 def>> call ] unit-test
+{ "even" } [ 2 cond-test-1 ] unit-test
+{ "even" } [ 2 \ cond-test-1 def>> call ] unit-test
+{ "odd" } [ 3 cond-test-1 ] unit-test
+{ "odd" } [ 3 \ cond-test-1 def>> call ] unit-test
: cond-test-2 ( obj -- str )
{
\ cond-test-2 def>> must-infer
-[ "true" ] [ t cond-test-2 ] unit-test
-[ "true" ] [ t \ cond-test-2 def>> call ] unit-test
-[ "false" ] [ f cond-test-2 ] unit-test
-[ "false" ] [ f \ cond-test-2 def>> call ] unit-test
-[ "something else" ] [ "ohio" cond-test-2 ] unit-test
-[ "something else" ] [ "ohio" \ cond-test-2 def>> call ] unit-test
+{ "true" } [ t cond-test-2 ] unit-test
+{ "true" } [ t \ cond-test-2 def>> call ] unit-test
+{ "false" } [ f cond-test-2 ] unit-test
+{ "false" } [ f \ cond-test-2 def>> call ] unit-test
+{ "something else" } [ "ohio" cond-test-2 ] unit-test
+{ "something else" } [ "ohio" \ cond-test-2 def>> call ] unit-test
: cond-test-3 ( obj -- str )
{
\ cond-test-3 def>> must-infer
-[ "something else" ] [ t cond-test-3 ] unit-test
-[ "something else" ] [ t \ cond-test-3 def>> call ] unit-test
-[ "something else" ] [ f cond-test-3 ] unit-test
-[ "something else" ] [ f \ cond-test-3 def>> call ] unit-test
-[ "something else" ] [ "ohio" cond-test-3 ] unit-test
-[ "something else" ] [ "ohio" \ cond-test-3 def>> call ] unit-test
+{ "something else" } [ t cond-test-3 ] unit-test
+{ "something else" } [ t \ cond-test-3 def>> call ] unit-test
+{ "something else" } [ f cond-test-3 ] unit-test
+{ "something else" } [ f \ cond-test-3 def>> call ] unit-test
+{ "something else" } [ "ohio" cond-test-3 ] unit-test
+{ "something else" } [ "ohio" \ cond-test-3 def>> call ] unit-test
: cond-test-4 ( -- )
{
{ [ dup 2 mod 0 = ] [ drop "even" ] }
} cond ;
-[ "early" ] [ 2 cond-test-5 ] unit-test
-[ "early" ] [ 2 \ cond-test-5 def>> call ] unit-test
+{ "early" } [ 2 cond-test-5 ] unit-test
+{ "early" } [ 2 \ cond-test-5 def>> call ] unit-test
: cond-test-6 ( a -- b )
{
{ [ dup 2 mod 0 = ] [ drop "even" ] }
} cond ;
-[ "really early" ] [ 2 cond-test-6 ] unit-test
-[ "really early" ] [ 2 \ cond-test-6 def>> call ] unit-test
+{ "really early" } [ 2 cond-test-6 ] unit-test
+{ "really early" } [ 2 \ cond-test-6 def>> call ] unit-test
! Case
: case-test-1 ( obj -- obj' )
\ case-test-1 def>> must-infer
-[ "two" ] [ 2 case-test-1 ] unit-test
-[ "two" ] [ 2 \ case-test-1 def>> call ] unit-test
+{ "two" } [ 2 case-test-1 ] unit-test
+{ "two" } [ 2 \ case-test-1 def>> call ] unit-test
[ "x" case-test-1 ] must-fail
[ "x" \ case-test-1 def>> call ] must-fail
\ case-test-2 def>> must-infer
-[ 25 ] [ 5 case-test-2 ] unit-test
-[ 25 ] [ 5 \ case-test-2 def>> call ] unit-test
+{ 25 } [ 5 case-test-2 ] unit-test
+{ 25 } [ 5 \ case-test-2 def>> call ] unit-test
: case-test-3 ( obj -- obj' )
{
\ case-test-3 def>> must-infer
-[ "an array" ] [ { 1 2 3 } case-test-3 ] unit-test
-[ "an array" ] [ { 1 2 3 } \ case-test-3 def>> call ] unit-test
+{ "an array" } [ { 1 2 3 } case-test-3 ] unit-test
+{ "an array" } [ { 1 2 3 } \ case-test-3 def>> call ] unit-test
CONSTANT: case-const-1 1
CONSTANT: case-const-2 2
\ case-test-4 def>> must-infer
-[ "uno" ] [ 1 case-test-4 ] unit-test
-[ "dos" ] [ 2 case-test-4 ] unit-test
-[ "tres" ] [ 3 case-test-4 ] unit-test
-[ "demasiado" ] [ 100 case-test-4 ] unit-test
+{ "uno" } [ 1 case-test-4 ] unit-test
+{ "dos" } [ 2 case-test-4 ] unit-test
+{ "tres" } [ 3 case-test-4 ] unit-test
+{ "demasiado" } [ 100 case-test-4 ] unit-test
-[ "uno" ] [ 1 \ case-test-4 def>> call ] unit-test
-[ "dos" ] [ 2 \ case-test-4 def>> call ] unit-test
-[ "tres" ] [ 3 \ case-test-4 def>> call ] unit-test
-[ "demasiado" ] [ 100 \ case-test-4 def>> call ] unit-test
+{ "uno" } [ 1 \ case-test-4 def>> call ] unit-test
+{ "dos" } [ 2 \ case-test-4 def>> call ] unit-test
+{ "tres" } [ 3 \ case-test-4 def>> call ] unit-test
+{ "demasiado" } [ 100 \ case-test-4 def>> call ] unit-test
: case-test-5 ( obj -- )
{
\ case-test-5 def>> must-infer
-[ ] [ 1 case-test-5 ] unit-test
-[ ] [ 1 \ case-test-5 def>> call ] unit-test
+{ } [ 1 case-test-5 ] unit-test
+{ } [ 1 \ case-test-5 def>> call ] unit-test
: do-not-call ( -- * ) "do not call" throw ;
\ test-case-6 def>> must-infer
-[ "three" ] [ 3 test-case-6 ] unit-test
-[ "do-not-call" ] [ \ do-not-call test-case-6 ] unit-test
+{ "three" } [ 3 test-case-6 ] unit-test
+{ "do-not-call" } [ \ do-not-call test-case-6 ] unit-test
-[ t ] [ { 1 3 2 } contiguous-range? ] unit-test
-[ f ] [ { 1 2 2 4 } contiguous-range? ] unit-test
-[ f ] [ { + 3 2 } contiguous-range? ] unit-test
-[ f ] [ { 1 0 7 } contiguous-range? ] unit-test
-[ f ] [ { 1 1 3 7 } contiguous-range? ] unit-test
-[ t ] [ { 7 6 4 8 5 } contiguous-range? ] unit-test
+{ t } [ { 1 3 2 } contiguous-range? ] unit-test
+{ f } [ { 1 2 2 4 } contiguous-range? ] unit-test
+{ f } [ { + 3 2 } contiguous-range? ] unit-test
+{ f } [ { 1 0 7 } contiguous-range? ] unit-test
+{ f } [ { 1 1 3 7 } contiguous-range? ] unit-test
+{ t } [ { 7 6 4 8 5 } contiguous-range? ] unit-test
: test-case-7 ( obj -- str )
\ test-case-7 def>> must-infer
-[ "plus" ] [ \ + test-case-7 ] unit-test
-[ "plus" ] [ \ + \ test-case-7 def>> call ] unit-test
+{ "plus" } [ \ + test-case-7 ] unit-test
+{ "plus" } [ \ + \ test-case-7 def>> call ] unit-test
DEFER: corner-case-1
<< \ corner-case-1 2 [ + ] curry 1array [ case ] curry ( a -- b ) define-declared >>
-[ t ] [ \ corner-case-1 optimized? ] unit-test
+{ t } [ \ corner-case-1 optimized? ] unit-test
-[ 4 ] [ 2 corner-case-1 ] unit-test
-[ 4 ] [ 2 \ corner-case-1 def>> call ] unit-test
+{ 4 } [ 2 corner-case-1 ] unit-test
+{ 4 } [ 2 \ corner-case-1 def>> call ] unit-test
: test-case-8 ( n -- string )
{
{ \ - [ "minus 2" ] }
} case ;
-[ "plus" ] [ \ + test-case-9 ] unit-test
-[ "plus" ] [ \ + \ test-case-9 def>> call ] unit-test
+{ "plus" } [ \ + test-case-9 ] unit-test
+{ "plus" } [ \ + \ test-case-9 def>> call ] unit-test
-[ "minus" ] [ \ - test-case-9 ] unit-test
-[ "minus" ] [ \ - \ test-case-9 def>> call ] unit-test
+{ "minus" } [ \ - test-case-9 ] unit-test
+{ "minus" } [ \ - \ test-case-9 def>> call ] unit-test
: test-case-10 ( a -- b )
{
{ 5 [ "cinco" ] }
} case ;
-[ "dos" ] [ 2 test-case-10 ] unit-test
-[ "dos" ] [ 2 \ test-case-10 def>> call ] unit-test
+{ "dos" } [ 2 test-case-10 ] unit-test
+{ "dos" } [ 2 \ test-case-10 def>> call ] unit-test
: test-case-11 ( a -- b )
{
{ 55 [ "cinco" ] }
} case ;
-[ "dos" ] [ 22 test-case-11 ] unit-test
-[ "dos" ] [ 22 \ test-case-11 def>> call ] unit-test
+{ "dos" } [ 22 test-case-11 ] unit-test
+{ "dos" } [ 22 \ test-case-11 def>> call ] unit-test
: test-case-12 ( a -- b )
{
{ 55 [ "cinco" ] }
} case ;
-[ "nachos" ] [ 33 test-case-12 ] unit-test
-[ "nachos" ] [ 33 \ test-case-12 def>> call ] unit-test
+{ "nachos" } [ 33 test-case-12 ] unit-test
+{ "nachos" } [ 33 \ test-case-12 def>> call ] unit-test
-[ ( x x -- x x ) ] [
+{ ( x x -- x x ) } [
[ { [ ] [ ] } spread ] infer
] unit-test
[ [ [ ] define-temp ] with-nested-compilation-unit ] must-infer
! Non-optimizing compiler bugs
-[ 1 1 ] [
+{ 1 1 } [
"A" <uninterned-word> [ [ [ 1 ] dip ] 2array 1array t t modify-code-heap ] keep
1 swap execute
] unit-test
-[ "A" "B" ] [
+{ "A" "B" } [
disable-optimizer
gensym "a" set
[ gensym [ ] ( -- ) define-declared ] with-compilation-unit
-[ 1 ] [ counter get-global ] unit-test
+{ 1 } [ counter get-global ] unit-test
observer remove-definition-observer
DEFER: nesting-test
-[ ] [ "IN: compiler.units.tests << : nesting-test ( -- ) ; >>" eval( -- ) ] unit-test
+{ } [ "IN: compiler.units.tests << : nesting-test ( -- ) ; >>" eval( -- ) ] unit-test
observer remove-definition-observer
<< [ uncompiled-generic-test ] [ jit-compile ] [ suffix! ] bi >>
"q" set
-[ 4 ] [ 3 "q" get call ] unit-test
+{ 4 } [ 3 "q" get call ] unit-test
-[ ] [ [ \ uncompiled-generic-test forget ] with-compilation-unit ] unit-test
+{ } [ [ \ uncompiled-generic-test forget ] with-compilation-unit ] unit-test
] with-scope
] callcc0 "x" get 5 = ;
-[ t ] [ 10 callcc1-test 10 iota reverse >vector = ] unit-test
-[ t ] [ callcc-namespace-test ] unit-test
+{ t } [ 10 callcc1-test 10 iota reverse >vector = ] unit-test
+{ t } [ callcc-namespace-test ] unit-test
[ 5 throw ] [ 5 = ] must-fail-with
-[ t ] [
+{ t } [
[ "Hello" throw ] ignore-errors
error get-global
"Hello" =
"!!! The following error is part of the test" print
-[ ] [ [ 6 [ 12 [ "2 car" ] ] ] print-error ] unit-test
+{ } [ [ 6 [ 12 [ "2 car" ] ] ] print-error ] unit-test
"!!! The following error is part of the test" print
-[ ] [ [ [ "2 car" ] eval ] try ] unit-test
+{ } [ [ [ "2 car" ] eval ] try ] unit-test
[ f throw ] must-fail
! Weird PowerPC bug.
-[ ] [
+{ } [
[ "4" throw ] ignore-errors
gc
gc
<< { don't-compile-me foo bar } [ t "no-compile" set-word-prop ] each >>
-[ 1 2 ] [ bar ] unit-test
+{ 1 2 } [ bar ] unit-test
-[ t ] [ \ bar def>> "c" get innermost-frame-executing = ] unit-test
+{ t } [ \ bar def>> "c" get innermost-frame-executing = ] unit-test
-[ 1 ] [ "c" get innermost-frame-scan ] unit-test
+{ 1 } [ "c" get innermost-frame-scan ] unit-test
SYMBOL: always-counter
SYMBOL: error-counter
[ 1 ] [ error-counter get ] unit-test
] with-scope
-[ ] [ [ return ] with-return ] unit-test
+{ } [ [ return ] with-return ] unit-test
[ { } [ ] attempt-all ] [ attempt-all-error? ] must-fail-with
-[ { 4 } ] [ { 2 2 } [ + ] with-datastack ] unit-test
+{ { 4 } } [ { 2 2 } [ + ] with-datastack ] unit-test
[ with-datastack ] must-infer
M: some-class some-generic ;
-[ ] [
+{ } [
[
\ some-generic
\ some-class
T{ dispose-error } "a" set
T{ dispose-dummy } "b" set
-[ f ] [ "b" get disposed?>> ] unit-test
+{ f } [ "b" get disposed?>> ] unit-test
[ { "a" "b" } [ get ] map dispose-each ] [ 3 = ] must-fail-with
-[ t ] [ "b" get disposed?>> ] unit-test
+{ t } [ "b" get disposed?>> ] unit-test
TUPLE: dummy-obj destroyed? ;
: destroy-later ( obj -- )
<dummy-destructor> |dispose drop ;
-[ t ] [
+{ t } [
[
<dummy-obj> dup destroy-always
] with-destructors destroyed?>>
] unit-test
-[ f ] [
+{ f } [
[
<dummy-obj> dup destroy-later
] with-destructors destroyed?>>
] unit-test
-[ t ] [
+{ t } [
<dummy-obj> [
[
dup destroy-always
] ignore-errors destroyed?>>
] unit-test
-[ t ] [
+{ t } [
<dummy-obj> [
[
dup destroy-later
quotations sequences ;
IN: effects.tests
-[ t ] [ { "a" } { "a" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
-[ f ] [ { "a" } { } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
-[ t ] [ { "a" "b" } { "a" "b" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
-[ f ] [ { "a" "b" "c" } { "a" "b" "c" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
-[ f ] [ { "a" "b" } { "a" "b" "c" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
-[ 2 ] [ ( a b -- c ) in>> length ] unit-test
-[ 1 ] [ ( a b -- c ) out>> length ] unit-test
-
-[ t ] [ ( a b -- c ) ( ... a b -- ... c ) effect<= ] unit-test
-[ t ] [ ( b -- ) ( ... a b -- ... c ) effect<= ] unit-test
-[ f ] [ ( ... a b -- ... c ) ( a b -- c ) effect<= ] unit-test
-[ f ] [ ( ... b -- ... ) ( a b -- c ) effect<= ] unit-test
-[ f ] [ ( a b -- c ) ( ... a b -- c ) effect<= ] unit-test
-[ f ] [ ( a b -- c ) ( ..x a b -- ..y c ) effect<= ] unit-test
-
-[ "( object -- object )" ] [ { f } { f } <effect> unparse ] unit-test
-[ "( a b -- c d )" ] [ { "a" "b" } { "c" "d" } <effect> unparse ] unit-test
-[ "( -- c d )" ] [ { } { "c" "d" } <effect> unparse ] unit-test
-[ "( a b -- )" ] [ { "a" "b" } { } <effect> unparse ] unit-test
-[ "( -- )" ] [ { } { } <effect> unparse ] unit-test
-[ "( a b -- c )" ] [ ( a b -- c ) unparse ] unit-test
-
-[ { "x" "y" } ] [ { "y" "x" } ( a b -- b a ) shuffle ] unit-test
-[ { "y" "x" "y" } ] [ { "y" "x" } ( a b -- a b a ) shuffle ] unit-test
-[ { } ] [ { "y" "x" } ( a b -- ) shuffle ] unit-test
-
-[ t ] [ ( -- ) ( -- ) compose-effects ( -- ) effect= ] unit-test
-[ t ] [ ( -- * ) ( -- ) compose-effects ( -- * ) effect= ] unit-test
-[ t ] [ ( -- ) ( -- * ) compose-effects ( -- * ) effect= ] unit-test
-
-[ { object object } ] [ ( a b -- ) effect-in-types ] unit-test
-[ { object sequence } ] [ ( a b: sequence -- ) effect-in-types ] unit-test
-
-[ f ] [ ( a b c -- d ) in-var>> ] unit-test
-[ f ] [ ( -- d ) in-var>> ] unit-test
-[ "a" ] [ ( ..a b c -- d ) in-var>> ] unit-test
-[ { "b" "c" } ] [ ( ..a b c -- d ) in>> ] unit-test
-
-[ f ] [ ( ..a b c -- e ) out-var>> ] unit-test
-[ "d" ] [ ( ..a b c -- ..d e ) out-var>> ] unit-test
-[ { "e" } ] [ ( ..a b c -- ..d e ) out>> ] unit-test
+{ t } [ { "a" } { "a" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
+{ f } [ { "a" } { } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
+{ t } [ { "a" "b" } { "a" "b" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
+{ f } [ { "a" "b" "c" } { "a" "b" "c" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
+{ f } [ { "a" "b" } { "a" "b" "c" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
+{ 2 } [ ( a b -- c ) in>> length ] unit-test
+{ 1 } [ ( a b -- c ) out>> length ] unit-test
+
+{ t } [ ( a b -- c ) ( ... a b -- ... c ) effect<= ] unit-test
+{ t } [ ( b -- ) ( ... a b -- ... c ) effect<= ] unit-test
+{ f } [ ( ... a b -- ... c ) ( a b -- c ) effect<= ] unit-test
+{ f } [ ( ... b -- ... ) ( a b -- c ) effect<= ] unit-test
+{ f } [ ( a b -- c ) ( ... a b -- c ) effect<= ] unit-test
+{ f } [ ( a b -- c ) ( ..x a b -- ..y c ) effect<= ] unit-test
+
+{ "( object -- object )" } [ { f } { f } <effect> unparse ] unit-test
+{ "( a b -- c d )" } [ { "a" "b" } { "c" "d" } <effect> unparse ] unit-test
+{ "( -- c d )" } [ { } { "c" "d" } <effect> unparse ] unit-test
+{ "( a b -- )" } [ { "a" "b" } { } <effect> unparse ] unit-test
+{ "( -- )" } [ { } { } <effect> unparse ] unit-test
+{ "( a b -- c )" } [ ( a b -- c ) unparse ] unit-test
+
+{ { "x" "y" } } [ { "y" "x" } ( a b -- b a ) shuffle ] unit-test
+{ { "y" "x" "y" } } [ { "y" "x" } ( a b -- a b a ) shuffle ] unit-test
+{ { } } [ { "y" "x" } ( a b -- ) shuffle ] unit-test
+
+{ t } [ ( -- ) ( -- ) compose-effects ( -- ) effect= ] unit-test
+{ t } [ ( -- * ) ( -- ) compose-effects ( -- * ) effect= ] unit-test
+{ t } [ ( -- ) ( -- * ) compose-effects ( -- * ) effect= ] unit-test
+
+{ { object object } } [ ( a b -- ) effect-in-types ] unit-test
+{ { object sequence } } [ ( a b: sequence -- ) effect-in-types ] unit-test
+
+{ f } [ ( a b c -- d ) in-var>> ] unit-test
+{ f } [ ( -- d ) in-var>> ] unit-test
+{ "a" } [ ( ..a b c -- d ) in-var>> ] unit-test
+{ { "b" "c" } } [ ( ..a b c -- d ) in>> ] unit-test
+
+{ f } [ ( ..a b c -- e ) out-var>> ] unit-test
+{ "d" } [ ( ..a b c -- ..d e ) out-var>> ] unit-test
+{ { "e" } } [ ( ..a b c -- ..d e ) out>> ] unit-test
[ "( a ..b c -- d )" eval( -- effect ) ]
[ error>> invalid-row-variable? ] must-fail-with
[ error>> row-variable-can't-have-type? ] must-fail-with
! test curry-effect
-[ ( -- x ) ] [ ( c -- d ) curry-effect ] unit-test
-[ ( -- x x ) ] [ ( -- d ) curry-effect ] unit-test
-[ ( x -- ) ] [ ( a b -- ) curry-effect ] unit-test
+{ ( -- x ) } [ ( c -- d ) curry-effect ] unit-test
+{ ( -- x x ) } [ ( -- d ) curry-effect ] unit-test
+{ ( x -- ) } [ ( a b -- ) curry-effect ] unit-test
M: integer my-hook "an integer" ;
M: string my-hook "a string" ;
-[ "an integer" ] [ 3 my-var set my-hook ] unit-test
-[ "a string" ] [ my-hook my-var set my-hook ] unit-test
+{ "an integer" } [ 3 my-var set my-hook ] unit-test
+{ "a string" } [ my-hook my-var set my-hook ] unit-test
[ 1.0 my-var set my-hook ] [ T{ no-method f 1.0 my-hook } = ] must-fail-with
HOOK: call-next-hooker my-var ( -- x )
M: growable call-next-hooker call-next-method "growable " prepend ;
-[ "vector growable sequence" ] [
+{ "vector growable sequence" } [
V{ } my-var [ call-next-hooker ] with-variable
] unit-test
-[ t ] [
+{ t } [
{ } \ nth effective-method nip M\ sequence nth eq?
] unit-test
-[ t ] [
+{ t } [
\ + \ nth effective-method nip dup \ nth "default-method" word-prop eq? and
] unit-test
IN: generic.math.tests
! Test math-combination
-[ [ [ >float ] dip ] ] [ \ real \ float math-upgrade ] unit-test
-[ [ >float ] ] [ \ float \ real math-upgrade ] unit-test
-[ [ [ >bignum ] dip ] ] [ \ fixnum \ bignum math-upgrade ] unit-test
-[ [ >float ] ] [ \ float \ integer math-upgrade ] unit-test
+{ [ [ >float ] dip ] } [ \ real \ float math-upgrade ] unit-test
+{ [ >float ] } [ \ float \ real math-upgrade ] unit-test
+{ [ [ >bignum ] dip ] } [ \ fixnum \ bignum math-upgrade ] unit-test
+{ [ >float ] } [ \ float \ integer math-upgrade ] unit-test
-[ number ] [ number float math-class-max ] unit-test
-[ number ] [ float number math-class-max ] unit-test
-[ float ] [ real float math-class-max ] unit-test
-[ float ] [ float real math-class-max ] unit-test
-[ fixnum ] [ fixnum null math-class-max ] unit-test
-[ fixnum ] [ null fixnum math-class-max ] unit-test
-[ bignum ] [ fixnum bignum math-class-max ] unit-test
-[ bignum ] [ bignum fixnum math-class-max ] unit-test
-[ number ] [ fixnum number math-class-max ] unit-test
-[ number ] [ number fixnum math-class-max ] unit-test
+{ number } [ number float math-class-max ] unit-test
+{ number } [ float number math-class-max ] unit-test
+{ float } [ real float math-class-max ] unit-test
+{ float } [ float real math-class-max ] unit-test
+{ fixnum } [ fixnum null math-class-max ] unit-test
+{ fixnum } [ null fixnum math-class-max ] unit-test
+{ bignum } [ fixnum bignum math-class-max ] unit-test
+{ bignum } [ bignum fixnum math-class-max ] unit-test
+{ number } [ fixnum number math-class-max ] unit-test
+{ number } [ number fixnum math-class-max ] unit-test
-[ t ] [ \ + math-generic? ] unit-test
+{ t } [ \ + math-generic? ] unit-test
IN: generic.parser.tests
-[ t ] [ ( -- ) ( -- ) method-effect= ] unit-test
-[ t ] [ ( a -- b ) ( x -- y ) method-effect= ] unit-test
-[ f ] [ ( a b -- c ) ( x -- y ) method-effect= ] unit-test
-[ f ] [ ( a -- b ) ( x y -- z ) method-effect= ] unit-test
+{ t } [ ( -- ) ( -- ) method-effect= ] unit-test
+{ t } [ ( a -- b ) ( x -- y ) method-effect= ] unit-test
+{ f } [ ( a b -- c ) ( x -- y ) method-effect= ] unit-test
+{ f } [ ( a -- b ) ( x y -- z ) method-effect= ] unit-test
-[ t ] [ ( -- * ) ( -- ) method-effect= ] unit-test
-[ f ] [ ( -- * ) ( x -- y ) method-effect= ] unit-test
-[ t ] [ ( x -- * ) ( x -- y ) method-effect= ] unit-test
-[ t ] [ ( x -- * ) ( x -- y z ) method-effect= ] unit-test
+{ t } [ ( -- * ) ( -- ) method-effect= ] unit-test
+{ f } [ ( -- * ) ( x -- y ) method-effect= ] unit-test
+{ t } [ ( x -- * ) ( x -- y ) method-effect= ] unit-test
+{ t } [ ( x -- * ) ( x -- y z ) method-effect= ] unit-test
M: fixnum class-of drop "fixnum" ;
M: word class-of drop "word" ;
-[ "fixnum" ] [ 5 class-of ] unit-test
-[ "word" ] [ \ class-of class-of ] unit-test
+{ "fixnum" } [ 5 class-of ] unit-test
+{ "word" } [ \ class-of class-of ] unit-test
[ 3.4 class-of ] must-fail
GENERIC: foobar ( x -- y )
M: object foobar drop "Hello world" ;
M: fixnum foobar drop "Goodbye cruel world" ;
-[ "Hello world" ] [ 4 foobar foobar ] unit-test
-[ "Goodbye cruel world" ] [ 4 foobar ] unit-test
+{ "Hello world" } [ 4 foobar foobar ] unit-test
+{ "Goodbye cruel world" } [ 4 foobar ] unit-test
GENERIC: lo-tag-test ( obj -- obj' )
M: rational lo-tag-test 2 - ;
M: complex lo-tag-test sq ;
-[ 8 ] [ 5 >bignum lo-tag-test ] unit-test
-[ 0.0 ] [ 4.0 lo-tag-test ] unit-test
-[ -1/2 ] [ 1+1/2 lo-tag-test ] unit-test
-[ -16 ] [ C{ 0 4 } lo-tag-test ] unit-test
+{ 8 } [ 5 >bignum lo-tag-test ] unit-test
+{ 0.0 } [ 4.0 lo-tag-test ] unit-test
+{ -1/2 } [ 1+1/2 lo-tag-test ] unit-test
+{ -16 } [ C{ 0 4 } lo-tag-test ] unit-test
GENERIC: hi-tag-test ( obj -- obj' )
M: array hi-tag-test [ hi-tag-test ] map ;
M: sequence hi-tag-test reverse ;
-[ B{ 3 2 1 } ] [ B{ 1 2 3 } hi-tag-test ] unit-test
+{ B{ 3 2 1 } } [ B{ 1 2 3 } hi-tag-test ] unit-test
-[ { 6 9 12 } ] [ { 3 6 9 } hi-tag-test ] unit-test
+{ { 6 9 12 } } [ { 3 6 9 } hi-tag-test ] unit-test
-[ "i like monkeys, in bed" ] [ "i like monkeys" hi-tag-test ] unit-test
+{ "i like monkeys, in bed" } [ "i like monkeys" hi-tag-test ] unit-test
UNION: funnies quotation float complex ;
M: integer union-containment drop 1 ;
M: number union-containment drop 2 ;
-[ 1 ] [ 1 union-containment ] unit-test
-[ 2 ] [ 1.0 union-containment ] unit-test
+{ 1 } [ 1 union-containment ] unit-test
+{ 2 } [ 1.0 union-containment ] unit-test
-[ 2 ] [ [ { } ] funny ] unit-test
-[ 0 ] [ { } funny ] unit-test
+{ 2 } [ [ { } ] funny ] unit-test
+{ 0 } [ { } funny ] unit-test
TUPLE: shape ;
M: circle area radius>> sq pi * ;
-[ 12 ] [ 4 3 <rectangle> area ] unit-test
-[ 12 ] [ 4 3 2 <parallelogram> area ] unit-test
-[ t ] [ 2 <circle> area 4 pi * = ] unit-test
+{ 12 } [ 4 3 <rectangle> area ] unit-test
+{ 12 } [ 4 3 2 <parallelogram> area ] unit-test
+{ t } [ 2 <circle> area 4 pi * = ] unit-test
GENERIC: perimeter ( shape -- n )
M: circle perimeter 2 * pi * ;
-[ 14 ] [ 4 3 <rectangle> perimeter ] unit-test
-[ 30.0 ] [ 10 4 3 <parallelogram> perimeter ] unit-test
+{ 14 } [ 4 3 <rectangle> perimeter ] unit-test
+{ 30.0 } [ 10 4 3 <parallelogram> perimeter ] unit-test
PREDICATE: very-funny < funnies number? ;
GENERIC: gooey ( x -- y )
M: very-funny gooey sq ;
-[ 0.25 ] [ 0.5 gooey ] unit-test
+{ 0.25 } [ 0.5 gooey ] unit-test
GENERIC: empty-method-test ( x -- y )
M: object empty-method-test ;
TUPLE: another-one ;
C: <another-one> another-one
-[ "Hi" ] [ <for-arguments-sake> empty-method-test empty-method-test ] unit-test
-[ T{ another-one f } ] [ <another-one> empty-method-test ] unit-test
+{ "Hi" } [ <for-arguments-sake> empty-method-test empty-method-test ] unit-test
+{ T{ another-one f } } [ <another-one> empty-method-test ] unit-test
GENERIC: big-mix-test ( obj -- obj' )
M: circle big-mix-test drop "circle" ;
-[ "integer" ] [ 3 big-mix-test ] unit-test
-[ "float" ] [ 5.0 big-mix-test ] unit-test
-[ "complex" ] [ -1 sqrt big-mix-test ] unit-test
-[ "sequence" ] [ B{ 1 2 3 } big-mix-test ] unit-test
-[ "sequence" ] [ ?{ t f t } big-mix-test ] unit-test
-[ "sequence" ] [ SBUF" hello world" big-mix-test ] unit-test
-[ "sequence" ] [ V{ "a" "b" } big-mix-test ] unit-test
-[ "sequence" ] [ BV{ 1 2 } big-mix-test ] unit-test
-[ "sequence" ] [ ?V{ t t f f } big-mix-test ] unit-test
-[ "string" ] [ "hello" big-mix-test ] unit-test
-[ "rectangle" ] [ 1 2 <rectangle> big-mix-test ] unit-test
-[ "parallelogram" ] [ 10 4 3 <parallelogram> big-mix-test ] unit-test
-[ "circle" ] [ 100 <circle> big-mix-test ] unit-test
-[ "tuple" ] [ H{ } big-mix-test ] unit-test
-[ "object" ] [ \ + big-mix-test ] unit-test
+{ "integer" } [ 3 big-mix-test ] unit-test
+{ "float" } [ 5.0 big-mix-test ] unit-test
+{ "complex" } [ -1 sqrt big-mix-test ] unit-test
+{ "sequence" } [ B{ 1 2 3 } big-mix-test ] unit-test
+{ "sequence" } [ ?{ t f t } big-mix-test ] unit-test
+{ "sequence" } [ SBUF" hello world" big-mix-test ] unit-test
+{ "sequence" } [ V{ "a" "b" } big-mix-test ] unit-test
+{ "sequence" } [ BV{ 1 2 } big-mix-test ] unit-test
+{ "sequence" } [ ?V{ t t f f } big-mix-test ] unit-test
+{ "string" } [ "hello" big-mix-test ] unit-test
+{ "rectangle" } [ 1 2 <rectangle> big-mix-test ] unit-test
+{ "parallelogram" } [ 10 4 3 <parallelogram> big-mix-test ] unit-test
+{ "circle" } [ 100 <circle> big-mix-test ] unit-test
+{ "tuple" } [ H{ } big-mix-test ] unit-test
+{ "object" } [ \ + big-mix-test ] unit-test
GENERIC: small-lo-tag ( obj -- obj )
M: byte-array small-lo-tag drop "byte-array" ;
-[ "fixnum" ] [ 3 small-lo-tag ] unit-test
+{ "fixnum" } [ 3 small-lo-tag ] unit-test
-[ "double-array" ] [ double-array{ 1.0 } small-lo-tag ] unit-test
+{ "double-array" } [ double-array{ 1.0 } small-lo-tag ] unit-test
! Testing recovery from bad method definitions
"IN: generic.standard.tests GENERIC: unhappy ( x -- x )" eval( -- )
[
"IN: generic.standard.tests M: dictionary unhappy ;" eval( -- )
] must-fail
-[ ] [ "IN: generic.standard.tests GENERIC: unhappy ( x -- x )" eval( -- ) ] unit-test
+{ } [ "IN: generic.standard.tests GENERIC: unhappy ( x -- x )" eval( -- ) ] unit-test
GENERIC# complex-combination 1 ( a b -- c )
M: string complex-combination drop ;
M: object complex-combination nip ;
-[ "hi" ] [ "hi" 3 complex-combination ] unit-test
-[ "hi" ] [ 3 "hi" complex-combination ] unit-test
+{ "hi" } [ "hi" 3 complex-combination ] unit-test
+{ "hi" } [ 3 "hi" complex-combination ] unit-test
! Regression
TUPLE: first-one ;
M: tuple-class wii drop 5 ;
M: integer wii drop 6 ;
-[ 3 ] [ T{ first-one } wii ] unit-test
+{ 3 } [ T{ first-one } wii ] unit-test
GENERIC: tag-and-f ( x -- x x )
M: f tag-and-f 4 ;
-[ f 4 ] [ f tag-and-f ] unit-test
+{ f 4 } [ f tag-and-f ] unit-test
-[ 3.4 3 ] [ 3.4 tag-and-f ] unit-test
+{ 3.4 3 } [ 3.4 tag-and-f ] unit-test
! Issues with forget
GENERIC: generic-forget-test ( a -- b )
M: f generic-forget-test ;
-[ ] [ \ f \ generic-forget-test lookup-method "m" set ] unit-test
+{ } [ \ f \ generic-forget-test lookup-method "m" set ] unit-test
-[ ] [ [ "m" get forget ] with-compilation-unit ] unit-test
+{ } [ [ "m" get forget ] with-compilation-unit ] unit-test
-[ ] [ "IN: generic.standard.tests M: f generic-forget-test ;" eval( -- ) ] unit-test
+{ } [ "IN: generic.standard.tests M: f generic-forget-test ;" eval( -- ) ] unit-test
-[ ] [ [ "m" get forget ] with-compilation-unit ] unit-test
+{ } [ [ "m" get forget ] with-compilation-unit ] unit-test
-[ f ] [ f generic-forget-test ] unit-test
+{ f } [ f generic-forget-test ] unit-test
! erg's regression
-[ ] [
+{ } [
"""IN: generic.standard.tests
GENERIC: jeah ( a -- b )
[ salary ] must-infer
-[ 24000 ] [ employee boa salary ] unit-test
+{ 24000 } [ employee boa salary ] unit-test
-[ 24000 ] [ tape-monkey boa salary ] unit-test
+{ 24000 } [ tape-monkey boa salary ] unit-test
-[ 36000 ] [ junior-manager boa salary ] unit-test
+{ 36000 } [ junior-manager boa salary ] unit-test
-[ 41000 ] [ middle-manager boa salary ] unit-test
+{ 41000 } [ middle-manager boa salary ] unit-test
-[ 51000 ] [ senior-manager boa salary ] unit-test
+{ 51000 } [ senior-manager boa salary ] unit-test
-[ 102000 ] [ executive boa salary ] unit-test
+{ 102000 } [ executive boa salary ] unit-test
[ ceo boa salary ]
[ T{ inconsistent-next-method f ceo salary } = ] must-fail-with
: funky ( obj -- seq ) [ funky* ] { } make ;
-[ { "b" "x" "z" } ] [ T{ b } funky ] unit-test
+{ { "b" "x" "z" } } [ T{ b } funky ] unit-test
-[ { "c" "y" "z" } ] [ T{ c } funky ] unit-test
+{ { "c" "y" "z" } } [ T{ c } funky ] unit-test
-[ t ] [
+{ t } [
T{ a } funky
{ { "a" "x" "z" } { "a" "y" "z" } } member?
] unit-test
! Changing method combination should not fail
-[ ] [ "IN: generic.standard.tests GENERIC: xyz ( a -- b )" eval( -- ) ] unit-test
-[ ] [ "IN: generic.standard.tests MATH: xyz ( a b -- c )" eval( -- ) ] unit-test
+{ } [ "IN: generic.standard.tests GENERIC: xyz ( a -- b )" eval( -- ) ] unit-test
+{ } [ "IN: generic.standard.tests MATH: xyz ( a b -- c )" eval( -- ) ] unit-test
-[ f ] [ "xyz" "generic.standard.tests" lookup-word pic-def>> ] unit-test
-[ f ] [ "xyz" "generic.standard.tests" lookup-word "decision-tree" word-prop ] unit-test
+{ f } [ "xyz" "generic.standard.tests" lookup-word pic-def>> ] unit-test
+{ f } [ "xyz" "generic.standard.tests" lookup-word "decision-tree" word-prop ] unit-test
! Corner case
[ "IN: generic.standard.tests GENERIC# broken-generic# -1 ( a -- b )" eval( -- ) ]
must-fail-with
! Generic words cannot be inlined
-[ ] [ "IN: generic.standard.tests GENERIC: foo ( -- x )" eval( -- ) ] unit-test
+{ } [ "IN: generic.standard.tests GENERIC: foo ( -- x )" eval( -- ) ] unit-test
[ "IN: generic.standard.tests GENERIC: foo ( -- x ) inline" eval( -- ) ] must-fail
! Moving a method from one vocab to another didn't always work
GENERIC: move-method-generic ( a -- b )
-[ ] [ "IN: generic.standard.tests.a USE: strings USE: generic.standard.tests M: string move-method-generic ;" <string-reader> "move-method-test-1" parse-stream drop ] unit-test
+{ } [ "IN: generic.standard.tests.a USE: strings USE: generic.standard.tests M: string move-method-generic ;" <string-reader> "move-method-test-1" parse-stream drop ] unit-test
-[ ] [ "IN: generic.standard.tests.b USE: strings USE: generic.standard.tests M: string move-method-generic ;" <string-reader> "move-method-test-2" parse-stream drop ] unit-test
+{ } [ "IN: generic.standard.tests.b USE: strings USE: generic.standard.tests M: string move-method-generic ;" <string-reader> "move-method-test-2" parse-stream drop ] unit-test
-[ ] [ "IN: generic.standard.tests.a" <string-reader> "move-method-test-1" parse-stream drop ] unit-test
+{ } [ "IN: generic.standard.tests.a" <string-reader> "move-method-test-1" parse-stream drop ] unit-test
-[ { string } ] [ \ move-method-generic order ] unit-test
+{ { string } } [ \ move-method-generic order ] unit-test
! FORGET: on method wrappers
GENERIC: forget-test ( a -- b )
M: integer forget-test 3 + ;
-[ ] [ "IN: generic.standard.tests USE: math FORGET: M\\ integer forget-test" eval( -- ) ] unit-test
+{ } [ "IN: generic.standard.tests USE: math FORGET: M\\ integer forget-test" eval( -- ) ] unit-test
-[ { } ] [
+{ { } } [
\ + effect-dependencies-of keys [ method? ] filter
[ "method-generic" word-prop \ forget-test eq? ] filter
] unit-test
GENERIC: flushable-generic ( a -- b ) flushable
M: integer flushable-generic ;
-[ t ] [ \ flushable-generic flushable? ] unit-test
-[ t ] [ M\ integer flushable-generic flushable? ] unit-test
+{ t } [ \ flushable-generic flushable? ] unit-test
+{ t } [ M\ integer flushable-generic flushable? ] unit-test
GENERIC: non-flushable-generic ( a -- b )
M: integer non-flushable-generic ; flushable
-[ f ] [ \ non-flushable-generic flushable? ] unit-test
-[ t ] [ M\ integer non-flushable-generic flushable? ] unit-test
+{ f } [ \ non-flushable-generic flushable? ] unit-test
+{ t } [ M\ integer non-flushable-generic flushable? ] unit-test
! method-for-object, method-for-class, effective-method
GENERIC: foozul ( a -- b )
M: integer foozul ;
M: slice foozul ;
-[ ] [ reversed \ foozul method-for-class M\ reversed foozul assert= ] unit-test
-[ ] [ { 1 2 3 } <reversed> \ foozul method-for-object M\ reversed foozul assert= ] unit-test
-[ ] [ { 1 2 3 } <reversed> \ foozul effective-method M\ reversed foozul assert= drop ] unit-test
+{ } [ reversed \ foozul method-for-class M\ reversed foozul assert= ] unit-test
+{ } [ { 1 2 3 } <reversed> \ foozul method-for-object M\ reversed foozul assert= ] unit-test
+{ } [ { 1 2 3 } <reversed> \ foozul effective-method M\ reversed foozul assert= drop ] unit-test
-[ ] [ fixnum \ foozul method-for-class M\ integer foozul assert= ] unit-test
-[ ] [ 13 \ foozul method-for-object M\ integer foozul assert= ] unit-test
-[ ] [ 13 \ foozul effective-method M\ integer foozul assert= drop ] unit-test
+{ } [ fixnum \ foozul method-for-class M\ integer foozul assert= ] unit-test
+{ } [ 13 \ foozul method-for-object M\ integer foozul assert= ] unit-test
+{ } [ 13 \ foozul effective-method M\ integer foozul assert= drop ] unit-test
! Ensure dynamic and static dispatch match in ambiguous cases
UNION: amb-union-1a integer float ;
M: amb-union-1a amb-generic-1 drop "a" ;
M: amb-union-1b amb-generic-1 drop "b" ;
-[ ] [
+{ } [
5.0 amb-generic-1
5.0 \ amb-generic-1 effective-method execute( a -- b ) assert=
] unit-test
-[ ] [
+{ } [
5.0 amb-generic-1
5.0 float \ amb-generic-1 method-for-class execute( a -- b ) assert=
] unit-test
M: amb-union-2a amb-generic-2 drop "a" ;
M: amb-union-2b amb-generic-2 drop "b" ;
-[ ] [
+{ } [
5.0 amb-generic-1
5.0 \ amb-generic-1 effective-method execute( a -- b ) assert=
] unit-test
-[ ] [
+{ } [
5.0 amb-generic-1
5.0 float \ amb-generic-1 method-for-class execute( a -- b ) assert=
] unit-test
M: amb-tuple-b amb-generic-3 drop "b" ;
M: amb-tuple-c amb-generic-3 drop "c" ;
-[ ] [
+{ } [
T{ amb-tuple-b f 3 } amb-generic-3
T{ amb-tuple-b f 3 } \ amb-generic-3 effective-method execute( a -- b ) assert=
] unit-test
M: amb-tuple-b amb-generic-4 drop "b" ;
M: amb-union-4 amb-generic-4 drop "4" ;
-[ ] [
+{ } [
T{ amb-tuple-b f 3 } amb-generic-4
T{ amb-tuple-b f 3 } \ amb-generic-4 effective-method execute( a -- b ) assert=
] unit-test
-[ ] [
+{ } [
T{ amb-tuple-b f 3 } amb-generic-4
T{ amb-tuple-b f 3 } amb-tuple-b \ amb-generic-4 method-for-class execute( a -- b ) assert=
] unit-test
M: amb-tuple-b amb-generic-5 drop "b" ;
M: amb-mixin-5 amb-generic-5 drop "5" ;
-[ ] [
+{ } [
T{ amb-tuple-b f 3 } amb-generic-5
T{ amb-tuple-b f 3 } \ amb-generic-5 effective-method execute( a -- b ) assert=
] unit-test
-[ ] [
+{ } [
T{ amb-tuple-b f 3 } amb-generic-5
T{ amb-tuple-b f 3 } amb-tuple-b \ amb-generic-5 method-for-class execute( a -- b ) assert=
] unit-test
M: amb-tuple-a amb-generic-6 drop "a" ;
M: amb-union-6 amb-generic-6 drop "6" ;
-[ ] [
+{ } [
T{ amb-tuple-b f 3 } amb-generic-6
T{ amb-tuple-b f 3 } \ amb-generic-6 effective-method execute( a -- b ) assert=
] unit-test
-[ ] [
+{ } [
T{ amb-tuple-b f 3 } amb-generic-6
T{ amb-tuple-b f 3 } amb-tuple-b \ amb-generic-6 method-for-class execute( a -- b ) assert=
] unit-test
M: amb-tuple-a amb-generic-7 drop "a" ;
M: amb-mixin-7 amb-generic-7 drop "7" ;
-[ ] [
+{ } [
T{ amb-tuple-b f 3 } amb-generic-7
T{ amb-tuple-b f 3 } \ amb-generic-7 effective-method execute( a -- b ) assert=
] unit-test
-[ ] [
+{ } [
T{ amb-tuple-b f 3 } amb-generic-7
T{ amb-tuple-b f 3 } amb-tuple-b \ amb-generic-7 method-for-class execute( a -- b ) assert=
] unit-test
M: amb-union-8 amb-generic-8 drop "8" ;
M: amb-predicate-a amb-generic-8 drop "a" ;
-[ ] [
+{ } [
4 amb-generic-8
4 \ amb-generic-8 effective-method execute( a -- b ) assert=
] unit-test
IN: growable.tests
! erg found this one
-[ fixnum ] [
+{ fixnum } [
2 >bignum V{ } [ set-length ] keep length class-of
] unit-test
USING: sets tools.test kernel sorting prettyprint hash-sets ;
IN: hash-sets.tests
-[ { 1 2 3 } ] [ HS{ 1 2 3 } members natural-sort ] unit-test
+{ { 1 2 3 } } [ HS{ 1 2 3 } members natural-sort ] unit-test
-[ "HS{ 1 2 3 4 }" ] [ HS{ 1 2 3 4 } unparse ] unit-test
+{ "HS{ 1 2 3 4 }" } [ HS{ 1 2 3 4 } unparse ] unit-test
-[ t ] [ 1 HS{ 0 1 2 } in? ] unit-test
-[ f ] [ 3 HS{ 0 1 2 } in? ] unit-test
-[ HS{ 1 2 3 } ] [ 3 HS{ 1 2 } clone [ adjoin ] keep ] unit-test
-[ HS{ 1 2 } ] [ 2 HS{ 1 2 } clone [ adjoin ] keep ] unit-test
-[ HS{ 1 2 3 } ] [ 4 HS{ 1 2 3 } clone [ delete ] keep ] unit-test
-[ HS{ 1 2 } ] [ 3 HS{ 1 2 3 } clone [ delete ] keep ] unit-test
-[ HS{ 1 2 } ] [ HS{ 1 2 } fast-set ] unit-test
-[ { 1 2 } ] [ HS{ 1 2 } members natural-sort ] unit-test
+{ t } [ 1 HS{ 0 1 2 } in? ] unit-test
+{ f } [ 3 HS{ 0 1 2 } in? ] unit-test
+{ HS{ 1 2 3 } } [ 3 HS{ 1 2 } clone [ adjoin ] keep ] unit-test
+{ HS{ 1 2 } } [ 2 HS{ 1 2 } clone [ adjoin ] keep ] unit-test
+{ HS{ 1 2 3 } } [ 4 HS{ 1 2 3 } clone [ delete ] keep ] unit-test
+{ HS{ 1 2 } } [ 3 HS{ 1 2 3 } clone [ delete ] keep ] unit-test
+{ HS{ 1 2 } } [ HS{ 1 2 } fast-set ] unit-test
+{ { 1 2 } } [ HS{ 1 2 } members natural-sort ] unit-test
-[ HS{ 1 2 3 4 } ] [ HS{ 1 2 3 } HS{ 2 3 4 } union ] unit-test
-[ HS{ 2 3 } ] [ HS{ 1 2 3 } HS{ 2 3 4 } intersect ] unit-test
-[ t ] [ HS{ 1 2 3 } HS{ 2 3 4 } intersects? ] unit-test
-[ f ] [ HS{ 1 } HS{ 2 3 4 } intersects? ] unit-test
-[ f ] [ HS{ 1 } HS{ 2 3 4 } subset? ] unit-test
-[ f ] [ HS{ 1 2 3 } HS{ 2 3 4 } subset? ] unit-test
-[ t ] [ HS{ 2 3 } HS{ 2 3 4 } subset? ] unit-test
-[ t ] [ HS{ } HS{ 2 3 4 } subset? ] unit-test
-[ HS{ 1 } ] [ HS{ 1 2 3 } HS{ 2 3 4 } diff ] unit-test
-[ t ] [ HS{ 1 2 3 } HS{ 2 1 3 } set= ] unit-test
-[ t ] [ HS{ 1 2 3 } HS{ 2 1 3 } = ] unit-test
-[ f ] [ HS{ 2 3 } HS{ 2 1 3 } set= ] unit-test
-[ f ] [ HS{ 1 2 3 } HS{ 2 3 } set= ] unit-test
+{ HS{ 1 2 3 4 } } [ HS{ 1 2 3 } HS{ 2 3 4 } union ] unit-test
+{ HS{ 2 3 } } [ HS{ 1 2 3 } HS{ 2 3 4 } intersect ] unit-test
+{ t } [ HS{ 1 2 3 } HS{ 2 3 4 } intersects? ] unit-test
+{ f } [ HS{ 1 } HS{ 2 3 4 } intersects? ] unit-test
+{ f } [ HS{ 1 } HS{ 2 3 4 } subset? ] unit-test
+{ f } [ HS{ 1 2 3 } HS{ 2 3 4 } subset? ] unit-test
+{ t } [ HS{ 2 3 } HS{ 2 3 4 } subset? ] unit-test
+{ t } [ HS{ } HS{ 2 3 4 } subset? ] unit-test
+{ HS{ 1 } } [ HS{ 1 2 3 } HS{ 2 3 4 } diff ] unit-test
+{ t } [ HS{ 1 2 3 } HS{ 2 1 3 } set= ] unit-test
+{ t } [ HS{ 1 2 3 } HS{ 2 1 3 } = ] unit-test
+{ f } [ HS{ 2 3 } HS{ 2 1 3 } set= ] unit-test
+{ f } [ HS{ 1 2 3 } HS{ 2 3 } set= ] unit-test
-[ HS{ 1 2 } HS{ 1 2 3 } ] [ HS{ 1 2 } clone dup clone [ 3 swap adjoin ] keep ] unit-test
+{ HS{ 1 2 } HS{ 1 2 3 } } [ HS{ 1 2 } clone dup clone [ 3 swap adjoin ] keep ] unit-test
-[ t ] [ HS{ } null? ] unit-test
-[ f ] [ HS{ 1 } null? ] unit-test
+{ t } [ HS{ } null? ] unit-test
+{ f } [ HS{ 1 } null? ] unit-test
{ { } } [ { 1 2 3 } duplicates ] unit-test
{ f } [ { 1 2 3 } >hash-set duplicates ] unit-test
tools.test vectors ;
IN: hashtables.tests
-[ H{ } ] [ { } [ dup ] H{ } map>assoc ] unit-test
+{ H{ } } [ { } [ dup ] H{ } map>assoc ] unit-test
-[ ] [ 1000 iota [ dup sq ] H{ } map>assoc "testhash" set ] unit-test
+{ } [ 1000 iota [ dup sq ] H{ } map>assoc "testhash" set ] unit-test
-[ V{ } ]
+{ V{ } }
[ 1000 iota [ dup sq swap "testhash" get at = ] reject ]
unit-test
-[ t ]
+{ t }
[ "testhash" get hashtable? ]
unit-test
-[ f ]
+{ f }
[ { 1 { 2 3 } } hashtable? ]
unit-test
! Test some hashcodes.
-[ t ] [ [ 1 2 3 ] hashcode [ 1 2 3 ] hashcode = ] unit-test
-[ t ] [ [ 1 [ 2 3 ] 4 ] hashcode [ 1 [ 2 3 ] 4 ] hashcode = ] unit-test
+{ t } [ [ 1 2 3 ] hashcode [ 1 2 3 ] hashcode = ] unit-test
+{ t } [ [ 1 [ 2 3 ] 4 ] hashcode [ 1 [ 2 3 ] 4 ] hashcode = ] unit-test
-[ t ] [ 12 hashcode 12 hashcode = ] unit-test
-[ t ] [ 12 >bignum hashcode 12 hashcode = ] unit-test
+{ t } [ 12 hashcode 12 hashcode = ] unit-test
+{ t } [ 12 >bignum hashcode 12 hashcode = ] unit-test
! Test various odd keys to see if they work.
f 100000000000000000000000000 "testhash" get set-at
{ } { [ { } ] } "testhash" get set-at
-[ t ] [ { 2 3 } "testhash" get at ] unit-test
-[ f ] [ 100000000000000000000000000 "testhash" get at* drop ] unit-test
-[ { } ] [ { [ { } ] } clone "testhash" get at* drop ] unit-test
+{ t } [ { 2 3 } "testhash" get at ] unit-test
+{ f } [ 100000000000000000000000000 "testhash" get at* drop ] unit-test
+{ { } } [ { [ { } ] } clone "testhash" get at* drop ] unit-test
! Regression
3 <hashtable> "broken-remove" set
2 W{ \ = } dup "y" set "broken-remove" get set-at
"x" get "broken-remove" get delete-at
2 "y" get "broken-remove" get set-at
-[ 1 ] [ "broken-remove" get keys length ] unit-test
+{ 1 } [ "broken-remove" get keys length ] unit-test
{
{ "salmon" "fish" }
{ "visual basic" "language" }
} >hashtable "testhash" set
-[ f f ] [
+{ f f } [
"visual basic" "testhash" get delete-at
"visual basic" "testhash" get at*
] unit-test
-[ t ] [ H{ } dup = ] unit-test
-[ f ] [ "xyz" H{ } = ] unit-test
-[ t ] [ H{ } H{ } = ] unit-test
-[ f ] [ H{ { 1 3 } } H{ } = ] unit-test
-[ f ] [ H{ } H{ { 1 3 } } = ] unit-test
-[ t ] [ H{ { 1 3 } } H{ { 1 3 } } = ] unit-test
-[ f ] [ H{ { 1 3 } } H{ { 1 "hey" } } = ] unit-test
+{ t } [ H{ } dup = ] unit-test
+{ f } [ "xyz" H{ } = ] unit-test
+{ t } [ H{ } H{ } = ] unit-test
+{ f } [ H{ { 1 3 } } H{ } = ] unit-test
+{ f } [ H{ } H{ { 1 3 } } = ] unit-test
+{ t } [ H{ { 1 3 } } H{ { 1 3 } } = ] unit-test
+{ f } [ H{ { 1 3 } } H{ { 1 "hey" } } = ] unit-test
! Testing the hash element counting
H{ } clone "counting" set
"value" "key" "counting" get set-at
-[ 1 ] [ "counting" get assoc-size ] unit-test
+{ 1 } [ "counting" get assoc-size ] unit-test
"value" "key" "counting" get set-at
-[ 1 ] [ "counting" get assoc-size ] unit-test
+{ 1 } [ "counting" get assoc-size ] unit-test
"key" "counting" get delete-at
-[ 0 ] [ "counting" get assoc-size ] unit-test
+{ 0 } [ "counting" get assoc-size ] unit-test
"key" "counting" get delete-at
-[ 0 ] [ "counting" get assoc-size ] unit-test
+{ 0 } [ "counting" get assoc-size ] unit-test
! Test rehashing
5 5 "rehash" get set-at
6 6 "rehash" get set-at
-[ 6 ] [ "rehash" get assoc-size ] unit-test
+{ 6 } [ "rehash" get assoc-size ] unit-test
-[ 6 ] [ "rehash" get clone assoc-size ] unit-test
+{ 6 } [ "rehash" get clone assoc-size ] unit-test
"rehash" get clear-assoc
-[ 0 ] [ "rehash" get assoc-size ] unit-test
+{ 0 } [ "rehash" get assoc-size ] unit-test
-[
+{
3
-] [
+} [
2 H{
{ 1 2 }
{ 2 3 }
10 [ f f "f-hash-test" get set-at ] times
-[ 1 ] [ "f-hash-test" get assoc-size ] unit-test
+{ 1 } [ "f-hash-test" get assoc-size ] unit-test
! Resource leak...
H{ } "x" set
100 [ drop "x" get clear-assoc ] each-integer
! Crash discovered by erg
-[ t ] [ 0.75 <hashtable> dup clone = ] unit-test
+{ t } [ 0.75 <hashtable> dup clone = ] unit-test
! Another crash discovered by erg
-[ ] [
+{ } [
H{ } clone
[ 1 swap set-at ] ignore-errors
[ 2 swap set-at ] ignore-errors
drop
] unit-test
-[ H{ { -1 4 } { -3 16 } { -5 36 } } ] [
+{ H{ { -1 4 } { -3 16 } { -5 36 } } } [
H{ { 1 2 } { 3 4 } { 5 6 } }
[ [ neg ] dip sq ] assoc-map
] unit-test
! Bug discovered by littledan
-[ { 5 5 5 5 } ] [
+{ { 5 5 5 5 } } [
[
H{
{ 1 2 }
] { } make
] unit-test
-[ { "one" "two" 3 } ] [
+{ { "one" "two" 3 } } [
{ 1 2 3 } H{ { 1 "one" } { 2 "two" } } substitute
] unit-test
! We want this to work
-[ ] [ hashtable new "h" set ] unit-test
+{ } [ hashtable new "h" set ] unit-test
-[ 0 ] [ "h" get assoc-size ] unit-test
+{ 0 } [ "h" get assoc-size ] unit-test
-[ f f ] [ "goo" "h" get at* ] unit-test
+{ f f } [ "goo" "h" get at* ] unit-test
-[ ] [ 1 2 "h" get set-at ] unit-test
+{ } [ 1 2 "h" get set-at ] unit-test
-[ 1 ] [ "h" get assoc-size ] unit-test
+{ 1 } [ "h" get assoc-size ] unit-test
-[ 1 ] [ 2 "h" get at ] unit-test
+{ 1 } [ 2 "h" get at ] unit-test
! Random test case
-[ "A" ] [ 100 iota [ dup ] H{ } map>assoc 32 over delete-at "A" 32 pick set-at 32 of ] unit-test
+{ "A" } [ 100 iota [ dup ] H{ } map>assoc 32 over delete-at "A" 32 pick set-at 32 of ] unit-test
USING: tools.test io.backend kernel ;
IN: io.backend.tests
-[ ] [ "a" normalize-path drop ] unit-test
+{ } [ "a" normalize-path drop ] unit-test
USING: io.binary tools.test classes math ;
IN: io.binary.tests
-[ 0x03020100 ] [ B{ 0 1 2 3 } le> ] unit-test
-[ 0x00010203 ] [ B{ 0 1 2 3 } be> ] unit-test
+{ 0x03020100 } [ B{ 0 1 2 3 } le> ] unit-test
+{ 0x00010203 } [ B{ 0 1 2 3 } be> ] unit-test
-[ 0x332211 ] [
+{ 0x332211 } [
B{ 0x11 0x22 0x33 } le>
] unit-test
{ -12 } [ B{ 0xf4 0xff 0xff 0xff } signed-le> ] unit-test
{ -12 } [ B{ 0xff 0xff 0xff 0xf4 } signed-be> ] unit-test
-[ 0x7a2c793b2ff08554 ] [
+{ 0x7a2c793b2ff08554 } [
B{ 0x54 0x85 0xf0 0x2f 0x3b 0x79 0x2c 0x7a } le>
] unit-test
-[ 0x988a259c3433f237 ] [
+{ 0x988a259c3433f237 } [
B{ 0x37 0xf2 0x33 0x34 0x9c 0x25 0x8a 0x98 } le>
] unit-test
-[ B{ 0 0 4 0xd2 } ] [ 1234 4 >be ] unit-test
-[ B{ 0 0 0 0 0 0 4 0xd2 } ] [ 1234 8 >be ] unit-test
-[ B{ 0xd2 4 0 0 } ] [ 1234 4 >le ] unit-test
-[ B{ 0xd2 4 0 0 0 0 0 0 } ] [ 1234 8 >le ] unit-test
+{ B{ 0 0 4 0xd2 } } [ 1234 4 >be ] unit-test
+{ B{ 0 0 0 0 0 0 4 0xd2 } } [ 1234 8 >be ] unit-test
+{ B{ 0xd2 4 0 0 } } [ 1234 4 >le ] unit-test
+{ B{ 0xd2 4 0 0 0 0 0 0 } } [ 1234 8 >le ] unit-test
-[ 1234 ] [ 1234 4 >be be> ] unit-test
-[ 1234 ] [ 1234 4 >le le> ] unit-test
+{ 1234 } [ 1234 4 >be be> ] unit-test
+{ 1234 } [ 1234 4 >le le> ] unit-test
-[ fixnum ] [ B{ 0 0 0 0 0 0 0 0 0 0 } be> class-of ] unit-test
+{ fixnum } [ B{ 0 0 0 0 0 0 0 0 0 0 } be> class-of ] unit-test
-[ 0x56780000 0x12340000 ] [ 0x1234000056780000 d>w/w ] unit-test
-[ 0x5678 0x1234 ] [ 0x12345678 w>h/h ] unit-test
-[ 0x34 0x12 ] [ 0x1234 h>b/b ] unit-test
+{ 0x56780000 0x12340000 } [ 0x1234000056780000 d>w/w ] unit-test
+{ 0x5678 0x1234 } [ 0x12345678 w>h/h ] unit-test
+{ 0x34 0x12 } [ 0x1234 h>b/b ] unit-test
USING: io.encodings.string io.encodings.ascii tools.test strings arrays ;
IN: io.encodings.ascii.tests
-[ B{ CHAR: f CHAR: o CHAR: o } ] [ "foo" ascii encode ] unit-test
+{ B{ CHAR: f CHAR: o CHAR: o } } [ "foo" ascii encode ] unit-test
[ { 128 } >string ascii encode ] must-fail
-[ B{ 127 } ] [ { 127 } >string ascii encode ] unit-test
+{ B{ 127 } } [ { 127 } >string ascii encode ] unit-test
-[ "bar" ] [ "bar" ascii decode ] unit-test
-[ { CHAR: b 0xfffd CHAR: r } ] [ B{ CHAR: b 233 CHAR: r } ascii decode >array ] unit-test
+{ "bar" } [ "bar" ascii decode ] unit-test
+{ { CHAR: b 0xfffd CHAR: r } } [ B{ CHAR: b 233 CHAR: r } ascii decode >array ] unit-test
tools.test ;
IN: io.encodings.tests
-[ { } ]
+{ { } }
[ "vocab:io/test/empty-file.txt" ascii file-lines ]
unit-test
: lines-test ( file encoding -- line1 line2 )
[ readln readln ] with-file-reader ;
-[
+{
"This is a line."
"This is another line."
-] [
+} [
"vocab:io/test/windows-eol.txt"
ascii lines-test
] unit-test
-[
+{
"This is a line."
"This is another line."
-] [
+} [
"vocab:io/test/mac-os-eol.txt"
ascii lines-test
] unit-test
-[
+{
"This is a line."
"This is another line."
-] [
+} [
"vocab:io/test/unix-eol.txt"
ascii lines-test
] unit-test
-[
+{
"1234"
-] [
+} [
"Hello world\r\n1234" <string-reader>
dup stream-readln drop
4 swap stream-read
] unit-test
-[
+{
"1234"
-] [
+} [
"Hello world\r\n1234" <string-reader>
dup stream-readln drop
4 swap stream-read-partial
] unit-test
-[
+{
CHAR: 1
-] [
+} [
"Hello world\r\n1234" <string-reader>
dup stream-readln drop
stream-read1
] unit-test
-[ utf8 ascii ] [
+{ utf8 ascii } [
"foo" utf8 [
input-stream get code>>
ascii decode-input
] with-byte-reader
] unit-test
-[ utf8 ascii ] [
+{ utf8 ascii } [
utf8 [
output-stream get code>>
ascii encode-output
io.encodings.string alien.c-types alien.strings accessors classes ;
IN: io.encodings.utf16.tests
-[ { CHAR: x } ] [ B{ 0 CHAR: x } utf16be decode >array ] unit-test
-[ { 0x1D11E } ] [ B{ 0xD8 0x34 0xDD 0x1E } utf16be decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ B{ 0b11011111 CHAR: q } utf16be decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ B{ 0b11011011 CHAR: x 0b11011011 CHAR: x } utf16be decode >array ] unit-test
+{ { CHAR: x } } [ B{ 0 CHAR: x } utf16be decode >array ] unit-test
+{ { 0x1D11E } } [ B{ 0xD8 0x34 0xDD 0x1E } utf16be decode >array ] unit-test
+{ { CHAR: replacement-character } } [ B{ 0b11011111 CHAR: q } utf16be decode >array ] unit-test
+{ { CHAR: replacement-character } } [ B{ 0b11011011 CHAR: x 0b11011011 CHAR: x } utf16be decode >array ] unit-test
-[ { 0 120 216 52 221 30 } ] [ { CHAR: x 0x1d11e } >string utf16be encode >array ] unit-test
+{ { 0 120 216 52 221 30 } } [ { CHAR: x 0x1d11e } >string utf16be encode >array ] unit-test
-[ { CHAR: x } ] [ B{ CHAR: x 0 } utf16le decode >array ] unit-test
-[ { 119070 } ] [ B{ 0x34 0xD8 0x1E 0xDD } >string utf16le decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ { 0 0b11011111 } >string utf16le decode >array ] unit-test
-[ { CHAR: replacement-character } ] [ { 0 0b11011011 0 0 } >string utf16le decode >array ] unit-test
+{ { CHAR: x } } [ B{ CHAR: x 0 } utf16le decode >array ] unit-test
+{ { 119070 } } [ B{ 0x34 0xD8 0x1E 0xDD } >string utf16le decode >array ] unit-test
+{ { CHAR: replacement-character } } [ { 0 0b11011111 } >string utf16le decode >array ] unit-test
+{ { CHAR: replacement-character } } [ { 0 0b11011011 0 0 } >string utf16le decode >array ] unit-test
-[ { 120 0 52 216 30 221 } ] [ { CHAR: x 0x1d11e } >string utf16le encode >array ] unit-test
+{ { 120 0 52 216 30 221 } } [ { CHAR: x 0x1d11e } >string utf16le encode >array ] unit-test
-[ { CHAR: x } ] [ B{ 0xff 0xfe CHAR: x 0 } utf16 decode >array ] unit-test
-[ { CHAR: x } ] [ B{ 0xfe 0xff 0 CHAR: x } utf16 decode >array ] unit-test
+{ { CHAR: x } } [ B{ 0xff 0xfe CHAR: x 0 } utf16 decode >array ] unit-test
+{ { CHAR: x } } [ B{ 0xfe 0xff 0 CHAR: x } utf16 decode >array ] unit-test
-[ { 0xff 0xfe 120 0 52 216 30 221 } ] [ { CHAR: x 0x1d11e } >string utf16 encode >array ] unit-test
+{ { 0xff 0xfe 120 0 52 216 30 221 } } [ { CHAR: x 0x1d11e } >string utf16 encode >array ] unit-test
! test ascii encoding path
-[ B{ CHAR: a 0 CHAR: b 0 CHAR: c 0 } ] [ "abc" utf16le encode ] unit-test
-[ B{ 0 CHAR: a 0 CHAR: b 0 CHAR: c } ] [ "abc" utf16be encode ] unit-test
+{ B{ CHAR: a 0 CHAR: b 0 CHAR: c 0 } } [ "abc" utf16le encode ] unit-test
+{ B{ 0 CHAR: a 0 CHAR: b 0 CHAR: c } } [ "abc" utf16be encode ] unit-test
: correct-endian ( obj -- ? )
code>> little-endian? [ utf16le = ] [ utf16be = ] if ;
-[ t ] [ B{ } utf16n <byte-reader> correct-endian ] unit-test
-[ t ] [ utf16n <byte-writer> correct-endian ] unit-test
+{ t } [ B{ } utf16n <byte-reader> correct-endian ] unit-test
+{ t } [ utf16n <byte-writer> correct-endian ] unit-test
: encode-utf8-w/stream ( array -- newarray )
>string utf8 encode >array ;
-[ { CHAR: replacement-character } ] [ { 0b11110,101 0b10,111111 0b10,000000 0b11111111 } decode-utf8-w/stream ] unit-test
+{ { CHAR: replacement-character } } [ { 0b11110,101 0b10,111111 0b10,000000 0b11111111 } decode-utf8-w/stream ] unit-test
-[ "x" ] [ "x" decode-utf8-w/stream >string ] unit-test
+{ "x" } [ "x" decode-utf8-w/stream >string ] unit-test
-[ { 0b11111000000 } ] [ { 0b110,11111 0b10,000000 } decode-utf8-w/stream >array ] unit-test
+{ { 0b11111000000 } } [ { 0b110,11111 0b10,000000 } decode-utf8-w/stream >array ] unit-test
-[ { CHAR: replacement-character } ] [ { 0b10000000 } decode-utf8-w/stream ] unit-test
+{ { CHAR: replacement-character } } [ { 0b10000000 } decode-utf8-w/stream ] unit-test
-[ { 0b1111000000111111 } ] [ { 0b1110,1111 0b10,000000 0b10,111111 } decode-utf8-w/stream >array ] unit-test
+{ { 0b1111000000111111 } } [ { 0b1110,1111 0b10,000000 0b10,111111 } decode-utf8-w/stream >array ] unit-test
-[ { 0b11110,101 0b10,111111 0b10,000000 0b10,111111 0b1110,1111 0b10,000000 0b10,111111 0b110,11111 0b10,000000 CHAR: x } ]
+{ { 0b11110,101 0b10,111111 0b10,000000 0b10,111111 0b1110,1111 0b10,000000 0b10,111111 0b110,11111 0b10,000000 CHAR: x } }
[ { 0b101111111000000111111 0b1111000000111111 0b11111000000 CHAR: x } encode-utf8-w/stream ] unit-test
-[ 3 ] [ 1 "日本語" >utf8-index ] unit-test
-[ 3 ] [ 9 "日本語" utf8-index> ] unit-test
+{ 3 } [ 1 "日本語" >utf8-index ] unit-test
+{ 3 } [ 9 "日本語" utf8-index> ] unit-test
-[ 3 ] [ 2 "lápis" >utf8-index ] unit-test
+{ 3 } [ 2 "lápis" >utf8-index ] unit-test
-[ V{ } ] [ 100000 iota [ [ code-point-length ] [ 1string utf8 encode length ] bi = ] reject ] unit-test
+{ V{ } } [ 100000 iota [ [ code-point-length ] [ 1string utf8 encode length ] bi = ] reject ] unit-test
-[ { CHAR: replacement-character } ] [ { 0b110,00000 0b10,000000 } decode-utf8-w/stream ] unit-test
-[ { CHAR: replacement-character } ] [ { 0b110,00001 0b10,111111 } decode-utf8-w/stream ] unit-test
-[ { 0x80 } ] [ { 0b110,00010 0b10,000000 } decode-utf8-w/stream ] unit-test
+{ { CHAR: replacement-character } } [ { 0b110,00000 0b10,000000 } decode-utf8-w/stream ] unit-test
+{ { CHAR: replacement-character } } [ { 0b110,00001 0b10,111111 } decode-utf8-w/stream ] unit-test
+{ { 0x80 } } [ { 0b110,00010 0b10,000000 } decode-utf8-w/stream ] unit-test
-[ { CHAR: replacement-character } ] [ { 0b1110,0000 0b10,000000 0b10,000000 } decode-utf8-w/stream ] unit-test
-[ { CHAR: replacement-character } ] [ { 0b1110,0000 0b10,011111 0b10,111111 } decode-utf8-w/stream ] unit-test
-[ { 0x800 } ] [ { 0b1110,0000 0b10,100000 0b10,000000 } decode-utf8-w/stream ] unit-test
+{ { CHAR: replacement-character } } [ { 0b1110,0000 0b10,000000 0b10,000000 } decode-utf8-w/stream ] unit-test
+{ { CHAR: replacement-character } } [ { 0b1110,0000 0b10,011111 0b10,111111 } decode-utf8-w/stream ] unit-test
+{ { 0x800 } } [ { 0b1110,0000 0b10,100000 0b10,000000 } decode-utf8-w/stream ] unit-test
-[ { CHAR: replacement-character } ] [ { 0b11110,000 0b10,000000 0b10,000000 0b10,000000 } decode-utf8-w/stream ] unit-test
-[ { CHAR: replacement-character } ] [ { 0b11110,000 0b10,001111 0b10,111111 0b10,111111 } decode-utf8-w/stream ] unit-test
-[ { CHAR: replacement-character } ] [ { 0b11110,100 0b10,010000 0b10,000000 0b10,000000 } decode-utf8-w/stream ] unit-test
-[ { 0x10000 } ] [ { 0b11110,000 0b10,010000 0b10,000000 0b10,000000 } decode-utf8-w/stream ] unit-test
-[ { 0x10FFFF } ] [ { 0b11110,100 0b10,001111 0b10,111111 0b10,111111 } decode-utf8-w/stream ] unit-test
+{ { CHAR: replacement-character } } [ { 0b11110,000 0b10,000000 0b10,000000 0b10,000000 } decode-utf8-w/stream ] unit-test
+{ { CHAR: replacement-character } } [ { 0b11110,000 0b10,001111 0b10,111111 0b10,111111 } decode-utf8-w/stream ] unit-test
+{ { CHAR: replacement-character } } [ { 0b11110,100 0b10,010000 0b10,000000 0b10,000000 } decode-utf8-w/stream ] unit-test
+{ { 0x10000 } } [ { 0b11110,000 0b10,010000 0b10,000000 0b10,000000 } decode-utf8-w/stream ] unit-test
+{ { 0x10FFFF } } [ { 0b11110,100 0b10,001111 0b10,111111 0b10,111111 } decode-utf8-w/stream ] unit-test
SPECIALIZED-ARRAY: int
IN: io.files.tests
-[ ] [ "append-test" temp-file dup exists? [ delete-file ] [ drop ] if ] unit-test
+{ } [ "append-test" temp-file dup exists? [ delete-file ] [ drop ] if ] unit-test
-[ ] [ "append-test" temp-file ascii <file-appender> dispose ] unit-test
+{ } [ "append-test" temp-file ascii <file-appender> dispose ] unit-test
-[
+{
"This is a line.\rThis is another line.\r"
-] [
+} [
"vocab:io/test/mac-os-eol.txt" latin1
[ 500 read ] with-file-reader
] unit-test
-[
+{
255
-] [
+} [
"vocab:io/test/binary.txt" latin1
[ read1 ] with-file-reader >fixnum
] unit-test
-[
+{
"This" CHAR: \s
-] [
+} [
"vocab:io/test/read-until-test.txt" ascii
[ " " read-until ] with-file-reader
] unit-test
-[
+{
"This" CHAR: \s
-] [
+} [
"vocab:io/test/read-until-test.txt" binary
[ " " read-until [ ascii decode ] dip ] with-file-reader
] unit-test
-[ ] [
+{ } [
"It seems Jobs has lost his grasp on reality again.\n"
"separator-test.txt" temp-file latin1 set-file-contents
] unit-test
-[
+{
{
{ "It seems " CHAR: J }
{ "obs has lost h" CHAR: i }
{ "s grasp on reality again.\n" f }
}
-] [
+} [
[
"separator-test.txt" temp-file
latin1 [
] { } make
] unit-test
-[ ] [
+{ } [
image binary [
10 [ 65536 read drop ] times
] with-file-reader
] unit-test
! Writing specialized arrays to binary streams should work
-[ ] [
+{ } [
"test.txt" temp-file binary [
int-array{ 1 2 3 } write
] with-file-writer
] unit-test
-[ int-array{ 1 2 3 } ] [
+{ int-array{ 1 2 3 } } [
"test.txt" temp-file binary [
3 4 * read
] with-file-reader
int cast-array
] unit-test
-[ ] [
+{ } [
BV{ 0 1 2 } "test.txt" temp-file binary set-file-contents
] unit-test
-[ t ] [
+{ t } [
"test.txt" temp-file binary file-contents
B{ 0 1 2 } =
] unit-test
CONSTANT: pt-array-1
pt-array{ S{ pt f 1 1 } S{ pt f 2 2 } S{ pt f 3 3 } }
-[ ] [
+{ } [
pt-array-1
"test.txt" temp-file binary set-file-contents
] unit-test
-[ t ] [
+{ t } [
"test.txt" temp-file binary file-contents
pt-array-1 >c-ptr sequence=
] unit-test
! Slices should support >c-ptr and byte-length
-[ ] [
+{ } [
pt-array-1 rest-slice
"test.txt" temp-file binary set-file-contents
] unit-test
-[ t ] [
+{ t } [
"test.txt" temp-file binary file-contents
pt cast-array
pt-array-1 rest-slice sequence=
] unit-test
-[ ] [
+{ } [
[
pt specialized-array-vocab forget-vocab
] with-compilation-unit
] must-fail
! Test EOF behavior
-[ 10 ] [
+{ 10 } [
image binary [
0 read drop
10 read length
] unit-test
! Make sure that writing to a closed stream from another thread doesn't crash
-[ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
+{ } [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
-[ ] [ "test-quux.txt" temp-file delete-file ] unit-test
+{ } [ "test-quux.txt" temp-file delete-file ] unit-test
-[ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
+{ } [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test
-[ ] [ "test-quux.txt" "quux-test.txt" [ temp-file ] bi@ move-file ] unit-test
+{ } [ "test-quux.txt" "quux-test.txt" [ temp-file ] bi@ move-file ] unit-test
-[ t ] [ "quux-test.txt" temp-file exists? ] unit-test
+{ t } [ "quux-test.txt" temp-file exists? ] unit-test
-[ ] [ "quux-test.txt" temp-file delete-file ] unit-test
+{ } [ "quux-test.txt" temp-file delete-file ] unit-test
! File seeking tests
-[ B{ 3 2 3 4 5 } ]
+{ B{ 3 2 3 4 5 } }
[
"seek-test1" unique-file binary
[
] 2bi
] unit-test
-[ B{ 1 2 3 4 3 } ]
+{ B{ 1 2 3 4 3 } }
[
"seek-test2" unique-file binary
[
] 2bi
] unit-test
-[ B{ 1 2 3 4 5 0 3 } ]
+{ B{ 1 2 3 4 5 0 3 } }
[
"seek-test3" unique-file binary
[
] 2bi
] unit-test
-[ B{ 3 } ]
+{ B{ 3 } }
[
B{ 1 2 3 4 5 } "seek-test4" unique-file binary [
set-file-contents
] 2bi
] unit-test
-[ B{ 2 } ]
+{ B{ 2 } }
[
B{ 1 2 3 4 5 } "seek-test5" unique-file binary [
set-file-contents
] with-file-reader
] must-fail
-[ ] [
+{ } [
"resource:license.txt" binary [
44 read drop
tell-input 44 assert=
] [ no-method? ] must-fail-with
! What happens if we close a file twice?
-[ ] [
+{ } [
"closing-twice" unique-file ascii <file-writer>
[ dispose ] [ dispose ] bi
] unit-test
{ SBUF" asdf" }
[ "asdf" <string-reader> 4 <sbuf> [ stream-copy ] keep ] unit-test
-[ "asdf" ]
+{ "asdf" }
[
[
[ "asdf" error-stream get stream-write ] with-error>output
] with-string-writer
] unit-test
-[ "asdf" ]
+{ "asdf" }
[
<string-writer> [
[
io.backend io.pathnames.private ;
IN: io.pathnames.tests
-[ "passwd" ] [ "/etc/passwd" file-name ] unit-test
-[ "awk" ] [ "/usr/libexec/awk/" file-name ] unit-test
-[ "awk" ] [ "/usr/libexec/awk///" file-name ] unit-test
-[ "" ] [ "" file-name ] unit-test
-
-[ "freetype6.dll" ] [ "resource:freetype6.dll" file-name ] unit-test
-[ "freetype6.dll" ] [ "resource:/freetype6.dll" file-name ] unit-test
-
-[ "/usr/lib" ] [ "/usr" "lib" append-path ] unit-test
-[ "/usr/lib" ] [ "/usr/" "lib" append-path ] unit-test
-[ "/usr/lib" ] [ "/usr" "./lib" append-path ] unit-test
-[ "/usr/lib/" ] [ "/usr" "./lib/" append-path ] unit-test
-[ "/lib" ] [ "/usr" "../lib" append-path ] unit-test
-[ "/lib/" ] [ "/usr" "../lib/" append-path ] unit-test
-
-[ "" ] [ "" "." append-path ] unit-test
+{ "passwd" } [ "/etc/passwd" file-name ] unit-test
+{ "awk" } [ "/usr/libexec/awk/" file-name ] unit-test
+{ "awk" } [ "/usr/libexec/awk///" file-name ] unit-test
+{ "" } [ "" file-name ] unit-test
+
+{ "freetype6.dll" } [ "resource:freetype6.dll" file-name ] unit-test
+{ "freetype6.dll" } [ "resource:/freetype6.dll" file-name ] unit-test
+
+{ "/usr/lib" } [ "/usr" "lib" append-path ] unit-test
+{ "/usr/lib" } [ "/usr/" "lib" append-path ] unit-test
+{ "/usr/lib" } [ "/usr" "./lib" append-path ] unit-test
+{ "/usr/lib/" } [ "/usr" "./lib/" append-path ] unit-test
+{ "/lib" } [ "/usr" "../lib" append-path ] unit-test
+{ "/lib/" } [ "/usr" "../lib/" append-path ] unit-test
+
+{ "" } [ "" "." append-path ] unit-test
[ "" ".." append-path ] must-fail
-[ "/" ] [ "/" "./." append-path ] unit-test
-[ "/" ] [ "/" "././" append-path ] unit-test
-[ "/a/b/lib" ] [ "/a/b/c/d/e/f/" "../../../../lib" append-path ] unit-test
-[ "/a/b/lib/" ] [ "/a/b/c/d/e/f/" "../../../../lib/" append-path ] unit-test
+{ "/" } [ "/" "./." append-path ] unit-test
+{ "/" } [ "/" "././" append-path ] unit-test
+{ "/a/b/lib" } [ "/a/b/c/d/e/f/" "../../../../lib" append-path ] unit-test
+{ "/a/b/lib/" } [ "/a/b/c/d/e/f/" "../../../../lib/" append-path ] unit-test
[ "" "../lib/" append-path ] must-fail
-[ "lib" ] [ "" "lib" append-path ] unit-test
-[ "lib" ] [ "" "./lib" append-path ] unit-test
+{ "lib" } [ "" "lib" append-path ] unit-test
+{ "lib" } [ "" "./lib" append-path ] unit-test
[ "foo/bar/." parent-directory ] must-fail
[ "foo/bar/./" parent-directory ] must-fail
[ "foo/.." parent-directory ] must-fail
[ "foo/../" parent-directory ] must-fail
[ "" parent-directory ] must-fail
-[ "." ] [ "boot.x86.64.image" parent-directory ] unit-test
+{ "." } [ "boot.x86.64.image" parent-directory ] unit-test
-[ "bar/foo" ] [ "bar/baz" "..///foo" append-path ] unit-test
-[ "bar/baz/foo" ] [ "bar/baz" ".///foo" append-path ] unit-test
-[ "bar/foo" ] [ "bar/baz" "./..//foo" append-path ] unit-test
-[ "bar/foo" ] [ "bar/baz" "./../././././././///foo" append-path ] unit-test
+{ "bar/foo" } [ "bar/baz" "..///foo" append-path ] unit-test
+{ "bar/baz/foo" } [ "bar/baz" ".///foo" append-path ] unit-test
+{ "bar/foo" } [ "bar/baz" "./..//foo" append-path ] unit-test
+{ "bar/foo" } [ "bar/baz" "./../././././././///foo" append-path ] unit-test
-[ t ] [ "resource:core" absolute-path? ] unit-test
-[ f ] [ "" absolute-path? ] unit-test
+{ t } [ "resource:core" absolute-path? ] unit-test
+{ f } [ "" absolute-path? ] unit-test
[ "touch-twice-test" temp-file delete-file ] ignore-errors
-[ ] [ 2 [ "touch-twice-test" temp-file touch-file ] times ] unit-test
+{ } [ 2 [ "touch-twice-test" temp-file touch-file ] times ] unit-test
! aum's bug
[
unit-test
] with-scope
-[ t ] [ cwd "misc" resource-path [ ] with-directory cwd = ] unit-test
+{ t } [ cwd "misc" resource-path [ ] with-directory cwd = ] unit-test
! Regression test for bug in file-extension
-[ f ] [ "/funny.directory/file-with-no-extension" file-extension ] unit-test
-[ "" ] [ "/funny.directory/file-with-no-extension." file-extension ] unit-test
+{ f } [ "/funny.directory/file-with-no-extension" file-extension ] unit-test
+{ "" } [ "/funny.directory/file-with-no-extension." file-extension ] unit-test
! Testing ~ special pathname
-[ t ] [ os windows? "~\\" "~/" ? absolute-path home = ] unit-test
-[ t ] [ "~/" home [ normalize-path ] same? ] unit-test
+{ t } [ os windows? "~\\" "~/" ? absolute-path home = ] unit-test
+{ t } [ "~/" home [ normalize-path ] same? ] unit-test
-[ t ] [ "~" absolute-path home = ] unit-test
-[ t ] [ "~" home [ normalize-path ] same? ] unit-test
+{ t } [ "~" absolute-path home = ] unit-test
+{ t } [ "~" home [ normalize-path ] same? ] unit-test
-[ t ] [ "~" home [ "foo" append-path ] bi@ [ normalize-path ] same? ] unit-test
-[ t ] [ os windows? "~\\~/" "~/~/" ? "~" "~" append-path [ path-components ] same? ] unit-test
+{ t } [ "~" home [ "foo" append-path ] bi@ [ normalize-path ] same? ] unit-test
+{ t } [ os windows? "~\\~/" "~/~/" ? "~" "~" append-path [ path-components ] same? ] unit-test
SPECIALIZED-ARRAY: int
IN: io.streams.byte-array.tests
-[ B{ } ] [ B{ } binary [ contents ] with-byte-reader ] unit-test
+{ B{ } } [ B{ } binary [ contents ] with-byte-reader ] unit-test
! Issue #70 github
-[ f ] [ B{ } binary [ 0 read ] with-byte-reader ] unit-test
-[ f ] [ B{ } binary [ 1 read ] with-byte-reader ] unit-test
-[ f ] [ B{ } ascii [ 0 read ] with-byte-reader ] unit-test
-[ f ] [ B{ } ascii [ readln ] with-byte-reader ] unit-test
-[ f f ] [ B{ } ascii [ "a" read-until ] with-byte-reader ] unit-test
-[ f f ] [ B{ } binary [ { 2 } read-until ] with-byte-reader ] unit-test
+{ f } [ B{ } binary [ 0 read ] with-byte-reader ] unit-test
+{ f } [ B{ } binary [ 1 read ] with-byte-reader ] unit-test
+{ f } [ B{ } ascii [ 0 read ] with-byte-reader ] unit-test
+{ f } [ B{ } ascii [ readln ] with-byte-reader ] unit-test
+{ f f } [ B{ } ascii [ "a" read-until ] with-byte-reader ] unit-test
+{ f f } [ B{ } binary [ { 2 } read-until ] with-byte-reader ] unit-test
-[ B{ 1 2 3 } ] [ binary [ B{ 1 2 3 } write ] with-byte-writer ] unit-test
-[ B{ 1 2 3 4 5 6 } ] [ binary [ B{ 1 2 3 } write B{ 4 5 6 } write ] with-byte-writer ] unit-test
-[ B{ 1 2 3 } ] [ { 1 2 3 } binary [ 3 read ] with-byte-reader ] unit-test
+{ B{ 1 2 3 } } [ binary [ B{ 1 2 3 } write ] with-byte-writer ] unit-test
+{ B{ 1 2 3 4 5 6 } } [ binary [ B{ 1 2 3 } write B{ 4 5 6 } write ] with-byte-writer ] unit-test
+{ B{ 1 2 3 } } [ { 1 2 3 } binary [ 3 read ] with-byte-reader ] unit-test
-[ B{ 0b11110101 0b10111111 0b10000000 0b10111111 0b11101111 0b10000000 0b10111111 0b11011111 0b10000000 CHAR: x } ]
+{ B{ 0b11110101 0b10111111 0b10000000 0b10111111 0b11101111 0b10000000 0b10111111 0b11011111 0b10000000 CHAR: x } }
[ { 0b101111111000000111111 0b1111000000111111 0b11111000000 CHAR: x } >string utf8 [ write ] with-byte-writer ] unit-test
-[ { 0b1111111000000111111 } t ] [ { 0b11110001 0b10111111 0b10000000 0b10111111 } utf8 <byte-reader> stream-contents dup >array swap string? ] unit-test
+{ { 0b1111111000000111111 } t } [ { 0b11110001 0b10111111 0b10000000 0b10111111 } utf8 <byte-reader> stream-contents dup >array swap string? ] unit-test
-[ B{ 121 120 } 0 ] [
+{ B{ 121 120 } 0 } [
B{ 0 121 120 0 0 0 0 0 0 } binary
[ 1 read drop "\0" read-until ] with-byte-reader
] unit-test
B{ } binary [ B{ 0 } read-until ] with-byte-reader
] unit-test
-[ 1 1 4 11 f ] [
+{ 1 1 4 11 f } [
B{ 1 2 3 4 5 6 7 8 9 10 11 12 } binary
[
read1
] with-byte-reader
] unit-test
-[ 0 ] [
+{ 0 } [
B{ 1 2 3 4 5 6 7 8 9 10 11 12 } binary [ tell-input ] with-byte-reader
] unit-test
! Overly aggressive compiler optimizations
-[ B{ 123 } ] [
+{ B{ 123 } } [
binary [ 123 >bignum write1 ] with-byte-writer
] unit-test
! Writing specialized arrays to byte writers
-[ int-array{ 1 2 3 } ] [
+{ int-array{ 1 2 3 } } [
binary [ int-array{ 1 2 3 } write ] with-byte-writer
int cast-array
] unit-test
SPECIALIZED-ARRAY: int
IN: io.streams.c.tests
-[ "hello world" ] [
+{ "hello world" } [
"hello world" "test.txt" temp-file ascii set-file-contents
"test.txt" temp-file "rb" fopen <c-reader> stream-contents
] unit-test
! Writing specialized arrays to binary streams
-[ ] [
+{ } [
"test.txt" temp-file "wb" fopen <c-writer> [
int-array{ 1 2 3 } write
] with-output-stream
] unit-test
-[ int-array{ 1 2 3 } ] [
+{ int-array{ 1 2 3 } } [
"test.txt" temp-file "rb" fopen <c-reader> [
3 4 * read
] with-input-stream
system alien alien.accessors kernel.private ;
IN: kernel.tests
-[ 0 ] [ f size ] unit-test
-[ t ] [ [ \ = \ = ] all-equal? ] unit-test
+{ 0 } [ f size ] unit-test
+{ t } [ [ \ = \ = ] all-equal? ] unit-test
-[
+{
{
{ 1 2 0 }
{ 1 2 1 }
{ 1 2 8 }
{ 1 2 9 }
}
-] [ 1 2 10 iota [ 3array ] 2with map ] unit-test
+} [ 1 2 10 iota [ 3array ] 2with map ] unit-test
! Don't leak extra roots if error is thrown
-[ ] [ 1000 [ [ 3 throw ] ignore-errors ] times ] unit-test
+{ } [ 1000 [ [ 3 throw ] ignore-errors ] times ] unit-test
-[ ] [ 1000 [ [ -1 f <array> ] ignore-errors ] times ] unit-test
+{ } [ 1000 [ [ -1 f <array> ] ignore-errors ] times ] unit-test
! Make sure we report the correct error on stack underflow
[ clear drop ] [
${ "kernel-error" ERROR-DATASTACK-UNDERFLOW f f } =
] must-fail-with
-[ ] [ :c ] unit-test
+{ } [ :c ] unit-test
[
3 [ { } set-retainstack ] dip ]
[ ${ "kernel-error" ERROR-RETAINSTACK-UNDERFLOW f f } =
] must-fail-with
-[ ] [ :c ] unit-test
+{ } [ :c ] unit-test
: overflow-d ( -- ) 3 overflow-d ;
${ "kernel-error" ERROR-DATASTACK-OVERFLOW f f } =
] must-fail-with
-[ ] [ :c ] unit-test
+{ } [ :c ] unit-test
[ overflow-d-alt ] [
${ "kernel-error" ERROR-DATASTACK-OVERFLOW f f } =
] must-fail-with
-[ ] [ [ :c ] with-string-writer drop ] unit-test
+{ } [ [ :c ] with-string-writer drop ] unit-test
[ overflow-r ] [
${ "kernel-error" ERROR-RETAINSTACK-OVERFLOW f f } =
] must-fail-with
-[ ] [ :c ] unit-test
+{ } [ :c ] unit-test
: overflow-c ( -- ) overflow-c overflow-c ;
[ -7 <byte-array> ] must-fail
-[ 3 ] [ t 3 and ] unit-test
-[ f ] [ f 3 and ] unit-test
-[ f ] [ 3 f and ] unit-test
-[ 4 ] [ 4 6 or ] unit-test
-[ 6 ] [ f 6 or ] unit-test
-[ f ] [ 1 2 xor ] unit-test
-[ 1 ] [ 1 f xor ] unit-test
-[ 2 ] [ f 2 xor ] unit-test
-[ f ] [ f f xor ] unit-test
+{ 3 } [ t 3 and ] unit-test
+{ f } [ f 3 and ] unit-test
+{ f } [ 3 f and ] unit-test
+{ 4 } [ 4 6 or ] unit-test
+{ 6 } [ f 6 or ] unit-test
+{ f } [ 1 2 xor ] unit-test
+{ 1 } [ 1 f xor ] unit-test
+{ 2 } [ f 2 xor ] unit-test
+{ f } [ f f xor ] unit-test
[ dip ] must-fail
-[ ] [ :c ] unit-test
+{ } [ :c ] unit-test
[ 1 [ call ] dip ] must-fail
-[ ] [ :c ] unit-test
+{ } [ :c ] unit-test
[ 1 2 [ call ] dip ] must-fail
-[ ] [ :c ] unit-test
+{ } [ :c ] unit-test
-[ 5 ] [ 1 [ 2 2 + ] dip + ] unit-test
+{ 5 } [ 1 [ 2 2 + ] dip + ] unit-test
[ [ ] keep ] must-fail
-[ 6 ] [ 2 [ sq ] keep + ] unit-test
+{ 6 } [ 2 [ sq ] keep + ] unit-test
[ [ ] 2keep ] must-fail
[ 1 [ ] 2keep ] must-fail
-[ 3 1 2 ] [ 1 2 [ 2drop 3 ] 2keep ] unit-test
+{ 3 1 2 } [ 1 2 [ 2drop 3 ] 2keep ] unit-test
-[ 0 ] [ f [ sq ] [ 0 ] if* ] unit-test
-[ 4 ] [ 2 [ sq ] [ 0 ] if* ] unit-test
+{ 0 } [ f [ sq ] [ 0 ] if* ] unit-test
+{ 4 } [ 2 [ sq ] [ 0 ] if* ] unit-test
-[ 0 ] [ f [ 0 ] unless* ] unit-test
-[ t ] [ t [ "Hello" ] unless* ] unit-test
+{ 0 } [ f [ 0 ] unless* ] unit-test
+{ t } [ t [ "Hello" ] unless* ] unit-test
-[ "2\n" ] [ [ 1 2 [ . ] [ sq . ] ?if ] with-string-writer ] unit-test
-[ "9\n" ] [ [ 3 f [ . ] [ sq . ] ?if ] with-string-writer ] unit-test
+{ "2\n" } [ [ 1 2 [ . ] [ sq . ] ?if ] with-string-writer ] unit-test
+{ "9\n" } [ [ 3 f [ . ] [ sq . ] ?if ] with-string-writer ] unit-test
-[ f ] [ f (clone) ] unit-test
-[ -123 ] [ -123 (clone) ] unit-test
+{ f } [ f (clone) ] unit-test
+{ -123 } [ -123 (clone) ] unit-test
-[ 6 2 ] [ 1 2 [ 5 + ] dip ] unit-test
+{ 6 2 } [ 1 2 [ 5 + ] dip ] unit-test
-[ ] [ callstack set-callstack ] unit-test
+{ } [ callstack set-callstack ] unit-test
[ 3drop datastack ] must-fail
-[ ] [ :c ] unit-test
+{ } [ :c ] unit-test
! Doesn't compile; important
: foo ( a -- b ) ;
<< \ foo t "no-compile" set-word-prop >>
[ drop foo ] must-fail
-[ ] [ :c ] unit-test
+{ } [ :c ] unit-test
! Regression
: (loop) ( a b c d -- )
[ total-failure-1 ] must-fail
-[ 1 1 2 2 3 3 ] [ 1 2 3 [ dup ] tri@ ] unit-test
-[ 1 4 9 ] [ 1 2 3 [ sq ] tri@ ] unit-test
+{ 1 1 2 2 3 3 } [ 1 2 3 [ dup ] tri@ ] unit-test
+{ 1 4 9 } [ 1 2 3 [ sq ] tri@ ] unit-test
[ [ sq ] tri@ ] must-infer
-[ 4 ] [ 1 { [ 1 ] [ 2 ] } dispatch sq ] unit-test
+{ 4 } [ 1 { [ 1 ] [ 2 ] } dispatch sq ] unit-test
! Test traceback accuracy
: last-frame ( -- pair )
error-continuation get call>> callstack>array 6 head* 3 tail* ;
-[
+{
{ [ 1 2 [ 3 throw ] call 4 ] [ 1 2 [ 3 throw ] call 4 ] 3 }
-] [
+} [
[ [ 1 2 [ 3 throw ] call 4 ] call ] ignore-errors
last-frame
] unit-test
-[
+{
{ [ 1 2 [ 3 throw ] dip 4 ] [ 1 2 [ 3 throw ] dip 4 ] 3 }
-] [
+} [
[ [ 1 2 [ 3 throw ] dip 4 ] call ] ignore-errors
last-frame
] unit-test
-[
+{
{ [ 1 2 3 throw [ ] call 4 ] [ 1 2 3 throw [ ] call 4 ] 3 }
-] [
+} [
[ [ 1 2 3 throw [ ] call 4 ] call ] ignore-errors
last-frame
] unit-test
-[
+{
{ [ 1 2 3 throw [ ] dip 4 ] [ 1 2 3 throw [ ] dip 4 ] 3 }
-] [
+} [
[ [ 1 2 3 throw [ ] dip 4 ] call ] ignore-errors
last-frame
] unit-test
-[
+{
{ [ 1 2 3 throw [ ] [ ] if 4 ] [ 1 2 3 throw [ ] [ ] if 4 ] 3 }
-] [
+} [
[ [ 1 2 3 throw [ ] [ ] if 4 ] call ] ignore-errors
last-frame
] unit-test
-[ 10 2 3 4 5 ] [ 1 2 3 4 5 [ 10 * ] 4dip ] unit-test
+{ 10 2 3 4 5 } [ 1 2 3 4 5 [ 10 * ] 4dip ] unit-test
-[ 3 -1 5/6 ] [ 1 2 3 4 5 6 [ + ] [ - ] [ / ] 2tri* ] unit-test
+{ 3 -1 5/6 } [ 1 2 3 4 5 6 [ + ] [ - ] [ / ] 2tri* ] unit-test
-[ { 1 2 } { 3 4 } { 5 6 } ] [ 1 2 3 4 5 6 [ 2array ] 2tri@ ] unit-test
+{ { 1 2 } { 3 4 } { 5 6 } } [ 1 2 3 4 5 6 [ 2array ] 2tri@ ] unit-test
-[ t ] [ { } identity-hashcode fixnum? ] unit-test
-[ 123 ] [ 123 identity-hashcode ] unit-test
-[ t ] [ f identity-hashcode fixnum? ] unit-test
+{ t } [ { } identity-hashcode fixnum? ] unit-test
+{ 123 } [ 123 identity-hashcode ] unit-test
+{ t } [ f identity-hashcode fixnum? ] unit-test
! Make sure memory protection faults work
[ f 0 alien-unsigned-1 ] [ vm-error? ] must-fail-with
USING: layouts math tools.test ;
IN: system.tests
-[ t ] [ cell integer? ] unit-test
-[ t ] [ bootstrap-cell integer? ] unit-test
+{ t } [ cell integer? ] unit-test
+{ t } [ bootstrap-cell integer? ] unit-test
! Smoke test
-[ t ] [ max-array-capacity cell-bits 2^ < ] unit-test
+{ t } [ max-array-capacity cell-bits 2^ < ] unit-test
-[ t ] [ most-negative-fixnum fixnum? ] unit-test
-[ t ] [ most-positive-fixnum fixnum? ] unit-test
+{ t } [ most-negative-fixnum fixnum? ] unit-test
+{ t } [ most-positive-fixnum fixnum? ] unit-test
grouping ;
IN: math.floats.tests
-[ t ] [ 0.0 float? ] unit-test
-[ t ] [ 3.1415 number? ] unit-test
-[ f ] [ 12 float? ] unit-test
+{ t } [ 0.0 float? ] unit-test
+{ t } [ 3.1415 number? ] unit-test
+{ f } [ 12 float? ] unit-test
-[ f ] [ 1 1.0 = ] unit-test
-[ t ] [ 1 1.0 number= ] unit-test
+{ f } [ 1 1.0 = ] unit-test
+{ t } [ 1 1.0 number= ] unit-test
-[ f ] [ 1 >bignum 1.0 = ] unit-test
-[ t ] [ 1 >bignum 1.0 number= ] unit-test
+{ f } [ 1 >bignum 1.0 = ] unit-test
+{ t } [ 1 >bignum 1.0 number= ] unit-test
-[ f ] [ 1.0 1 = ] unit-test
-[ t ] [ 1.0 1 number= ] unit-test
+{ f } [ 1.0 1 = ] unit-test
+{ t } [ 1.0 1 number= ] unit-test
-[ f ] [ 1.0 1 >bignum = ] unit-test
-[ t ] [ 1.0 1 >bignum number= ] unit-test
+{ f } [ 1.0 1 >bignum = ] unit-test
+{ t } [ 1.0 1 >bignum number= ] unit-test
-[ f ] [ 1 1.3 = ] unit-test
-[ f ] [ 1 >bignum 1.3 = ] unit-test
-[ f ] [ 1.3 1 = ] unit-test
-[ f ] [ 1.3 1 >bignum = ] unit-test
+{ f } [ 1 1.3 = ] unit-test
+{ f } [ 1 >bignum 1.3 = ] unit-test
+{ f } [ 1.3 1 = ] unit-test
+{ f } [ 1.3 1 >bignum = ] unit-test
-[ t ] [ 134.3 >fixnum 134 = ] unit-test
+{ t } [ 134.3 >fixnum 134 = ] unit-test
-[ 3 ] [ 3.5 >bignum ] unit-test
-[ -3 ] [ -3.5 >bignum ] unit-test
+{ 3 } [ 3.5 >bignum ] unit-test
+{ -3 } [ -3.5 >bignum ] unit-test
-[ 3 ] [ 3.5 >fixnum ] unit-test
-[ -3 ] [ -3.5 >fixnum ] unit-test
+{ 3 } [ 3.5 >fixnum ] unit-test
+{ -3 } [ -3.5 >fixnum ] unit-test
-[ 2.1 ] [ -2.1 neg ] unit-test
+{ 2.1 } [ -2.1 neg ] unit-test
-[ 3 ] [ 3.1415 >fixnum ] unit-test
-[ 3 ] [ 3.1415 >bignum ] unit-test
+{ 3 } [ 3.1415 >fixnum ] unit-test
+{ 3 } [ 3.1415 >bignum ] unit-test
-[ t ] [ pi 3 > ] unit-test
-[ f ] [ e 2 <= ] unit-test
+{ t } [ pi 3 > ] unit-test
+{ f } [ e 2 <= ] unit-test
-[ t ] [ 1.0 dup float>bits bits>float = ] unit-test
-[ t ] [ pi double>bits bits>double pi = ] unit-test
-[ t ] [ e double>bits bits>double e = ] unit-test
+{ t } [ 1.0 dup float>bits bits>float = ] unit-test
+{ t } [ pi double>bits bits>double pi = ] unit-test
+{ t } [ e double>bits bits>double e = ] unit-test
-[ 0b11111111111000000000000000000000000000000000000000000000000000 ]
+{ 0b11111111111000000000000000000000000000000000000000000000000000 }
[ 1.5 double>bits ] unit-test
-[ 1.5 ]
+{ 1.5 }
[ 0b11111111111000000000000000000000000000000000000000000000000000 bits>double ]
unit-test
-[ 2.0 ] [ 1.0 1 + ] unit-test
-[ 0.0 ] [ 1.0 1 - ] unit-test
+{ 2.0 } [ 1.0 1 + ] unit-test
+{ 0.0 } [ 1.0 1 - ] unit-test
-[ t ] [ 0.0 zero? ] unit-test
-[ t ] [ -0.0 zero? ] unit-test
+{ t } [ 0.0 zero? ] unit-test
+{ t } [ -0.0 zero? ] unit-test
-[ 0 ] [ 1/0. >bignum ] unit-test
+{ 0 } [ 1/0. >bignum ] unit-test
-[ t ] [ 64 iota [ 2^ 0.5 * ] map [ < ] monotonic? ] unit-test
+{ t } [ 64 iota [ 2^ 0.5 * ] map [ < ] monotonic? ] unit-test
-[ 5 ] [ 10.5 1.9 /i ] unit-test
+{ 5 } [ 10.5 1.9 /i ] unit-test
-[ t ] [ 0 0 /f fp-nan? ] unit-test
-[ t ] [ 0.0 0.0 /f fp-nan? ] unit-test
-[ t ] [ 0.0 0.0 / fp-nan? ] unit-test
-[ t ] [ 0 0 [ >bignum ] bi@ /f fp-nan? ] unit-test
+{ t } [ 0 0 /f fp-nan? ] unit-test
+{ t } [ 0.0 0.0 /f fp-nan? ] unit-test
+{ t } [ 0.0 0.0 / fp-nan? ] unit-test
+{ t } [ 0 0 [ >bignum ] bi@ /f fp-nan? ] unit-test
-[ 1/0. ] [ 1 0 /f ] unit-test
-[ 1/0. ] [ 1.0 0.0 /f ] unit-test
-[ 1/0. ] [ 1.0 0.0 / ] unit-test
-[ 1/0. ] [ 1 0 [ >bignum ] bi@ /f ] unit-test
+{ 1/0. } [ 1 0 /f ] unit-test
+{ 1/0. } [ 1.0 0.0 /f ] unit-test
+{ 1/0. } [ 1.0 0.0 / ] unit-test
+{ 1/0. } [ 1 0 [ >bignum ] bi@ /f ] unit-test
-[ -1/0. ] [ -1 0 /f ] unit-test
-[ -1/0. ] [ -1.0 0.0 /f ] unit-test
-[ -1/0. ] [ -1.0 0.0 / ] unit-test
-[ -1/0. ] [ -1 0 [ >bignum ] bi@ /f ] unit-test
+{ -1/0. } [ -1 0 /f ] unit-test
+{ -1/0. } [ -1.0 0.0 /f ] unit-test
+{ -1/0. } [ -1.0 0.0 / ] unit-test
+{ -1/0. } [ -1 0 [ >bignum ] bi@ /f ] unit-test
-[ t ] [ 0/0. 0/0. unordered? ] unit-test
-[ t ] [ 1.0 0/0. unordered? ] unit-test
-[ t ] [ 0/0. 1.0 unordered? ] unit-test
-[ f ] [ 1.0 1.0 unordered? ] unit-test
+{ t } [ 0/0. 0/0. unordered? ] unit-test
+{ t } [ 1.0 0/0. unordered? ] unit-test
+{ t } [ 0/0. 1.0 unordered? ] unit-test
+{ f } [ 1.0 1.0 unordered? ] unit-test
-[ t ] [ -0.0 fp-sign ] unit-test
-[ t ] [ -1.0 fp-sign ] unit-test
-[ f ] [ 0.0 fp-sign ] unit-test
-[ f ] [ 1.0 fp-sign ] unit-test
+{ t } [ -0.0 fp-sign ] unit-test
+{ t } [ -1.0 fp-sign ] unit-test
+{ f } [ 0.0 fp-sign ] unit-test
+{ f } [ 1.0 fp-sign ] unit-test
-[ t ] [ -0.0 abs 0.0 fp-bitwise= ] unit-test
-[ 1.5 ] [ -1.5 abs ] unit-test
-[ 1.5 ] [ 1.5 abs ] unit-test
+{ t } [ -0.0 abs 0.0 fp-bitwise= ] unit-test
+{ 1.5 } [ -1.5 abs ] unit-test
+{ 1.5 } [ 1.5 abs ] unit-test
-[ 5.0 ] [ 3 5.0 max ] unit-test
-[ 3 ] [ 3 5.0 min ] unit-test
+{ 5.0 } [ 3 5.0 max ] unit-test
+{ 3 } [ 3 5.0 min ] unit-test
{ 39 0x1.999999999998ap-4 } [ 4.0 .1 /mod ] unit-test
{ 38 0x1.9999999999984p-4 } [ 3.9 .1 /mod ] unit-test
[ "-8" ] [ -8 unparse ] unit-test
] with-variable
-[ t ] [ 0 fixnum? ] unit-test
-[ t ] [ 31415 number? ] unit-test
-[ t ] [ 31415 >bignum number? ] unit-test
-[ t ] [ 2345621 fixnum? ] unit-test
+{ t } [ 0 fixnum? ] unit-test
+{ t } [ 31415 number? ] unit-test
+{ t } [ 31415 >bignum number? ] unit-test
+{ t } [ 2345621 fixnum? ] unit-test
-[ t ] [ 2345621 dup >bignum >fixnum = ] unit-test
+{ t } [ 2345621 dup >bignum >fixnum = ] unit-test
-[ t ] [ 0 >fixnum 0 >bignum = ] unit-test
-[ f ] [ 0 >fixnum 1 >bignum = ] unit-test
-[ f ] [ 1 >bignum 0 >bignum = ] unit-test
-[ t ] [ 0 >bignum 0 >fixnum = ] unit-test
+{ t } [ 0 >fixnum 0 >bignum = ] unit-test
+{ f } [ 0 >fixnum 1 >bignum = ] unit-test
+{ f } [ 1 >bignum 0 >bignum = ] unit-test
+{ t } [ 0 >bignum 0 >fixnum = ] unit-test
-[ t ] [ 0 >bignum bignum? ] unit-test
-[ f ] [ 0 >fixnum bignum? ] unit-test
-[ f ] [ 0 >fixnum bignum? ] unit-test
-[ t ] [ 0 >fixnum fixnum? ] unit-test
+{ t } [ 0 >bignum bignum? ] unit-test
+{ f } [ 0 >fixnum bignum? ] unit-test
+{ f } [ 0 >fixnum bignum? ] unit-test
+{ t } [ 0 >fixnum fixnum? ] unit-test
-[ -1 ] [ 1 neg ] unit-test
-[ -1 ] [ 1 >bignum neg ] unit-test
-[ 134217728 ] [ -134217728 >fixnum -1 * ] unit-test
-[ 134217728 ] [ -134217728 >fixnum neg ] unit-test
+{ -1 } [ 1 neg ] unit-test
+{ -1 } [ 1 >bignum neg ] unit-test
+{ 134217728 } [ -134217728 >fixnum -1 * ] unit-test
+{ 134217728 } [ -134217728 >fixnum neg ] unit-test
-[ 9 3 ] [ 93 10 /mod ] unit-test
-[ 9 3 ] [ 93 >bignum 10 /mod ] unit-test
+{ 9 3 } [ 93 10 /mod ] unit-test
+{ 9 3 } [ 93 >bignum 10 /mod ] unit-test
-[ 5 ] [ 2 >bignum 3 >bignum + ] unit-test
+{ 5 } [ 2 >bignum 3 >bignum + ] unit-test
-[ -10000000001981284352 ] [
+{ -10000000001981284352 } [
-10000000000000000000
-0x100000000 bitand
] unit-test
-[ 9999999997686317056 ] [
+{ 9999999997686317056 } [
10000000000000000000
-0x100000000 bitand
] unit-test
-[ 4294967296 ] [
+{ 4294967296 } [
-10000000000000000000
0x100000000 bitand
] unit-test
-[ 0 ] [
+{ 0 } [
10000000000000000000
0x100000000 bitand
] unit-test
-[ -1 ] [ -1 >bignum >fixnum ] unit-test
+{ -1 } [ -1 >bignum >fixnum ] unit-test
10 number-base [
[ "8589934592" ]
unit-test
] with-variable
-[ 7 ] [ 255 log2 ] unit-test
-[ 8 ] [ 256 log2 ] unit-test
-[ 8 ] [ 257 log2 ] unit-test
-[ 0 ] [ 1 log2 ] unit-test
-
-[ 7 ] [ 255 >bignum log2 ] unit-test
-[ 8 ] [ 256 >bignum log2 ] unit-test
-[ 8 ] [ 257 >bignum log2 ] unit-test
-[ 0 ] [ 1 >bignum log2 ] unit-test
-
-[ f ] [ 0b1101 -1 bit? ] unit-test
-[ t ] [ 0b1101 0 bit? ] unit-test
-[ f ] [ 0b1101 1 bit? ] unit-test
-[ t ] [ 0b1101 2 bit? ] unit-test
-[ t ] [ 0b1101 3 bit? ] unit-test
-[ f ] [ 0b1101 4 bit? ] unit-test
-[ f ] [ 0b1101 1000 bit? ] unit-test
-
-[ f ] [ 0b1101 >bignum -1 bit? ] unit-test
-[ t ] [ 0b1101 >bignum 0 bit? ] unit-test
-[ f ] [ 0b1101 >bignum 1 bit? ] unit-test
-[ t ] [ 0b1101 >bignum 2 bit? ] unit-test
-[ t ] [ 0b1101 >bignum 3 bit? ] unit-test
-[ f ] [ 0b1101 >bignum 4 bit? ] unit-test
-[ f ] [ 0b1101 >bignum 1000 bit? ] unit-test
-
-[ t ] [ -0b1101 -1 bit? ] unit-test
-[ t ] [ -0b1101 0 bit? ] unit-test
-[ t ] [ -0b1101 1 bit? ] unit-test
-[ f ] [ -0b1101 2 bit? ] unit-test
-[ f ] [ -0b1101 3 bit? ] unit-test
-[ t ] [ -0b1101 4 bit? ] unit-test
-[ t ] [ -0b1101 1000 bit? ] unit-test
-
-[ t ] [ -0b1101 >bignum -1 bit? ] unit-test
-[ t ] [ -0b1101 >bignum 0 bit? ] unit-test
-[ t ] [ -0b1101 >bignum 1 bit? ] unit-test
-[ f ] [ -0b1101 >bignum 2 bit? ] unit-test
-[ f ] [ -0b1101 >bignum 3 bit? ] unit-test
-[ t ] [ -0b1101 >bignum 4 bit? ] unit-test
-[ t ] [ -0b1101 >bignum 1000 bit? ] unit-test
-
-[ t ] [ 1067811677921310779 >bignum 59 bit? ] unit-test
-
-[ 2 ] [ 0 next-power-of-2 ] unit-test
-[ 2 ] [ 1 next-power-of-2 ] unit-test
-[ 2 ] [ 2 next-power-of-2 ] unit-test
-[ 4 ] [ 3 next-power-of-2 ] unit-test
-[ 16 ] [ 13 next-power-of-2 ] unit-test
-[ 16 ] [ 16 next-power-of-2 ] unit-test
-
-[ 134217728 ] [ -134217728 >fixnum -1 /i ] unit-test
-[ 134217728 0 ] [ -134217728 >fixnum -1 /mod ] unit-test
-[ 0 ] [ -1 -134217728 >fixnum /i ] unit-test
-[ 4420880996869850977 ] [ 13262642990609552931 3 /i ] unit-test
-[ 0 -1 ] [ -1 -134217728 >fixnum /mod ] unit-test
-[ 0 -1 ] [ -1 -134217728 >bignum /mod ] unit-test
-[ 14355 ] [ 1591517158873146351817850880000000 32769 mod ] unit-test
-[ 8 530505719624382123 ] [ 13262642990609552931 1591517158873146351 /mod ] unit-test
-[ 8 ] [ 13262642990609552931 1591517158873146351 /i ] unit-test
-[ 530505719624382123 ] [ 13262642990609552931 1591517158873146351 mod ] unit-test
-
-[ -351382792 ] [ -43922849 3 shift ] unit-test
-
-[ t ] [ 0 zero? ] unit-test
-[ f ] [ 30 zero? ] unit-test
-[ t ] [ 0 >bignum zero? ] unit-test
-
-[ 2147483632 ] [ 134217727 >fixnum 16 fixnum* ] unit-test
-
-[ 23603949310011464311086123800853779733506160743636399259558684142844552151041 ]
+{ 7 } [ 255 log2 ] unit-test
+{ 8 } [ 256 log2 ] unit-test
+{ 8 } [ 257 log2 ] unit-test
+{ 0 } [ 1 log2 ] unit-test
+
+{ 7 } [ 255 >bignum log2 ] unit-test
+{ 8 } [ 256 >bignum log2 ] unit-test
+{ 8 } [ 257 >bignum log2 ] unit-test
+{ 0 } [ 1 >bignum log2 ] unit-test
+
+{ f } [ 0b1101 -1 bit? ] unit-test
+{ t } [ 0b1101 0 bit? ] unit-test
+{ f } [ 0b1101 1 bit? ] unit-test
+{ t } [ 0b1101 2 bit? ] unit-test
+{ t } [ 0b1101 3 bit? ] unit-test
+{ f } [ 0b1101 4 bit? ] unit-test
+{ f } [ 0b1101 1000 bit? ] unit-test
+
+{ f } [ 0b1101 >bignum -1 bit? ] unit-test
+{ t } [ 0b1101 >bignum 0 bit? ] unit-test
+{ f } [ 0b1101 >bignum 1 bit? ] unit-test
+{ t } [ 0b1101 >bignum 2 bit? ] unit-test
+{ t } [ 0b1101 >bignum 3 bit? ] unit-test
+{ f } [ 0b1101 >bignum 4 bit? ] unit-test
+{ f } [ 0b1101 >bignum 1000 bit? ] unit-test
+
+{ t } [ -0b1101 -1 bit? ] unit-test
+{ t } [ -0b1101 0 bit? ] unit-test
+{ t } [ -0b1101 1 bit? ] unit-test
+{ f } [ -0b1101 2 bit? ] unit-test
+{ f } [ -0b1101 3 bit? ] unit-test
+{ t } [ -0b1101 4 bit? ] unit-test
+{ t } [ -0b1101 1000 bit? ] unit-test
+
+{ t } [ -0b1101 >bignum -1 bit? ] unit-test
+{ t } [ -0b1101 >bignum 0 bit? ] unit-test
+{ t } [ -0b1101 >bignum 1 bit? ] unit-test
+{ f } [ -0b1101 >bignum 2 bit? ] unit-test
+{ f } [ -0b1101 >bignum 3 bit? ] unit-test
+{ t } [ -0b1101 >bignum 4 bit? ] unit-test
+{ t } [ -0b1101 >bignum 1000 bit? ] unit-test
+
+{ t } [ 1067811677921310779 >bignum 59 bit? ] unit-test
+
+{ 2 } [ 0 next-power-of-2 ] unit-test
+{ 2 } [ 1 next-power-of-2 ] unit-test
+{ 2 } [ 2 next-power-of-2 ] unit-test
+{ 4 } [ 3 next-power-of-2 ] unit-test
+{ 16 } [ 13 next-power-of-2 ] unit-test
+{ 16 } [ 16 next-power-of-2 ] unit-test
+
+{ 134217728 } [ -134217728 >fixnum -1 /i ] unit-test
+{ 134217728 0 } [ -134217728 >fixnum -1 /mod ] unit-test
+{ 0 } [ -1 -134217728 >fixnum /i ] unit-test
+{ 4420880996869850977 } [ 13262642990609552931 3 /i ] unit-test
+{ 0 -1 } [ -1 -134217728 >fixnum /mod ] unit-test
+{ 0 -1 } [ -1 -134217728 >bignum /mod ] unit-test
+{ 14355 } [ 1591517158873146351817850880000000 32769 mod ] unit-test
+{ 8 530505719624382123 } [ 13262642990609552931 1591517158873146351 /mod ] unit-test
+{ 8 } [ 13262642990609552931 1591517158873146351 /i ] unit-test
+{ 530505719624382123 } [ 13262642990609552931 1591517158873146351 mod ] unit-test
+
+{ -351382792 } [ -43922849 3 shift ] unit-test
+
+{ t } [ 0 zero? ] unit-test
+{ f } [ 30 zero? ] unit-test
+{ t } [ 0 >bignum zero? ] unit-test
+
+{ 2147483632 } [ 134217727 >fixnum 16 fixnum* ] unit-test
+
+{ 23603949310011464311086123800853779733506160743636399259558684142844552151041 }
[
1957739506503920732625800353008742584087090810400921800808997218266517557963281171906190947801528098188887586755474449585677502695226712388326288208691204
79562815144503850065234921197651376510595262628033069372760833939060637564931
! We don't care if this fails or returns 0 (its CPU-specific)
! as long as it doesn't crash
-[ ] [ [ 0 0 /i drop ] ignore-errors ] unit-test
-[ ] [ [ 100000000000000000 0 /i drop ] ignore-errors ] unit-test
-
-[ -2 ] [ 1 bitnot ] unit-test
-[ -2 ] [ 1 >bignum bitnot ] unit-test
-[ -2 ] [ 1 >bignum bitnot ] unit-test
-[ 0 ] [ 123 dup bitnot bitand ] unit-test
-[ 0 ] [ 123 >bignum dup bitnot bitand ] unit-test
-[ 0 ] [ 123 dup bitnot >bignum bitand ] unit-test
-[ 0 ] [ 123 dup bitnot bitand >bignum ] unit-test
-[ -1 ] [ 123 dup bitnot bitor ] unit-test
-[ -1 ] [ 123 >bignum dup bitnot bitor ] unit-test
-[ -1 ] [ 123 dup bitnot >bignum bitor ] unit-test
-[ -1 ] [ 123 dup bitnot bitor >bignum ] unit-test
-[ -1 ] [ 123 dup bitnot bitxor ] unit-test
-[ -1 ] [ 123 >bignum dup bitnot bitxor ] unit-test
-[ -1 ] [ 123 dup bitnot >bignum bitxor ] unit-test
-[ -1 ] [ 123 dup bitnot bitxor >bignum ] unit-test
-[ 4 ] [ 4 7 bitand ] unit-test
-
-[ 256 ] [ 65536 -8 shift ] unit-test
-[ 256 ] [ 65536 >bignum -8 shift ] unit-test
-[ 256 ] [ 65536 -8 >bignum shift ] unit-test
-[ 256 ] [ 65536 >bignum -8 >bignum shift ] unit-test
-[ 4294967296 ] [ 1 16 shift 16 shift ] unit-test
-[ 4294967296 ] [ 1 32 shift ] unit-test
-[ 1267650600228229401496703205376 ] [ 1 100 shift ] unit-test
-
-[ t ] [ 1 26 shift fixnum? ] unit-test
-
-[ t ] [
+{ } [ [ 0 0 /i drop ] ignore-errors ] unit-test
+{ } [ [ 100000000000000000 0 /i drop ] ignore-errors ] unit-test
+
+{ -2 } [ 1 bitnot ] unit-test
+{ -2 } [ 1 >bignum bitnot ] unit-test
+{ -2 } [ 1 >bignum bitnot ] unit-test
+{ 0 } [ 123 dup bitnot bitand ] unit-test
+{ 0 } [ 123 >bignum dup bitnot bitand ] unit-test
+{ 0 } [ 123 dup bitnot >bignum bitand ] unit-test
+{ 0 } [ 123 dup bitnot bitand >bignum ] unit-test
+{ -1 } [ 123 dup bitnot bitor ] unit-test
+{ -1 } [ 123 >bignum dup bitnot bitor ] unit-test
+{ -1 } [ 123 dup bitnot >bignum bitor ] unit-test
+{ -1 } [ 123 dup bitnot bitor >bignum ] unit-test
+{ -1 } [ 123 dup bitnot bitxor ] unit-test
+{ -1 } [ 123 >bignum dup bitnot bitxor ] unit-test
+{ -1 } [ 123 dup bitnot >bignum bitxor ] unit-test
+{ -1 } [ 123 dup bitnot bitxor >bignum ] unit-test
+{ 4 } [ 4 7 bitand ] unit-test
+
+{ 256 } [ 65536 -8 shift ] unit-test
+{ 256 } [ 65536 >bignum -8 shift ] unit-test
+{ 256 } [ 65536 -8 >bignum shift ] unit-test
+{ 256 } [ 65536 >bignum -8 >bignum shift ] unit-test
+{ 4294967296 } [ 1 16 shift 16 shift ] unit-test
+{ 4294967296 } [ 1 32 shift ] unit-test
+{ 1267650600228229401496703205376 } [ 1 100 shift ] unit-test
+
+{ t } [ 1 26 shift fixnum? ] unit-test
+
+{ t } [
t
[ 27 28 29 30 31 32 59 60 61 62 63 64 ]
[
] each
] unit-test
-[ t ] [
+{ t } [
t
[ 27 28 29 30 31 32 59 60 61 62 63 64 ]
[
] each
] unit-test
-[ 12 ] [ 11 4 align ] unit-test
-[ 12 ] [ 12 4 align ] unit-test
-[ 10 ] [ 10 2 align ] unit-test
-[ 14 ] [ 13 2 align ] unit-test
-[ 11 ] [ 11 1 align ] unit-test
+{ 12 } [ 11 4 align ] unit-test
+{ 12 } [ 12 4 align ] unit-test
+{ 10 } [ 10 2 align ] unit-test
+{ 14 } [ 13 2 align ] unit-test
+{ 11 } [ 11 1 align ] unit-test
-[ t ] [ 256 power-of-2? ] unit-test
-[ f ] [ 123 power-of-2? ] unit-test
+{ t } [ 256 power-of-2? ] unit-test
+{ f } [ 123 power-of-2? ] unit-test
-[ f ] [ -128 power-of-2? ] unit-test
-[ f ] [ 0 power-of-2? ] unit-test
-[ t ] [ 1 power-of-2? ] unit-test
+{ f } [ -128 power-of-2? ] unit-test
+{ f } [ 0 power-of-2? ] unit-test
+{ t } [ 1 power-of-2? ] unit-test
: ratio>float ( a b -- f ) [ >bignum ] bi@ /f ;
-[ 5. ] [ 5 1 ratio>float ] unit-test
-[ 4. ] [ 4 1 ratio>float ] unit-test
-[ 2. ] [ 2 1 ratio>float ] unit-test
-[ .5 ] [ 1 2 ratio>float ] unit-test
-[ .75 ] [ 3 4 ratio>float ] unit-test
-[ 1. ] [ 2000 2^ 2000 2^ 1 + ratio>float ] unit-test
-[ -1. ] [ 2000 2^ neg 2000 2^ 1 + ratio>float ] unit-test
-[ 0.4 ] [ 6 15 ratio>float ] unit-test
+{ 5. } [ 5 1 ratio>float ] unit-test
+{ 4. } [ 4 1 ratio>float ] unit-test
+{ 2. } [ 2 1 ratio>float ] unit-test
+{ .5 } [ 1 2 ratio>float ] unit-test
+{ .75 } [ 3 4 ratio>float ] unit-test
+{ 1. } [ 2000 2^ 2000 2^ 1 + ratio>float ] unit-test
+{ -1. } [ 2000 2^ neg 2000 2^ 1 + ratio>float ] unit-test
+{ 0.4 } [ 6 15 ratio>float ] unit-test
-[ 0x3fe553522d230931 ]
+{ 0x3fe553522d230931 }
[ 61967020039 92984792073 ratio>float double>bits ] unit-test
: random-integer ( -- n )
{ t f } random [ neg ] when
{ t f } random [ >bignum ] when ;
-[ t ] [
+{ t } [
10000 [
drop
random-integer
] unit-test
! Ensure that /f is accurate for fixnums > 2^53 on 64-bit platforms
-[ 0x1.758bec11492f9p-54 ] [ 1 12345678901234567 /f ] unit-test
-[ -0x1.758bec11492f9p-54 ] [ 1 -12345678901234567 /f ] unit-test
+{ 0x1.758bec11492f9p-54 } [ 1 12345678901234567 /f ] unit-test
+{ -0x1.758bec11492f9p-54 } [ 1 -12345678901234567 /f ] unit-test
! Ensure that /f rounds to nearest and not to zero
-[ 0x1.0p55 ] [ 0x7f,ffff,ffff,ffff >bignum 1 /f ] unit-test
-[ 0x1.0p55 ] [ -0x7f,ffff,ffff,ffff >bignum -1 /f ] unit-test
-[ -0x1.0p55 ] [ -0x7f,ffff,ffff,ffff >bignum 1 /f ] unit-test
-[ -0x1.0p55 ] [ 0x7f,ffff,ffff,ffff >bignum -1 /f ] unit-test
-
-[ 0x1.0000,0000,0000,0p56 ] [ 0x100,0000,0000,0007 >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,0p56 ] [ -0x100,0000,0000,0007 >bignum -1 /f ] unit-test
-[ 0x1.0000,0000,0000,0p120 ] [ 0x100,0000,0000,0007,FFFF,FFFF,FFFF,FFFF >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,0p120 ] [ -0x100,0000,0000,0007,FFFF,FFFF,FFFF,FFFF >bignum -1 /f ] unit-test
-[ 0x1.0000,0000,0000,0p56 ] [ 0x100,0000,0000,0008 >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,0p56 ] [ -0x100,0000,0000,0008 >bignum -1 /f ] unit-test
-[ 0x1.0000,0000,0000,1p56 ] [ 0x100,0000,0000,0009 >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,1p56 ] [ -0x100,0000,0000,0009 >bignum -1 /f ] unit-test
-[ 0x1.0000,0000,0000,1p120 ] [ 0x100,0000,0000,0008,0000,0000,0000,0001 >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,1p120 ] [ -0x100,0000,0000,0008,0000,0000,0000,0001 >bignum -1 /f ] unit-test
+{ 0x1.0p55 } [ 0x7f,ffff,ffff,ffff >bignum 1 /f ] unit-test
+{ 0x1.0p55 } [ -0x7f,ffff,ffff,ffff >bignum -1 /f ] unit-test
+{ -0x1.0p55 } [ -0x7f,ffff,ffff,ffff >bignum 1 /f ] unit-test
+{ -0x1.0p55 } [ 0x7f,ffff,ffff,ffff >bignum -1 /f ] unit-test
+
+{ 0x1.0000,0000,0000,0p56 } [ 0x100,0000,0000,0007 >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,0p56 } [ -0x100,0000,0000,0007 >bignum -1 /f ] unit-test
+{ 0x1.0000,0000,0000,0p120 } [ 0x100,0000,0000,0007,FFFF,FFFF,FFFF,FFFF >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,0p120 } [ -0x100,0000,0000,0007,FFFF,FFFF,FFFF,FFFF >bignum -1 /f ] unit-test
+{ 0x1.0000,0000,0000,0p56 } [ 0x100,0000,0000,0008 >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,0p56 } [ -0x100,0000,0000,0008 >bignum -1 /f ] unit-test
+{ 0x1.0000,0000,0000,1p56 } [ 0x100,0000,0000,0009 >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,1p56 } [ -0x100,0000,0000,0009 >bignum -1 /f ] unit-test
+{ 0x1.0000,0000,0000,1p120 } [ 0x100,0000,0000,0008,0000,0000,0000,0001 >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,1p120 } [ -0x100,0000,0000,0008,0000,0000,0000,0001 >bignum -1 /f ] unit-test
! Ensure that /f rounds to even on tie
-[ 0x1.0000,0000,0000,1p56 ] [ 0x100,0000,0000,0017 >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,1p56 ] [ -0x100,0000,0000,0017 >bignum -1 /f ] unit-test
-[ 0x1.0000,0000,0000,1p120 ] [ 0x100,0000,0000,0017,FFFF,FFFF,FFFF,FFFF >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,1p120 ] [ -0x100,0000,0000,0017,FFFF,FFFF,FFFF,FFFF >bignum -1 /f ] unit-test
-[ 0x1.0000,0000,0000,2p56 ] [ 0x100,0000,0000,0018 >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,2p56 ] [ -0x100,0000,0000,0018 >bignum -1 /f ] unit-test
-[ 0x1.0000,0000,0000,2p56 ] [ 0x100,0000,0000,0019 >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,2p56 ] [ -0x100,0000,0000,0019 >bignum -1 /f ] unit-test
-[ 0x1.0000,0000,0000,2p120 ] [ 0x100,0000,0000,0018,0000,0000,0000,0001 >bignum 1 /f ] unit-test
-[ 0x1.0000,0000,0000,2p120 ] [ -0x100,0000,0000,0018,0000,0000,0000,0001 >bignum -1 /f ] unit-test
-
-[ 17 ] [ 17 >bignum 5 max ] unit-test
-[ 5 ] [ 17 >bignum 5 min ] unit-test
-
-[ 1 ] [ 1 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784 /f double>bits ] unit-test
-[ 12 ] [ 3 50600563326827654588123836679729326762389162441035529589225339506857584891998836722990095925359281123796769466079202977847452184346448369216753349985184627480379356069141590341116726935523304085309941919618186267140501870856173174654525838912289889085202514128089692388083353653807625633046581877161501565826926935273373696 /f double>bits ] unit-test
-[ 123 ] [ 123 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784 /f double>bits ] unit-test
-[ 1234 ] [ 617 101201126653655309176247673359458653524778324882071059178450679013715169783997673445980191850718562247593538932158405955694904368692896738433506699970369254960758712138283180682233453871046608170619883839236372534281003741712346349309051677824579778170405028256179384776166707307615251266093163754323003131653853870546747392 /f double>bits ] unit-test
-[ 1/0. ] [ 2048 2^ 1 /f ] unit-test
-[ -1/0. ] [ 2048 2^ -1 /f ] unit-test
-[ -1/0. ] [ 2048 2^ neg 1 /f ] unit-test
-[ 1/0. ] [ 2048 2^ neg -1 /f ] unit-test
+{ 0x1.0000,0000,0000,1p56 } [ 0x100,0000,0000,0017 >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,1p56 } [ -0x100,0000,0000,0017 >bignum -1 /f ] unit-test
+{ 0x1.0000,0000,0000,1p120 } [ 0x100,0000,0000,0017,FFFF,FFFF,FFFF,FFFF >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,1p120 } [ -0x100,0000,0000,0017,FFFF,FFFF,FFFF,FFFF >bignum -1 /f ] unit-test
+{ 0x1.0000,0000,0000,2p56 } [ 0x100,0000,0000,0018 >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,2p56 } [ -0x100,0000,0000,0018 >bignum -1 /f ] unit-test
+{ 0x1.0000,0000,0000,2p56 } [ 0x100,0000,0000,0019 >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,2p56 } [ -0x100,0000,0000,0019 >bignum -1 /f ] unit-test
+{ 0x1.0000,0000,0000,2p120 } [ 0x100,0000,0000,0018,0000,0000,0000,0001 >bignum 1 /f ] unit-test
+{ 0x1.0000,0000,0000,2p120 } [ -0x100,0000,0000,0018,0000,0000,0000,0001 >bignum -1 /f ] unit-test
+
+{ 17 } [ 17 >bignum 5 max ] unit-test
+{ 5 } [ 17 >bignum 5 min ] unit-test
+
+{ 1 } [ 1 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784 /f double>bits ] unit-test
+{ 12 } [ 3 50600563326827654588123836679729326762389162441035529589225339506857584891998836722990095925359281123796769466079202977847452184346448369216753349985184627480379356069141590341116726935523304085309941919618186267140501870856173174654525838912289889085202514128089692388083353653807625633046581877161501565826926935273373696 /f double>bits ] unit-test
+{ 123 } [ 123 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784 /f double>bits ] unit-test
+{ 1234 } [ 617 101201126653655309176247673359458653524778324882071059178450679013715169783997673445980191850718562247593538932158405955694904368692896738433506699970369254960758712138283180682233453871046608170619883839236372534281003741712346349309051677824579778170405028256179384776166707307615251266093163754323003131653853870546747392 /f double>bits ] unit-test
+{ 1/0. } [ 2048 2^ 1 /f ] unit-test
+{ -1/0. } [ 2048 2^ -1 /f ] unit-test
+{ -1/0. } [ 2048 2^ neg 1 /f ] unit-test
+{ 1/0. } [ 2048 2^ neg -1 /f ] unit-test
USING: kernel layouts math math.private namespaces make tools.test ;
IN: math.tests
-[ ] [ 5 [ ] times ] unit-test
-[ ] [ 0 [ ] times ] unit-test
-[ ] [ -1 [ ] times ] unit-test
-
-[ ] [ 5 [ drop ] each-integer ] unit-test
-[ [ 0 1 2 3 4 ] ] [ [ 5 [ , ] each-integer ] [ ] make ] unit-test
-[ [ ] ] [ [ -1 [ , ] each-integer ] [ ] make ] unit-test
-
-[ f ] [ 1/0. fp-nan? ] unit-test
-[ f ] [ -1/0. fp-nan? ] unit-test
-[ t ] [ -0/0. fp-nan? ] unit-test
-[ t ] [ 1 <fp-nan> fp-nan? ] unit-test
+{ } [ 5 [ ] times ] unit-test
+{ } [ 0 [ ] times ] unit-test
+{ } [ -1 [ ] times ] unit-test
+
+{ } [ 5 [ drop ] each-integer ] unit-test
+{ [ 0 1 2 3 4 ] } [ [ 5 [ , ] each-integer ] [ ] make ] unit-test
+{ [ ] } [ [ -1 [ , ] each-integer ] [ ] make ] unit-test
+
+{ f } [ 1/0. fp-nan? ] unit-test
+{ f } [ -1/0. fp-nan? ] unit-test
+{ t } [ -0/0. fp-nan? ] unit-test
+{ t } [ 1 <fp-nan> fp-nan? ] unit-test
! [ t ] [ 1 <fp-nan> fp-snan? ] unit-test
! [ f ] [ 1 <fp-nan> fp-qnan? ] unit-test
-[ t ] [ 0x8000000000001 <fp-nan> fp-nan? ] unit-test
-[ f ] [ 0x8000000000001 <fp-nan> fp-snan? ] unit-test
-[ t ] [ 0x8000000000001 <fp-nan> fp-qnan? ] unit-test
-
-[ t ] [ 1/0. fp-infinity? ] unit-test
-[ t ] [ -1/0. fp-infinity? ] unit-test
-[ f ] [ -0/0. fp-infinity? ] unit-test
-
-[ f ] [ 0 <fp-nan> fp-nan? ] unit-test
-[ t ] [ 0 <fp-nan> fp-infinity? ] unit-test
-
-[ t ] [ 0.0 neg -0.0 fp-bitwise= ] unit-test
-[ t ] [ -0.0 neg 0.0 fp-bitwise= ] unit-test
-
-[ 0.0 ] [ -0.0 next-float ] unit-test
-[ t ] [ 1.0 dup next-float < ] unit-test
-[ t ] [ -1.0 dup next-float < ] unit-test
-
-[ -0.0 ] [ 0.0 prev-float ] unit-test
-[ t ] [ 1.0 dup prev-float > ] unit-test
-[ t ] [ -1.0 dup prev-float > ] unit-test
-
-[ f ] [ 0/0. 0/0. = ] unit-test
-[ f ] [ 0/0. 1.0 = ] unit-test
-[ f ] [ 0/0. 1/0. = ] unit-test
-[ f ] [ 0/0. -1/0. = ] unit-test
-
-[ f ] [ 0/0. 0/0. = ] unit-test
-[ f ] [ 1.0 0/0. = ] unit-test
-[ f ] [ -1/0. 0/0. = ] unit-test
-[ f ] [ 1/0. 0/0. = ] unit-test
-
-[ f ] [ 0/0. 0/0. < ] unit-test
-[ f ] [ 0/0. 1.0 < ] unit-test
-[ f ] [ 0/0. 1/0. < ] unit-test
-[ f ] [ 0/0. -1/0. < ] unit-test
-
-[ f ] [ 0/0. 0/0. <= ] unit-test
-[ f ] [ 0/0. 1.0 <= ] unit-test
-[ f ] [ 0/0. 1/0. <= ] unit-test
-[ f ] [ 0/0. -1/0. <= ] unit-test
-
-[ f ] [ 0/0. 0/0. > ] unit-test
-[ f ] [ 1.0 0/0. > ] unit-test
-[ f ] [ -1/0. 0/0. > ] unit-test
-[ f ] [ 1/0. 0/0. > ] unit-test
-
-[ f ] [ 0/0. 0/0. >= ] unit-test
-[ f ] [ 1.0 0/0. >= ] unit-test
-[ f ] [ -1/0. 0/0. >= ] unit-test
-[ f ] [ 1/0. 0/0. >= ] unit-test
-
-[ f ] [ 0 neg? ] unit-test
-[ f ] [ 1/2 neg? ] unit-test
-[ f ] [ 1 neg? ] unit-test
-[ t ] [ -1/2 neg? ] unit-test
-[ t ] [ -1 neg? ] unit-test
-
-[ f ] [ 0.0 neg? ] unit-test
-[ f ] [ 1.0 neg? ] unit-test
-[ f ] [ 1/0. neg? ] unit-test
-[ t ] [ -0.0 neg? ] unit-test
-[ t ] [ -1.0 neg? ] unit-test
-[ t ] [ -1/0. neg? ] unit-test
+{ t } [ 0x8000000000001 <fp-nan> fp-nan? ] unit-test
+{ f } [ 0x8000000000001 <fp-nan> fp-snan? ] unit-test
+{ t } [ 0x8000000000001 <fp-nan> fp-qnan? ] unit-test
+
+{ t } [ 1/0. fp-infinity? ] unit-test
+{ t } [ -1/0. fp-infinity? ] unit-test
+{ f } [ -0/0. fp-infinity? ] unit-test
+
+{ f } [ 0 <fp-nan> fp-nan? ] unit-test
+{ t } [ 0 <fp-nan> fp-infinity? ] unit-test
+
+{ t } [ 0.0 neg -0.0 fp-bitwise= ] unit-test
+{ t } [ -0.0 neg 0.0 fp-bitwise= ] unit-test
+
+{ 0.0 } [ -0.0 next-float ] unit-test
+{ t } [ 1.0 dup next-float < ] unit-test
+{ t } [ -1.0 dup next-float < ] unit-test
+
+{ -0.0 } [ 0.0 prev-float ] unit-test
+{ t } [ 1.0 dup prev-float > ] unit-test
+{ t } [ -1.0 dup prev-float > ] unit-test
+
+{ f } [ 0/0. 0/0. = ] unit-test
+{ f } [ 0/0. 1.0 = ] unit-test
+{ f } [ 0/0. 1/0. = ] unit-test
+{ f } [ 0/0. -1/0. = ] unit-test
+
+{ f } [ 0/0. 0/0. = ] unit-test
+{ f } [ 1.0 0/0. = ] unit-test
+{ f } [ -1/0. 0/0. = ] unit-test
+{ f } [ 1/0. 0/0. = ] unit-test
+
+{ f } [ 0/0. 0/0. < ] unit-test
+{ f } [ 0/0. 1.0 < ] unit-test
+{ f } [ 0/0. 1/0. < ] unit-test
+{ f } [ 0/0. -1/0. < ] unit-test
+
+{ f } [ 0/0. 0/0. <= ] unit-test
+{ f } [ 0/0. 1.0 <= ] unit-test
+{ f } [ 0/0. 1/0. <= ] unit-test
+{ f } [ 0/0. -1/0. <= ] unit-test
+
+{ f } [ 0/0. 0/0. > ] unit-test
+{ f } [ 1.0 0/0. > ] unit-test
+{ f } [ -1/0. 0/0. > ] unit-test
+{ f } [ 1/0. 0/0. > ] unit-test
+
+{ f } [ 0/0. 0/0. >= ] unit-test
+{ f } [ 1.0 0/0. >= ] unit-test
+{ f } [ -1/0. 0/0. >= ] unit-test
+{ f } [ 1/0. 0/0. >= ] unit-test
+
+{ f } [ 0 neg? ] unit-test
+{ f } [ 1/2 neg? ] unit-test
+{ f } [ 1 neg? ] unit-test
+{ t } [ -1/2 neg? ] unit-test
+{ t } [ -1 neg? ] unit-test
+
+{ f } [ 0.0 neg? ] unit-test
+{ f } [ 1.0 neg? ] unit-test
+{ f } [ 1/0. neg? ] unit-test
+{ t } [ -0.0 neg? ] unit-test
+{ t } [ -1.0 neg? ] unit-test
+{ t } [ -1/0. neg? ] unit-test
{ -0x3fffffff } [ 0x3ffffffe >bignum bitnot ] unit-test
{ -0x40000000 } [ 0x3fffffff >bignum bitnot ] unit-test
USING: kernel math.order tools.test ;
IN: math.order.tests
-[ +lt+ ] [ "ab" "abc" <=> ] unit-test
-[ +gt+ ] [ "abc" "ab" <=> ] unit-test
-[ +lt+ ] [ 3 4 <=> ] unit-test
-[ +eq+ ] [ 4 4 <=> ] unit-test
-[ +gt+ ] [ 4 3 <=> ] unit-test
+{ +lt+ } [ "ab" "abc" <=> ] unit-test
+{ +gt+ } [ "abc" "ab" <=> ] unit-test
+{ +lt+ } [ 3 4 <=> ] unit-test
+{ +eq+ } [ 4 4 <=> ] unit-test
+{ +gt+ } [ 4 3 <=> ] unit-test
-[ 20 ] [ 20 0 100 clamp ] unit-test
-[ 0 ] [ -20 0 100 clamp ] unit-test
-[ 100 ] [ 120 0 100 clamp ] unit-test
+{ 20 } [ 20 0 100 clamp ] unit-test
+{ 0 } [ -20 0 100 clamp ] unit-test
+{ 100 } [ 120 0 100 clamp ] unit-test
USING: kernel literals math math.parser sequences tools.test ;
IN: math.parser.tests
-[ f ]
+{ f }
[ f string>number ]
unit-test
-[ f ]
+{ f }
[ ";" string>number ]
unit-test
-[ f ]
+{ f }
[ "<>" string>number ]
unit-test
-[ f ]
+{ f }
[ "^" string>number ]
unit-test
-[ f ]
+{ f }
[ "789:;<=>?@" string>number ]
unit-test
-[ f ]
+{ f }
[ "12345abcdef" string>number ]
unit-test
-[ 12 ]
+{ 12 }
[ "+12" string>number ]
unit-test
-[ -12 ]
+{ -12 }
[ "-12" string>number ]
unit-test
-[ f ]
+{ f }
[ "-+12" string>number ]
unit-test
-[ f ]
+{ f }
[ "+-12" string>number ]
unit-test
-[ f ]
+{ f }
[ "--12" string>number ]
unit-test
-[ f ]
+{ f }
[ "-" string>number ]
unit-test
-[ f ]
+{ f }
[ "e" string>number ]
unit-test
-[ 1/2 ] [ "1/2" string>number ] unit-test
-[ -1/2 ] [ "-1/2" string>number ] unit-test
-[ 2 ] [ "4/2" string>number ] unit-test
-[ f ] [ "1/-2" string>number ] unit-test
-[ f ] [ "1/2/3" string>number ] unit-test
-[ 1+1/2 ] [ "1+1/2" string>number ] unit-test
-[ 1+1/2 ] [ "+1+1/2" string>number ] unit-test
-[ f ] [ "1-1/2" string>number ] unit-test
-[ -1-1/2 ] [ "-1-1/2" string>number ] unit-test
-[ f ] [ "-1+1/2" string>number ] unit-test
-[ f ] [ "1+2" string>number ] unit-test
-[ f ] [ "1+" string>number ] unit-test
-[ f ] [ "1-" string>number ] unit-test
-[ f ] [ "1+1/2+2" string>number ] unit-test
-
-[ 100000 ] [ "100,000" string>number ] unit-test
-
-[ 100000.0 ] [ "100,000.0" string>number ] unit-test
-
-[ f ] [ "," string>number ] unit-test
-[ f ] [ "-," string>number ] unit-test
-[ f ] [ "1," string>number ] unit-test
-[ f ] [ "-1," string>number ] unit-test
-[ f ] [ ",2" string>number ] unit-test
-[ f ] [ "-,2" string>number ] unit-test
-
-[ 2.0 ] [ "2." string>number ] unit-test
-[ 2.0 ] [ "+2." string>number ] unit-test
-[ 0.25 ] [ ".25" string>number ] unit-test
-[ -2.0 ] [ "-2." string>number ] unit-test
-[ -0.25 ] [ "-.25" string>number ] unit-test
-[ f ] [ "-." string>number ] unit-test
-
-[ 255 ] [ "ff" hex> ] unit-test
-
-[ 100.0 ] [ "1.0e2" string>number ] unit-test
-[ 100.0 ] [ "100.0" string>number ] unit-test
-[ 100.0 ] [ "100." string>number ] unit-test
-
-[ 100.0 ] [ "1e2" string>number ] unit-test
-[ 100.0 ] [ "1e+2" string>number ] unit-test
-[ 0x1e2 ] [ "1e2" hex> ] unit-test
-
-[ 0x1.999999999999ap-3 ] [ "0.2" string>number ] unit-test
-[ 0x1.3333333333333p0 ] [ "1.2" string>number ] unit-test
-[ 0x1.5555555555555p0 ] [ "1.333,333,333,333,333,333" string>number ] unit-test
-[ 0x1.aaaaaaaaaaaabp0 ] [ "1.666,666,666,666,666,666" string>number ] unit-test
-
-[ "100.0" ]
+{ 1/2 } [ "1/2" string>number ] unit-test
+{ -1/2 } [ "-1/2" string>number ] unit-test
+{ 2 } [ "4/2" string>number ] unit-test
+{ f } [ "1/-2" string>number ] unit-test
+{ f } [ "1/2/3" string>number ] unit-test
+{ 1+1/2 } [ "1+1/2" string>number ] unit-test
+{ 1+1/2 } [ "+1+1/2" string>number ] unit-test
+{ f } [ "1-1/2" string>number ] unit-test
+{ -1-1/2 } [ "-1-1/2" string>number ] unit-test
+{ f } [ "-1+1/2" string>number ] unit-test
+{ f } [ "1+2" string>number ] unit-test
+{ f } [ "1+" string>number ] unit-test
+{ f } [ "1-" string>number ] unit-test
+{ f } [ "1+1/2+2" string>number ] unit-test
+
+{ 100000 } [ "100,000" string>number ] unit-test
+
+{ 100000.0 } [ "100,000.0" string>number ] unit-test
+
+{ f } [ "," string>number ] unit-test
+{ f } [ "-," string>number ] unit-test
+{ f } [ "1," string>number ] unit-test
+{ f } [ "-1," string>number ] unit-test
+{ f } [ ",2" string>number ] unit-test
+{ f } [ "-,2" string>number ] unit-test
+
+{ 2.0 } [ "2." string>number ] unit-test
+{ 2.0 } [ "+2." string>number ] unit-test
+{ 0.25 } [ ".25" string>number ] unit-test
+{ -2.0 } [ "-2." string>number ] unit-test
+{ -0.25 } [ "-.25" string>number ] unit-test
+{ f } [ "-." string>number ] unit-test
+
+{ 255 } [ "ff" hex> ] unit-test
+
+{ 100.0 } [ "1.0e2" string>number ] unit-test
+{ 100.0 } [ "100.0" string>number ] unit-test
+{ 100.0 } [ "100." string>number ] unit-test
+
+{ 100.0 } [ "1e2" string>number ] unit-test
+{ 100.0 } [ "1e+2" string>number ] unit-test
+{ 0x1e2 } [ "1e2" hex> ] unit-test
+
+{ 0x1.999999999999ap-3 } [ "0.2" string>number ] unit-test
+{ 0x1.3333333333333p0 } [ "1.2" string>number ] unit-test
+{ 0x1.5555555555555p0 } [ "1.333,333,333,333,333,333" string>number ] unit-test
+{ 0x1.aaaaaaaaaaaabp0 } [ "1.666,666,666,666,666,666" string>number ] unit-test
+
+{ "100.0" }
[ "1.0e2" string>number number>string ]
unit-test
-[ -100.0 ] [ "-1.0e2" string>number ] unit-test
-[ -100.0 ] [ "-100.0" string>number ] unit-test
-[ -100.0 ] [ "-100." string>number ] unit-test
+{ -100.0 } [ "-1.0e2" string>number ] unit-test
+{ -100.0 } [ "-100.0" string>number ] unit-test
+{ -100.0 } [ "-100." string>number ] unit-test
-[ "-100.0" ]
+{ "-100.0" }
[ "-1.0e2" string>number number>string ]
unit-test
-[ -100.0 ] [ "-1.e2" string>number ] unit-test
+{ -100.0 } [ "-1.e2" string>number ] unit-test
-[ "0.01" ]
+{ "0.01" }
[ "1.0e-2" string>number number>string ]
unit-test
-[ 0.01 ] [ "1.0e-2" string>number ] unit-test
+{ 0.01 } [ "1.0e-2" string>number ] unit-test
-[ "-0.01" ]
+{ "-0.01" }
[ "-1.0e-2" string>number number>string ]
unit-test
-[ -0.01 ] [ "-1.0e-2" string>number ] unit-test
+{ -0.01 } [ "-1.0e-2" string>number ] unit-test
-[ "-0.01" ]
+{ "-0.01" }
[ "-1.e-2" string>number number>string ]
unit-test
-[ -1.0e-12 ] [ "-1.0e-12" string>number ] unit-test
+{ -1.0e-12 } [ "-1.0e-12" string>number ] unit-test
-[ t ]
+{ t }
[ "-1.0e-12" string>number number>string { "-1.0e-12" "-1.0e-012" } member? ]
unit-test
-[ f ]
+{ f }
[ "-1e-2e4" string>number ]
unit-test
-[ "3.14" ]
+{ "3.14" }
[ "3.14" string>number number>string ]
unit-test
-[ f ]
+{ f }
[ "." string>number ]
unit-test
-[ f ]
+{ f }
[ ".e" string>number ]
unit-test
-[ "101.0" ]
+{ "101.0" }
[ "1.01e2" string>number number>string ]
unit-test
-[ "-101.0" ]
+{ "-101.0" }
[ "-1.01e2" string>number number>string ]
unit-test
-[ "1.01" ]
+{ "1.01" }
[ "101.0e-2" string>number number>string ]
unit-test
-[ "-1.01" ]
+{ "-1.01" }
[ "-101.0e-2" string>number number>string ]
unit-test
-[ f ]
+{ f }
[ "1e1/2" string>number ]
unit-test
-[ f ]
+{ f }
[ "1e1.2" string>number ]
unit-test
-[ f ]
+{ f }
[ "e/2" string>number ]
unit-test
-[ f ] [ "12" bin> ] unit-test
-[ f ] [ "fdsf" bin> ] unit-test
-[ 3 ] [ "11" bin> ] unit-test
+{ f } [ "12" bin> ] unit-test
+{ f } [ "fdsf" bin> ] unit-test
+{ 3 } [ "11" bin> ] unit-test
-[ f ] [ "\0." string>number ] unit-test
+{ f } [ "\0." string>number ] unit-test
[ 1 1 >base ] must-fail
[ 1 0 >base ] must-fail
[ 123.456 8 >base ] [ invalid-radix? ] must-fail-with
[ 123.456 2 >base ] [ invalid-radix? ] must-fail-with
-[ "0/0." ] [ 0.0 0.0 / number>string ] unit-test
-
-[ "1/0." ] [ 1.0 0.0 / number>string ] unit-test
-
-[ "-1/0." ] [ -1.0 0.0 / number>string ] unit-test
-
-[ t ] [ "0/0." string>number fp-nan? ] unit-test
-
-[ 1/0. ] [ "1/0." string>number ] unit-test
-
-[ -1/0. ] [ "-1/0." string>number ] unit-test
-
-[ -0.5 ] [ "-1/2." string>number ] unit-test
-
-[ "-0.0" ] [ -0.0 number>string ] unit-test
-
-[ "-3/4" ] [ -3/4 number>string ] unit-test
-[ "-1-1/4" ] [ -5/4 number>string ] unit-test
-
-[ "1.0p0" ] [ 1.0 >hex ] unit-test
-[ "1.8p2" ] [ 6.0 >hex ] unit-test
-[ "1.08p2" ] [ 4.125 >hex ] unit-test
-[ "1.8p-2" ] [ 0.375 >hex ] unit-test
-[ "-1.8p2" ] [ -6.0 >hex ] unit-test
-[ "1.8p10" ] [ 1536.0 >hex ] unit-test
-[ "0.0" ] [ 0.0 >hex ] unit-test
-[ "1.0p-1074" ] [ 1 bits>double >hex ] unit-test
-[ "-0.0" ] [ -0.0 >hex ] unit-test
-
-[ 1.0 ] [ "1.0p0" hex> ] unit-test
-[ 1.5 ] [ "1.8p0" hex> ] unit-test
-[ 1.875 ] [ "1.ep0" hex> ] unit-test
-[ 1.90625 ] [ "1.e8p0" hex> ] unit-test
-[ 1.03125 ] [ "1.08p0" hex> ] unit-test
-[ 15.5 ] [ "f.8p0" hex> ] unit-test
-[ 15.53125 ] [ "f.88p0" hex> ] unit-test
-[ -15.5 ] [ "-f.8p0" hex> ] unit-test
-[ 15.5 ] [ "f.8p0" hex> ] unit-test
-[ -15.5 ] [ "-f.8p0" hex> ] unit-test
-[ 62.0 ] [ "f.8p2" hex> ] unit-test
-[ 3.875 ] [ "f.8p-2" hex> ] unit-test
-[ $[ 1 bits>double ] ] [ "1.0p-1074" hex> ] unit-test
-[ 0.0 ] [ "1.0p-1075" hex> ] unit-test
-[ 1/0. ] [ "1.0p1024" hex> ] unit-test
-[ -1/0. ] [ "-1.0p1024" hex> ] unit-test
-
-[ 0 ] [ "0" string>number ] unit-test
-[ 0 ] [ "00" string>number ] unit-test
-[ 0 ] [ "0,000" string>number ] unit-test
-[ 0.0 ] [ "0." string>number ] unit-test
-[ 0.0 ] [ "0.0" string>number ] unit-test
-[ 0.0 ] [ "0x0.0p0" string>number ] unit-test
-[ 0 ] [ "0x0" string>number ] unit-test
-[ 0 ] [ "0o0" string>number ] unit-test
-[ 0 ] [ "0b0" string>number ] unit-test
-
-[ 10 ] [ "010" string>number ] unit-test
-[ 16 ] [ "0x10" string>number ] unit-test
-[ 8 ] [ "0o10" string>number ] unit-test
-[ 2 ] [ "0b10" string>number ] unit-test
-
-[ -10 ] [ "-010" string>number ] unit-test
-[ -16 ] [ "-0x10" string>number ] unit-test
-[ -8 ] [ "-0o10" string>number ] unit-test
-[ -2 ] [ "-0b10" string>number ] unit-test
-
-[ f ] [ "01a" string>number ] unit-test
-[ f ] [ "0x1g" string>number ] unit-test
-[ f ] [ "0o18" string>number ] unit-test
-[ f ] [ "0b12" string>number ] unit-test
-
-[ 11 ] [ "0x0b" string>number ] unit-test
-[ f ] [ "0x0o0" string>number ] unit-test
-
-[ 0x7FFF,ABCD ] [ "0x7FFF,ABCD" string>number ] unit-test
-
-[ 1.0 ] [ "0x1.0p0" string>number ] unit-test
-[ 6.0 ] [ "0x1.8p2" string>number ] unit-test
-[ 0.375 ] [ "0x1.8p-2" string>number ] unit-test
-[ -6.0 ] [ "-0x1.8p2" string>number ] unit-test
-[ -0.375 ] [ "-0x1.8p-2" string>number ] unit-test
-
-[ f ] [ "0x" string>number ] unit-test
-[ f ] [ "0b" string>number ] unit-test
-[ f ] [ "0o" string>number ] unit-test
-[ f ] [ "0x," string>number ] unit-test
-[ f ] [ "0b," string>number ] unit-test
-[ f ] [ "0o," string>number ] unit-test
-[ f ] [ "0x,1" string>number ] unit-test
-[ f ] [ "0b,1" string>number ] unit-test
-[ f ] [ "0o,1" string>number ] unit-test
-[ f ] [ "0x1," string>number ] unit-test
-[ f ] [ "0b1," string>number ] unit-test
-[ f ] [ "0o1," string>number ] unit-test
+{ "0/0." } [ 0.0 0.0 / number>string ] unit-test
+
+{ "1/0." } [ 1.0 0.0 / number>string ] unit-test
+
+{ "-1/0." } [ -1.0 0.0 / number>string ] unit-test
+
+{ t } [ "0/0." string>number fp-nan? ] unit-test
+
+{ 1/0. } [ "1/0." string>number ] unit-test
+
+{ -1/0. } [ "-1/0." string>number ] unit-test
+
+{ -0.5 } [ "-1/2." string>number ] unit-test
+
+{ "-0.0" } [ -0.0 number>string ] unit-test
+
+{ "-3/4" } [ -3/4 number>string ] unit-test
+{ "-1-1/4" } [ -5/4 number>string ] unit-test
+
+{ "1.0p0" } [ 1.0 >hex ] unit-test
+{ "1.8p2" } [ 6.0 >hex ] unit-test
+{ "1.08p2" } [ 4.125 >hex ] unit-test
+{ "1.8p-2" } [ 0.375 >hex ] unit-test
+{ "-1.8p2" } [ -6.0 >hex ] unit-test
+{ "1.8p10" } [ 1536.0 >hex ] unit-test
+{ "0.0" } [ 0.0 >hex ] unit-test
+{ "1.0p-1074" } [ 1 bits>double >hex ] unit-test
+{ "-0.0" } [ -0.0 >hex ] unit-test
+
+{ 1.0 } [ "1.0p0" hex> ] unit-test
+{ 1.5 } [ "1.8p0" hex> ] unit-test
+{ 1.875 } [ "1.ep0" hex> ] unit-test
+{ 1.90625 } [ "1.e8p0" hex> ] unit-test
+{ 1.03125 } [ "1.08p0" hex> ] unit-test
+{ 15.5 } [ "f.8p0" hex> ] unit-test
+{ 15.53125 } [ "f.88p0" hex> ] unit-test
+{ -15.5 } [ "-f.8p0" hex> ] unit-test
+{ 15.5 } [ "f.8p0" hex> ] unit-test
+{ -15.5 } [ "-f.8p0" hex> ] unit-test
+{ 62.0 } [ "f.8p2" hex> ] unit-test
+{ 3.875 } [ "f.8p-2" hex> ] unit-test
+{ $[ 1 bits>double ] } [ "1.0p-1074" hex> ] unit-test
+{ 0.0 } [ "1.0p-1075" hex> ] unit-test
+{ 1/0. } [ "1.0p1024" hex> ] unit-test
+{ -1/0. } [ "-1.0p1024" hex> ] unit-test
+
+{ 0 } [ "0" string>number ] unit-test
+{ 0 } [ "00" string>number ] unit-test
+{ 0 } [ "0,000" string>number ] unit-test
+{ 0.0 } [ "0." string>number ] unit-test
+{ 0.0 } [ "0.0" string>number ] unit-test
+{ 0.0 } [ "0x0.0p0" string>number ] unit-test
+{ 0 } [ "0x0" string>number ] unit-test
+{ 0 } [ "0o0" string>number ] unit-test
+{ 0 } [ "0b0" string>number ] unit-test
+
+{ 10 } [ "010" string>number ] unit-test
+{ 16 } [ "0x10" string>number ] unit-test
+{ 8 } [ "0o10" string>number ] unit-test
+{ 2 } [ "0b10" string>number ] unit-test
+
+{ -10 } [ "-010" string>number ] unit-test
+{ -16 } [ "-0x10" string>number ] unit-test
+{ -8 } [ "-0o10" string>number ] unit-test
+{ -2 } [ "-0b10" string>number ] unit-test
+
+{ f } [ "01a" string>number ] unit-test
+{ f } [ "0x1g" string>number ] unit-test
+{ f } [ "0o18" string>number ] unit-test
+{ f } [ "0b12" string>number ] unit-test
+
+{ 11 } [ "0x0b" string>number ] unit-test
+{ f } [ "0x0o0" string>number ] unit-test
+
+{ 0x7FFF,ABCD } [ "0x7FFF,ABCD" string>number ] unit-test
+
+{ 1.0 } [ "0x1.0p0" string>number ] unit-test
+{ 6.0 } [ "0x1.8p2" string>number ] unit-test
+{ 0.375 } [ "0x1.8p-2" string>number ] unit-test
+{ -6.0 } [ "-0x1.8p2" string>number ] unit-test
+{ -0.375 } [ "-0x1.8p-2" string>number ] unit-test
+
+{ f } [ "0x" string>number ] unit-test
+{ f } [ "0b" string>number ] unit-test
+{ f } [ "0o" string>number ] unit-test
+{ f } [ "0x," string>number ] unit-test
+{ f } [ "0b," string>number ] unit-test
+{ f } [ "0o," string>number ] unit-test
+{ f } [ "0x,1" string>number ] unit-test
+{ f } [ "0b,1" string>number ] unit-test
+{ f } [ "0o,1" string>number ] unit-test
+{ f } [ "0x1," string>number ] unit-test
+{ f } [ "0b1," string>number ] unit-test
+{ f } [ "0o1," string>number ] unit-test
! #372
! hex float requires exponent
-[ f ] [ "0x1.0" string>number ] unit-test
+{ f } [ "0x1.0" string>number ] unit-test
! hex float rounds to even on half
-[ 0x1.0000,0000,0000,0p0 ] [ "0x1.0000,0000,0000,0,8p0" string>number ] unit-test
-[ 0x1.0000,0000,0000,2p0 ] [ "0x1.0000,0000,0000,1,8p0" string>number ] unit-test
-[ 0x1.0000,0000,0000,0p0 ] [ "0x8.0000,0000,0000,4p-3" string>number ] unit-test
-[ 0x1.0000,0000,0000,2p0 ] [ "0x8.0000,0000,0000,Cp-3" string>number ] unit-test
+{ 0x1.0000,0000,0000,0p0 } [ "0x1.0000,0000,0000,0,8p0" string>number ] unit-test
+{ 0x1.0000,0000,0000,2p0 } [ "0x1.0000,0000,0000,1,8p0" string>number ] unit-test
+{ 0x1.0000,0000,0000,0p0 } [ "0x8.0000,0000,0000,4p-3" string>number ] unit-test
+{ 0x1.0000,0000,0000,2p0 } [ "0x8.0000,0000,0000,Cp-3" string>number ] unit-test
-[ -0x1.0000,0000,0000,0p0 ] [ "-0x1.0000,0000,0000,0,8p0" string>number ] unit-test
-[ -0x1.0000,0000,0000,2p0 ] [ "-0x1.0000,0000,0000,1,8p0" string>number ] unit-test
-[ -0x1.0000,0000,0000,0p0 ] [ "-0x8.0000,0000,0000,4p-3" string>number ] unit-test
-[ -0x1.0000,0000,0000,2p0 ] [ "-0x8.0000,0000,0000,Cp-3" string>number ] unit-test
+{ -0x1.0000,0000,0000,0p0 } [ "-0x1.0000,0000,0000,0,8p0" string>number ] unit-test
+{ -0x1.0000,0000,0000,2p0 } [ "-0x1.0000,0000,0000,1,8p0" string>number ] unit-test
+{ -0x1.0000,0000,0000,0p0 } [ "-0x8.0000,0000,0000,4p-3" string>number ] unit-test
+{ -0x1.0000,0000,0000,2p0 } [ "-0x8.0000,0000,0000,Cp-3" string>number ] unit-test
! hex float rounds to nearest with tiny epsilons
-[ 0x1.0000,0000,0000,0p0 ] [ "0x1.0000,0000,0000,0,4p0" string>number ] unit-test
-[ 0x1.0000,0000,0000,0p0 ] [ "0x1.0000,0000,0000,0,7Fp0" string>number ] unit-test
-[ 0x1.0000,0000,0000,0p0 ] [ "0x1.0000,0000,0000,0,7FFF,FFFF,FFFF,FFFFp0" string>number ] unit-test
+{ 0x1.0000,0000,0000,0p0 } [ "0x1.0000,0000,0000,0,4p0" string>number ] unit-test
+{ 0x1.0000,0000,0000,0p0 } [ "0x1.0000,0000,0000,0,7Fp0" string>number ] unit-test
+{ 0x1.0000,0000,0000,0p0 } [ "0x1.0000,0000,0000,0,7FFF,FFFF,FFFF,FFFFp0" string>number ] unit-test
-[ 0x1.0000,0000,0000,1p0 ] [ "0x1.0000,0000,0000,0,Cp0" string>number ] unit-test
-[ 0x1.0000,0000,0000,1p0 ] [ "0x1.0000,0000,0000,0,81p0" string>number ] unit-test
-[ 0x1.0000,0000,0000,1p0 ] [ "0x1.0000,0000,0000,0,8000,0000,0000,0001p0" string>number ] unit-test
+{ 0x1.0000,0000,0000,1p0 } [ "0x1.0000,0000,0000,0,Cp0" string>number ] unit-test
+{ 0x1.0000,0000,0000,1p0 } [ "0x1.0000,0000,0000,0,81p0" string>number ] unit-test
+{ 0x1.0000,0000,0000,1p0 } [ "0x1.0000,0000,0000,0,8000,0000,0000,0001p0" string>number ] unit-test
-[ 0x1.0000,0000,0000,1p0 ] [ "0x1.0000,0000,0000,1,4p0" string>number ] unit-test
-[ 0x1.0000,0000,0000,1p0 ] [ "0x1.0000,0000,0000,1,7Fp0" string>number ] unit-test
-[ 0x1.0000,0000,0000,1p0 ] [ "0x1.0000,0000,0000,1,7FFF,FFFF,FFFF,FFFFp0" string>number ] unit-test
+{ 0x1.0000,0000,0000,1p0 } [ "0x1.0000,0000,0000,1,4p0" string>number ] unit-test
+{ 0x1.0000,0000,0000,1p0 } [ "0x1.0000,0000,0000,1,7Fp0" string>number ] unit-test
+{ 0x1.0000,0000,0000,1p0 } [ "0x1.0000,0000,0000,1,7FFF,FFFF,FFFF,FFFFp0" string>number ] unit-test
-[ 0x1.0000,0000,0000,2p0 ] [ "0x1.0000,0000,0000,1,Cp0" string>number ] unit-test
-[ 0x1.0000,0000,0000,2p0 ] [ "0x1.0000,0000,0000,1,81p0" string>number ] unit-test
-[ 0x1.0000,0000,0000,2p0 ] [ "0x1.0000,0000,0000,1,8000,0000,0000,0001p0" string>number ] unit-test
+{ 0x1.0000,0000,0000,2p0 } [ "0x1.0000,0000,0000,1,Cp0" string>number ] unit-test
+{ 0x1.0000,0000,0000,2p0 } [ "0x1.0000,0000,0000,1,81p0" string>number ] unit-test
+{ 0x1.0000,0000,0000,2p0 } [ "0x1.0000,0000,0000,1,8000,0000,0000,0001p0" string>number ] unit-test
-[ -0x1.0000,0000,0000,0p0 ] [ "-0x1.0000,0000,0000,0,4p0" string>number ] unit-test
-[ -0x1.0000,0000,0000,0p0 ] [ "-0x1.0000,0000,0000,0,7Fp0" string>number ] unit-test
-[ -0x1.0000,0000,0000,0p0 ] [ "-0x1.0000,0000,0000,0,7FFF,FFFF,FFFF,FFFFp0" string>number ] unit-test
+{ -0x1.0000,0000,0000,0p0 } [ "-0x1.0000,0000,0000,0,4p0" string>number ] unit-test
+{ -0x1.0000,0000,0000,0p0 } [ "-0x1.0000,0000,0000,0,7Fp0" string>number ] unit-test
+{ -0x1.0000,0000,0000,0p0 } [ "-0x1.0000,0000,0000,0,7FFF,FFFF,FFFF,FFFFp0" string>number ] unit-test
-[ -0x1.0000,0000,0000,1p0 ] [ "-0x1.0000,0000,0000,0,Cp0" string>number ] unit-test
-[ -0x1.0000,0000,0000,1p0 ] [ "-0x1.0000,0000,0000,0,81p0" string>number ] unit-test
-[ -0x1.0000,0000,0000,1p0 ] [ "-0x1.0000,0000,0000,0,8000,0000,0000,0001p0" string>number ] unit-test
+{ -0x1.0000,0000,0000,1p0 } [ "-0x1.0000,0000,0000,0,Cp0" string>number ] unit-test
+{ -0x1.0000,0000,0000,1p0 } [ "-0x1.0000,0000,0000,0,81p0" string>number ] unit-test
+{ -0x1.0000,0000,0000,1p0 } [ "-0x1.0000,0000,0000,0,8000,0000,0000,0001p0" string>number ] unit-test
-[ -0x1.0000,0000,0000,1p0 ] [ "-0x1.0000,0000,0000,1,4p0" string>number ] unit-test
-[ -0x1.0000,0000,0000,1p0 ] [ "-0x1.0000,0000,0000,1,7Fp0" string>number ] unit-test
-[ -0x1.0000,0000,0000,1p0 ] [ "-0x1.0000,0000,0000,1,7FFF,FFFF,FFFF,FFFFp0" string>number ] unit-test
+{ -0x1.0000,0000,0000,1p0 } [ "-0x1.0000,0000,0000,1,4p0" string>number ] unit-test
+{ -0x1.0000,0000,0000,1p0 } [ "-0x1.0000,0000,0000,1,7Fp0" string>number ] unit-test
+{ -0x1.0000,0000,0000,1p0 } [ "-0x1.0000,0000,0000,1,7FFF,FFFF,FFFF,FFFFp0" string>number ] unit-test
-[ -0x1.0000,0000,0000,2p0 ] [ "-0x1.0000,0000,0000,1,Cp0" string>number ] unit-test
-[ -0x1.0000,0000,0000,2p0 ] [ "-0x1.0000,0000,0000,1,81p0" string>number ] unit-test
-[ -0x1.0000,0000,0000,2p0 ] [ "-0x1.0000,0000,0000,1,8000,0000,0000,0001p0" string>number ] unit-test
+{ -0x1.0000,0000,0000,2p0 } [ "-0x1.0000,0000,0000,1,Cp0" string>number ] unit-test
+{ -0x1.0000,0000,0000,2p0 } [ "-0x1.0000,0000,0000,1,81p0" string>number ] unit-test
+{ -0x1.0000,0000,0000,2p0 } [ "-0x1.0000,0000,0000,1,8000,0000,0000,0001p0" string>number ] unit-test
! #453
! hex> dec> oct> bin> shouldn't admit radix prefixes
-[ 0x0b ] [ "0b" hex> ] unit-test
-[ 0x0b0 ] [ "0b0" hex> ] unit-test
-[ f ] [ "0o0" hex> ] unit-test
-[ f ] [ "0x0" hex> ] unit-test
-
-[ f ] [ "0b" dec> ] unit-test
-[ f ] [ "0b0" dec> ] unit-test
-[ f ] [ "0o0" dec> ] unit-test
-[ f ] [ "0x0" dec> ] unit-test
-
-[ f ] [ "0b" oct> ] unit-test
-[ f ] [ "0b0" oct> ] unit-test
-[ f ] [ "0o0" oct> ] unit-test
-[ f ] [ "0x0" oct> ] unit-test
-
-[ f ] [ "0b" bin> ] unit-test
-[ f ] [ "0b0" bin> ] unit-test
-[ f ] [ "0o0" bin> ] unit-test
-[ f ] [ "0x0" bin> ] unit-test
+{ 0x0b } [ "0b" hex> ] unit-test
+{ 0x0b0 } [ "0b0" hex> ] unit-test
+{ f } [ "0o0" hex> ] unit-test
+{ f } [ "0x0" hex> ] unit-test
+
+{ f } [ "0b" dec> ] unit-test
+{ f } [ "0b0" dec> ] unit-test
+{ f } [ "0o0" dec> ] unit-test
+{ f } [ "0x0" dec> ] unit-test
+
+{ f } [ "0b" oct> ] unit-test
+{ f } [ "0b0" oct> ] unit-test
+{ f } [ "0o0" oct> ] unit-test
+{ f } [ "0x0" oct> ] unit-test
+
+{ f } [ "0b" bin> ] unit-test
+{ f } [ "0b0" bin> ] unit-test
+{ f } [ "0o0" bin> ] unit-test
+{ f } [ "0x0" bin> ] unit-test
2 [ [ [ 3 throw ] instances ] must-fail ] times
! Tests for 'become'
-[ ] [ { } { } become ] unit-test
+{ } [ { } { } become ] unit-test
! Become something when it's on the data stack.
{ "replacer" } [
! Bug found on Windows build box, having too many words in the
! image breaks 'become'
-[ ] [ 100000 [ f <uninterned-word> ] replicate { } { } become drop ] unit-test
+{ } [ 100000 [ f <uninterned-word> ] replicate { } { } become drop ] unit-test
! Bug: code heap collection had to be done when data heap was
! full, not just when code heap was full. If the code heap
: leak-loop ( -- ) 100 [ leak-step ] times ;
-[ ] [ leak-loop ] unit-test
+{ } [ leak-loop ] unit-test
! Bug: allocation of large objects directly into tenured space
! can proceed past the high water mark.
! large objects are unreachable.
SYMBOL: foo
-[ ] [
+{ } [
gc
data-room tenured>> size>>
: test-namespace ( -- ? )
H{ } clone dup [ namespace = ] with-variables ;
-[ t ] [ test-namespace ] unit-test
+{ t } [ test-namespace ] unit-test
10 "some-global" set
-[ f ]
+{ f }
[ H{ } clone [ f "some-global" set "some-global" get ] with-variables ]
unit-test
test-initialize [ 1 ] initialize
test-initialize [ 2 ] initialize
-[ 1 ] [ test-initialize get-global ] unit-test
+{ 1 } [ test-initialize get-global ] unit-test
f test-initialize set-global
test-initialize [ 5 ] initialize
-[ 5 ] [ test-initialize get-global ] unit-test
+{ 5 } [ test-initialize get-global ] unit-test
SYMBOL: toggle-test
-[ f ] [ toggle-test get ] unit-test
-[ t ] [ toggle-test [ toggle ] [ get ] bi ] unit-test
-[ f ] [ toggle-test [ toggle ] [ get ] bi ] unit-test
+{ f } [ toggle-test get ] unit-test
+{ t } [ toggle-test [ toggle ] [ get ] bi ] unit-test
+{ f } [ toggle-test [ toggle ] [ get ] bi ] unit-test
-[ t ] [ toggle-test [ on ] [ get ] bi ] unit-test
-[ f ] [ toggle-test [ off ] [ get ] bi ] unit-test
+{ t } [ toggle-test [ on ] [ get ] bi ] unit-test
+{ f } [ toggle-test [ off ] [ get ] bi ] unit-test
-[ t ] [ [ test-initialize get-global ] { at* set-at } inlined? ] unit-test
-[ t ] [ [ test-initialize set-global ] { at* set-at } inlined? ] unit-test
+{ t } [ [ test-initialize get-global ] { at* set-at } inlined? ] unit-test
+{ t } [ [ test-initialize set-global ] { at* set-at } inlined? ] unit-test
USING: lexer namespaces parser.notes source-files tools.test ;
IN: parser.notes.tests
-[ ] [ f lexer set f file set "Hello world" note. ] unit-test
+{ } [ f lexer set f file set "Hello world" note. ] unit-test
tools.crossref grouping sets ;
IN: parser.tests
-[ 1 [ 2 [ 3 ] 4 ] 5 ]
+{ 1 [ 2 [ 3 ] 4 ] 5 }
[ "1\n[\n2\n[\n3\n]\n4\n]\n5" eval( -- a b c ) ]
unit-test
-[ t t f f ]
+{ t t f f }
[ "t t f f" eval( -- ? ? ? ? ) ]
unit-test
-[ "hello world" ]
+{ "hello world" }
[ "\"hello world\"" eval( -- string ) ]
unit-test
-[ "\n\r\t\\" ]
+{ "\n\r\t\\" }
[ "\"\\n\\r\\t\\\\\"" eval( -- string ) ]
unit-test
-[ "hello world" ]
+{ "hello world" }
[
"""#!/usr/bin/env factor
"hello world" """ eval( -- string )
] unit-test
-[ "hello world" ]
+{ "hello world" }
[
"IN: parser.tests : hello ( -- str ) \"hello world\" ;"
eval( -- ) "USE: parser.tests hello" eval( -- string )
[ "IN: parser.tests : 123 ( -- n ) 123 ;" eval( -- ) ]
[ error>> invalid-word-name? ] must-fail-with
-[ ]
+{ }
[ "! This is a comment, people." eval( -- ) ]
unit-test
! Test escapes
-[ " " ]
+{ " " }
[ "\"\\u000020\"" eval( -- string ) ]
unit-test
-[ "'" ]
+{ "'" }
[ "\"\\u000027\"" eval( -- string ) ]
unit-test
! Test EOL comments in multiline strings.
-[ "Hello" ] [ "#! This calls until-eol.\n\"Hello\"" eval( -- string ) ] unit-test
+{ "Hello" } [ "#! This calls until-eol.\n\"Hello\"" eval( -- string ) ] unit-test
-[ word ] [ \ f class-of ] unit-test
+{ word } [ \ f class-of ] unit-test
! Test stack effect parsing
: effect-parsing-test ( a b -- c ) + ;
-[ t ] [
+{ t } [
"effect-parsing-test" "parser.tests" lookup-word
\ effect-parsing-test eq?
] unit-test
-[ T{ effect f { "a" "b" } { "c" } f } ]
+{ T{ effect f { "a" "b" } { "c" } f } }
[ \ effect-parsing-test "declared-effect" word-prop ] unit-test
: baz ( a b -- * ) 2array throw ;
-[ t ]
+{ t }
[ \ baz "declared-effect" word-prop terminated?>> ]
unit-test
-[ ] [ "IN: parser.tests USE: math : effect-parsing-test ( a b -- d ) - ;" eval( -- ) ] unit-test
+{ } [ "IN: parser.tests USE: math : effect-parsing-test ( a b -- d ) - ;" eval( -- ) ] unit-test
-[ t ] [
+{ t } [
"effect-parsing-test" "parser.tests" lookup-word
\ effect-parsing-test eq?
] unit-test
-[ T{ effect f { "a" "b" } { "d" } f } ]
+{ T{ effect f { "a" "b" } { "d" } f } }
[ \ effect-parsing-test "declared-effect" word-prop ] unit-test
[ "IN: parser.tests : missing-- ( a b ) ;" eval( -- ) ] must-fail
! Funny bug
-[ 2 ] [ "IN: parser.tests : \0. ( -- x ) 2 ; \0." eval( -- n ) ] unit-test
+{ 2 } [ "IN: parser.tests : \0. ( -- x ) 2 ; \0." eval( -- n ) ] unit-test
DEFER: foo
"IN: parser.tests USING: math prettyprint ; SYNTAX: foo 2 2 + . ;" eval( -- )
-[ ] [ "USE: parser.tests foo" eval( -- ) ] unit-test
+{ } [ "USE: parser.tests foo" eval( -- ) ] unit-test
"IN: parser.tests USING: math prettyprint ; : foo ( -- ) 2 2 + . ;" eval( -- )
-[ t ] [
+{ t } [
"USE: parser.tests \\ foo" eval( -- word )
"foo" "parser.tests" lookup-word eq?
] unit-test
! Test smudging
-[ 1 ] [
+{ 1 } [
"IN: parser.tests : smudge-me ( -- ) ;" <string-reader> "foo"
parse-stream drop
"foo" source-file definitions>> first cardinality
] unit-test
-[ t ] [ "smudge-me" "parser.tests" lookup-word >boolean ] unit-test
+{ t } [ "smudge-me" "parser.tests" lookup-word >boolean ] unit-test
-[ ] [
+{ } [
"IN: parser.tests : smudge-me-more ( -- ) ;" <string-reader> "foo"
parse-stream drop
] unit-test
-[ t ] [ "smudge-me-more" "parser.tests" lookup-word >boolean ] unit-test
-[ f ] [ "smudge-me" "parser.tests" lookup-word >boolean ] unit-test
+{ t } [ "smudge-me-more" "parser.tests" lookup-word >boolean ] unit-test
+{ f } [ "smudge-me" "parser.tests" lookup-word >boolean ] unit-test
-[ 3 ] [
+{ 3 } [
"IN: parser.tests USING: math strings ; GENERIC: smudge-me ( a -- b ) M: integer smudge-me ; M: string smudge-me ;" <string-reader> "foo"
parse-stream drop
"foo" source-file definitions>> first cardinality
] unit-test
-[ 1 ] [
+{ 1 } [
"IN: parser.tests USING: arrays ; M: array smudge-me ;" <string-reader> "bar"
parse-stream drop
"bar" source-file definitions>> first cardinality
] unit-test
-[ 2 ] [
+{ 2 } [
"IN: parser.tests USING: math strings ; GENERIC: smudge-me ( a -- b ) M: integer smudge-me ;" <string-reader> "foo"
parse-stream drop
"foo" source-file definitions>> first cardinality
] unit-test
-[ t ] [
+{ t } [
array "smudge-me" "parser.tests" lookup-word order member-eq?
] unit-test
-[ t ] [
+{ t } [
integer "smudge-me" "parser.tests" lookup-word order member-eq?
] unit-test
-[ f ] [
+{ f } [
string "smudge-me" "parser.tests" lookup-word order member-eq?
] unit-test
-[ ] [
+{ } [
"IN: parser.tests USE: math 2 2 +" <string-reader> "a"
parse-stream drop
] unit-test
-[ t ] [
+{ t } [
"a" <pathname> \ + usage member?
] unit-test
-[ ] [
+{ } [
"IN: parser.tests USE: math 2 2 -" <string-reader> "a"
parse-stream drop
] unit-test
-[ f ] [
+{ f } [
"a" <pathname> \ + usage member?
] unit-test
-[ ] [
+{ } [
"a" source-files get delete-at
2 [
"IN: parser.tests DEFER: x : y ( -- ) x ; : x ( -- ) y ;"
<string-reader> "a" parse-stream
] [ source-file-error? ] must-fail-with
-[ t ] [
+{ t } [
"y" "parser.tests" lookup-word >boolean
] unit-test
-[ f ] [
+{ f } [
"IN: parser.tests : x ( -- ) ;"
<string-reader> "a" parse-stream drop
"y" "parser.tests" lookup-word
] unit-test
! Test new forward definition logic
-[ ] [
+{ } [
"IN: axx : axx ( -- ) ;"
<string-reader> "axx" parse-stream drop
] unit-test
-[ ] [
+{ } [
"USE: axx IN: bxx : bxx ( -- ) ; : cxx ( -- ) axx bxx ;"
<string-reader> "bxx" parse-stream drop
] unit-test
! So we move the bxx word to axx...
-[ ] [
+{ } [
"IN: axx : axx ( -- ) ; : bxx ( -- ) ;"
<string-reader> "axx" parse-stream drop
] unit-test
-[ t ] [ "bxx" "axx" lookup-word >boolean ] unit-test
+{ t } [ "bxx" "axx" lookup-word >boolean ] unit-test
! And reload the file that uses it...
-[ ] [
+{ } [
"USE: axx IN: bxx ( -- ) : cxx ( -- ) axx bxx ;"
<string-reader> "bxx" parse-stream drop
] unit-test
! Turning a generic into a non-generic could cause all
! kinds of funnyness
-[ ] [
+{ } [
"IN: ayy USE: kernel GENERIC: ayy ( a -- b ) M: object ayy ;"
<string-reader> "ayy" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: ayy USE: kernel : ayy ( -- ) ;"
<string-reader> "ayy" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: azz TUPLE: my-class ; GENERIC: a-generic ( a -- b )"
<string-reader> "azz" parse-stream drop
] unit-test
-[ ] [
+{ } [
"USE: azz M: my-class a-generic ;"
<string-reader> "azz-2" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: azz GENERIC: a-generic ( a -- b )"
<string-reader> "azz" parse-stream drop
] unit-test
-[ ] [
+{ } [
"USE: azz USE: math M: integer a-generic ;"
<string-reader> "azz-2" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: parser.tests : <bogus-error> ( -- ) ; : bogus ( -- error ) <bogus-error> ;"
<string-reader> "bogus-error" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: parser.tests TUPLE: bogus-error ; C: <bogus-error> bogus-error : bogus ( -- error ) <bogus-error> ;"
<string-reader> "bogus-error" parse-stream drop
] unit-test
! Problems with class predicates -vs- ordinary words
-[ ] [
+{ } [
"IN: parser.tests TUPLE: killer ;"
<string-reader> "removing-the-predicate" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: parser.tests GENERIC: killer? ( a -- b )"
<string-reader> "removing-the-predicate" parse-stream drop
] unit-test
-[ t ] [
+{ t } [
"killer?" "parser.tests" lookup-word >boolean
] unit-test
<string-reader> "redefining-a-class-1" parse-stream
] [ error>> error>> error>> redefine-error? ] must-fail-with
-[ ] [
+{ } [
"IN: parser.tests TUPLE: class-redef-test ; SYMBOL: class-redef-test"
<string-reader> "redefining-a-class-2" parse-stream drop
] unit-test
<string-reader> "redefining-a-class-3" parse-stream drop
] [ error>> error>> error>> redefine-error? ] must-fail-with
-[ ] [
+{ } [
"IN: parser.tests TUPLE: class-fwd-test ;"
<string-reader> "redefining-a-class-3" parse-stream drop
] unit-test
<string-reader> "redefining-a-class-3" parse-stream drop
] [ error>> error>> error>> no-word-error? ] must-fail-with
-[ ] [
+{ } [
"IN: parser.tests TUPLE: class-fwd-test ; SYMBOL: class-fwd-test"
<string-reader> "redefining-a-class-3" parse-stream drop
] unit-test
<string-reader> "redefining-a-class-4" parse-stream drop
] [ error>> error>> error>> redefine-error? ] must-fail-with
-[ ] [
+{ } [
"IN: parser.tests : foo ( x y -- z ) 1 2 ; : bar ( a -- b ) ;" eval( -- )
] unit-test
"IN: parser.tests : foo ( x y -- z) 1 2 ; : bar ( a -- b ) ;" eval( -- )
] must-fail
-[ ] [
+{ } [
"IN: parser.tests USE: kernel PREDICATE: foo < object ;" eval( -- )
] unit-test
-[ t ] [
+{ t } [
"foo" "parser.tests" lookup-word last-word eq?
] unit-test
-[ ] [
+{ } [
[
"redefining-a-class-5" forget-source
"redefining-a-class-6" forget-source
] unit-test
] times
-[ ] [
+{ } [
[ "this-better-not-exist" forget-vocab ] with-compilation-unit
] unit-test
[ ": foo ;" eval( -- ) ] [ error>> error>> no-current-vocab-error? ] must-fail-with
-[ 92 ] [ "CHAR: \\" eval( -- n ) ] unit-test
-[ 92 ] [ "CHAR: \\\\" eval( -- n ) ] unit-test
+{ 92 } [ "CHAR: \\" eval( -- n ) ] unit-test
+{ 92 } [ "CHAR: \\\\" eval( -- n ) ] unit-test
-[ ] [
+{ } [
{
"IN: parser.tests"
"USING: math arrays kernel ;"
} "\n" join <string-reader> "change-combination-test" parse-stream drop
] unit-test
-[ ] [
+{ } [
{
"IN: parser.tests"
"USING: math arrays kernel ;"
} "\n" join <string-reader> "change-combination-test" parse-stream drop
] unit-test
-[ 2 ] [
+{ 2 } [
"change-combination" "parser.tests" lookup-word
"methods" word-prop assoc-size
] unit-test
-[ ] [
+{ } [
2 [
"IN: parser.tests DEFER: twice-fails FORGET: twice-fails MIXIN: twice-fails"
<string-reader> "twice-fails-test" parse-stream drop
] times
] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: parser.tests : staging-problem-test-1 ( -- a ) 1 ; : staging-problem-test-2 ( -- a ) staging-problem-test-1 ;"
<string-reader> "staging-problem-test" parse-stream
] unit-test
-[ t ] [ "staging-problem-test-1" "parser.tests" lookup-word >boolean ] unit-test
+{ t } [ "staging-problem-test-1" "parser.tests" lookup-word >boolean ] unit-test
-[ t ] [ "staging-problem-test-2" "parser.tests" lookup-word >boolean ] unit-test
+{ t } [ "staging-problem-test-2" "parser.tests" lookup-word >boolean ] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: parser.tests << : staging-problem-test-1 ( -- a ) 1 ; >> : staging-problem-test-2 ( -- a ) staging-problem-test-1 ;"
<string-reader> "staging-problem-test" parse-stream
] unit-test
-[ t ] [ "staging-problem-test-1" "parser.tests" lookup-word >boolean ] unit-test
+{ t } [ "staging-problem-test-1" "parser.tests" lookup-word >boolean ] unit-test
-[ t ] [ "staging-problem-test-2" "parser.tests" lookup-word >boolean ] unit-test
+{ t } [ "staging-problem-test-2" "parser.tests" lookup-word >boolean ] unit-test
[ "DEFER: blahy" eval( -- ) ] [ error>> error>> no-current-vocab-error? ] must-fail-with
SYMBOLS: a b c ;
-[ a ] [ a ] unit-test
-[ b ] [ b ] unit-test
-[ c ] [ c ] unit-test
+{ a } [ a ] unit-test
+{ b } [ b ] unit-test
+{ c } [ c ] unit-test
DEFER: blah
-[ ] [ "IN: parser.tests GENERIC: blah ( -- )" eval( -- ) ] unit-test
-[ ] [ "IN: parser.tests SYMBOLS: blah ;" eval( -- ) ] unit-test
+{ } [ "IN: parser.tests GENERIC: blah ( -- )" eval( -- ) ] unit-test
+{ } [ "IN: parser.tests SYMBOLS: blah ;" eval( -- ) ] unit-test
-[ f ] [ \ blah generic? ] unit-test
-[ t ] [ \ blah symbol? ] unit-test
+{ f } [ \ blah generic? ] unit-test
+{ t } [ \ blah symbol? ] unit-test
DEFER: blah1
QUALIFIED: qualified.tests.foo
QUALIFIED: qualified.tests.bar
-[ 1 2 3 ] [ qualified.tests.foo:x qualified.tests.bar:x x ] unit-test
+{ 1 2 3 } [ qualified.tests.foo:x qualified.tests.bar:x x ] unit-test
QUALIFIED-WITH: qualified.tests.bar p
-[ 2 ] [ p:x ] unit-test
+{ 2 } [ p:x ] unit-test
RENAME: x qualified.tests.baz => y
-[ 3 ] [ y ] unit-test
+{ 3 } [ y ] unit-test
FROM: qualified.tests.baz => x ;
-[ 3 ] [ x ] unit-test
-[ 3 ] [ y ] unit-test
+{ 3 } [ x ] unit-test
+{ 3 } [ y ] unit-test
EXCLUDE: qualified.tests.bar => x ;
-[ 3 ] [ x ] unit-test
-[ 4 ] [ y ] unit-test
+{ 3 } [ x ] unit-test
+{ 4 } [ y ] unit-test
! Two similar bugs
! Replace : def with something in << >>
-/* [ [ ] ] [
+/* { [ ] } [
"IN: parser.tests : was-once-a-word-bug ( -- ) ;"
<string-reader> "was-once-a-word-test" parse-stream
] unit-test
-[ t ] [ "was-once-a-word-bug" "parser.tests" lookup-word >boolean ] unit-test
+{ t } [ "was-once-a-word-bug" "parser.tests" lookup-word >boolean ] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: parser.tests USE: words << \"was-once-a-word-bug\" \"parser.tests\" create-word [ ] ( -- ) define-declared >>"
<string-reader> "was-once-a-word-test" parse-stream
] unit-test
-[ t ] [ "was-once-a-word-bug" "parser.tests" lookup-word >boolean ] unit-test */
+{ t } [ "was-once-a-word-bug" "parser.tests" lookup-word >boolean ] unit-test */
! Replace : def with DEFER:
-[ [ ] ] [
+{ [ ] } [
"IN: parser.tests : is-not-deferred ( -- ) ;"
<string-reader> "is-not-deferred" parse-stream
] unit-test
-[ t ] [ "is-not-deferred" "parser.tests" lookup-word >boolean ] unit-test
-[ f ] [ "is-not-deferred" "parser.tests" lookup-word deferred? ] unit-test
+{ t } [ "is-not-deferred" "parser.tests" lookup-word >boolean ] unit-test
+{ f } [ "is-not-deferred" "parser.tests" lookup-word deferred? ] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: parser.tests DEFER: is-not-deferred"
<string-reader> "is-not-deferred" parse-stream
] unit-test
-[ t ] [ "is-not-deferred" "parser.tests" lookup-word >boolean ] unit-test
-[ t ] [ "is-not-deferred" "parser.tests" lookup-word deferred? ] unit-test
+{ t } [ "is-not-deferred" "parser.tests" lookup-word >boolean ] unit-test
+{ t } [ "is-not-deferred" "parser.tests" lookup-word deferred? ] unit-test
! Forward-reference resolution case iterated using list in the wrong direction
-[ [ ] ] [
+{ [ ] } [
"IN: parser.tests.forward-ref-1 DEFER: x DEFER: y"
<string-reader> "forward-ref-1" parse-stream
] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: parser.tests.forward-ref-2 DEFER: x DEFER: y"
<string-reader> "forward-ref-2" parse-stream
] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: parser.tests.forward-ref-3 FROM: parser.tests.forward-ref-1 => x y ; FROM: parser.tests.forward-ref-2 => x y ; : z ( -- ) x y ;"
<string-reader> "forward-ref-3" parse-stream
] unit-test
-[ t ] [
+{ t } [
"z" "parser.tests.forward-ref-3" lookup-word def>> [ vocabulary>> ] map all-equal?
] unit-test
-[ [ ] ] [
+{ [ ] } [
"FROM: parser.tests.forward-ref-1 => x y ; FROM: parser.tests.forward-ref-2 => x y ; IN: parser.tests.forward-ref-3 : x ( -- ) ; : z ( -- ) x y ;"
<string-reader> "forward-ref-3" parse-stream
] unit-test
-[ f ] [
+{ f } [
"z" "parser.tests.forward-ref-3" lookup-word def>> [ vocabulary>> ] map all-equal?
] unit-test
-[ [ ] ] [
+{ [ ] } [
"IN: parser.tests.forward-ref-3 FROM: parser.tests.forward-ref-1 => x y ; FROM: parser.tests.forward-ref-2 => x y ; : z ( -- ) x y ;"
<string-reader> "forward-ref-3" parse-stream
] unit-test
-[ t ] [
+{ t } [
"z" "parser.tests.forward-ref-3" lookup-word def>> [ vocabulary>> ] map all-equal?
] unit-test
-[ [ dup ] ] [
+{ [ dup ] } [
"USE: kernel dup" <string-reader> "unuse-test" parse-stream
] unit-test
"USE: kernel UNUSE: kernel dup" <string-reader> "unuse-test" parse-stream
] [ error>> error>> error>> no-word-error? ] must-fail-with
-[ ] [ [ "vocabs.loader.test.l" forget-vocab ] with-compilation-unit ] unit-test
+{ } [ [ "vocabs.loader.test.l" forget-vocab ] with-compilation-unit ] unit-test
[
[ "vocabs.loader.test.l" use-vocab ] must-fail
USING: math kernel quotations tools.test sequences ;
IN: quotations.tests
-[ [ 3 ] ] [ 3 [ ] curry ] unit-test
-[ [ \ + ] ] [ \ + [ ] curry ] unit-test
-[ [ \ + = ] ] [ \ + [ = ] curry ] unit-test
+{ [ 3 ] } [ 3 [ ] curry ] unit-test
+{ [ \ + ] } [ \ + [ ] curry ] unit-test
+{ [ \ + = ] } [ \ + [ = ] curry ] unit-test
-[ [ 1 + 2 + 3 + ] ] [
+{ [ 1 + 2 + 3 + ] } [
{ 1 2 3 } [ [ + ] curry ] map concat
] unit-test
-[ [ 1 2 3 4 ] ] [ [ 1 2 ] [ 3 4 ] append ] unit-test
-[ [ 1 2 3 ] ] [ [ 1 2 ] 3 suffix ] unit-test
-[ [ 3 1 2 ] ] [ [ 1 2 ] 3 prefix ] unit-test
+{ [ 1 2 3 4 ] } [ [ 1 2 ] [ 3 4 ] append ] unit-test
+{ [ 1 2 3 ] } [ [ 1 2 ] 3 suffix ] unit-test
+{ [ 3 1 2 ] } [ [ 1 2 ] 3 prefix ] unit-test
-[ [ "hi" ] ] [ "hi" 1quotation ] unit-test
+{ [ "hi" ] } [ "hi" 1quotation ] unit-test
[ 1 \ + curry ] must-fail
sequences.private strings tools.test ;
IN: sbufs.tests
-[ 5 ] [ "Hello" >sbuf length ] unit-test
+{ 5 } [ "Hello" >sbuf length ] unit-test
-[ "Hello" ] [
+{ "Hello" } [
100 <sbuf> "buf" set
"Hello" "buf" get push-all
"buf" get clone "buf-clone" set
"buf" get >string
] unit-test
-[ CHAR: h ] [ 0 SBUF" hello world" nth ] unit-test
-[ CHAR: H ] [
+{ CHAR: h } [ 0 SBUF" hello world" nth ] unit-test
+{ CHAR: H } [
CHAR: H 0 SBUF" hello world" [ set-nth ] keep first
] unit-test
-[ SBUF" x" ] [ 1 <sbuf> CHAR: x >bignum over push ] unit-test
+{ SBUF" x" } [ 1 <sbuf> CHAR: x >bignum over push ] unit-test
-[ fixnum ] [ 1 >bignum SBUF" " new-sequence length class-of ] unit-test
+{ fixnum } [ 1 >bignum SBUF" " new-sequence length class-of ] unit-test
-[ fixnum ] [ 1 >bignum iota [ ] SBUF" " map-as length class-of ] unit-test
+{ fixnum } [ 1 >bignum iota [ ] SBUF" " map-as length class-of ] unit-test
[ 1.5 SBUF" " new-sequence ] must-fail
generic.single math.vectors math.functions ;
IN: sequences.tests
-[ "empty" ] [ { } [ "empty" ] [ "not empty" ] if-empty ] unit-test
-[ { 1 } "not empty" ] [ { 1 } [ "empty" ] [ "not empty" ] if-empty ] unit-test
-
-[ V{ 1 2 3 4 } ] [ 1 5 dup iota <slice> >vector ] unit-test
-[ 3 ] [ 1 4 dup iota <slice> length ] unit-test
-[ 2 ] [ 1 3 { 1 2 3 4 } <slice> length ] unit-test
-[ V{ 2 3 } ] [ 1 3 { 1 2 3 4 } <slice> >vector ] unit-test
-[ V{ 4 5 } ] [ { 1 2 3 4 5 } 2 tail-slice* >vector ] unit-test
-[ V{ 3 4 } ] [ 2 4 1 10 dup iota <slice> subseq >vector ] unit-test
-[ V{ 3 4 } ] [ 0 2 2 4 1 10 dup iota <slice> <slice> subseq >vector ] unit-test
+{ "empty" } [ { } [ "empty" ] [ "not empty" ] if-empty ] unit-test
+{ { 1 } "not empty" } [ { 1 } [ "empty" ] [ "not empty" ] if-empty ] unit-test
+
+{ V{ 1 2 3 4 } } [ 1 5 dup iota <slice> >vector ] unit-test
+{ 3 } [ 1 4 dup iota <slice> length ] unit-test
+{ 2 } [ 1 3 { 1 2 3 4 } <slice> length ] unit-test
+{ V{ 2 3 } } [ 1 3 { 1 2 3 4 } <slice> >vector ] unit-test
+{ V{ 4 5 } } [ { 1 2 3 4 5 } 2 tail-slice* >vector ] unit-test
+{ V{ 3 4 } } [ 2 4 1 10 dup iota <slice> subseq >vector ] unit-test
+{ V{ 3 4 } } [ 0 2 2 4 1 10 dup iota <slice> <slice> subseq >vector ] unit-test
[ 0 10 "hello" <slice> ] must-fail
[ -10 3 "hello" <slice> ] must-fail
[ 2 1 "hello" <slice> ] must-fail
-[ "cba" ] [ "abcdef" 3 head-slice reverse ] unit-test
+{ "cba" } [ "abcdef" 3 head-slice reverse ] unit-test
-[ 5040 ] [ [ 1 2 3 4 5 6 7 ] 1 [ * ] reduce ] unit-test
+{ 5040 } [ [ 1 2 3 4 5 6 7 ] 1 [ * ] reduce ] unit-test
-[ 5040 { 1 1 2 6 24 120 720 } ]
+{ 5040 { 1 1 2 6 24 120 720 } }
[ { 1 2 3 4 5 6 7 } 1 [ * ] accumulate ] unit-test
-[ 64 B{ 1 2 4 16 } ]
+{ 64 B{ 1 2 4 16 } }
[ B{ 2 2 4 4 } 1 [ * ] accumulate ] unit-test
-[ 5040 { 1 1 2 6 24 120 720 } ]
+{ 5040 { 1 1 2 6 24 120 720 } }
[ { 1 2 3 4 5 6 7 } 1 [ * ] accumulate! ] unit-test
-[ t ]
+{ t }
[ { 1 2 3 4 5 6 7 } dup 1 [ * ] accumulate! nip eq? ] unit-test
-[ f f ] [ [ ] [ ] find ] unit-test
-[ 0 1 ] [ [ 1 ] [ ] find ] unit-test
-[ 1 "world" ] [ [ "hello" "world" ] [ "world" = ] find ] unit-test
-[ 2 3 ] [ [ 1 2 3 ] [ 2 > ] find ] unit-test
-[ f f ] [ [ 1 2 3 ] [ 10 > ] find ] unit-test
+{ f f } [ [ ] [ ] find ] unit-test
+{ 0 1 } [ [ 1 ] [ ] find ] unit-test
+{ 1 "world" } [ [ "hello" "world" ] [ "world" = ] find ] unit-test
+{ 2 3 } [ [ 1 2 3 ] [ 2 > ] find ] unit-test
+{ f f } [ [ 1 2 3 ] [ 10 > ] find ] unit-test
-[ 1 CHAR: e ]
+{ 1 CHAR: e }
[ "hello world" "aeiou" [ member? ] curry find ] unit-test
-[ 4 CHAR: o ]
+{ 4 CHAR: o }
[ 3 "hello world" "aeiou" [ member? ] curry find-from ] unit-test
-[ f f ] [ "abcd" [ 10 > nip ] find-index ] unit-test
-[ f f ] [ "abcd" [ drop CHAR: e = ] find-index ] unit-test
-[ 3 CHAR: d ] [ "abcdefg" [ 3 = nip ] find-index ] unit-test
-[ 3 CHAR: d ] [ "abcdefg" [ drop CHAR: d = ] find-index ] unit-test
+{ f f } [ "abcd" [ 10 > nip ] find-index ] unit-test
+{ f f } [ "abcd" [ drop CHAR: e = ] find-index ] unit-test
+{ 3 CHAR: d } [ "abcdefg" [ 3 = nip ] find-index ] unit-test
+{ 3 CHAR: d } [ "abcdefg" [ drop CHAR: d = ] find-index ] unit-test
-[ 0 CHAR: a ] [ 0 "abcdef" [ drop CHAR: a >= ] find-index-from ] unit-test
-[ 1 CHAR: b ] [ 0 "abcdef" [ drop CHAR: a > ] find-index-from ] unit-test
-[ 2 CHAR: c ] [ 1 "abcdef" [ drop CHAR: b > ] find-index-from ] unit-test
+{ 0 CHAR: a } [ 0 "abcdef" [ drop CHAR: a >= ] find-index-from ] unit-test
+{ 1 CHAR: b } [ 0 "abcdef" [ drop CHAR: a > ] find-index-from ] unit-test
+{ 2 CHAR: c } [ 1 "abcdef" [ drop CHAR: b > ] find-index-from ] unit-test
-[ f ] [ 3 [ ] member? ] unit-test
-[ f ] [ 3 [ 1 2 ] member? ] unit-test
-[ t ] [ 1 [ 1 2 ] member? ] unit-test
-[ t ] [ 2 [ 1 2 ] member? ] unit-test
+{ f } [ 3 [ ] member? ] unit-test
+{ f } [ 3 [ 1 2 ] member? ] unit-test
+{ t } [ 1 [ 1 2 ] member? ] unit-test
+{ t } [ 2 [ 1 2 ] member? ] unit-test
-[ t ]
+{ t }
[ [ "hello" "world" ] [ second ] keep member-eq? ] unit-test
-[ 4 ] [ CHAR: x "tuvwxyz" >vector index ] unit-test
+{ 4 } [ CHAR: x "tuvwxyz" >vector index ] unit-test
-[ f ] [ CHAR: x 5 "tuvwxyz" >vector index-from ] unit-test
+{ f } [ CHAR: x 5 "tuvwxyz" >vector index-from ] unit-test
-[ f ] [ CHAR: a 0 "tuvwxyz" >vector index-from ] unit-test
+{ f } [ CHAR: a 0 "tuvwxyz" >vector index-from ] unit-test
-[ f ] [ [ "Hello" { } 0.75 ] [ string? ] all? ] unit-test
-[ t ] [ [ ] [ ] all? ] unit-test
-[ t ] [ [ "hi" t 0.5 ] [ ] all? ] unit-test
+{ f } [ [ "Hello" { } 0.75 ] [ string? ] all? ] unit-test
+{ t } [ [ ] [ ] all? ] unit-test
+{ t } [ [ "hi" t 0.5 ] [ ] all? ] unit-test
-[ [ 1 2 3 ] ] [ [ 1 4 2 5 3 6 ] [ 4 < ] filter ] unit-test
-[ { 4 2 6 } ] [ { 1 4 2 5 3 6 } [ 2 mod 0 = ] filter ] unit-test
+{ [ 1 2 3 ] } [ [ 1 4 2 5 3 6 ] [ 4 < ] filter ] unit-test
+{ { 4 2 6 } } [ { 1 4 2 5 3 6 } [ 2 mod 0 = ] filter ] unit-test
-[ [ 3 ] ] [ [ 1 2 3 ] 2 [ swap < ] curry filter ] unit-test
+{ [ 3 ] } [ [ 1 2 3 ] 2 [ swap < ] curry filter ] unit-test
-[ V{ 1 2 3 } ] [ V{ 1 4 2 5 3 6 } clone [ 4 < ] filter! ] unit-test
-[ V{ 4 2 6 } ] [ V{ 1 4 2 5 3 6 } clone [ 2 mod 0 = ] filter! ] unit-test
+{ V{ 1 2 3 } } [ V{ 1 4 2 5 3 6 } clone [ 4 < ] filter! ] unit-test
+{ V{ 4 2 6 } } [ V{ 1 4 2 5 3 6 } clone [ 2 mod 0 = ] filter! ] unit-test
-[ V{ 3 } ] [ V{ 1 2 3 } clone 2 [ swap < ] curry filter! ] unit-test
+{ V{ 3 } } [ V{ 1 2 3 } clone 2 [ swap < ] curry filter! ] unit-test
-[ "hello world how are you" ]
+{ "hello world how are you" }
[ { "hello" "world" "how" "are" "you" } " " join ] unit-test
-[ "hello world how are you" ]
+{ "hello world how are you" }
[ { "hello" "world" "how" "are" "you" } " " "" join-as ] unit-test
-[ "" ] [ { } "" join ] unit-test
+{ "" } [ { } "" join ] unit-test
-[ "" ] [ { } "" "" join-as ] unit-test
+{ "" } [ { } "" "" join-as ] unit-test
-[ { } ] [ { } flip ] unit-test
+{ { } } [ { } flip ] unit-test
-[ { "b" "e" } ] [ 1 { { "a" "b" "c" } { "d" "e" "f" } } flip nth ] unit-test
+{ { "b" "e" } } [ 1 { { "a" "b" "c" } { "d" "e" "f" } } flip nth ] unit-test
-[ { { 1 4 } { 2 5 } { 3 6 } } ]
+{ { { 1 4 } { 2 5 } { 3 6 } } }
[ { { 1 2 3 } { 4 5 6 } } flip ] unit-test
-[ [ 2 3 4 ] ] [ [ 1 2 3 ] 1 [ + ] curry map ] unit-test
+{ [ 2 3 4 ] } [ [ 1 2 3 ] 1 [ + ] curry map ] unit-test
-[ 1 ] [ 0 [ 1 2 ] nth ] unit-test
-[ 2 ] [ 1 [ 1 2 ] nth ] unit-test
+{ 1 } [ 0 [ 1 2 ] nth ] unit-test
+{ 2 } [ 1 [ 1 2 ] nth ] unit-test
-[ [ ] ] [ [ ] [ ] append ] unit-test
-[ [ 1 ] ] [ [ 1 ] [ ] append ] unit-test
-[ [ 2 ] ] [ [ ] [ 2 ] append ] unit-test
-[ [ 1 2 3 4 ] ] [ [ 1 2 3 ] [ 4 ] append ] unit-test
-[ [ 1 2 3 4 ] ] [ [ 1 2 3 ] { 4 } append ] unit-test
+{ [ ] } [ [ ] [ ] append ] unit-test
+{ [ 1 ] } [ [ 1 ] [ ] append ] unit-test
+{ [ 2 ] } [ [ ] [ 2 ] append ] unit-test
+{ [ 1 2 3 4 ] } [ [ 1 2 3 ] [ 4 ] append ] unit-test
+{ [ 1 2 3 4 ] } [ [ 1 2 3 ] { 4 } append ] unit-test
[ "a" -1 append ] must-fail
[ -1 "a" append ] must-fail
{ "0123456789" } [ 58 iota [ 48 < ] "" reject-as ] unit-test
-[ [ ] ] [ 1 [ ] remove ] unit-test
-[ [ ] ] [ 1 [ 1 ] remove ] unit-test
-[ [ 3 1 1 ] ] [ 2 [ 3 2 1 2 1 ] remove ] unit-test
+{ [ ] } [ 1 [ ] remove ] unit-test
+{ [ ] } [ 1 [ 1 ] remove ] unit-test
+{ [ 3 1 1 ] } [ 2 [ 3 2 1 2 1 ] remove ] unit-test
-[ [ ] ] [ [ ] reverse ] unit-test
-[ [ 1 ] ] [ [ 1 ] reverse ] unit-test
-[ [ 3 2 1 ] ] [ [ 1 2 3 ] reverse ] unit-test
+{ [ ] } [ [ ] reverse ] unit-test
+{ [ 1 ] } [ [ 1 ] reverse ] unit-test
+{ [ 3 2 1 ] } [ [ 1 2 3 ] reverse ] unit-test
-[ f ] [ f 0 head ] unit-test
-[ [ ] ] [ [ 1 ] 0 head ] unit-test
-[ [ 1 2 3 ] ] [ [ 1 2 3 4 ] 3 head ] unit-test
-[ [ ] ] [ [ 1 2 3 ] 3 tail ] unit-test
-[ [ 3 ] ] [ [ 1 2 3 ] 2 tail ] unit-test
+{ f } [ f 0 head ] unit-test
+{ [ ] } [ [ 1 ] 0 head ] unit-test
+{ [ 1 2 3 ] } [ [ 1 2 3 4 ] 3 head ] unit-test
+{ [ ] } [ [ 1 2 3 ] 3 tail ] unit-test
+{ [ 3 ] } [ [ 1 2 3 ] 2 tail ] unit-test
-[ "blah" ] [ "blahxx" 2 head* ] unit-test
+{ "blah" } [ "blahxx" 2 head* ] unit-test
-[ "xx" ] [ "blahxx" 2 tail* ] unit-test
+{ "xx" } [ "blahxx" 2 tail* ] unit-test
-[ t ] [ "xxfoo" 2 head-slice "xxbar" 2 head-slice = ] unit-test
-[ t ] [ "xxfoo" 2 head-slice "xxbar" 2 head-slice [ hashcode ] same? ] unit-test
+{ t } [ "xxfoo" 2 head-slice "xxbar" 2 head-slice = ] unit-test
+{ t } [ "xxfoo" 2 head-slice "xxbar" 2 head-slice [ hashcode ] same? ] unit-test
-[ t ] [ "xxfoo" 2 head-slice SBUF" barxx" 2 tail-slice* = ] unit-test
-[ t ] [ "xxfoo" 2 head-slice SBUF" barxx" 2 tail-slice* [ hashcode ] same? ] unit-test
+{ t } [ "xxfoo" 2 head-slice SBUF" barxx" 2 tail-slice* = ] unit-test
+{ t } [ "xxfoo" 2 head-slice SBUF" barxx" 2 tail-slice* [ hashcode ] same? ] unit-test
-[ t ] [ [ 1 2 3 ] [ 1 2 3 ] sequence= ] unit-test
-[ t ] [ [ 1 2 3 ] { 1 2 3 } sequence= ] unit-test
-[ t ] [ { 1 2 3 } [ 1 2 3 ] sequence= ] unit-test
-[ f ] [ [ ] [ 1 2 3 ] sequence= ] unit-test
+{ t } [ [ 1 2 3 ] [ 1 2 3 ] sequence= ] unit-test
+{ t } [ [ 1 2 3 ] { 1 2 3 } sequence= ] unit-test
+{ t } [ { 1 2 3 } [ 1 2 3 ] sequence= ] unit-test
+{ f } [ [ ] [ 1 2 3 ] sequence= ] unit-test
-[ { 1 3 2 4 } ] [ { 1 2 3 4 } clone 1 2 pick exchange ] unit-test
+{ { 1 3 2 4 } } [ { 1 2 3 4 } clone 1 2 pick exchange ] unit-test
-[ { "" "a" "aa" "aaa" } ]
+{ { "" "a" "aa" "aaa" } }
[ 4 [ CHAR: a <string> ] { } map-integers ]
unit-test
{ V{ 1 3 5 7 9 } } [ 10 iota >vector [ even? ] reject! ] unit-test
-[ V{ } ] [ "f" V{ } clone remove! ] unit-test
-[ V{ } ] [ "f" V{ "f" } clone remove! ] unit-test
-[ V{ } ] [ "f" V{ "f" "f" } clone remove! ] unit-test
-[ V{ "x" } ] [ "f" V{ "f" "x" "f" } clone remove! ] unit-test
-[ V{ "y" "x" } ] [ "f" V{ "y" "f" "x" "f" } clone remove! ] unit-test
+{ V{ } } [ "f" V{ } clone remove! ] unit-test
+{ V{ } } [ "f" V{ "f" } clone remove! ] unit-test
+{ V{ } } [ "f" V{ "f" "f" } clone remove! ] unit-test
+{ V{ "x" } } [ "f" V{ "f" "x" "f" } clone remove! ] unit-test
+{ V{ "y" "x" } } [ "f" V{ "y" "f" "x" "f" } clone remove! ] unit-test
-[ V{ 0 1 4 5 } ] [ 6 iota >vector 2 4 pick delete-slice ] unit-test
+{ V{ 0 1 4 5 } } [ 6 iota >vector 2 4 pick delete-slice ] unit-test
[ 6 >vector 2 8 pick delete-slice ] must-fail
-[ V{ } ] [ 6 iota >vector 0 6 pick delete-slice ] unit-test
+{ V{ } } [ 6 iota >vector 0 6 pick delete-slice ] unit-test
-[ { 1 2 "a" "b" 5 6 7 } ] [
+{ { 1 2 "a" "b" 5 6 7 } } [
{ "a" "b" } 2 4 { 1 2 3 4 5 6 7 }
replace-slice
] unit-test
-[ { 1 2 "a" "b" 6 7 } ] [
+{ { 1 2 "a" "b" 6 7 } } [
{ "a" "b" } 2 5 { 1 2 3 4 5 6 7 }
replace-slice
] unit-test
-[ { 1 2 "a" "b" 4 5 6 7 } ] [
+{ { 1 2 "a" "b" 4 5 6 7 } } [
{ "a" "b" } 2 3 { 1 2 3 4 5 6 7 }
replace-slice
] unit-test
-[ { 1 2 3 4 5 6 7 "a" "b" } ] [
+{ { 1 2 3 4 5 6 7 "a" "b" } } [
{ "a" "b" } 7 7 { 1 2 3 4 5 6 7 }
replace-slice
] unit-test
-[ { "a" 3 } ] [
+{ { "a" 3 } } [
{ "a" } 0 2 { 1 2 3 } replace-slice
] unit-test
-[ { 1 4 9 } ] [ { 1 2 3 } clone [ sq ] map! ] unit-test
+{ { 1 4 9 } } [ { 1 2 3 } clone [ sq ] map! ] unit-test
-[ 5 ] [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
-[ 5 ] [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
-[ 5 ] [ 1 >bignum "\u000001\u000005\u000007" nth-unsafe ] unit-test
+{ 5 } [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
+{ 5 } [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
+{ 5 } [ 1 >bignum "\u000001\u000005\u000007" nth-unsafe ] unit-test
-[ SBUF" before&after" ] [
+{ SBUF" before&after" } [
"&" 6 11 SBUF" before and after" replace-slice
] unit-test
-[ 3 "a" ] [ { "a" "b" "c" "a" "d" } [ "a" = ] find-last ] unit-test
+{ 3 "a" } [ { "a" "b" "c" "a" "d" } [ "a" = ] find-last ] unit-test
-[ f f ] [ 100 { 1 2 3 } [ 1 = ] find-from ] unit-test
-[ f f ] [ 100 { 1 2 3 } [ 1 = ] find-last-from ] unit-test
-[ f f ] [ -1 { 1 2 3 } [ 1 = ] find-from ] unit-test
+{ f f } [ 100 { 1 2 3 } [ 1 = ] find-from ] unit-test
+{ f f } [ 100 { 1 2 3 } [ 1 = ] find-last-from ] unit-test
+{ f f } [ -1 { 1 2 3 } [ 1 = ] find-from ] unit-test
-[ 0 ] [ { "a" "b" "c" } { "A" "B" "C" } mismatch ] unit-test
+{ 0 } [ { "a" "b" "c" } { "A" "B" "C" } mismatch ] unit-test
-[ 1 ] [ { "a" "b" "c" } { "a" "B" "C" } mismatch ] unit-test
+{ 1 } [ { "a" "b" "c" } { "a" "B" "C" } mismatch ] unit-test
-[ f ] [ { "a" "b" "c" } { "a" "b" "c" } mismatch ] unit-test
+{ f } [ { "a" "b" "c" } { "a" "b" "c" } mismatch ] unit-test
-[ V{ } V{ } ] [ { "a" "b" } { "a" "b" } drop-prefix [ >vector ] bi@ ] unit-test
+{ V{ } V{ } } [ { "a" "b" } { "a" "b" } drop-prefix [ >vector ] bi@ ] unit-test
-[ V{ "C" } V{ "c" } ] [ { "a" "b" "C" } { "a" "b" "c" } drop-prefix [ >vector ] bi@ ] unit-test
+{ V{ "C" } V{ "c" } } [ { "a" "b" "C" } { "a" "b" "c" } drop-prefix [ >vector ] bi@ ] unit-test
[ -1 1 "abc" <slice> ] must-fail
-[ V{ "a" "b" } V{ } ] [ { "X" "a" "b" } { "X" } drop-prefix [ >vector ] bi@ ] unit-test
+{ V{ "a" "b" } V{ } } [ { "X" "a" "b" } { "X" } drop-prefix [ >vector ] bi@ ] unit-test
[ 0.5 { 1 2 3 } nth ] [ no-method? ] must-fail-with
[ 0.5 "asdfasdf" nth ] [ no-method? ] must-fail-with
! Pathological case
-[ "ihbye" ] [ "hi" <reversed> "bye" append ] unit-test
+{ "ihbye" } [ "hi" <reversed> "bye" append ] unit-test
-[ t ] [ "hi" <reversed> SBUF" hi" <reversed> = ] unit-test
+{ t } [ "hi" <reversed> SBUF" hi" <reversed> = ] unit-test
-[ t ] [ "hi" <reversed> SBUF" hi" <reversed> = ] unit-test
+{ t } [ "hi" <reversed> SBUF" hi" <reversed> = ] unit-test
-[ t ] [ "hi" <reversed> SBUF" hi" <reversed> [ hashcode ] same? ] unit-test
+{ t } [ "hi" <reversed> SBUF" hi" <reversed> [ hashcode ] same? ] unit-test
[ -10 "hi" "bye" copy ] must-fail
[ 10 "hi" "bye" copy ] must-fail
-[ V{ 1 2 3 5 6 } ] [
+{ V{ 1 2 3 5 6 } } [
3 V{ 1 2 3 4 5 6 } clone remove-nth!
] unit-test
! erg's random tester found this one
-[ SBUF" 12341234" ] [
+{ SBUF" 12341234" } [
9 <sbuf> dup "1234" swap push-all dup dup swap push-all
] unit-test
-[ f ] [ f V{ } like f V{ } like eq? ] unit-test
+{ f } [ f V{ } like f V{ } like eq? ] unit-test
-[ V{ f f f } ] [ 3 V{ } new-sequence ] unit-test
-[ SBUF" \0\0\0" ] [ 3 SBUF" " new-sequence ] unit-test
+{ V{ f f f } } [ 3 V{ } new-sequence ] unit-test
+{ SBUF" \0\0\0" } [ 3 SBUF" " new-sequence ] unit-test
-[ 0 ] [ f length ] unit-test
+{ 0 } [ f length ] unit-test
[ f first ] must-fail
-[ 3 ] [ 3 10 iota nth ] unit-test
-[ 3 ] [ 3 10 iota nth-unsafe ] unit-test
+{ 3 } [ 3 10 iota nth ] unit-test
+{ 3 } [ 3 10 iota nth-unsafe ] unit-test
[ -3 10 iota nth ] must-fail
[ 11 10 iota nth ] must-fail
-[ f ] [ f ?first ] unit-test
-[ f ] [ { } ?first ] unit-test
-[ 0 ] [ 10 iota ?first ] unit-test
+{ f } [ f ?first ] unit-test
+{ f } [ { } ?first ] unit-test
+{ 0 } [ 10 iota ?first ] unit-test
-[ f ] [ f ?last ] unit-test
-[ f ] [ { } ?last ] unit-test
-[ 9 ] [ 10 iota ?last ] unit-test
+{ f } [ f ?last ] unit-test
+{ f } [ { } ?last ] unit-test
+{ 9 } [ 10 iota ?last ] unit-test
[ -1/0. 0 remove-nth! ] must-fail
-[ "" ] [ "" [ CHAR: \s = ] trim ] unit-test
-[ "" ] [ "" [ CHAR: \s = ] trim-head ] unit-test
-[ "" ] [ "" [ CHAR: \s = ] trim-tail ] unit-test
-[ "" ] [ " " [ CHAR: \s = ] trim-head ] unit-test
-[ "" ] [ " " [ CHAR: \s = ] trim-tail ] unit-test
-[ "asdf" ] [ " asdf " [ CHAR: \s = ] trim ] unit-test
-[ "asdf " ] [ " asdf " [ CHAR: \s = ] trim-head ] unit-test
-[ " asdf" ] [ " asdf " [ CHAR: \s = ] trim-tail ] unit-test
+{ "" } [ "" [ CHAR: \s = ] trim ] unit-test
+{ "" } [ "" [ CHAR: \s = ] trim-head ] unit-test
+{ "" } [ "" [ CHAR: \s = ] trim-tail ] unit-test
+{ "" } [ " " [ CHAR: \s = ] trim-head ] unit-test
+{ "" } [ " " [ CHAR: \s = ] trim-tail ] unit-test
+{ "asdf" } [ " asdf " [ CHAR: \s = ] trim ] unit-test
+{ "asdf " } [ " asdf " [ CHAR: \s = ] trim-head ] unit-test
+{ " asdf" } [ " asdf " [ CHAR: \s = ] trim-tail ] unit-test
-[ 328350 ] [ 100 iota [ sq ] map-sum ] unit-test
+{ 328350 } [ 100 iota [ sq ] map-sum ] unit-test
-[ 50 ] [ 100 iota [ even? ] count ] unit-test
-[ 50 ] [ 100 iota [ odd? ] count ] unit-test
+{ 50 } [ 100 iota [ even? ] count ] unit-test
+{ 50 } [ 100 iota [ odd? ] count ] unit-test
-[ { "b" "d" } ] [ { 1 3 } { "a" "b" "c" "d" } nths ] unit-test
-[ { "a" "b" "c" "d" } ] [ { 0 1 2 3 } { "a" "b" "c" "d" } nths ] unit-test
-[ { "d" "c" "b" "a" } ] [ { 3 2 1 0 } { "a" "b" "c" "d" } nths ] unit-test
-[ { "d" "a" "b" "c" } ] [ { 3 0 1 2 } { "a" "b" "c" "d" } nths ] unit-test
+{ { "b" "d" } } [ { 1 3 } { "a" "b" "c" "d" } nths ] unit-test
+{ { "a" "b" "c" "d" } } [ { 0 1 2 3 } { "a" "b" "c" "d" } nths ] unit-test
+{ { "d" "c" "b" "a" } } [ { 3 2 1 0 } { "a" "b" "c" "d" } nths ] unit-test
+{ { "d" "a" "b" "c" } } [ { 3 0 1 2 } { "a" "b" "c" "d" } nths ] unit-test
-[ "dac" ] [ { 3 0 2 } "abcd" nths ] unit-test
+{ "dac" } [ { 3 0 2 } "abcd" nths ] unit-test
TUPLE: bogus-hashcode ;
M: bogus-hashcode hashcode* 2drop 0 >bignum ;
-[ 0 ] [ { T{ bogus-hashcode } } hashcode ] unit-test
+{ 0 } [ { T{ bogus-hashcode } } hashcode ] unit-test
-[ { 2 4 6 } { 1 3 5 7 } ] [ { 1 2 3 4 5 6 7 } [ even? ] partition ] unit-test
+{ { 2 4 6 } { 1 3 5 7 } } [ { 1 2 3 4 5 6 7 } [ even? ] partition ] unit-test
-[ { 1 3 7 } ] [ 2 { 1 3 5 7 } remove-nth ] unit-test
+{ { 1 3 7 } } [ 2 { 1 3 5 7 } remove-nth ] unit-test
-[ { 1 3 "X" 5 7 } ] [ "X" 2 { 1 3 5 7 } insert-nth ] unit-test
+{ { 1 3 "X" 5 7 } } [ "X" 2 { 1 3 5 7 } insert-nth ] unit-test
-[ V{ 0 2 } ] [ "a" { "a" "b" "a" } indices ] unit-test
+{ V{ 0 2 } } [ "a" { "a" "b" "a" } indices ] unit-test
-[ "a,b" ] [ "a" "b" "," glue ] unit-test
-[ "(abc)" ] [ "abc" "(" ")" surround ] unit-test
+{ "a,b" } [ "a" "b" "," glue ] unit-test
+{ "(abc)" } [ "abc" "(" ")" surround ] unit-test
-[ "HELLO" ] [
+{ "HELLO" } [
"HELLO" { -1 -1 -1 -1 -1 } { 2 2 2 2 2 2 }
[ * 2 + + ] 3map
] unit-test
{ 3 0 } [ [ 3drop ] 3each ] must-infer-as
-[ V{ 0 3 } ] [ "A" { "A" "B" "C" "A" "D" } indices ] unit-test
+{ V{ 0 3 } } [ "A" { "A" "B" "C" "A" "D" } indices ] unit-test
[ "asdf" iota ] must-fail
[ -1 iota ] must-fail
-[ T{ iota-tuple { n 10 } } ] [ 10 iota ] unit-test
-[ 0 ] [ 10 iota first ] unit-test
+{ T{ iota-tuple { n 10 } } } [ 10 iota ] unit-test
+{ 0 } [ 10 iota first ] unit-test
{ 0 } [ 0 iota sum ] unit-test
{ 0 } [ 1 iota sum ] unit-test
{ 10 } [ 5 iota sum ] unit-test
{ 15 } [ 6 iota sum ] unit-test
-[ "hi" 3 ] [
+{ "hi" 3 } [
{ 1 2 3 4 5 6 7 8 } [ H{ { 3 "hi" } } at ] map-find
] unit-test
-[ f f ] [
+{ f f } [
{ 1 2 3 4 5 6 7 8 } [ H{ { 11 "hi" } } at ] map-find
] unit-test
USE: make
-[ { "a" 1 "b" 1 "c" } ]
+{ { "a" 1 "b" 1 "c" } }
[ 1 { "a" "b" "c" } [ [ dup , ] [ , ] interleave drop ] { } make ] unit-test
-[ t ] [ 0 array-capacity? ] unit-test
-[ f ] [ -1 array-capacity? ] unit-test
+{ t } [ 0 array-capacity? ] unit-test
+{ f } [ -1 array-capacity? ] unit-test
-[ +lt+ ] [ { 0 0 0 } { 1 1 1 } <=> ] unit-test
-[ +lt+ ] [ { 0 0 0 } { 0 1 1 } <=> ] unit-test
-[ +lt+ ] [ { 0 0 0 } { 0 0 0 0 } <=> ] unit-test
-[ +gt+ ] [ { 1 1 1 } { 0 0 0 } <=> ] unit-test
-[ +gt+ ] [ { 0 1 1 } { 0 0 0 } <=> ] unit-test
-[ +gt+ ] [ { 0 0 0 0 } { 0 0 0 } <=> ] unit-test
-[ +eq+ ] [ { } { } <=> ] unit-test
-[ +eq+ ] [ { 1 2 3 } { 1 2 3 } <=> ] unit-test
+{ +lt+ } [ { 0 0 0 } { 1 1 1 } <=> ] unit-test
+{ +lt+ } [ { 0 0 0 } { 0 1 1 } <=> ] unit-test
+{ +lt+ } [ { 0 0 0 } { 0 0 0 0 } <=> ] unit-test
+{ +gt+ } [ { 1 1 1 } { 0 0 0 } <=> ] unit-test
+{ +gt+ } [ { 0 1 1 } { 0 0 0 } <=> ] unit-test
+{ +gt+ } [ { 0 0 0 0 } { 0 0 0 } <=> ] unit-test
+{ +eq+ } [ { } { } <=> ] unit-test
+{ +eq+ } [ { 1 2 3 } { 1 2 3 } <=> ] unit-test
-[ { { { 1 "a" } { 1 "b" } } { { 2 "a" } { 2 "b" } } } ]
+{ { { { 1 "a" } { 1 "b" } } { { 2 "a" } { 2 "b" } } } }
[ { 1 2 } { "a" "b" } cartesian-product ] unit-test
[ { } [ string>digits sum ] [ + ] map-reduce ] must-infer
[ { } [ ] [ + ] map-reduce ] must-fail
-[ 4 ] [ { 1 1 } [ 1 + ] [ + ] map-reduce ] unit-test
+{ 4 } [ { 1 1 } [ 1 + ] [ + ] map-reduce ] unit-test
[ { } { } [ [ string>digits product ] bi@ + ] [ + ] 2map-reduce ] must-infer
[ { } { } [ + ] [ + ] 2map-reduce ] must-fail
-[ 24 ] [ { 1 2 } { 3 4 } [ + ] [ * ] 2map-reduce ] unit-test
+{ 24 } [ { 1 2 } { 3 4 } [ + ] [ * ] 2map-reduce ] unit-test
-[ 4 ] [ 5 iota [ ] supremum-by ] unit-test
-[ 0 ] [ 5 iota [ ] infimum-by ] unit-test
+{ 4 } [ 5 iota [ ] supremum-by ] unit-test
+{ 0 } [ 5 iota [ ] infimum-by ] unit-test
{ "bar" } [ { "bar" "baz" "qux" } [ length ] supremum-by ] unit-test
{ "bar" } [ { "bar" "baz" "qux" } [ length ] infimum-by ] unit-test
-[ { "foo" } ] [ { { "foo" } { "bar" } } [ first ] supremum-by ] unit-test
-[ { "bar" } ] [ { { "foo" } { "bar" } } [ first ] infimum-by ] unit-test
+{ { "foo" } } [ { { "foo" } { "bar" } } [ first ] supremum-by ] unit-test
+{ { "bar" } } [ { { "foo" } { "bar" } } [ first ] infimum-by ] unit-test
{ -2 1 } [ -2 { 1 2 3 } [ over ^ ] supremum-by ] unit-test
{ -2 3 } [ -2 { 1 2 3 } [ over ^ ] infimum-by ] unit-test
-[ { 0 0 255 } ] [
+{ { 0 0 255 } } [
{
{ 0 0 0 }
{ 95 255 95 }
math sequences bit-sets bit-arrays ;
IN: sets.tests
-[ V{ 1 2 3 } ] [ 3 V{ 1 2 } clone [ adjoin ] keep ] unit-test
-[ V{ 1 2 } ] [ 2 V{ 1 2 } clone [ adjoin ] keep ] unit-test
-
-[ t ] [ 4 { 2 4 5 } in? ] unit-test
-[ f ] [ 1 { 2 4 5 } in? ] unit-test
-[ f ] [ f 5 <bit-set> in? ] unit-test
-
-[ V{ 1 2 } ] [ 3 V{ 1 2 } clone [ delete ] keep ] unit-test
-[ V{ 2 } ] [ 1 V{ 1 2 } clone [ delete ] keep ] unit-test
-[ 0 ] [ 5 <bit-set> 0 over delete cardinality ] unit-test
-[ 0 ] [ 5 <bit-set> f over delete cardinality ] unit-test
-[ 0 ] [ 5 <bit-set> 3 over adjoin 3 over delete cardinality ] unit-test
-[ 0 ] [ 5 <bit-set> 10 over delete cardinality ] unit-test
-[ HS{ 1 } ] [ HS{ 1 2 } 2 over delete ] unit-test
-
-[ { 1 2 3 } ] [ { 1 1 1 2 2 3 3 3 3 3 } dup set-like natural-sort ] unit-test
-[ { 1 2 3 } ] [ HS{ 1 2 3 } { } set-like natural-sort ] unit-test
-[ { 1 2 3 } ] [ { 1 2 2 3 3 } { } set-like ] unit-test
-[ { 3 2 1 } ] [ { 3 3 2 2 1 } { } set-like ] unit-test
-[ t ] [ 4 <bit-set> 1 <bit-set> set-like 4 <bit-set> = ] unit-test
-[ t ] [ { 1 2 3 } HS{ } set-like HS{ 1 2 3 } = ] unit-test
-
-[ HS{ 1 2 3 } ] [ { 1 2 3 } fast-set ] unit-test
-[ T{ bit-set { table ?{ f } } } ]
+{ V{ 1 2 3 } } [ 3 V{ 1 2 } clone [ adjoin ] keep ] unit-test
+{ V{ 1 2 } } [ 2 V{ 1 2 } clone [ adjoin ] keep ] unit-test
+
+{ t } [ 4 { 2 4 5 } in? ] unit-test
+{ f } [ 1 { 2 4 5 } in? ] unit-test
+{ f } [ f 5 <bit-set> in? ] unit-test
+
+{ V{ 1 2 } } [ 3 V{ 1 2 } clone [ delete ] keep ] unit-test
+{ V{ 2 } } [ 1 V{ 1 2 } clone [ delete ] keep ] unit-test
+{ 0 } [ 5 <bit-set> 0 over delete cardinality ] unit-test
+{ 0 } [ 5 <bit-set> f over delete cardinality ] unit-test
+{ 0 } [ 5 <bit-set> 3 over adjoin 3 over delete cardinality ] unit-test
+{ 0 } [ 5 <bit-set> 10 over delete cardinality ] unit-test
+{ HS{ 1 } } [ HS{ 1 2 } 2 over delete ] unit-test
+
+{ { 1 2 3 } } [ { 1 1 1 2 2 3 3 3 3 3 } dup set-like natural-sort ] unit-test
+{ { 1 2 3 } } [ HS{ 1 2 3 } { } set-like natural-sort ] unit-test
+{ { 1 2 3 } } [ { 1 2 2 3 3 } { } set-like ] unit-test
+{ { 3 2 1 } } [ { 3 3 2 2 1 } { } set-like ] unit-test
+{ t } [ 4 <bit-set> 1 <bit-set> set-like 4 <bit-set> = ] unit-test
+{ t } [ { 1 2 3 } HS{ } set-like HS{ 1 2 3 } = ] unit-test
+
+{ HS{ 1 2 3 } } [ { 1 2 3 } fast-set ] unit-test
+{ T{ bit-set { table ?{ f } } } }
[ 1 <bit-set> fast-set ] unit-test
-[ { 1 } ] [ { 1 } members ] unit-test
+{ { 1 } } [ { 1 } members ] unit-test
-[ { } ] [ { } { } union ] unit-test
-[ { 1 2 3 4 } ] [ { 1 2 3 } { 2 3 4 } union ] unit-test
+{ { } } [ { } { } union ] unit-test
+{ { 1 2 3 4 } } [ { 1 2 3 } { 2 3 4 } union ] unit-test
-[ { } ] [ { } { } intersect ] unit-test
-[ { 2 3 } ] [ { 1 2 3 } { 2 3 4 } intersect ] unit-test
-[ { 2 3 } ] [ { 1 2 3 } { 2 3 4 5 } intersect ] unit-test
-[ { 2 3 4 } ] [ { 1 2 3 4 } { 2 3 4 } intersect ] unit-test
-[ { 2 3 } ] [ { 1 2 2 3 } { 2 3 3 4 } intersect ] unit-test
+{ { } } [ { } { } intersect ] unit-test
+{ { 2 3 } } [ { 1 2 3 } { 2 3 4 } intersect ] unit-test
+{ { 2 3 } } [ { 1 2 3 } { 2 3 4 5 } intersect ] unit-test
+{ { 2 3 4 } } [ { 1 2 3 4 } { 2 3 4 } intersect ] unit-test
+{ { 2 3 } } [ { 1 2 2 3 } { 2 3 3 4 } intersect ] unit-test
-[ t ] [ { 1 2 } { 1 3 } intersects? ] unit-test
-[ f ] [ { 4 2 } { 1 3 } intersects? ] unit-test
-[ f ] [ { } { 1 } intersects? ] unit-test
-[ f ] [ { 1 } { } intersects? ] unit-test
-[ f ] [ { } { } intersects? ] unit-test
+{ t } [ { 1 2 } { 1 3 } intersects? ] unit-test
+{ f } [ { 4 2 } { 1 3 } intersects? ] unit-test
+{ f } [ { } { 1 } intersects? ] unit-test
+{ f } [ { 1 } { } intersects? ] unit-test
+{ f } [ { } { } intersects? ] unit-test
-[ { } ] [ { } { } diff ] unit-test
-[ { 1 } ] [ { 1 2 3 } { 2 3 4 } diff ] unit-test
-[ { 1 } ] [ { 1 2 3 } { 2 3 4 5 } diff ] unit-test
-[ { 1 } ] [ { 1 2 3 4 } { 2 3 4 } diff ] unit-test
-[ { 1 } ] [ { 1 1 2 3 } { 2 3 4 4 } diff ] unit-test
+{ { } } [ { } { } diff ] unit-test
+{ { 1 } } [ { 1 2 3 } { 2 3 4 } diff ] unit-test
+{ { 1 } } [ { 1 2 3 } { 2 3 4 5 } diff ] unit-test
+{ { 1 } } [ { 1 2 3 4 } { 2 3 4 } diff ] unit-test
+{ { 1 } } [ { 1 1 2 3 } { 2 3 4 4 } diff ] unit-test
-[ T{ bit-set { table ?{ f f f } } } ]
+{ T{ bit-set { table ?{ f f f } } } }
[ 3 <bit-set> 0 over adjoin dup diff ] unit-test
-[ f ] [ { 1 2 3 4 } { 1 2 } subset? ] unit-test
-[ t ] [ { 1 2 3 4 } { 1 2 } swap subset? ] unit-test
-[ t ] [ { 1 2 } { 1 2 } subset? ] unit-test
-[ t ] [ { } { 1 2 } subset? ] unit-test
-[ t ] [ { } { } subset? ] unit-test
-[ f ] [ { 1 } { } subset? ] unit-test
-
-[ t ] [ { 1 2 3 } { 2 1 3 } set= ] unit-test
-[ f ] [ { 2 3 } { 1 2 3 } set= ] unit-test
-[ f ] [ { 1 2 3 } { 2 3 } set= ] unit-test
-
-[ { 2 1 2 1 } ] [ { 1 2 3 2 1 2 1 } duplicates ] unit-test
-[ f ] [ HS{ 1 2 3 1 2 1 } duplicates ] unit-test
-
-[ f ] [ { 0 1 1 2 3 5 } all-unique? ] unit-test
-[ t ] [ { 0 1 2 3 4 5 } all-unique? ] unit-test
-[ t ] [ HS{ 0 1 2 3 4 5 } all-unique? ] unit-test
-
-[ t ] [ f null? ] unit-test
-[ f ] [ { 4 } null? ] unit-test
-[ t ] [ HS{ } null? ] unit-test
-[ f ] [ HS{ 3 } null? ] unit-test
-[ t ] [ 2 <bit-set> null? ] unit-test
-[ f ] [ 3 <bit-set> 0 over adjoin null? ] unit-test
-
-[ 0 ] [ f cardinality ] unit-test
-[ 0 ] [ { } cardinality ] unit-test
-[ 1 ] [ { 1 } cardinality ] unit-test
-[ 1 ] [ { 1 1 } cardinality ] unit-test
-[ 1 ] [ HS{ 1 } cardinality ] unit-test
-[ 3 ] [ HS{ 1 2 3 } cardinality ] unit-test
-[ 0 ] [ 0 <bit-set> cardinality ] unit-test
-[ 0 ] [ 5 <bit-set> cardinality ] unit-test
-[ 2 ] [ 5 <bit-set> 0 over adjoin 1 over adjoin cardinality ] unit-test
-[ 1 ] [ 5 <bit-set> 1 over adjoin cardinality ] unit-test
-
-[ { } ] [ { } { } within ] unit-test
-[ { 2 3 } ] [ { 1 2 3 } { 2 3 4 } within ] unit-test
-[ { 2 2 3 } ] [ { 1 2 2 3 } { 2 3 3 4 } within ] unit-test
-
-[ { } ] [ { } { } without ] unit-test
-[ { 1 } ] [ { 1 2 3 } { 2 3 4 } without ] unit-test
-[ { 1 1 } ] [ { 1 1 2 3 3 } { 2 3 4 4 } without ] unit-test
-
-[ { 1 2 3 } ] [ { { 1 } { 2 } { 1 3 } } combine ] unit-test
-[ f ] [ { } combine ] unit-test
-
-[ { 1 4 9 16 25 36 } ]
+{ f } [ { 1 2 3 4 } { 1 2 } subset? ] unit-test
+{ t } [ { 1 2 3 4 } { 1 2 } swap subset? ] unit-test
+{ t } [ { 1 2 } { 1 2 } subset? ] unit-test
+{ t } [ { } { 1 2 } subset? ] unit-test
+{ t } [ { } { } subset? ] unit-test
+{ f } [ { 1 } { } subset? ] unit-test
+
+{ t } [ { 1 2 3 } { 2 1 3 } set= ] unit-test
+{ f } [ { 2 3 } { 1 2 3 } set= ] unit-test
+{ f } [ { 1 2 3 } { 2 3 } set= ] unit-test
+
+{ { 2 1 2 1 } } [ { 1 2 3 2 1 2 1 } duplicates ] unit-test
+{ f } [ HS{ 1 2 3 1 2 1 } duplicates ] unit-test
+
+{ f } [ { 0 1 1 2 3 5 } all-unique? ] unit-test
+{ t } [ { 0 1 2 3 4 5 } all-unique? ] unit-test
+{ t } [ HS{ 0 1 2 3 4 5 } all-unique? ] unit-test
+
+{ t } [ f null? ] unit-test
+{ f } [ { 4 } null? ] unit-test
+{ t } [ HS{ } null? ] unit-test
+{ f } [ HS{ 3 } null? ] unit-test
+{ t } [ 2 <bit-set> null? ] unit-test
+{ f } [ 3 <bit-set> 0 over adjoin null? ] unit-test
+
+{ 0 } [ f cardinality ] unit-test
+{ 0 } [ { } cardinality ] unit-test
+{ 1 } [ { 1 } cardinality ] unit-test
+{ 1 } [ { 1 1 } cardinality ] unit-test
+{ 1 } [ HS{ 1 } cardinality ] unit-test
+{ 3 } [ HS{ 1 2 3 } cardinality ] unit-test
+{ 0 } [ 0 <bit-set> cardinality ] unit-test
+{ 0 } [ 5 <bit-set> cardinality ] unit-test
+{ 2 } [ 5 <bit-set> 0 over adjoin 1 over adjoin cardinality ] unit-test
+{ 1 } [ 5 <bit-set> 1 over adjoin cardinality ] unit-test
+
+{ { } } [ { } { } within ] unit-test
+{ { 2 3 } } [ { 1 2 3 } { 2 3 4 } within ] unit-test
+{ { 2 2 3 } } [ { 1 2 2 3 } { 2 3 3 4 } within ] unit-test
+
+{ { } } [ { } { } without ] unit-test
+{ { 1 } } [ { 1 2 3 } { 2 3 4 } without ] unit-test
+{ { 1 1 } } [ { 1 1 2 3 3 } { 2 3 4 4 } without ] unit-test
+
+{ { 1 2 3 } } [ { { 1 } { 2 } { 1 3 } } combine ] unit-test
+{ f } [ { } combine ] unit-test
+
+{ { 1 4 9 16 25 36 } }
[ { { 1 2 3 } { 4 5 6 } } [ [ sq ] map ] gather ] unit-test
-[ H{ { 3 HS{ 1 2 } } } ] [ H{ } clone 1 3 pick adjoin-at 2 3 pick adjoin-at ] unit-test
+{ H{ { 3 HS{ 1 2 } } } } [ H{ } clone 1 3 pick adjoin-at 2 3 pick adjoin-at ] unit-test
-[ H{ { 3 H{ { 1 1 } { 2 2 } } } } ] [ H{ } clone 1 3 pick conjoin-at 2 3 pick conjoin-at ] unit-test
+{ H{ { 3 H{ { 1 1 } { 2 2 } } } } } [ H{ } clone 1 3 pick conjoin-at 2 3 pick conjoin-at ] unit-test
TUPLE: null-set ;
INSTANCE: null-set set
M: null-set members drop f ;
-[ 0 ] [ T{ null-set } cardinality ] unit-test
-[ f ] [ T{ null-set } members ] unit-test
-[ t ] [ T{ null-set } T{ null-set } set-like T{ null-set } = ] unit-test
-
-[ t ] [ T{ null-set } set? ] unit-test
-[ t ] [ HS{ } set? ] unit-test
-[ t ] [ { } set? ] unit-test
-[ t ] [ 5 <bit-set> set? ] unit-test
-[ f ] [ H{ } set? ] unit-test
-
-[ HS{ } ] [ HS{ } [ clear-set ] keep ] unit-test
-[ HS{ } ] [ HS{ 1 2 3 } [ clear-set ] keep ] unit-test
-
-[ HS{ } ] [ HS{ } HS{ } union! ] unit-test
-[ HS{ 1 } ] [ HS{ 1 } HS{ } union! ] unit-test
-[ HS{ 1 } ] [ HS{ } HS{ 1 } union! ] unit-test
-[ HS{ 1 2 3 } ] [ HS{ 1 } HS{ 1 2 3 } union! ] unit-test
-
-[ f ] [ { } intersection ] unit-test
-[ HS{ } ] [ { HS{ } } intersection ] unit-test
-[ HS{ 1 } ] [ { HS{ 1 2 3 } HS{ 1 } } intersection ] unit-test
-
-[ HS{ } ] [ HS{ } HS{ } diff! ] unit-test
-[ HS{ 1 } ] [ HS{ 1 2 3 } HS{ 2 3 } diff! ] unit-test
-[ HS{ 1 } ] [ HS{ 1 } HS{ 2 3 4 } diff! ] unit-test
-[ HS{ 1 2 3 } ] [ HS{ 1 2 3 } HS{ 4 } diff! ] unit-test
-
-[ HS{ } ] [ HS{ } HS{ } intersect! ] unit-test
-[ HS{ 2 3 } ] [ HS{ 1 2 3 } HS{ 2 3 } intersect! ] unit-test
-[ HS{ } ] [ HS{ 1 } HS{ 2 3 4 } intersect! ] unit-test
-[ HS{ } ] [ HS{ 1 2 3 } HS{ 4 } intersect! ] unit-test
+{ 0 } [ T{ null-set } cardinality ] unit-test
+{ f } [ T{ null-set } members ] unit-test
+{ t } [ T{ null-set } T{ null-set } set-like T{ null-set } = ] unit-test
+
+{ t } [ T{ null-set } set? ] unit-test
+{ t } [ HS{ } set? ] unit-test
+{ t } [ { } set? ] unit-test
+{ t } [ 5 <bit-set> set? ] unit-test
+{ f } [ H{ } set? ] unit-test
+
+{ HS{ } } [ HS{ } [ clear-set ] keep ] unit-test
+{ HS{ } } [ HS{ 1 2 3 } [ clear-set ] keep ] unit-test
+
+{ HS{ } } [ HS{ } HS{ } union! ] unit-test
+{ HS{ 1 } } [ HS{ 1 } HS{ } union! ] unit-test
+{ HS{ 1 } } [ HS{ } HS{ 1 } union! ] unit-test
+{ HS{ 1 2 3 } } [ HS{ 1 } HS{ 1 2 3 } union! ] unit-test
+
+{ f } [ { } intersection ] unit-test
+{ HS{ } } [ { HS{ } } intersection ] unit-test
+{ HS{ 1 } } [ { HS{ 1 2 3 } HS{ 1 } } intersection ] unit-test
+
+{ HS{ } } [ HS{ } HS{ } diff! ] unit-test
+{ HS{ 1 } } [ HS{ 1 2 3 } HS{ 2 3 } diff! ] unit-test
+{ HS{ 1 } } [ HS{ 1 } HS{ 2 3 4 } diff! ] unit-test
+{ HS{ 1 2 3 } } [ HS{ 1 2 3 } HS{ 4 } diff! ] unit-test
+
+{ HS{ } } [ HS{ } HS{ } intersect! ] unit-test
+{ HS{ 2 3 } } [ HS{ 1 2 3 } HS{ 2 3 } intersect! ] unit-test
+{ HS{ } } [ HS{ 1 } HS{ 2 3 4 } intersect! ] unit-test
+{ HS{ } } [ HS{ 1 2 3 } HS{ 4 } intersect! ] unit-test
TUPLE: hello length ;
-[ 3 ] [ "xyz" length>> ] unit-test
+{ 3 } [ "xyz" length>> ] unit-test
[ "xyz" 4 >>length ] [ no-method? ] must-fail-with
M: protocol-slot-test-tuple my-protocol-slot-test>> x>> sq ;
M: protocol-slot-test-tuple my-protocol-slot-test<< [ sqrt ] dip x<< ;
-[ 9 ] [ T{ protocol-slot-test-tuple { x 3 } } my-protocol-slot-test>> ] unit-test
+{ 9 } [ T{ protocol-slot-test-tuple { x 3 } } my-protocol-slot-test>> ] unit-test
-[ 4.0 ] [
+{ 4.0 } [
T{ protocol-slot-test-tuple { x 3 } } clone
[ 7 + ] change-my-protocol-slot-test x>>
] unit-test
UNION: comme-ca integer float ;
comme-ca 25.5 "initial-value" set-word-prop
-[ 0 t ] [ comme-ci initial-value ] unit-test
-[ 25.5 t ] [ comme-ca initial-value ] unit-test
+{ 0 t } [ comme-ci initial-value ] unit-test
+{ 25.5 t } [ comme-ca initial-value ] unit-test
tools.test vectors sets vocabs grouping ;
IN: sorting.tests
-[ { } ] [ { } natural-sort ] unit-test
+{ { } } [ { } natural-sort ] unit-test
-[ { 270000000 270000001 } ]
+{ { 270000000 270000001 } }
[ T{ slice f 270000000 270000002 T{ iota-tuple f 270000002 } } natural-sort ]
unit-test
-[ t ] [
+{ t } [
100 [
drop
100 [ 20 random [ 1000 random ] replicate ] replicate
] all-integers?
] unit-test
-[ ] [ { 1 2 } [ 2drop 1 ] sort drop ] unit-test
+{ } [ { 1 2 } [ 2drop 1 ] sort drop ] unit-test
! Is it a stable sort?
-[ t ] [ { { 1 "a" } { 1 "b" } { 1 "c" } } dup sort-keys = ] unit-test
+{ t } [ { { 1 "a" } { 1 "b" } { 1 "c" } } dup sort-keys = ] unit-test
-[ { { 1 "a" } { 1 "b" } { 1 "c" } { 1 "e" } { 2 "d" } } ]
+{ { { 1 "a" } { 1 "b" } { 1 "c" } { 1 "e" } { 2 "d" } } }
[ { { 1 "a" } { 1 "b" } { 1 "c" } { 2 "d" } { 1 "e" } } sort-keys ] unit-test
-[ ] [ all-words natural-sort drop ] unit-test
+{ } [ all-words natural-sort drop ] unit-test
DEFER: forget-test
-[ ] [ [ \ forget-test [ 1 ] ( -- ) define-declared ] with-compilation-unit ] unit-test
-[ t ] [ \ forget-test compiler-errors get key? ] unit-test
-[ ] [ [ \ forget-test forget ] with-compilation-unit ] unit-test
-[ f ] [ \ forget-test compiler-errors get key? ] unit-test
+{ } [ [ \ forget-test [ 1 ] ( -- ) define-declared ] with-compilation-unit ] unit-test
+{ t } [ \ forget-test compiler-errors get key? ] unit-test
+{ } [ [ \ forget-test forget ] with-compilation-unit ] unit-test
+{ f } [ \ forget-test compiler-errors get key? ] unit-test
USING: source-files tools.test assocs sequences strings
namespaces kernel ;
-[ { } ] [ source-files get keys [ string? ] reject ] unit-test
+{ { } } [ source-files get keys [ string? ] reject ] unit-test
USING: splitting tools.test kernel sequences arrays strings ascii math ;
IN: splitting.tests
-[ "hello" "world ." ] [ "hello world ." " " split1 ] unit-test
-[ "hello" "world-+." ] [ "hello-+world-+." "-+" split1 ] unit-test
-[ "goodbye" f ] [ "goodbye" " " split1 ] unit-test
-[ "" "" ] [ "great" "great" split1 ] unit-test
-
-[ "hello world" "." ] [ "hello world ." " " split1-last ] unit-test
-[ "hello-+world" "." ] [ "hello-+world-+." "-+" split1-last ] unit-test
-[ "goodbye" f ] [ "goodbye" " " split1-last ] unit-test
-[ "" "" ] [ "great" "great" split1-last ] unit-test
-
-[ "hello world" "." ] [ "hello world ." " " split1-last-slice [ >string ] bi@ ] unit-test
-[ "hello-+world" "." ] [ "hello-+world-+." "-+" split1-last-slice [ >string ] bi@ ] unit-test
-[ "goodbye" f ] [ "goodbye" " " split1-last-slice [ >string ] dip ] unit-test
-[ "" f ] [ "great" "great" split1-last-slice [ >string ] dip ] unit-test
-
-[ "and end" t ] [ "Beginning and end" "Beginning " ?head ] unit-test
-[ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?head ] unit-test
-[ "Beginning and end" f ] [ "Beginning and end" "eginning " ?head ] unit-test
-
-[ "Beginning" t ] [ "Beginning and end" " and end" ?tail ] unit-test
-[ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?tail ] unit-test
-[ "Beginning and end" f ] [ "Beginning and end" "eginning " ?tail ] unit-test
-
-[ { "This" "is" "a" "split" "sentence" } ]
+{ "hello" "world ." } [ "hello world ." " " split1 ] unit-test
+{ "hello" "world-+." } [ "hello-+world-+." "-+" split1 ] unit-test
+{ "goodbye" f } [ "goodbye" " " split1 ] unit-test
+{ "" "" } [ "great" "great" split1 ] unit-test
+
+{ "hello world" "." } [ "hello world ." " " split1-last ] unit-test
+{ "hello-+world" "." } [ "hello-+world-+." "-+" split1-last ] unit-test
+{ "goodbye" f } [ "goodbye" " " split1-last ] unit-test
+{ "" "" } [ "great" "great" split1-last ] unit-test
+
+{ "hello world" "." } [ "hello world ." " " split1-last-slice [ >string ] bi@ ] unit-test
+{ "hello-+world" "." } [ "hello-+world-+." "-+" split1-last-slice [ >string ] bi@ ] unit-test
+{ "goodbye" f } [ "goodbye" " " split1-last-slice [ >string ] dip ] unit-test
+{ "" f } [ "great" "great" split1-last-slice [ >string ] dip ] unit-test
+
+{ "and end" t } [ "Beginning and end" "Beginning " ?head ] unit-test
+{ "Beginning and end" f } [ "Beginning and end" "Beginning x" ?head ] unit-test
+{ "Beginning and end" f } [ "Beginning and end" "eginning " ?head ] unit-test
+
+{ "Beginning" t } [ "Beginning and end" " and end" ?tail ] unit-test
+{ "Beginning and end" f } [ "Beginning and end" "Beginning x" ?tail ] unit-test
+{ "Beginning and end" f } [ "Beginning and end" "eginning " ?tail ] unit-test
+
+{ { "This" "is" "a" "split" "sentence" } }
[ "This is a split sentence" " " split ]
unit-test
-[ { "OneWord" } ]
+{ { "OneWord" } }
[ "OneWord" " " split ]
unit-test
-[ { "a" "b" "c" "d" "e" "f" } ]
+{ { "a" "b" "c" "d" "e" "f" } }
[ "aXbYcXdYeXf" "XY" split ] unit-test
-[ { "" "" } ]
+{ { "" "" } }
[ " " " " split ] unit-test
-[ { "hey" } ]
+{ { "hey" } }
[ "hey" " " split ] unit-test
-[ "Hello world" t ] [ "Hello world\n" "\n" ?tail ] unit-test
-[ "Hello world" f ] [ "Hello world" "\n" ?tail ] unit-test
-[ "" t ] [ "\n" "\n" ?tail ] unit-test
-[ "" f ] [ "" "\n" ?tail ] unit-test
-
-[ { "" } ] [ "" string-lines ] unit-test
-[ { "" "" } ] [ "\n" string-lines ] unit-test
-[ { "" "" } ] [ "\r" string-lines ] unit-test
-[ { "" "" } ] [ "\r\n" string-lines ] unit-test
-[ { "hello" } ] [ "hello" string-lines ] unit-test
-[ { "hello" "" } ] [ "hello\n" string-lines ] unit-test
-[ { "hello" "" } ] [ "hello\r" string-lines ] unit-test
-[ { "hello" "" } ] [ "hello\r\n" string-lines ] unit-test
-[ { "hello" "hi" } ] [ "hello\nhi" string-lines ] unit-test
-[ { "hello" "hi" } ] [ "hello\rhi" string-lines ] unit-test
-[ { "hello" "hi" } ] [ "hello\r\nhi" string-lines ] unit-test
-
-[ { "" } ] [ SBUF" " string-lines ] unit-test
-[ { "" "" } ] [ SBUF" \n" string-lines ] unit-test
-[ { "" "" } ] [ SBUF" \r" string-lines ] unit-test
-[ { "" "" } ] [ SBUF" \r\n" string-lines ] unit-test
-[ { "hello" } ] [ SBUF" hello" string-lines ] unit-test
-[ { "hello" "" } ] [ SBUF" hello\n" string-lines ] unit-test
-[ { "hello" "" } ] [ SBUF" hello\r" string-lines ] unit-test
-[ { "hello" "" } ] [ SBUF" hello\r\n" string-lines ] unit-test
-[ { "hello" "hi" } ] [ SBUF" hello\nhi" string-lines ] unit-test
-[ { "hello" "hi" } ] [ SBUF" hello\rhi" string-lines ] unit-test
-[ { "hello" "hi" } ] [ SBUF" hello\r\nhi" string-lines ] unit-test
-
-[ { "hey" "world" "what's" "happening" } ]
+{ "Hello world" t } [ "Hello world\n" "\n" ?tail ] unit-test
+{ "Hello world" f } [ "Hello world" "\n" ?tail ] unit-test
+{ "" t } [ "\n" "\n" ?tail ] unit-test
+{ "" f } [ "" "\n" ?tail ] unit-test
+
+{ { "" } } [ "" string-lines ] unit-test
+{ { "" "" } } [ "\n" string-lines ] unit-test
+{ { "" "" } } [ "\r" string-lines ] unit-test
+{ { "" "" } } [ "\r\n" string-lines ] unit-test
+{ { "hello" } } [ "hello" string-lines ] unit-test
+{ { "hello" "" } } [ "hello\n" string-lines ] unit-test
+{ { "hello" "" } } [ "hello\r" string-lines ] unit-test
+{ { "hello" "" } } [ "hello\r\n" string-lines ] unit-test
+{ { "hello" "hi" } } [ "hello\nhi" string-lines ] unit-test
+{ { "hello" "hi" } } [ "hello\rhi" string-lines ] unit-test
+{ { "hello" "hi" } } [ "hello\r\nhi" string-lines ] unit-test
+
+{ { "" } } [ SBUF" " string-lines ] unit-test
+{ { "" "" } } [ SBUF" \n" string-lines ] unit-test
+{ { "" "" } } [ SBUF" \r" string-lines ] unit-test
+{ { "" "" } } [ SBUF" \r\n" string-lines ] unit-test
+{ { "hello" } } [ SBUF" hello" string-lines ] unit-test
+{ { "hello" "" } } [ SBUF" hello\n" string-lines ] unit-test
+{ { "hello" "" } } [ SBUF" hello\r" string-lines ] unit-test
+{ { "hello" "" } } [ SBUF" hello\r\n" string-lines ] unit-test
+{ { "hello" "hi" } } [ SBUF" hello\nhi" string-lines ] unit-test
+{ { "hello" "hi" } } [ SBUF" hello\rhi" string-lines ] unit-test
+{ { "hello" "hi" } } [ SBUF" hello\r\nhi" string-lines ] unit-test
+
+{ { "hey" "world" "what's" "happening" } }
[ "heyAworldBwhat'sChappening" [ LETTER? ] split-when ] unit-test
{ { { 2 } { 3 } { 5 1 } { 7 } } } [
1 { 2 1 3 2 5 1 3 7 }
[ dupd = dup [ [ 1 + ] dip ] when ] split-when nip
] unit-test
-[ { "hey" "world" "what's" "happening" } ]
+{ { "hey" "world" "what's" "happening" } }
[
"heyAworldBwhat'sChappening" [ LETTER? ] split-when-slice
[ >string ] map
] unit-test
-[ "" f ] [ "" [ blank? ] split1-when ] unit-test
-[ "" "ABC" ] [ " ABC" [ blank? ] split1-when ] unit-test
-[ "a" " bc" ] [ "a bc" [ blank? ] split1-when ] unit-test
+{ "" f } [ "" [ blank? ] split1-when ] unit-test
+{ "" "ABC" } [ " ABC" [ blank? ] split1-when ] unit-test
+{ "a" " bc" } [ "a bc" [ blank? ] split1-when ] unit-test
-[ "" f ] [ "" [ blank? ] split1-when-slice ] unit-test
-[ "" "ABC" ] [ " ABC" [ blank? ] split1-when-slice [ >string ] bi@ ] unit-test
-[ "a" " bc" ] [ "a bc" [ blank? ] split1-when-slice [ >string ] bi@ ] unit-test
+{ "" f } [ "" [ blank? ] split1-when-slice ] unit-test
+{ "" "ABC" } [ " ABC" [ blank? ] split1-when-slice [ >string ] bi@ ] unit-test
+{ "a" " bc" } [ "a bc" [ blank? ] split1-when-slice [ >string ] bi@ ] unit-test
{ "abarbbarc" }
[ "afoobfooc" "foo" "bar" replace ] unit-test
tools.test ;
IN: strings.parser.tests
-[ "Hello\n\rworld" ] [ "Hello\\n\\rworld" unescape-string ] unit-test
+{ "Hello\n\rworld" } [ "Hello\\n\\rworld" unescape-string ] unit-test
-[ "Hello\n\rworld" ] [ "Hello\n\rworld" ] unit-test
-[ "Hello\n\rworld" ] [ """Hello\n\rworld""" ] unit-test
-[ "Hello\n\rworld\n" ] [ "Hello\n\rworld
+{ "Hello\n\rworld" } [ "Hello\n\rworld" ] unit-test
+{ "Hello\n\rworld" } [ """Hello\n\rworld""" ] unit-test
+{ "Hello\n\rworld\n" } [ "Hello\n\rworld
" ] unit-test
-[ "Hello\n\rworld" "hi" ] [ "Hello\n\rworld" "hi" ] unit-test
-[ "Hello\n\rworld" "hi" ] [ """Hello\n\rworld""" """hi""" ] unit-test
-[ "Hello\n\rworld\n" "hi" ] [ """Hello\n\rworld
+{ "Hello\n\rworld" "hi" } [ "Hello\n\rworld" "hi" ] unit-test
+{ "Hello\n\rworld" "hi" } [ """Hello\n\rworld""" """hi""" ] unit-test
+{ "Hello\n\rworld\n" "hi" } [ """Hello\n\rworld
""" """hi""" ] unit-test
-[ "Hello\n\rworld\"" "hi" ] [ """Hello\n\rworld\"""" """hi""" ] unit-test
+{ "Hello\n\rworld\"" "hi" } [ """Hello\n\rworld\"""" """hi""" ] unit-test
[
"\"\"\"Hello\n\rworld\\\n\"\"\"" eval( -- obj )
error>> escaped-char-expected?
] must-fail-with
-[
+{
" \" abc \" "
-] [
+} [
"\"\"\" \" abc \" \"\"\"" eval( -- string )
] unit-test
-[
+{
"\"abc\""
-] [
+} [
"\"\"\"\"abc\"\"\"\"" eval( -- string )
] unit-test
-[ "\"\\" ] [ "\"\\" ] unit-test
+{ "\"\\" } [ "\"\\" ] unit-test
-[ "\e" ] [ "\u00001b" ] unit-test
-[ "\e" ] [ "\x1b" ] unit-test
+{ "\e" } [ "\u00001b" ] unit-test
+{ "\e" } [ "\x1b" ] unit-test
arrays memory prettyprint io.streams.null kernel.private ;
IN: strings.tests
-[ CHAR: b ] [ 1 >bignum "abc" nth ] unit-test
+{ CHAR: b } [ 1 >bignum "abc" nth ] unit-test
-[ ] [ 10 [ [ -1000000 <sbuf> ] ignore-errors ] times ] unit-test
+{ } [ 10 [ [ -1000000 <sbuf> ] ignore-errors ] times ] unit-test
-[ "abc" ] [ [ "a" "b" "c" ] [ [ % ] each ] "" make ] unit-test
+{ "abc" } [ [ "a" "b" "c" ] [ [ % ] each ] "" make ] unit-test
-[ "abc" ] [ "ab" "c" append ] unit-test
-[ "abc" ] [ "a" "b" "c" 3append ] unit-test
+{ "abc" } [ "ab" "c" append ] unit-test
+{ "abc" } [ "a" "b" "c" 3append ] unit-test
-[ 3 ] [ "a" "hola" start ] unit-test
-[ f ] [ "x" "hola" start ] unit-test
-[ 0 ] [ "" "a" start ] unit-test
-[ 0 ] [ "" "" start ] unit-test
-[ 0 ] [ "hola" "hola" start ] unit-test
-[ 1 ] [ "ol" "hola" start ] unit-test
-[ f ] [ "amigo" "hola" start ] unit-test
-[ f ] [ "holaa" "hola" start ] unit-test
+{ 3 } [ "a" "hola" start ] unit-test
+{ f } [ "x" "hola" start ] unit-test
+{ 0 } [ "" "a" start ] unit-test
+{ 0 } [ "" "" start ] unit-test
+{ 0 } [ "hola" "hola" start ] unit-test
+{ 1 } [ "ol" "hola" start ] unit-test
+{ f } [ "amigo" "hola" start ] unit-test
+{ f } [ "holaa" "hola" start ] unit-test
-[ "Beginning" ] [ "Beginning and end" 9 head ] unit-test
+{ "Beginning" } [ "Beginning and end" 9 head ] unit-test
-[ f ] [ CHAR: I "team" member? ] unit-test
-[ t ] [ "ea" "team" subseq? ] unit-test
-[ f ] [ "actore" "Factor" subseq? ] unit-test
+{ f } [ CHAR: I "team" member? ] unit-test
+{ t } [ "ea" "team" subseq? ] unit-test
+{ f } [ "actore" "Factor" subseq? ] unit-test
-[ "end" ] [ "Beginning and end" 14 tail ] unit-test
+{ "end" } [ "Beginning and end" 14 tail ] unit-test
-[ t ] [ "abc" "abd" before? ] unit-test
-[ t ] [ "z" "abd" after? ] unit-test
-[ "abc" ] [ "abc" "abd" min ] unit-test
-[ "z" ] [ "z" "abd" max ] unit-test
+{ t } [ "abc" "abd" before? ] unit-test
+{ t } [ "z" "abd" after? ] unit-test
+{ "abc" } [ "abc" "abd" min ] unit-test
+{ "z" } [ "z" "abd" max ] unit-test
[ 0 10 "hello" subseq ] must-fail
-[ "Replacing+spaces+with+plus" ]
+{ "Replacing+spaces+with+plus" }
[
"Replacing spaces with plus"
[ dup CHAR: \s = [ drop CHAR: + ] when ] map
]
unit-test
-[ "05" ] [ "5" 2 CHAR: 0 pad-head ] unit-test
-[ "666" ] [ "666" 2 CHAR: 0 pad-head ] unit-test
+{ "05" } [ "5" 2 CHAR: 0 pad-head ] unit-test
+{ "666" } [ "666" 2 CHAR: 0 pad-head ] unit-test
[ 1 "" nth ] must-fail
[ -6 "hello" nth ] must-fail
-[ t ] [ "hello world" dup >vector >string = ] unit-test
+{ t } [ "hello world" dup >vector >string = ] unit-test
-[ "ab" ] [ 2 "abc" resize-string ] unit-test
-[ "abc\0\0\0" ] [ 6 "abc" resize-string ] unit-test
+{ "ab" } [ 2 "abc" resize-string ] unit-test
+{ "abc\0\0\0" } [ 6 "abc" resize-string ] unit-test
-[ "\u001234b" ] [ 2 "\u001234bc" resize-string ] unit-test
-[ "\u001234bc\0\0\0" ] [ 6 "\u001234bc" resize-string ] unit-test
+{ "\u001234b" } [ 2 "\u001234bc" resize-string ] unit-test
+{ "\u001234bc\0\0\0" } [ 6 "\u001234bc" resize-string ] unit-test
! Random tester found this
[ 2 -7 resize-string ]
! Make sure 24-bit strings work
"hello world" "s" set
-[ ] [ 0x1234 1 "s" get set-nth ] unit-test
-[ 0x1234 ] [ 1 "s" get nth ] unit-test
+{ } [ 0x1234 1 "s" get set-nth ] unit-test
+{ 0x1234 } [ 1 "s" get nth ] unit-test
-[ ] [ 0x4321 3 "s" get set-nth ] unit-test
-[ 0x4321 ] [ 3 "s" get nth ] unit-test
+{ } [ 0x4321 3 "s" get set-nth ] unit-test
+{ 0x4321 } [ 3 "s" get nth ] unit-test
-[ ] [ 0x654321 5 "s" get set-nth ] unit-test
-[ 0x654321 ] [ 5 "s" get nth ] unit-test
+{ } [ 0x654321 5 "s" get set-nth ] unit-test
+{ 0x654321 } [ 5 "s" get nth ] unit-test
-[
+{
{
CHAR: h
0x1234
CHAR: l
CHAR: d
}
-] [
+} [
"s" get >array
] unit-test
! Make sure string initialization works
-[ 0x123456 ] [ 100 0x123456 <string> first ] unit-test
+{ 0x123456 } [ 100 0x123456 <string> first ] unit-test
! Make sure we clear aux vector when storing octets
-[ "\u123456hi" ] [ "ih\u123456" clone reverse! ] unit-test
+{ "\u123456hi" } [ "ih\u123456" clone reverse! ] unit-test
! Make sure aux vector is not shared
-[ "\udeadbe" ] [
+{ "\udeadbe" } [
"\udeadbe" clone
CHAR: \u123456 over clone set-first
] unit-test
! Regressions
-[ ] [
+{ } [
[
4 [
100 [ "obdurak" clone ] replicate
] with-null-writer
] unit-test
-[ t ] [
+{ t } [
10000 [
drop
300 100 CHAR: \u123456
] unit-test
"X" "s" set
-[ ] [ 0x100,0000 0 "s" get set-nth ] unit-test
-[ 0 ] [ 0 "s" get nth ] unit-test
+{ } [ 0x100,0000 0 "s" get set-nth ] unit-test
+{ 0 } [ 0 "s" get nth ] unit-test
-[ ] [ -1 0 "s" get set-nth ] unit-test
-[ 0x7fffff ] [ 0 "s" get nth ] unit-test
+{ } [ -1 0 "s" get set-nth ] unit-test
+{ 0x7fffff } [ 0 "s" get nth ] unit-test
continuations random growable classes ;
IN: vectors.tests
-[ ] [ 10 [ [ -1000000 <vector> ] ignore-errors ] times ] unit-test
+{ } [ 10 [ [ -1000000 <vector> ] ignore-errors ] times ] unit-test
-[ 3 ] [ [ t f t ] length ] unit-test
-[ 3 ] [ V{ t f t } length ] unit-test
+{ 3 } [ [ t f t ] length ] unit-test
+{ 3 } [ V{ t f t } length ] unit-test
[ -3 V{ } nth ] must-fail
[ 3 V{ } nth ] must-fail
[ "hey" [ 1 2 ] set-length ] must-fail
[ "hey" V{ 1 2 } set-length ] must-fail
-[ 3 ] [ 3 0 <vector> [ set-length ] keep length ] unit-test
-[ "yo" ] [
+{ 3 } [ 3 0 <vector> [ set-length ] keep length ] unit-test
+{ "yo" } [
"yo" 4 1 <vector> [ set-nth ] keep 4 swap nth
] unit-test
[ 1 V{ } nth ] must-fail
[ -1 V{ } set-length ] must-fail
-[ V{ } ] [ [ ] >vector ] unit-test
-[ V{ 1 2 } ] [ [ 1 2 ] >vector ] unit-test
+{ V{ } } [ [ ] >vector ] unit-test
+{ V{ 1 2 } } [ [ 1 2 ] >vector ] unit-test
-[ t ] [
+{ t } [
100 [ 100 random ] V{ } replicate-as
dup >array >vector =
] unit-test
-[ f ] [ V{ } V{ 1 2 3 } = ] unit-test
-[ f ] [ V{ 1 2 } V{ 1 2 3 } = ] unit-test
-[ f ] [ [ 1 2 ] V{ 1 2 3 } = ] unit-test
-[ f ] [ V{ 1 2 } [ 1 2 3 ] = ] unit-test
+{ f } [ V{ } V{ 1 2 3 } = ] unit-test
+{ f } [ V{ 1 2 } V{ 1 2 3 } = ] unit-test
+{ f } [ [ 1 2 ] V{ 1 2 3 } = ] unit-test
+{ f } [ V{ 1 2 } [ 1 2 3 ] = ] unit-test
-[ { 1 4 9 16 } ]
+{ { 1 4 9 16 } }
[
[ 1 2 3 4 ]
>vector [ dup * ] map >array
] unit-test
-[ t ] [ V{ } hashcode V{ } hashcode = ] unit-test
-[ t ] [ V{ 1 2 3 } hashcode V{ 1 2 3 } hashcode = ] unit-test
-[ t ] [ V{ 1 V{ 2 } 3 } hashcode V{ 1 V{ 2 } 3 } hashcode = ] unit-test
-[ t ] [ V{ } hashcode V{ } hashcode = ] unit-test
+{ t } [ V{ } hashcode V{ } hashcode = ] unit-test
+{ t } [ V{ 1 2 3 } hashcode V{ 1 2 3 } hashcode = ] unit-test
+{ t } [ V{ 1 V{ 2 } 3 } hashcode V{ 1 V{ 2 } 3 } hashcode = ] unit-test
+{ t } [ V{ } hashcode V{ } hashcode = ] unit-test
-[ V{ 1 2 3 } V{ 1 2 3 4 5 6 } ]
+{ V{ 1 2 3 } V{ 1 2 3 4 5 6 } }
[ V{ 1 2 3 } dup V{ 4 5 6 } append ] unit-test
-[ V{ 1 2 3 4 } ] [ [ V{ 1 } [ 2 ] V{ 3 4 } ] concat ] unit-test
+{ V{ 1 2 3 4 } } [ [ V{ 1 } [ 2 ] V{ 3 4 } ] concat ] unit-test
-[ V{ } ] [ V{ } 0 tail ] unit-test
-[ V{ } ] [ V{ 1 2 } 2 tail ] unit-test
-[ V{ 3 4 } ] [ V{ 1 2 3 4 } 2 tail ] unit-test
+{ V{ } } [ V{ } 0 tail ] unit-test
+{ V{ } } [ V{ 1 2 } 2 tail ] unit-test
+{ V{ 3 4 } } [ V{ 1 2 3 4 } 2 tail ] unit-test
-[ V{ 3 } ] [ V{ 1 2 3 } 1 tail* ] unit-test
+{ V{ 3 } } [ V{ 1 2 3 } 1 tail* ] unit-test
0 <vector> "funny-stack" set
-[ ] [ V{ 1 5 } "funny-stack" get push ] unit-test
-[ ] [ V{ 2 3 } "funny-stack" get push ] unit-test
-[ V{ 2 3 } ] [ "funny-stack" get pop ] unit-test
-[ V{ 1 5 } ] [ "funny-stack" get last ] unit-test
-[ V{ 1 5 } ] [ "funny-stack" get pop ] unit-test
+{ } [ V{ 1 5 } "funny-stack" get push ] unit-test
+{ } [ V{ 2 3 } "funny-stack" get push ] unit-test
+{ V{ 2 3 } } [ "funny-stack" get pop ] unit-test
+{ V{ 1 5 } } [ "funny-stack" get last ] unit-test
+{ V{ 1 5 } } [ "funny-stack" get pop ] unit-test
[ "funny-stack" get pop ] must-fail
[ "funny-stack" get pop ] must-fail
-[ ] [ "funky" "funny-stack" get push ] unit-test
-[ "funky" ] [ "funny-stack" get pop ] unit-test
+{ } [ "funky" "funny-stack" get push ] unit-test
+{ "funky" } [ "funny-stack" get pop ] unit-test
-[ t ] [
+{ t } [
V{ 1 2 3 4 } dup underlying>> length
[ clone underlying>> length ] dip
=
] unit-test
-[ f ] [
+{ f } [
V{ 1 2 3 4 } dup clone
[ underlying>> ] bi@ eq?
] unit-test
-[ 0 ] [
+{ 0 } [
[
10 <vector> "x" set
"x" get clone length
] with-scope
] unit-test
-[ f ] [ 5 V{ } index ] unit-test
-[ 4 ] [ 5 V{ 1 2 3 4 5 } index ] unit-test
+{ f } [ 5 V{ } index ] unit-test
+{ 4 } [ 5 V{ 1 2 3 4 5 } index ] unit-test
-[ t ] [
+{ t } [
100 iota >array dup >vector <reversed> >array [ reverse ] dip =
] unit-test
-[ fixnum ] [ 1 >bignum V{ } new-sequence length class-of ] unit-test
+{ fixnum } [ 1 >bignum V{ } new-sequence length class-of ] unit-test
-[ fixnum ] [ 1 >bignum iota [ ] V{ } map-as length class-of ] unit-test
+{ fixnum } [ 1 >bignum iota [ ] V{ } map-as length class-of ] unit-test
-[ V{ "lulz" } ] [ "lulz" 1vector ] unit-test
+{ V{ "lulz" } } [ "lulz" 1vector ] unit-test
IN: vocabs.loader.tests
! This vocab should not exist, but just in case...
-[ ] [
+{ } [
[
"vocabs.loader.test" forget-vocab
] with-compilation-unit
] unit-test
-[ T{ vocab-link f "vocabs.loader.test" } ]
+{ T{ vocab-link f "vocabs.loader.test" } }
[ "vocabs.loader.test" >vocab-link ] unit-test
-[ t ]
+{ t }
[ "kernel" >vocab-link "kernel" lookup-vocab = ] unit-test
IN: vocabs.loader.test.2
IN: vocabs.loader.tests
-[ ] [
+{ } [
"vocabs.loader.test.2" run
"vocabs.loader.test.2" lookup-vocab run
"vocabs.loader.test.2" <vocab-link> run
] unit-test
] times
-[ 2 ] [ "count-me" get-global ] unit-test
+{ 2 } [ "count-me" get-global ] unit-test
[
"IN: vocabs.loader.test.a v-l-t-a-hello"
0 "count-me" set-global
-[ ] [
+{ } [
[
"vocabs.loader.test.b" forget-vocab
] with-compilation-unit
] unit-test
-[ f ] [ "vocabs.loader.test.b" vocab-files empty? ] unit-test
+{ f } [ "vocabs.loader.test.b" vocab-files empty? ] unit-test
-[ ] [
+{ } [
[
"vocabs.loader.test.b" vocab-files
[ forget-source ] each
[ "vocabs.loader.test.b" require ] must-fail
-[ 1 ] [ "count-me" get-global ] unit-test
+{ 1 } [ "count-me" get-global ] unit-test
-[ ] [
+{ } [
[
"bob" "vocabs.loader.test.b" create-word [ ] define
] with-compilation-unit
] unit-test
-[ ] [ "vocabs.loader.test.b" refresh ] unit-test
+{ } [ "vocabs.loader.test.b" refresh ] unit-test
-[ 2 ] [ "count-me" get-global ] unit-test
+{ 2 } [ "count-me" get-global ] unit-test
-[ f ] [ "fred" "vocabs.loader.test.b" lookup-word undefined-word? ] unit-test
+{ f } [ "fred" "vocabs.loader.test.b" lookup-word undefined-word? ] unit-test
-[ ] [
+{ } [
[
"vocabs.loader.test.b" vocab-files
[ forget-source ] each
] with-compilation-unit
] unit-test
-[ ] [ "vocabs.loader.test.b" changed-vocab ] unit-test
+{ } [ "vocabs.loader.test.b" changed-vocab ] unit-test
-[ ] [ "vocabs.loader.test.b" refresh ] unit-test
+{ } [ "vocabs.loader.test.b" refresh ] unit-test
-[ 3 ] [ "count-me" get-global ] unit-test
+{ 3 } [ "count-me" get-global ] unit-test
-[ { "resource:core/kernel/kernel.factor" 1 } ]
+{ { "resource:core/kernel/kernel.factor" 1 } }
[ "kernel" <vocab-link> where ] unit-test
-[ { "resource:core/kernel/kernel.factor" 1 } ]
+{ { "resource:core/kernel/kernel.factor" 1 } }
[ "kernel" lookup-vocab where ] unit-test
-[ ] [
+{ } [
[
"vocabs.loader.test.c" forget-vocab
"vocabs.loader.test.d" forget-vocab
] with-compilation-unit
] unit-test
-[ +done+ ] [
+{ +done+ } [
[ "vocabs.loader.test.d" require ] [ :1 ] recover
"vocabs.loader.test.d" lookup-vocab source-loaded?>>
] unit-test
forget-junk
-[ { } ] [
+{ { } } [
"IN: xabbabbja" eval( -- ) "xabbabbja" vocab-files
] unit-test
forget-junk
-[ ] [ [ "vocabs.loader.test.e" forget-vocab ] with-compilation-unit ] unit-test
+{ } [ [ "vocabs.loader.test.e" forget-vocab ] with-compilation-unit ] unit-test
0 "vocabs.loader.test.g" set-global
"vocabs.loader.test.g" forget-vocab
] with-compilation-unit
-[ ] [ "vocabs.loader.test.g" require ] unit-test
+{ } [ "vocabs.loader.test.g" require ] unit-test
-[ 1 ] [ "vocabs.loader.test.g" get-global ] unit-test
+{ 1 } [ "vocabs.loader.test.g" get-global ] unit-test
[
"vocabs.loader.test.h" forget-vocab
"vocabs.loader.test.i" forget-vocab
] with-compilation-unit
-[ ] [ "vocabs.loader.test.h" require ] unit-test
+{ } [ "vocabs.loader.test.h" require ] unit-test
[
"vocabs.loader.test.k" forget-vocab
] with-compilation-unit
-[ ] [ [ "vocabs.loader.test.j" require ] [ drop :1 ] recover ] unit-test
+{ } [ [ "vocabs.loader.test.j" require ] [ drop :1 ] recover ] unit-test
-[ ] [ "vocabs.loader.test.m" require ] unit-test
-[ f ] [ "vocabs.loader.test.n" lookup-vocab ] unit-test
-[ ] [ "vocabs.loader.test.o" require ] unit-test
-[ t ] [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
+{ } [ "vocabs.loader.test.m" require ] unit-test
+{ f } [ "vocabs.loader.test.n" lookup-vocab ] unit-test
+{ } [ "vocabs.loader.test.o" require ] unit-test
+{ t } [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
[
"mno" [ "vocabs.loader.test." swap suffix forget-vocab ] each
] with-compilation-unit
-[ ] [ "vocabs.loader.test.o" require ] unit-test
-[ f ] [ "vocabs.loader.test.n" lookup-vocab ] unit-test
-[ ] [ "vocabs.loader.test.m" require ] unit-test
-[ t ] [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
+{ } [ "vocabs.loader.test.o" require ] unit-test
+{ f } [ "vocabs.loader.test.n" lookup-vocab ] unit-test
+{ } [ "vocabs.loader.test.m" require ] unit-test
+{ t } [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
-[ f ] [ "vocabs.loader.test.p" lookup-vocab ] unit-test
-[ ] [ "vocabs.loader.test.p.private" require ] unit-test
-[ { "foo" } ] [ "vocabs.loader.test.p" vocab-words [ name>> ] map ] unit-test
+{ f } [ "vocabs.loader.test.p" lookup-vocab ] unit-test
+{ } [ "vocabs.loader.test.p.private" require ] unit-test
+{ { "foo" } } [ "vocabs.loader.test.p" vocab-words [ name>> ] map ] unit-test
[
"mnop" [ "vocabs.loader.test." swap suffix forget-vocab ] each
USING: vocabs tools.test ;
IN: vocabs.tests
-[ f ] [ "kernel" vocab-main ] unit-test
+{ f } [ "kernel" vocab-main ] unit-test
-[ t ] [ "" "" child-vocab? ] unit-test
-[ t ] [ "" "io.files" child-vocab? ] unit-test
-[ t ] [ "io" "io.files" child-vocab? ] unit-test
-[ f ] [ "io.files" "io" child-vocab? ] unit-test
+{ t } [ "" "" child-vocab? ] unit-test
+{ t } [ "" "io.files" child-vocab? ] unit-test
+{ t } [ "io" "io.files" child-vocab? ] unit-test
+{ f } [ "io.files" "io" child-vocab? ] unit-test
[ "foo/bar" create-vocab ] [ bad-vocab-name? ] must-fail-with
[ "foo\\bar" create-vocab ] [ bad-vocab-name? ] must-fail-with
IN: words.alias.tests
ALIAS: foo +
-[ ] [ "IN: words.alias.tests CONSTANT: foo 5" eval( -- ) ] unit-test
-[ ( -- value ) ] [ \ foo stack-effect ] unit-test
+{ } [ "IN: words.alias.tests CONSTANT: foo 5" eval( -- ) ] unit-test
+{ ( -- value ) } [ \ foo stack-effect ] unit-test
ALIAS: MY-H{ H{
{ H{ { 1 2 } } } [
CONSTANT: a +
-[ + ] [ a ] unit-test
+{ + } [ a ] unit-test
-[ t ] [ \ a constant? ] unit-test
+{ t } [ \ a constant? ] unit-test
CONSTANT: b \ +
-[ \ + ] [ b ] unit-test
+{ \ + } [ b ] unit-test
CONSTANT: c { 1 2 3 }
-[ { 1 2 3 } ] [ c ] unit-test
+{ { 1 2 3 } } [ c ] unit-test
SYMBOL: foo
-[ f ] [ \ foo constant? ] unit-test
+{ f } [ \ foo constant? ] unit-test
io.streams.string accessors eval words.symbol grouping ;
IN: words.tests
-[ 4 ] [
+{ 4 } [
[
"poo" "words.tests" create-word [ 2 2 + ] ( -- n ) define-declared
] with-compilation-unit
"poo" "words.tests" lookup-word execute
] unit-test
-[ t ] [ t loaded-vocab-names [ vocab-words [ word? and ] each ] each ] unit-test
+{ t } [ t loaded-vocab-names [ vocab-words [ word? and ] each ] each ] unit-test
DEFER: plist-test
-[ t ] [
+{ t } [
\ plist-test t "sample-property" set-word-prop
\ plist-test "sample-property" word-prop
] unit-test
-[ f ] [
+{ f } [
\ plist-test f "sample-property" set-word-prop
\ plist-test "sample-property" word-prop
] unit-test
-[ ] [ [ "create-test" "scratchpad" create-word { 1 2 } "testing" set-word-prop ] with-compilation-unit ] unit-test
+{ } [ [ "create-test" "scratchpad" create-word { 1 2 } "testing" set-word-prop ] with-compilation-unit ] unit-test
-[ { 1 2 } ] [
+{ { 1 2 } } [
"create-test" "scratchpad" lookup-word "testing" word-prop
] unit-test
[ ] [ [ "test-scope" "scratchpad" create-word drop ] with-compilation-unit ] unit-test
] with-scope
-[ "test-scope" ] [
+{ "test-scope" } [
"test-scope" "scratchpad" lookup-word name>>
] unit-test
-[ t ] [ loaded-vocab-names array? ] unit-test
-[ t ] [ loaded-vocab-names [ vocab-words [ word? ] all? ] all? ] unit-test
+{ t } [ loaded-vocab-names array? ] unit-test
+{ t } [ loaded-vocab-names [ vocab-words [ word? ] all? ] all? ] unit-test
-[ f ] [ gensym gensym = ] unit-test
+{ f } [ gensym gensym = ] unit-test
SYMBOL: a-symbol
-[ t ] [ \ a-symbol symbol? ] unit-test
+{ t } [ \ a-symbol symbol? ] unit-test
! See if redefining a generic as a colon def clears some
! word props.
GENERIC: testing ( a -- b )
"IN: words.tests : testing ( -- ) ;" eval( -- )
-[ f ] [ \ testing generic? ] unit-test
+{ f } [ \ testing generic? ] unit-test
: forgotten ( -- ) ;
: another-forgotten ( -- ) ;
[ "IN: words.tests DEFER: not-compiled << not-compiled >>" eval( -- ) ]
[ error>> [ undefined-word? ] [ word>> name>> "not-compiled" = ] bi and ] must-fail-with
-[ ] [ "IN: words.tests FORGET: not-compiled" eval( -- ) ] unit-test
+{ } [ "IN: words.tests FORGET: not-compiled" eval( -- ) ] unit-test
-[ ] [ [ "no-loc" "words.tests" create-word drop ] with-compilation-unit ] unit-test
-[ f ] [ "no-loc" "words.tests" lookup-word where ] unit-test
+{ } [ [ "no-loc" "words.tests" create-word drop ] with-compilation-unit ] unit-test
+{ f } [ "no-loc" "words.tests" lookup-word where ] unit-test
-[ ] [ "IN: words.tests : no-loc-2 ( -- ) ;" eval( -- ) ] unit-test
-[ f ] [ "no-loc-2" "words.tests" lookup-word where ] unit-test
+{ } [ "IN: words.tests : no-loc-2 ( -- ) ;" eval( -- ) ] unit-test
+{ f } [ "no-loc-2" "words.tests" lookup-word where ] unit-test
-[ ] [ "IN: words.tests : test-last ( -- ) ;" eval( -- ) ] unit-test
-[ "test-last" ] [ last-word name>> ] unit-test
+{ } [ "IN: words.tests : test-last ( -- ) ;" eval( -- ) ] unit-test
+{ "test-last" } [ last-word name>> ] unit-test
"undef-test" "words.tests" lookup-word [
[ forget ] with-compilation-unit
[ "IN: words.tests : undef-test ( -- ) ; << undef-test >>" eval( -- ) ]
[ error>> undefined-word? ] must-fail-with
-[ ] [
+{ } [
"IN: words.tests GENERIC: symbol-generic ( -- )" eval( -- )
] unit-test
-[ ] [
+{ } [
"IN: words.tests SYMBOL: symbol-generic" eval( -- )
] unit-test
-[ t ] [ "symbol-generic" "words.tests" lookup-word symbol? ] unit-test
-[ f ] [ "symbol-generic" "words.tests" lookup-word generic? ] unit-test
+{ t } [ "symbol-generic" "words.tests" lookup-word symbol? ] unit-test
+{ f } [ "symbol-generic" "words.tests" lookup-word generic? ] unit-test
-[ ] [
+{ } [
"IN: words.tests GENERIC: symbol-generic ( a -- b )" <string-reader>
"symbol-generic-test" parse-stream drop
] unit-test
-[ ] [
+{ } [
"IN: words.tests TUPLE: symbol-generic ;" <string-reader>
"symbol-generic-test" parse-stream drop
] unit-test
-[ t ] [ "symbol-generic" "words.tests" lookup-word symbol? ] unit-test
-[ f ] [ "symbol-generic" "words.tests" lookup-word generic? ] unit-test
+{ t } [ "symbol-generic" "words.tests" lookup-word symbol? ] unit-test
+{ f } [ "symbol-generic" "words.tests" lookup-word generic? ] unit-test
! Regressions
-[ ] [ "IN: words.tests : decl-forget-test ( -- ) ; foldable" eval( -- ) ] unit-test
-[ t ] [ "decl-forget-test" "words.tests" lookup-word "foldable" word-prop ] unit-test
-[ ] [ "IN: words.tests : decl-forget-test ( -- ) ;" eval( -- ) ] unit-test
-[ f ] [ "decl-forget-test" "words.tests" lookup-word "foldable" word-prop ] unit-test
+{ } [ "IN: words.tests : decl-forget-test ( -- ) ; foldable" eval( -- ) ] unit-test
+{ t } [ "decl-forget-test" "words.tests" lookup-word "foldable" word-prop ] unit-test
+{ } [ "IN: words.tests : decl-forget-test ( -- ) ;" eval( -- ) ] unit-test
+{ f } [ "decl-forget-test" "words.tests" lookup-word "foldable" word-prop ] unit-test
-[ ] [ "IN: words.tests : decl-forget-test ( -- ) ; flushable" eval( -- ) ] unit-test
-[ t ] [ "decl-forget-test" "words.tests" lookup-word "flushable" word-prop ] unit-test
-[ ] [ "IN: words.tests : decl-forget-test ( -- ) ;" eval( -- ) ] unit-test
-[ f ] [ "decl-forget-test" "words.tests" lookup-word "flushable" word-prop ] unit-test
+{ } [ "IN: words.tests : decl-forget-test ( -- ) ; flushable" eval( -- ) ] unit-test
+{ t } [ "decl-forget-test" "words.tests" lookup-word "flushable" word-prop ] unit-test
+{ } [ "IN: words.tests : decl-forget-test ( -- ) ;" eval( -- ) ] unit-test
+{ f } [ "decl-forget-test" "words.tests" lookup-word "flushable" word-prop ] unit-test
-[ { } ]
+{ { } }
[
all-words [
[ "effect-dependencies" word-prop ]
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 }
T{ ##add-imm f 4 2 31337 }
T{ ##load-memory f 5 4 3 0 0 int-rep c:uchar }
}
-] ?
+] }
[
V{
T{ ##peek f 0 D 0 }
T{ ##add-imm f 4 3 31337 }
T{ ##load-memory f 5 2 4 0 1 int-rep c:uchar }
}
-] ?
+] }
[
V{
T{ ##peek f 0 D 0 }
! 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 }
T{ ##shl-imm f 4 3 2 }
T{ ##load-memory f 5 2 4 0 0 int-rep c:uchar }
}
-] ?
+] }
[
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
! 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
: message ( -- msg ) "Hello world!" ;
-[ ] ! Generating keys
+[ ] { }
[
"prime256v1" [ generate-key get-private-key get-public-key ] with-ec
pub-key set priv-key set
] unit-test
-[ ] ! Signing message
+[ ] { }
[
message sha-256 checksum-bytes
priv-key get
signature set
] unit-test
-[ t ] ! Verifying signature
+[ t ] { }
[
message sha-256 checksum-bytes
signature get pub-key get
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
-{ 1.0 3.0 } { 2.0 4.0 } { 5.0 6.0 } <affine-transform> 1array [
+{ 1.0 3.0 } { 2.0 4.0 } { 5.0 6.0 } <affine-transform> } [
{ 1.0 2.0 } { 3.0 4.0 } { 5.0 6.0 } <affine-transform>
transpose-axes
] unit-test
-{ 1.0 -1.0 } { 1.0 1.0 } { 0.0 0.0 } <affine-transform> 1array [
+{ 1.0 -1.0 } { 1.0 1.0 } { 0.0 0.0 } <affine-transform> } [
{ 0.5 0.5 } { -0.5 0.5 } { 5.0 5.0 } <affine-transform>
inverse-axes
] unit-test
-{ 1.0 -1.0 } { 1.0 1.0 } { -10.0 0.0 } <affine-transform> 1array [
+{ 1.0 -1.0 } { 1.0 1.0 } { -10.0 0.0 } <affine-transform> } [
{ 0.5 0.5 } { -0.5 0.5 } { 5.0 5.0 } <affine-transform>
inverse-transform
] unit-test
-{ 1.0 0.0 } { 0.0 1.0 } { 0.0 0.0 } <affine-transform> 1array [
+{ 1.0 0.0 } { 0.0 1.0 } { 0.0 0.0 } <affine-transform> } [
{ 0.5 0.5 } { -0.5 0.5 } { 5.0 5.0 } <affine-transform>
dup inverse-transform a.
] unit-test
-{ 2.0 -1.0 } { -1.0 -2.0 } { 5.0 -6.0 } <affine-transform> 1array [
+{ 2.0 -1.0 } { -1.0 -2.0 } { 5.0 -6.0 } <affine-transform> } [
{ 1.0 0.0 } { 0.0 -1.0 } { 0.0 0.0 } <affine-transform>
{ 2.0 1.0 } { -1.0 2.0 } { 5.0 6.0 } <affine-transform>
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
-{ 1.0 0.0 } { 0.0 1.0 } { 5.0 10.0 } <affine-transform> 1array [
+{ 1.0 0.0 } { 0.0 1.0 } { 5.0 10.0 } <affine-transform> } [
{ 5.0 10.0 } <translation>
] unit-test
{ $[ pi 0.25 * cos ] $[ pi 0.25 * sin ] }
{ $[ pi -0.25 * sin ] $[ pi 0.25 * cos ] }
-{ 0.0 0.0 } <affine-transform> 1array [
+{ 0.0 0.0 } <affine-transform> } [
pi 0.25 * <rotation>
] 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
math.functions sequences svg tools.test xml xml.traversal multiline ;
IN: svg.tests
-{ 1.0 2.25 } { -3.0 4.0 } { 5.5 0.5 } <affine-transform> 1array [
+{ 1.0 2.25 } { -3.0 4.0 } { 5.5 0.5 } <affine-transform> } [
"matrix ( 1 +2.25 -3 , 0.4e+1 ,5.5, 5e-1 )" svg-transform>affine-transform
] unit-test
-{ 1.0 0.0 } { 0.0 1.0 } { 5.0 10.0 } <affine-transform> 1array [
+{ 1.0 0.0 } { 0.0 1.0 } { 5.0 10.0 } <affine-transform> } [
"translate(5.0, 1e1 )" svg-transform>affine-transform
] unit-test
-{ 1.0 0.0 } { 0.0 1.0 } { 5.0 10.0 } <affine-transform> 1array [
+{ 1.0 0.0 } { 0.0 1.0 } { 5.0 10.0 } <affine-transform> } [
"translate( 5.0 1e+1)" svg-transform>affine-transform
] unit-test
-{ 2.0 0.0 } { 0.0 2.0 } { 0.0 0.0 } <affine-transform> 1array [
+{ 2.0 0.0 } { 0.0 2.0 } { 0.0 0.0 } <affine-transform> } [
"scale(2.0)" svg-transform>affine-transform
] unit-test
-{ 2.0 0.0 } { 0.0 4.0 } { 0.0 0.0 } <affine-transform> 1array [
+{ 2.0 0.0 } { 0.0 4.0 } { 0.0 0.0 } <affine-transform> } [
"scale(2.0 4.0)" svg-transform>affine-transform
] unit-test
-{ 2.0 0.0 } { 0.0 4.0 } { 0.0 0.0 } <affine-transform> 1array [
+{ 2.0 0.0 } { 0.0 4.0 } { 0.0 0.0 } <affine-transform> } [
"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 ] } {
{ $[ 30 degrees cos ] $[ 30 degrees sin ] }
{ $[ -30 degrees sin ] $[ 30 degrees cos ] }
-{ 1.0 2.0 } <affine-transform> 1array [
+{ 1.0 2.0 } <affine-transform> } [
"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 1array [ 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
+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
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