factor: commit weekend work.
parent
f5f7770d30
commit
200b5192ed
|
@ -5,33 +5,27 @@ sequences.generalizations ;
|
|||
IN: combinators.smart.syntax
|
||||
|
||||
SYNTAX: \quotation[ parse-quotation '[ _ [ ] output>sequence ] append! ;
|
||||
SYNTAX: \'quotation[ parse-quotation '[ _ fry call [ ] output>sequence ] append! ;
|
||||
|
||||
SYNTAX: \array[ parse-quotation '[ _ { } output>sequence ] append! ;
|
||||
SYNTAX: \'array[ parse-quotation '[ _ fry call { } output>sequence ] append! ;
|
||||
! SYNTAX: \array[ parse-quotation '[ _ { } output>sequence ] append! ;
|
||||
SYNTAX: \array[ parse-quotation '[ _ { } output>sequence ] call( -- a ) suffix! ;
|
||||
|
||||
SYNTAX: \vector[ parse-quotation '[ _ V{ } output>sequence ] append! ;
|
||||
SYNTAX: \'vector[ parse-quotation '[ _ fry call V{ } output>sequence ] append! ;
|
||||
SYNTAX: \vector[ parse-quotation '[ _ V{ } output>sequence ] call( -- a ) suffix! ;
|
||||
|
||||
SYNTAX: \assoc[ parse-quotation '[ _ { } output>assoc ] append! ;
|
||||
SYNTAX: \'assoc[ parse-quotation '[ _ fry call { } output>assoc ] append! ;
|
||||
SYNTAX: \assoc[ parse-quotation '[ _ { } output>assoc ] call( -- a ) suffix! ;
|
||||
|
||||
SYNTAX: \hashtable[ parse-quotation '[ _ H{ } output>assoc ] append! ;
|
||||
SYNTAX: \'hashtable[ parse-quotation '[ _ fry call H{ } output>assoc ] append! ;
|
||||
SYNTAX: \hashtable[ parse-quotation '[ _ H{ } output>assoc ] call( -- a ) suffix! ;
|
||||
|
||||
ERROR: wrong-number-of-outputs quot expected got ;
|
||||
: check-outputs ( quot n -- quot )
|
||||
2dup [ outputs dup ] dip = [ 2drop ] [ wrong-number-of-outputs ] if ;
|
||||
|
||||
SYNTAX: \1[ parse-quotation 1 check-outputs '[ _ { } output>sequence 1 firstn ] append! ;
|
||||
SYNTAX: \2[ parse-quotation 2 check-outputs '[ _ { } output>sequence 2 firstn ] append! ;
|
||||
SYNTAX: \3[ parse-quotation 3 check-outputs '[ _ { } output>sequence 3 firstn ] append! ;
|
||||
SYNTAX: \4[ parse-quotation 4 check-outputs '[ _ { } output>sequence 4 firstn ] append! ;
|
||||
SYNTAX: \5[ parse-quotation 5 check-outputs '[ _ { } output>sequence 5 firstn ] append! ;
|
||||
SYNTAX: \n[ parse-quotation 5 check-outputs '[ _ { } output>sequence 5 firstn ] append! ;
|
||||
: 2suffix! ( seq obj1 obj2 -- seq ) [ suffix! ] dip suffix! ; inline
|
||||
: 3suffix! ( seq obj1 obj2 obj3 -- seq ) [ 2suffix! ] dip suffix! ; inline
|
||||
: 4suffix! ( seq obj1 obj2 obj3 obj4 -- seq ) [ 3suffix! ] dip suffix! ; inline
|
||||
: 5suffix! ( seq obj1 obj2 obj3 obj4 obj5 -- seq ) [ 4suffix! ] dip suffix! ; inline
|
||||
|
||||
SYNTAX: \'1[ parse-quotation fry '[ _ call 1 check-outputs { } output>sequence 1 firstn ] append! ;
|
||||
SYNTAX: \'2[ parse-quotation fry '[ _ call 2 check-outputs { } output>sequence 2 firstn ] append! ;
|
||||
SYNTAX: \'3[ parse-quotation fry '[ _ call 3 check-outputs { } output>sequence 3 firstn ] append! ;
|
||||
SYNTAX: \'4[ parse-quotation fry '[ _ call 4 check-outputs { } output>sequence 4 firstn ] append! ;
|
||||
SYNTAX: \'5[ parse-quotation fry '[ _ call 5 check-outputs { } output>sequence 5 firstn ] append! ;
|
||||
SYNTAX: \1[ parse-quotation 1 check-outputs '[ _ { } output>sequence 1 firstn ] call( -- a ) suffix! ; foldable
|
||||
SYNTAX: \2[ parse-quotation 2 check-outputs '[ _ { } output>sequence 2 firstn ] call( -- a b ) 2suffix! ; foldable
|
||||
SYNTAX: \3[ parse-quotation 3 check-outputs '[ _ { } output>sequence 3 firstn ] call( -- a b c ) 3suffix! ; foldable
|
||||
SYNTAX: \4[ parse-quotation 4 check-outputs '[ _ { } output>sequence 4 firstn ] call( -- a b c d ) 4suffix! ; foldable
|
||||
SYNTAX: \5[ parse-quotation 5 check-outputs '[ _ { } output>sequence 5 firstn ] call( -- a b c d e ) 5suffix! ; foldable
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
USING: calendar formatting kernel literals math math.functions
|
||||
sequences strings system tools.test ;
|
||||
USING: calendar combinators.smart.syntax formatting kernel math
|
||||
math.functions sequences strings system tools.test ;
|
||||
IN: formatting.tests
|
||||
|
||||
[ "%s" printf ] must-infer
|
||||
|
@ -165,9 +165,9 @@ IN: formatting.tests
|
|||
{ t } [ "PM" testtime "%p" strftime = ] unit-test
|
||||
|
||||
! Differences on Windows due to rounding mode (#1792).
|
||||
${ os windows? "1.3" "1.2" ? } [ 125/100 "%.1f" sprintf ] unit-test
|
||||
${ os windows? "3" "2" ? } [ 5/2 "%.0f" sprintf ] unit-test
|
||||
array[ os windows? "1.3" "1.2" ? ] [ 125/100 "%.1f" sprintf ] unit-test
|
||||
array[ os windows? "3" "2" ? ] [ 5/2 "%.0f" sprintf ] unit-test
|
||||
! Differences on Windows due to setprecision(0)
|
||||
${ os windows? "2.500000e+00" "2e+00" ? } [ 5/2 "%.0e" sprintf ] unit-test
|
||||
${ os windows? "3.500000e+00" "4e+00" ? } [ 7/2 "%.0e" sprintf ] unit-test
|
||||
${ os windows? "1.000000e+00" "1e+00" ? } [ 1.0 "%.0e" sprintf ] unit-test
|
||||
array[ os windows? "2.500000e+00" "2e+00" ? ] [ 5/2 "%.0e" sprintf ] unit-test
|
||||
array[ os windows? "3.500000e+00" "4e+00" ? ] [ 7/2 "%.0e" sprintf ] unit-test
|
||||
array[ os windows? "1.000000e+00" "1e+00" ? ] [ 1.0 "%.0e" sprintf ] unit-test
|
||||
|
|
|
@ -61,7 +61,7 @@ some-header: 1; 2
|
|||
blah
|
||||
]]
|
||||
|
||||
${ read-request-test-1' } [
|
||||
array[ read-request-test-1' ] [
|
||||
read-request-test-1 lf>crlf
|
||||
[ read-request ] with-string-reader
|
||||
[ write-request ] with-string-writer
|
||||
|
@ -159,7 +159,7 @@ content-type: text/html; charset=UTF-8
|
|||
|
||||
]]
|
||||
|
||||
${ read-response-test-1' } [
|
||||
array[ read-response-test-1' ] [
|
||||
URL" http://localhost/" url set
|
||||
read-response-test-1 lf>crlf
|
||||
[ read-response ] with-string-reader
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
! Copyright (C) 2007, 2009 Slava Pestov, Eduardo Cavazos.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: lexer macros memoize parser sequences vocabs
|
||||
vocabs.loader words kernel namespaces locals.parser locals.types
|
||||
locals.errors ;
|
||||
USING: fry kernel lexer locals.errors locals.parser locals.types
|
||||
macros memoize namespaces sequences vocabs vocabs.loader words ;
|
||||
IN: locals
|
||||
|
||||
SYNTAX: :>
|
||||
|
@ -12,6 +11,7 @@ SYNTAX: :>
|
|||
SYNTAX: \|[ parse-lambda append! ;
|
||||
|
||||
SYNTAX: \let[ parse-let append! ;
|
||||
SYNTAX: \'let[ H{ } clone (parse-lambda) [ fry call <let> ?rewrite-closures call ] curry append! ;
|
||||
|
||||
SYNTAX: \:: (::) define-declared ;
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
USING: accessors alien arrays byte-arrays classes combinators
|
||||
cpu.architecture effects fry functors generalizations generic
|
||||
generic.parser kernel lexer literals locals macros math math.functions
|
||||
math.vectors math.vectors.private math.vectors.simd.intrinsics
|
||||
namespaces parser prettyprint.custom quotations sequences
|
||||
combinators.smart.syntax cpu.architecture effects fry functors
|
||||
generalizations generic generic.parser kernel lexer literals
|
||||
locals macros math math.bitwise math.functions math.vectors
|
||||
math.vectors.private math.vectors.simd.intrinsics namespaces
|
||||
parser prettyprint.custom quotations sequences
|
||||
sequences.generalizations sequences.private vocabs vocabs.loader
|
||||
words math.bitwise ;
|
||||
words ;
|
||||
QUALIFIED-WITH: alien.c-types c
|
||||
IN: math.vectors.simd
|
||||
|
||||
|
@ -46,7 +47,7 @@ PRIVATE>
|
|||
! SIMD base type
|
||||
|
||||
TUPLE: simd-128
|
||||
{ underlying byte-array read-only initial: $[ 16 <byte-array> ] } ;
|
||||
{ underlying byte-array read-only initial: 1[ 16 <byte-array> ] } ;
|
||||
|
||||
GENERIC: simd-element-type ( obj -- c-type )
|
||||
GENERIC: simd-rep ( simd -- rep )
|
||||
|
|
|
@ -17,23 +17,23 @@ IN: opengl.textures.tests
|
|||
[ [ image new swap >>dim ] map ] map image-locs
|
||||
] unit-test
|
||||
|
||||
${ GL_RGBA8 GL_RGBA GL_UNSIGNED_BYTE }
|
||||
array[ GL_RGBA8 GL_RGBA GL_UNSIGNED_BYTE ]
|
||||
[ RGBA ubyte-components (image-format) ] unit-test
|
||||
|
||||
${ GL_RGBA8 GL_BGRA GL_UNSIGNED_BYTE }
|
||||
array[ GL_RGBA8 GL_BGRA GL_UNSIGNED_BYTE ]
|
||||
[ BGRA ubyte-components (image-format) ] unit-test
|
||||
|
||||
${ GL_RGBA8 GL_BGRA GL_UNSIGNED_INT_8_8_8_8_REV }
|
||||
array[ GL_RGBA8 GL_BGRA GL_UNSIGNED_INT_8_8_8_8_REV ]
|
||||
[ ARGB ubyte-components (image-format) ] unit-test
|
||||
|
||||
${ GL_RGBA32F GL_RGBA GL_FLOAT }
|
||||
array[ GL_RGBA32F GL_RGBA GL_FLOAT ]
|
||||
[ RGBA float-components (image-format) ] unit-test
|
||||
|
||||
${ GL_RGBA32UI GL_BGRA_INTEGER GL_UNSIGNED_INT }
|
||||
array[ GL_RGBA32UI GL_BGRA_INTEGER GL_UNSIGNED_INT ]
|
||||
[ BGRA uint-integer-components (image-format) ] unit-test
|
||||
|
||||
${ GL_RGB9_E5 GL_RGB GL_UNSIGNED_INT_5_9_9_9_REV }
|
||||
array[ GL_RGB9_E5 GL_RGB GL_UNSIGNED_INT_5_9_9_9_REV ]
|
||||
[ BGR u-9-9-9-e5-components (image-format) ] unit-test
|
||||
|
||||
${ GL_R11F_G11F_B10F GL_RGB GL_UNSIGNED_INT_10F_11F_11F_REV }
|
||||
array[ GL_R11F_G11F_B10F GL_RGB GL_UNSIGNED_INT_10F_11F_11F_REV ]
|
||||
[ BGR float-11-11-10-components (image-format) ] unit-test
|
||||
|
|
|
@ -110,7 +110,7 @@ CONSTANT: objects
|
|||
|
||||
! Changed the serialization of numbers in [2^1008;2^1024[
|
||||
! check backwards compatibility
|
||||
${ 1008 2^ } [ B{
|
||||
array[ 1008 2^ ] [ B{
|
||||
255 1 127 1 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 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
|
||||
|
@ -118,7 +118,7 @@ ${ 1008 2^ } [ B{
|
|||
0 0 0 0 0 0 0 0 0 0 0 0
|
||||
} binary [ deserialize-cell ] with-byte-reader ] unit-test
|
||||
|
||||
${ 1024 2^ 1 - } [ B{
|
||||
array[ 1024 2^ 1 - ] [ B{
|
||||
255 1 128 255 255 255 255 255 255 255 255 255 255 255 255
|
||||
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
|
||||
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
|
||||
|
|
|
@ -18,7 +18,7 @@ TYPED: fix+ ( a: fixnum b: fixnum -- c: fixnum )
|
|||
! [ most-positive-fixnum 1 fix+ ] unit-test
|
||||
|
||||
! XXX: Check that we throw an error. This used to underflow to the least-positive-fixnum.
|
||||
[ most-positive-fixnum 1 fix+ ] [ ${ KERNEL-ERROR 7 } head? ] must-fail-with
|
||||
[ most-positive-fixnum 1 fix+ ] [ array[ KERNEL-ERROR 7 ] head? ] must-fail-with
|
||||
|
||||
TUPLE: tweedle-dee ; final
|
||||
TUPLE: tweedle-dum ; final
|
||||
|
|
|
@ -103,12 +103,12 @@ CONSTANT: events-mask
|
|||
[ width>> ] [ height>> ] bi 2array ;
|
||||
|
||||
: scroll-direction ( event -- pair )
|
||||
direction>> {
|
||||
{ $ GDK_SCROLL_UP { 0 -1 } }
|
||||
{ $ GDK_SCROLL_DOWN { 0 1 } }
|
||||
{ $ GDK_SCROLL_LEFT { -1 0 } }
|
||||
{ $ GDK_SCROLL_RIGHT { 1 0 } }
|
||||
} at ;
|
||||
direction>> array[
|
||||
array[ GDK_SCROLL_UP { 0 -1 } ]
|
||||
array[ GDK_SCROLL_DOWN { 0 1 } ]
|
||||
array[ GDK_SCROLL_LEFT { -1 0 } ]
|
||||
array[ GDK_SCROLL_RIGHT { 1 0 } ]
|
||||
] at ;
|
||||
|
||||
: on-motion ( win event user-data -- ? )
|
||||
drop swap
|
||||
|
@ -362,25 +362,25 @@ CONSTANT: window-controls>func-flags
|
|||
] 2tri ;
|
||||
|
||||
! OpenGL and Pixel formats
|
||||
CONSTANT: perm-attribs ${ GDK_GL_USE_GL GDK_GL_RGBA }
|
||||
CONSTANT: perm-attribs array[ GDK_GL_USE_GL GDK_GL_RGBA ]
|
||||
|
||||
CONSTANT: attrib-table H{
|
||||
{ double-buffered ${ GDK_GL_DOUBLEBUFFER } }
|
||||
{ stereo ${ GDK_GL_STEREO } }
|
||||
{ color-bits ${ GDK_GL_BUFFER_SIZE } }
|
||||
{ red-bits ${ GDK_GL_RED_SIZE } }
|
||||
{ green-bits ${ GDK_GL_GREEN_SIZE } }
|
||||
{ blue-bits ${ GDK_GL_BLUE_SIZE } }
|
||||
{ alpha-bits ${ GDK_GL_ALPHA_SIZE } }
|
||||
{ accum-red-bits ${ GDK_GL_ACCUM_RED_SIZE } }
|
||||
{ accum-green-bits ${ GDK_GL_ACCUM_GREEN_SIZE } }
|
||||
{ accum-blue-bits ${ GDK_GL_ACCUM_BLUE_SIZE } }
|
||||
{ accum-alpha-bits ${ GDK_GL_ACCUM_ALPHA_SIZE } }
|
||||
{ depth-bits ${ GDK_GL_DEPTH_SIZE } }
|
||||
{ stencil-bits ${ GDK_GL_STENCIL_SIZE } }
|
||||
{ aux-buffers ${ GDK_GL_AUX_BUFFERS } }
|
||||
{ sample-buffers ${ GDK_GL_SAMPLE_BUFFERS } }
|
||||
{ samples ${ GDK_GL_SAMPLES } }
|
||||
{ double-buffered array[ GDK_GL_DOUBLEBUFFER ] }
|
||||
{ stereo array[ GDK_GL_STEREO ] }
|
||||
{ color-bits array[ GDK_GL_BUFFER_SIZE ] }
|
||||
{ red-bits array[ GDK_GL_RED_SIZE ] }
|
||||
{ green-bits array[ GDK_GL_GREEN_SIZE ] }
|
||||
{ blue-bits array[ GDK_GL_BLUE_SIZE ] }
|
||||
{ alpha-bits array[ GDK_GL_ALPHA_SIZE ] }
|
||||
{ accum-red-bits array[ GDK_GL_ACCUM_RED_SIZE ] }
|
||||
{ accum-green-bits array[ GDK_GL_ACCUM_GREEN_SIZE ] }
|
||||
{ accum-blue-bits array[ GDK_GL_ACCUM_BLUE_SIZE ] }
|
||||
{ accum-alpha-bits array[ GDK_GL_ACCUM_ALPHA_SIZE ] }
|
||||
{ depth-bits array[ GDK_GL_DEPTH_SIZE ] }
|
||||
{ stencil-bits array[ GDK_GL_STENCIL_SIZE ] }
|
||||
{ aux-buffers array[ GDK_GL_AUX_BUFFERS ] }
|
||||
{ sample-buffers array[ GDK_GL_SAMPLE_BUFFERS ] }
|
||||
{ samples array[ GDK_GL_SAMPLES ] }
|
||||
}
|
||||
|
||||
M: gtk-ui-backend (make-pixel-format)
|
||||
|
|
|
@ -6,59 +6,59 @@ IN: ui.backend.x11.keys
|
|||
|
||||
CONSTANT: modifiers
|
||||
{
|
||||
${ S+ ShiftMask }
|
||||
${ C+ ControlMask }
|
||||
${ A+ Mod1Mask }
|
||||
${ M+ Mod4Mask }
|
||||
}
|
||||
array[ ShiftMask ]
|
||||
array[ ControlMask ]
|
||||
array[ Mod1Mask ]
|
||||
array[ Mod4Mask ]
|
||||
]
|
||||
|
||||
CONSTANT: codes
|
||||
H{
|
||||
{ $ XK_BackSpace "BACKSPACE" }
|
||||
{ $ XK_Tab "TAB" }
|
||||
{ $ XK_ISO_Left_Tab "TAB" }
|
||||
{ $ XK_Return "RET" }
|
||||
{ $ XK_KP_Enter "ENTER" }
|
||||
{ $ XK_Escape "ESC" }
|
||||
{ $ XK_Delete "DELETE" }
|
||||
{ $ XK_Insert "INSERT" }
|
||||
{ $ XK_Home "HOME" }
|
||||
{ $ XK_Left "LEFT" }
|
||||
{ $ XK_Up "UP" }
|
||||
{ $ XK_Right "RIGHT" }
|
||||
{ $ XK_Down "DOWN" }
|
||||
{ $ XK_Page_Up "PAGE_UP" }
|
||||
{ $ XK_Page_Down "PAGE_DOWN" }
|
||||
{ $ XK_End "END" }
|
||||
{ $ XK_Begin "BEGIN" }
|
||||
{ $ XK_F1 "F1" }
|
||||
{ $ XK_F2 "F2" }
|
||||
{ $ XK_F3 "F3" }
|
||||
{ $ XK_F4 "F4" }
|
||||
{ $ XK_F5 "F5" }
|
||||
{ $ XK_F6 "F6" }
|
||||
{ $ XK_F7 "F7" }
|
||||
{ $ XK_F8 "F8" }
|
||||
{ $ XK_F9 "F9" }
|
||||
{ $ XK_F10 "F10" }
|
||||
{ $ XK_F11 "F11" }
|
||||
{ $ XK_F12 "F12" }
|
||||
array[ XK_BackSpace "BACKSPACE" ]
|
||||
array[ XK_Tab "TAB" ]
|
||||
array[ XK_ISO_Left_Tab "TAB" ]
|
||||
array[ XK_Return "RET" ]
|
||||
array[ XK_KP_Enter "ENTER" ]
|
||||
array[ XK_Escape "ESC" ]
|
||||
array[ XK_Delete "DELETE" ]
|
||||
array[ XK_Insert "INSERT" ]
|
||||
array[ XK_Home "HOME" ]
|
||||
array[ XK_Left "LEFT" ]
|
||||
array[ XK_Up "UP" ]
|
||||
array[ XK_Right "RIGHT" ]
|
||||
array[ XK_Down "DOWN" ]
|
||||
array[ XK_Page_Up "PAGE_UP" ]
|
||||
array[ XK_Page_Down "PAGE_DOWN" ]
|
||||
array[ XK_End "END" ]
|
||||
array[ XK_Begin "BEGIN" ]
|
||||
array[ XK_F1 "F1" ]
|
||||
array[ XK_F2 "F2" ]
|
||||
array[ XK_F3 "F3" ]
|
||||
array[ XK_F4 "F4" ]
|
||||
array[ XK_F5 "F5" ]
|
||||
array[ XK_F6 "F6" ]
|
||||
array[ XK_F7 "F7" ]
|
||||
array[ XK_F8 "F8" ]
|
||||
array[ XK_F9 "F9" ]
|
||||
array[ XK_F10 "F10" ]
|
||||
array[ XK_F11 "F11" ]
|
||||
array[ XK_F12 "F12" ]
|
||||
|
||||
{ $ XK_Shift_L f }
|
||||
{ $ XK_Shift_R f }
|
||||
{ $ XK_Control_L f }
|
||||
{ $ XK_Control_R f }
|
||||
{ $ XK_Caps_Lock f }
|
||||
{ $ XK_Shift_Lock f }
|
||||
array[ XK_Shift_L f ]
|
||||
array[ XK_Shift_R f ]
|
||||
array[ XK_Control_L f ]
|
||||
array[ XK_Control_R f ]
|
||||
array[ XK_Caps_Lock f ]
|
||||
array[ XK_Shift_Lock f ]
|
||||
|
||||
{ $ XK_Meta_L f }
|
||||
{ $ XK_Meta_R f }
|
||||
{ $ XK_Alt_L f }
|
||||
{ $ XK_Alt_R f }
|
||||
{ $ XK_Super_L f }
|
||||
{ $ XK_Super_R f }
|
||||
{ $ XK_Hyper_L f }
|
||||
{ $ XK_Hyper_R f }
|
||||
array[ XK_Meta_L f ]
|
||||
array[ XK_Meta_R f ]
|
||||
array[ XK_Alt_L f ]
|
||||
array[ XK_Alt_R f ]
|
||||
array[ XK_Super_L f ]
|
||||
array[ XK_Super_R f ]
|
||||
array[ XK_Hyper_L f ]
|
||||
array[ XK_Hyper_R f ]
|
||||
}
|
||||
|
||||
: code>sym ( code -- name/code/f action? )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
USING: accessors arrays kernel kernel.private layouts literals math
|
||||
sequences tools.test vectors ;
|
||||
USING: accessors arrays combinators.smart.syntax kernel
|
||||
kernel.private layouts math sequences tools.test vectors ;
|
||||
|
||||
[ -2 { "a" "b" "c" } nth ] must-fail
|
||||
[ 10 { "a" "b" "c" } nth ] must-fail
|
||||
|
@ -20,7 +20,7 @@ sequences tools.test vectors ;
|
|||
[ cell-bits cell log2 - 2^ f <array> ] must-fail
|
||||
! To big for a fixnum #1045
|
||||
[ 67 2^ 3 <array> ] [
|
||||
${ KERNEL-ERROR ERROR-OUT-OF-FIXNUM-RANGE 147573952589676412928 f }
|
||||
array[ KERNEL-ERROR ERROR-OUT-OF-FIXNUM-RANGE 147573952589676412928 f ]
|
||||
=
|
||||
] must-fail-with
|
||||
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
USING: accessors arrays assocs calendar classes classes.algebra
|
||||
classes.private classes.tuple classes.tuple.private columns
|
||||
combinators.short-circuit compiler.errors compiler.units
|
||||
definitions eval generic generic.single io.streams.string kernel
|
||||
kernel.private literals math math.constants memory namespaces
|
||||
parser parser.notes see sequences sequences.private slots
|
||||
splitting strings threads tools.test vectors vocabs words
|
||||
words.symbol ;
|
||||
IN: classes.tuple.tests
|
||||
|
||||
TUPLE: rect x y w h ;
|
||||
|
@ -546,12 +538,12 @@ must-fail-with
|
|||
|
||||
[ 444444444444444444444444444444444444444444444444433333 >bignum "asdf" declared-types boa ]
|
||||
[
|
||||
${ KERNEL-ERROR ERROR-OUT-OF-FIXNUM-RANGE
|
||||
444444444444444444444444444444444444444444444444433333 f } =
|
||||
array[ KERNEL-ERROR ERROR-OUT-OF-FIXNUM-RANGE
|
||||
444444444444444444444444444444444444444444444444433333 f ] =
|
||||
] must-fail-with
|
||||
|
||||
! Check bignum coercer
|
||||
TUPLE: bignum-coercer { n bignum initial: $[ 0 >bignum ] } ;
|
||||
TUPLE: bignum-coercer { n bignum initial: 1[ 0 >bignum ] } ;
|
||||
|
||||
{ 13 bignum } [ 13.5 bignum-coercer boa n>> dup class-of ] unit-test
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
USING: accessors alien alien.accessors arrays assocs byte-arrays
|
||||
continuations debugger grouping io.streams.string kernel
|
||||
kernel.private literals locals.backend math memory namespaces
|
||||
prettyprint sequences sequences.private tools.test words ;
|
||||
combinators.smart.syntax continuations debugger grouping
|
||||
io.streams.string kernel kernel.private locals.backend math
|
||||
memory namespaces prettyprint sequences sequences.private
|
||||
tools.test words ;
|
||||
IN: kernel.tests
|
||||
|
||||
{ 0 } [ f size ] unit-test
|
||||
|
@ -29,14 +30,14 @@ IN: kernel.tests
|
|||
|
||||
! Make sure we report the correct error on stack underflow
|
||||
[ clear drop ] [
|
||||
2 head ${ KERNEL-ERROR ERROR-DATASTACK-UNDERFLOW } =
|
||||
2 head array[ KERNEL-ERROR ERROR-DATASTACK-UNDERFLOW ] =
|
||||
] must-fail-with
|
||||
|
||||
{ } [ :c ] unit-test
|
||||
|
||||
[
|
||||
3 [ { } set-retainstack ] dip ]
|
||||
[ 2 head ${ KERNEL-ERROR ERROR-RETAINSTACK-UNDERFLOW } =
|
||||
[ 2 head array[ KERNEL-ERROR ERROR-RETAINSTACK-UNDERFLOW ] =
|
||||
] must-fail-with
|
||||
|
||||
{ } [ :c ] unit-test
|
||||
|
@ -55,19 +56,19 @@ IN: kernel.tests
|
|||
>>
|
||||
|
||||
[ overflow-d ] [
|
||||
2 head ${ KERNEL-ERROR ERROR-DATASTACK-OVERFLOW } =
|
||||
2 head array[ KERNEL-ERROR ERROR-DATASTACK-OVERFLOW ] =
|
||||
] must-fail-with
|
||||
|
||||
{ } [ :c ] unit-test
|
||||
|
||||
[ overflow-d-alt ] [
|
||||
2 head ${ KERNEL-ERROR ERROR-DATASTACK-OVERFLOW } =
|
||||
2 head array[ KERNEL-ERROR ERROR-DATASTACK-OVERFLOW ] =
|
||||
] must-fail-with
|
||||
|
||||
{ } [ [ :c ] with-string-writer drop ] unit-test
|
||||
|
||||
[ overflow-r ] [
|
||||
2 head ${ KERNEL-ERROR ERROR-RETAINSTACK-OVERFLOW } =
|
||||
2 head array[ KERNEL-ERROR ERROR-RETAINSTACK-OVERFLOW ] =
|
||||
] must-fail-with
|
||||
|
||||
{ } [ :c ] unit-test
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
USING: arrays continuations io.streams.null kernel
|
||||
kernel.private literals make math math.order memory namespaces
|
||||
prettyprint sbufs sequences strings strings.private tools.test
|
||||
vectors ;
|
||||
USING: arrays combinators.smart.syntax continuations
|
||||
io.streams.null kernel kernel.private make math math.order
|
||||
memory namespaces prettyprint sbufs sequences strings
|
||||
strings.private tools.test vectors ;
|
||||
|
||||
{ char: b } [ 1 >bignum "abc" nth ] unit-test
|
||||
|
||||
|
@ -59,7 +59,7 @@ unit-test
|
|||
|
||||
! Random tester found this
|
||||
[ 2 -7 resize-string ]
|
||||
[ ${ KERNEL-ERROR ERROR-TYPE 11 -7 } = ] must-fail-with
|
||||
[ array[ KERNEL-ERROR ERROR-TYPE 11 -7 ] = ] must-fail-with
|
||||
|
||||
! Make sure 24-bit strings work
|
||||
"hello world" "s" set
|
||||
|
|
|
@ -24,7 +24,7 @@ CONSTANT: initial-dt 5
|
|||
: <boids-gadget> ( -- gadget )
|
||||
boids-gadget new
|
||||
t >>clipped?
|
||||
${ width height } >>pref-dim
|
||||
array[ width height ] >>pref-dim
|
||||
initial-population random-boids >>boids
|
||||
initial-behaviours >>behaviours
|
||||
initial-dt >>dt ;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
USING: kernel literals llvm llvm.ffi system tools.test ;
|
||||
IN: llvm.tests
|
||||
|
||||
${ cpu x86.64? "x86-64" "x86-32" ? } [
|
||||
array[ cpu x86.64? "x86-64" "x86-32" ? ] [
|
||||
initialize-native-target
|
||||
LLVMGetFirstTarget LLVMGetTargetName
|
||||
] unit-test
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
USING: kernel layouts literals math math.cardinality
|
||||
math.functions random sequences tools.test ;
|
||||
|
||||
${ fixnum-bits } [ 0 trailing-zeros ] unit-test
|
||||
array[ fixnum-bits ] [ 0 trailing-zeros ] unit-test
|
||||
{ 0 } [ 0b1 trailing-zeros ] unit-test
|
||||
{ 1 } [ 0b10 trailing-zeros ] unit-test
|
||||
{ 2 } [ 0b100 trailing-zeros ] unit-test
|
||||
|
|
|
@ -54,7 +54,7 @@ TUPLE: triplets-count primitives total ;
|
|||
: next-triplet ( triplet T -- triplet' ) [ 1array ] [ m. ] bi* first ;
|
||||
|
||||
: candidates-triplets ( seed -- candidates )
|
||||
${ T1 T2 T3 } [ next-triplet ] with map ;
|
||||
array[ T1 T2 T3 ] [ next-triplet ] with map ;
|
||||
|
||||
: add-triplets ( current-triples limit triplet -- stop )
|
||||
sum 2dup > [
|
||||
|
|
|
@ -10,19 +10,19 @@ CONSTANT: stylesheet
|
|||
H{
|
||||
{ default-span-style
|
||||
H{
|
||||
{ font-name $ default-sans-serif-font-name }
|
||||
{ font-size $[ default-font-size 3 * ] }
|
||||
{ font-name 1[ default-sans-serif-font-name ] }
|
||||
{ font-size 1[ default-font-size 3 * ] }
|
||||
}
|
||||
}
|
||||
{ default-block-style
|
||||
H{
|
||||
{ wrap-margin $[ default-font-size 92 * ] }
|
||||
{ wrap-margin 1[ default-font-size 92 * ] }
|
||||
}
|
||||
}
|
||||
{ code-char-style
|
||||
H{
|
||||
{ font-name $ default-monospace-font-name }
|
||||
{ font-size $[ default-font-size 3 * ] }
|
||||
{ font-name 1[ default-monospace-font-name ] }
|
||||
{ font-size 1[ default-font-size 3 * ] }
|
||||
}
|
||||
}
|
||||
{ code-style
|
||||
|
@ -32,19 +32,17 @@ CONSTANT: stylesheet
|
|||
}
|
||||
{ snippet-style
|
||||
H{
|
||||
{ font-name $ default-monospace-font-name }
|
||||
{ font-size $[ default-font-size 3 * ] }
|
||||
{ font-name 1[ default-monospace-font-name ] }
|
||||
{ font-size 1[ default-font-size 3 * ] }
|
||||
{ foreground T{ rgba f 0.1 0.1 0.4 1 } }
|
||||
}
|
||||
}
|
||||
{ table-content-style
|
||||
H{ { wrap-margin $[ default-font-size 83 * ] } }
|
||||
H{ { wrap-margin 1[ default-font-size 83 * ] } }
|
||||
}
|
||||
{ list-style
|
||||
H{
|
||||
{ table-gap ${ default-font-size 5/6 *
|
||||
default-font-size 10/6 * }
|
||||
}
|
||||
{ table-gap array[ default-font-size 5/6 * default-font-size 10/6 * ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,8 +50,8 @@ CONSTANT: stylesheet
|
|||
: $title ( string -- )
|
||||
[
|
||||
H{
|
||||
{ font-name $ default-sans-serif-font-name }
|
||||
{ font-size $[ default-font-size 4 * ] }
|
||||
{ font-name 1[ default-sans-serif-font-name ] }
|
||||
{ font-size 1[ default-font-size 4 * ] }
|
||||
} format
|
||||
] ($block) ;
|
||||
|
||||
|
@ -70,7 +68,7 @@ CONSTANT: stylesheet
|
|||
[
|
||||
<gadget>
|
||||
divider-interior >>interior
|
||||
${ default-font-size 67 * default-font-size 5/6 * } >>dim
|
||||
array[ default-font-size 67 * default-font-size 5/6 * ] >>dim
|
||||
{ 1 0 } >>orientation
|
||||
gadget.
|
||||
] ($block) ;
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
! (c)2009 Joe Groff, see BSD license
|
||||
USING: accessors literals math math.affine-transforms
|
||||
math.functions math.trig multiline sequences svg tools.test xml
|
||||
xml.traversal ;
|
||||
USING: accessors combinators.smart.syntax literals math
|
||||
math.affine-transforms math.functions math.trig multiline
|
||||
sequences svg tools.test xml xml.traversal ;
|
||||
IN: svg.tests
|
||||
|
||||
${ { 1.0 2.25 } { -3.0 4.0 } { 5.5 0.5 } <affine-transform> } [
|
||||
array[ { 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> } [
|
||||
array[ { 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> } [
|
||||
array[ { 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> } [
|
||||
array[ { 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> } [
|
||||
array[ { 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> } [
|
||||
array[ { 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
|
||||
|
||||
|
@ -55,11 +55,11 @@ ${ { 2.0 0.0 } { 0.0 4.0 } { 0.0 0.0 } <affine-transform> } [
|
|||
} <affine-transform> 0.001 a~
|
||||
] unit-test
|
||||
|
||||
${
|
||||
array[
|
||||
{ $[ 30 deg>rad cos ] $[ 30 deg>rad sin ] }
|
||||
{ $[ -30 deg>rad sin ] $[ 30 deg>rad cos ] }
|
||||
{ 1.0 2.0 } <affine-transform>
|
||||
} [
|
||||
] [
|
||||
"translate(1 2) rotate(30)" svg-transform>affine-transform
|
||||
] unit-test
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
! Copyright (C) 2017 Alexander Ilin.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays colors.constants kernel literals locals
|
||||
math math.constants math.functions sequences ui ui.gadgets
|
||||
ui.gadgets.charts ui.gadgets.charts.axes ui.gadgets.charts.lines
|
||||
;
|
||||
USING: accessors arrays colors.constants
|
||||
combinators.smart.syntax kernel literals locals math
|
||||
math.constants math.functions sequences ui ui.gadgets
|
||||
ui.gadgets.charts ui.gadgets.charts.axes ui.gadgets.charts.lines ;
|
||||
IN: ui.gadgets.charts.demos
|
||||
|
||||
CONSTANT: -pi $[ pi neg ]
|
||||
|
@ -11,17 +11,17 @@ CONSTANT: -pi $[ pi neg ]
|
|||
: sine-wave ( steps -- seq )
|
||||
[ <iota> ] keep
|
||||
pi 2 * swap / [ * pi - dup sin 2array ] curry map
|
||||
${ pi $[ pi sin ] } suffix ;
|
||||
array[ pi 1[ pi sin ] ] suffix ;
|
||||
|
||||
: cosine-wave ( steps -- seq )
|
||||
[ <iota> ] keep
|
||||
pi 2 * swap / [ * pi - dup cos 2array ] curry map
|
||||
${ pi $[ pi cos ] } suffix ;
|
||||
array[ pi 1[ pi cos ] ] suffix ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
:: (chart-demo) ( n -- )
|
||||
chart new ${ ${ -pi pi } { -1 1 } } >>axes
|
||||
chart new array[ array[ -pi pi ] { -1 1 } ] >>axes
|
||||
line new color: blue >>color n sine-wave >>data add-gadget
|
||||
line new color: red >>color n cosine-wave >>data add-gadget
|
||||
vertical-axis new add-gadget
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2014 Jon Harper.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel literals sequences tools.test yaml.conversion
|
||||
yaml.ffi ;
|
||||
USING: combinators.smart.syntax kernel literals sequences
|
||||
tools.test yaml.conversion yaml.ffi ;
|
||||
IN: yaml.conversion.tests
|
||||
|
||||
: resolve-test ( res str -- ) [ f resolve-plain-scalar ] curry unit-test ;
|
||||
|
@ -9,14 +9,14 @@ IN: yaml.conversion.tests
|
|||
[ f resolve-plain-scalar ] curry unit-test
|
||||
] with each ;
|
||||
|
||||
${ YAML_NULL_TAG } "null" resolve-test
|
||||
${ YAML_NULL_TAG } "" resolve-test
|
||||
${ YAML_STR_TAG } "\"\"" resolve-test
|
||||
${ YAML_BOOL_TAG } { "true" "True" "false" "FALSE" } resolve-tests
|
||||
${ YAML_INT_TAG } { "0" "0o7" "0x3A" "-19" } resolve-tests
|
||||
${ YAML_FLOAT_TAG } { "0." "-0.0" ".5" "+12e03" "-2E+05" } resolve-tests
|
||||
${ YAML_FLOAT_TAG } { ".inf" "-.Inf" "+.INF" ".NAN" } resolve-tests
|
||||
${ YAML_TIMESTAMP_TAG } {
|
||||
array[ YAML_NULL_TAG ] "null" resolve-test
|
||||
array[ YAML_NULL_TAG ] "" resolve-test
|
||||
array[ YAML_STR_TAG ] "\"\"" resolve-test
|
||||
array[ YAML_BOOL_TAG ] { "true" "True" "false" "FALSE" } resolve-tests
|
||||
array[ YAML_INT_TAG ] { "0" "0o7" "0x3A" "-19" } resolve-tests
|
||||
array[ YAML_FLOAT_TAG ] { "0." "-0.0" ".5" "+12e03" "-2E+05" } resolve-tests
|
||||
array[ YAML_FLOAT_TAG ] { ".inf" "-.Inf" "+.INF" ".NAN" } resolve-tests
|
||||
array[ YAML_TIMESTAMP_TAG ] {
|
||||
"2001-12-15T02:59:43.1Z"
|
||||
"2001-12-14t21:59:43.10-05:00"
|
||||
"2001-12-14 21:59:43.10 -5"
|
||||
|
@ -24,5 +24,5 @@ ${ YAML_TIMESTAMP_TAG } {
|
|||
"2002-12-14"
|
||||
"2001-2-4 \t\t 1:59:43.10 \t\t -5:00"
|
||||
} resolve-tests
|
||||
${ YAML_STR_TAG } "<<" resolve-test
|
||||
${ YAML_MERGE_TAG } [ "<<" t resolve-plain-scalar ] unit-test
|
||||
array[ YAML_STR_TAG ] "<<" resolve-test
|
||||
array[ YAML_MERGE_TAG ] [ "<<" t resolve-plain-scalar ] unit-test
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2014 Jon Harper.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: assocs grouping kernel linked-assocs literals locals
|
||||
namespaces sequences tools.test yaml yaml.config yaml.ffi
|
||||
yaml.private calendar yaml.conversion ;
|
||||
USING: assocs calendar combinators.smart.syntax grouping kernel
|
||||
linked-assocs literals locals namespaces sequences tools.test
|
||||
yaml yaml.config yaml.conversion yaml.ffi yaml.private ;
|
||||
IN: yaml.tests
|
||||
|
||||
! TODO real conformance tests here
|
||||
|
@ -45,9 +45,9 @@ CONSTANT: test-represented-string "--- !!seq
|
|||
...
|
||||
"
|
||||
|
||||
${ test-obj } [ $ test-string yaml> ] unit-test
|
||||
${ test-represented-string } [ $ test-obj >yaml ] unit-test
|
||||
${ test-represented-string } [ $ test-represented-string yaml> >yaml ] unit-test
|
||||
array[ test-obj ] [ test-string yaml> ] unit-test
|
||||
array[ test-represented-string ] [ test-obj >yaml ] unit-test
|
||||
array[ test-represented-string ] [ test-represented-string yaml> >yaml ] unit-test
|
||||
|
||||
! Non-scalar key
|
||||
CONSTANT: complex-key H{ { { "foo" } "bar" } }
|
||||
|
@ -58,7 +58,7 @@ CONSTANT: complex-key-represented "--- !!map
|
|||
...
|
||||
"
|
||||
|
||||
${ complex-key } [ $ complex-key-represented yaml> ] unit-test
|
||||
array[ complex-key ] [ complex-key-represented yaml> ] unit-test
|
||||
|
||||
! Multiple docs
|
||||
CONSTANT: test-docs "--- !!str a
|
||||
|
@ -73,9 +73,9 @@ CONSTANT: test-docs "--- !!str a
|
|||
"
|
||||
CONSTANT: test-objs { "a" { "b" "c" } H{ { "d" "e" } } }
|
||||
|
||||
${ test-objs } [ $ test-docs yaml-docs> ] unit-test
|
||||
${ test-docs } [ $ test-objs >yaml-docs ] unit-test
|
||||
${ test-docs } [ $ test-docs yaml-docs> >yaml-docs ] unit-test
|
||||
array[ test-objs ] [ test-docs yaml-docs> ] unit-test
|
||||
array[ test-docs ] [ test-objs >yaml-docs ] unit-test
|
||||
array[ test-docs ] [ test-docs yaml-docs> >yaml-docs ] unit-test
|
||||
|
||||
! Misc types
|
||||
CONSTANT: test-types { 1 t f 1.0 }
|
||||
|
@ -87,8 +87,8 @@ CONSTANT: test-represented-types "--- !!seq
|
|||
...
|
||||
"
|
||||
|
||||
${ test-types } [ $ test-represented-types yaml> ] unit-test
|
||||
${ test-types } [ $ test-types >yaml yaml> ] unit-test
|
||||
array[ test-types ] [ test-represented-types yaml> ] unit-test
|
||||
array[ test-types ] [ test-types >yaml yaml> ] unit-test
|
||||
|
||||
|
||||
! Anchors
|
||||
|
@ -104,11 +104,11 @@ CONSTANT: test-anchors-obj {
|
|||
"1" "1" { "1" "2" } { "1" "2" } H{ { "1" "one" } } H{ { "1" "one" } }
|
||||
}
|
||||
|
||||
${ test-anchors-obj } [ $ test-anchors yaml> ] unit-test
|
||||
${ test-anchors-obj } [ $ test-anchors-obj >yaml yaml> ] unit-test
|
||||
array[ test-anchors-obj ] [ test-anchors yaml> ] unit-test
|
||||
array[ test-anchors-obj ] [ test-anchors-obj >yaml yaml> ] unit-test
|
||||
! and test indentity
|
||||
{ t } [ $ test-anchors yaml> 2 group [ all-eq? ] all? ] unit-test
|
||||
{ t } [ $ test-anchors yaml> >yaml yaml> 2 group [ all-eq? ] all? ] unit-test
|
||||
{ t } [ test-anchors yaml> 2 group [ all-eq? ] all? ] unit-test
|
||||
{ t } [ test-anchors yaml> >yaml yaml> 2 group [ all-eq? ] all? ] unit-test
|
||||
|
||||
! Anchors and fancy types
|
||||
CONSTANT: fancy-anchors "- &1 [ \"foo\" ]
|
||||
|
@ -119,8 +119,8 @@ CONSTANT: fancy-anchors "- &1 [ \"foo\" ]
|
|||
CONSTANT: fancy-anchors-obj {
|
||||
{ "foo" } HS{ { "foo" } } HS{ { "foo" } }
|
||||
}
|
||||
${ fancy-anchors-obj } [ $ fancy-anchors yaml> ] unit-test
|
||||
${ fancy-anchors-obj } [ $ fancy-anchors-obj >yaml yaml> ] unit-test
|
||||
array[ fancy-anchors-obj ] [ fancy-anchors yaml> ] unit-test
|
||||
array[ fancy-anchors-obj ] [ fancy-anchors-obj >yaml yaml> ] unit-test
|
||||
|
||||
! Simple Recursive output
|
||||
: simple-recursive-list ( -- obj )
|
||||
|
@ -131,9 +131,9 @@ CONSTANT: simple-recursive-list-anchored T{ yaml-anchor f "0" {
|
|||
CONSTANT: simple-recursive-list-yaml "&0
|
||||
- *0"
|
||||
|
||||
${ simple-recursive-list-anchored } [ simple-recursive-list replace-identities ] unit-test
|
||||
${ simple-recursive-list-anchored } [ $ simple-recursive-list-yaml yaml> replace-identities ] unit-test
|
||||
${ simple-recursive-list-anchored } [ simple-recursive-list >yaml yaml> replace-identities ] unit-test
|
||||
array[ simple-recursive-list-anchored ] [ simple-recursive-list replace-identities ] unit-test
|
||||
array[ simple-recursive-list-anchored ] [ simple-recursive-list-yaml yaml> replace-identities ] unit-test
|
||||
array[ simple-recursive-list-anchored ] [ simple-recursive-list >yaml yaml> replace-identities ] unit-test
|
||||
|
||||
! many recursive outputs
|
||||
: many-recursive-objects ( -- obj )
|
||||
|
@ -145,7 +145,7 @@ CONSTANT: many-recursive-objects-anchored {
|
|||
T{ yaml-anchor f "3" { T{ yaml-alias f "3" } } }
|
||||
}
|
||||
|
||||
${ many-recursive-objects-anchored } [ many-recursive-objects replace-identities ] unit-test
|
||||
array[ many-recursive-objects-anchored ] [ many-recursive-objects replace-identities ] unit-test
|
||||
|
||||
! Advanced recursive outputs
|
||||
:: transitive-recursive-objects ( -- obj )
|
||||
|
@ -158,7 +158,7 @@ CONSTANT: transitive-recursive-objects-anchored T{ yaml-anchor f "0" {
|
|||
H{ { HS{ T{ yaml-alias f "0" } } T{ yaml-alias f "0" } } }
|
||||
} }
|
||||
|
||||
${ transitive-recursive-objects-anchored } [ transitive-recursive-objects replace-identities ] unit-test
|
||||
array[ transitive-recursive-objects-anchored ] [ transitive-recursive-objects replace-identities ] unit-test
|
||||
|
||||
|
||||
! Lifted from pyyaml
|
||||
|
@ -187,8 +187,8 @@ ${ transitive-recursive-objects-anchored } [ transitive-recursive-objects replac
|
|||
! n: is a string
|
||||
! "
|
||||
!
|
||||
! ${ construct-bool-obj } [ $ construct-bool-str yaml> ] unit-test
|
||||
! ${ construct-bool-obj } [ $ construct-bool-obj >yaml yaml> ] unit-test
|
||||
! array[ construct-bool-obj ] [ construct-bool-str yaml> ] unit-test
|
||||
! array[ construct-bool-obj ] [ construct-bool-obj >yaml yaml> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-int
|
||||
|
@ -210,8 +210,8 @@ ${ transitive-recursive-objects-anchored } [ transitive-recursive-objects replac
|
|||
! sexagesimal: 190:20:30
|
||||
! "
|
||||
!
|
||||
! ${ construct-int-obj } [ $ construct-int-str yaml> ] unit-test
|
||||
! ${ construct-int-obj } [ $ construct-int-obj >yaml yaml> ] unit-test
|
||||
! array[ construct-int-obj ] [ construct-int-str yaml> ] unit-test
|
||||
! array[ construct-int-obj ] [ construct-int-obj >yaml yaml> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-map
|
||||
|
@ -232,8 +232,8 @@ Block style: !!map
|
|||
Flow style: !!map { Clark: Evans, Brian: Ingerson, Oren: Ben-Kiki }
|
||||
"
|
||||
|
||||
${ construct-map-obj } [ $ construct-map-str yaml> ] unit-test
|
||||
${ construct-map-obj } [ $ construct-map-obj >yaml yaml> ] unit-test
|
||||
array[ construct-map-obj ] [ construct-map-str yaml> ] unit-test
|
||||
array[ construct-map-obj ] [ construct-map-obj >yaml yaml> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-null
|
||||
|
@ -273,9 +273,9 @@ sparse:
|
|||
- Null
|
||||
"
|
||||
|
||||
${ construct-null-obj } [ $ construct-null-str yaml-docs> ] unit-test
|
||||
array[ construct-null-obj ] [ construct-null-str yaml-docs> ] unit-test
|
||||
! TODO Decide what to do with null -> f -> false
|
||||
! ${ construct-null-obj } [ $ construct-null-obj >yaml-docs yaml-docs> ] unit-test
|
||||
! array[ construct-null-obj ] [ construct-null-obj >yaml-docs yaml-docs> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-seq
|
||||
|
@ -300,8 +300,8 @@ Flow style: !!seq [ Mercury, Venus, Earth, Mars, # Rocks
|
|||
Pluto ] # Overrated
|
||||
"
|
||||
|
||||
${ construct-seq-obj } [ $ construct-seq-str yaml> ] unit-test
|
||||
${ construct-seq-obj } [ $ construct-seq-obj >yaml yaml> ] unit-test
|
||||
array[ construct-seq-obj ] [ construct-seq-str yaml> ] unit-test
|
||||
array[ construct-seq-obj ] [ construct-seq-obj >yaml yaml> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-set
|
||||
|
@ -330,8 +330,8 @@ baseball players: !!set
|
|||
baseball teams: !!set { Boston Red Sox, Detroit Tigers, New York Yankees }
|
||||
"
|
||||
|
||||
${ construct-set-obj } [ $ construct-set-str yaml> ] unit-test
|
||||
${ construct-set-obj } [ $ construct-set-obj >yaml yaml> ] unit-test
|
||||
array[ construct-set-obj ] [ construct-set-str yaml> ] unit-test
|
||||
array[ construct-set-obj ] [ construct-set-obj >yaml yaml> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-binary
|
||||
|
@ -398,8 +398,8 @@ description:
|
|||
The binary value above is a tiny arrow encoded as a gif image.
|
||||
"
|
||||
|
||||
${ construct-binary-obj } [ $ construct-binary-str yaml> ] unit-test
|
||||
${ construct-binary-obj } [ $ construct-binary-obj >yaml yaml> ] unit-test
|
||||
array[ construct-binary-obj ] [ construct-binary-str yaml> ] unit-test
|
||||
array[ construct-binary-obj ] [ construct-binary-obj >yaml yaml> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-merge
|
||||
|
@ -459,8 +459,8 @@ CONSTANT: construct-merge-str "---
|
|||
label: center/big
|
||||
"
|
||||
|
||||
${ construct-merge-obj } [ $ construct-merge-str yaml> ] unit-test
|
||||
${ construct-merge-obj } [ $ construct-merge-obj2 >yaml yaml> ] unit-test
|
||||
array[ construct-merge-obj ] [ construct-merge-str yaml> ] unit-test
|
||||
array[ construct-merge-obj ] [ construct-merge-obj2 >yaml yaml> ] unit-test
|
||||
|
||||
! More merge tests
|
||||
! see http://sourceforge.net/p/yaml/mailman/message/12308050
|
||||
|
@ -475,15 +475,15 @@ CONSTANT: nested-merge-obj H{
|
|||
{ "baz" 3 }
|
||||
}
|
||||
|
||||
${ nested-merge-obj } [ $ nested-merge-str yaml> ] unit-test
|
||||
${ nested-merge-obj } [ $ nested-merge-obj >yaml yaml> ] unit-test
|
||||
array[ nested-merge-obj ] [ nested-merge-str yaml> ] unit-test
|
||||
array[ nested-merge-obj ] [ nested-merge-obj >yaml yaml> ] unit-test
|
||||
|
||||
CONSTANT: recursive-merge-str "--- &A
|
||||
<<: *A"
|
||||
CONSTANT: recursive-merge-obj H{ }
|
||||
|
||||
${ recursive-merge-obj } [ $ recursive-merge-str yaml> ] unit-test
|
||||
${ recursive-merge-obj } [ $ recursive-merge-obj >yaml yaml> ] unit-test
|
||||
array[ recursive-merge-obj ] [ recursive-merge-str yaml> ] unit-test
|
||||
array[ recursive-merge-obj ] [ recursive-merge-obj >yaml yaml> ] unit-test
|
||||
|
||||
! Compare with pyyaml
|
||||
! >>> print yaml.load("&1 {1: 2, 2: 3, 3: {4: 5, <<: *1}}")
|
||||
|
@ -511,44 +511,42 @@ CONSTANT: recursive-merge-obj3 H{
|
|||
}
|
||||
|
||||
{ t } [
|
||||
$ recursive-merge-str2 yaml> recursive-merge-obj2
|
||||
recursive-merge-str2 yaml> recursive-merge-obj2
|
||||
[ replace-identities ] bi@ =
|
||||
] unit-test
|
||||
{ t } [
|
||||
recursive-merge-obj2 >yaml yaml> recursive-merge-obj2
|
||||
[ replace-identities ] bi@ =
|
||||
] unit-test
|
||||
${ recursive-merge-obj3 } [ $ recursive-merge-str3 yaml> ] unit-test
|
||||
${ recursive-merge-obj3 } [ $ recursive-merge-obj3 >yaml yaml> ] unit-test
|
||||
array[ recursive-merge-obj3 ] [ recursive-merge-str3 yaml> ] unit-test
|
||||
array[ recursive-merge-obj3 ] [ recursive-merge-obj3 >yaml yaml> ] unit-test
|
||||
|
||||
! Serializing merge
|
||||
CONSTANT: serialize-merge-obj H{
|
||||
{ T{ yaml-merge } H{ { 1 2 } } }
|
||||
}
|
||||
CONSTANT: serialize-merge-obj2 H{ { 1 2 } }
|
||||
${ serialize-merge-obj2 } [ $ serialize-merge-obj >yaml yaml> ] unit-test
|
||||
array[ serialize-merge-obj2 ] [ serialize-merge-obj >yaml yaml> ] unit-test
|
||||
f merge [
|
||||
${ serialize-merge-obj } [ $ serialize-merge-obj >yaml yaml> ] unit-test
|
||||
array[ serialize-merge-obj ] [ serialize-merge-obj >yaml yaml> ] unit-test
|
||||
] with-variable
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-omap
|
||||
CONSTANT: construct-omap-obj H{
|
||||
{
|
||||
"Bestiary"
|
||||
$[ <linked-hash> {
|
||||
{ "aardvark" "African pig-like ant eater. Ugly." }
|
||||
{ "anteater" "South-American ant eater. Two species." }
|
||||
{ "anaconda" "South-American constrictor snake. Scaly." }
|
||||
} assoc-union! ]
|
||||
} {
|
||||
"Numbers"
|
||||
$[ <linked-hash> {
|
||||
{ "one" 1 }
|
||||
{ "two" 2 }
|
||||
{ "three" 3 }
|
||||
} assoc-union! ]
|
||||
}
|
||||
{
|
||||
"Bestiary"
|
||||
1[
|
||||
<linked-hash> {
|
||||
{ "aardvark" "African pig-like ant eater. Ugly." }
|
||||
{ "anteater" "South-American ant eater. Two species." }
|
||||
{ "anaconda" "South-American constrictor snake. Scaly." }
|
||||
} assoc-union!
|
||||
]
|
||||
} {
|
||||
"Numbers"
|
||||
1[ <linked-hash> { { "one" 1 } { "two" 2 } { "three" 3 } } assoc-union! ]
|
||||
}
|
||||
}
|
||||
|
||||
CONSTANT: construct-omap-str "# Explicitly typed ordered map (dictionary).
|
||||
|
@ -561,8 +559,8 @@ Bestiary: !!omap
|
|||
Numbers: !!omap [ one: 1, two: 2, three : 3 ]
|
||||
"
|
||||
|
||||
${ construct-omap-obj } [ $ construct-omap-str yaml> ] unit-test
|
||||
${ construct-omap-obj } [ construct-omap-obj >yaml yaml> ] unit-test
|
||||
array[ construct-omap-obj ] [ construct-omap-str yaml> ] unit-test
|
||||
array[ construct-omap-obj ] [ construct-omap-obj >yaml yaml> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-pairs
|
||||
|
@ -605,8 +603,8 @@ CONSTANT: construct-pairs-obj-roundtripped H{
|
|||
}
|
||||
}
|
||||
|
||||
${ construct-pairs-obj } [ $ construct-pairs-str yaml> ] unit-test
|
||||
${ construct-pairs-obj } [ $ construct-pairs-obj >yaml yaml> ] unit-test
|
||||
array[ construct-pairs-obj ] [ construct-pairs-str yaml> ] unit-test
|
||||
array[ construct-pairs-obj ] [ construct-pairs-obj >yaml yaml> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-timestamp
|
||||
|
@ -684,8 +682,8 @@ date (00:00:00Z): 2002-12-14
|
|||
crazy: 2002-2-4 \t\t \t 1:02:59.123 \t\t +10:23
|
||||
"
|
||||
|
||||
${ construct-timestamp-obj } [ $ construct-timestamp-str yaml> ] unit-test
|
||||
${ construct-timestamp-obj } [ $ construct-timestamp-obj >yaml yaml> ] unit-test
|
||||
array[ construct-timestamp-obj ] [ construct-timestamp-str yaml> ] unit-test
|
||||
array[ construct-timestamp-obj ] [ construct-timestamp-obj >yaml yaml> ] unit-test
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
! construct-value
|
||||
|
@ -715,16 +713,16 @@ link with:
|
|||
version: 2.3
|
||||
"
|
||||
|
||||
${ construct-value-safe-obj } [ $ construct-value-str yaml-docs> ] unit-test
|
||||
${ construct-value-safe-obj } [ $ construct-value-safe-obj >yaml-docs yaml-docs> ] unit-test
|
||||
array[ construct-value-safe-obj ] [ construct-value-str yaml-docs> ] unit-test
|
||||
array[ construct-value-safe-obj ] [ construct-value-safe-obj >yaml-docs yaml-docs> ] unit-test
|
||||
f value [
|
||||
${ construct-value-unsafe-obj } [ $ construct-value-str yaml-docs> ] unit-test
|
||||
${ construct-value-unsafe-obj } [ $ construct-value-unsafe-obj >yaml-docs yaml-docs> ] unit-test
|
||||
${ construct-value-safe-obj } [
|
||||
$ construct-value-str yaml-docs> [
|
||||
dup "link with" swap [ [ scalar-value ] map ] change-at
|
||||
] map
|
||||
] unit-test
|
||||
array[ construct-value-unsafe-obj ] [ construct-value-str yaml-docs> ] unit-test
|
||||
array[ construct-value-unsafe-obj ] [ construct-value-unsafe-obj >yaml-docs yaml-docs> ] unit-test
|
||||
array[ construct-value-safe-obj ] [
|
||||
construct-value-str yaml-docs> [
|
||||
dup "link with" swap [ [ scalar-value ] map ] change-at
|
||||
] map
|
||||
] unit-test
|
||||
] with-variable
|
||||
|
||||
! Serializing value
|
||||
|
@ -732,9 +730,9 @@ CONSTANT: serialize-value-obj H{
|
|||
{ T{ yaml-value } 1 }
|
||||
}
|
||||
CONSTANT: serialize-value-obj2 1
|
||||
${ serialize-value-obj2 } [ $ serialize-value-obj >yaml yaml> ] unit-test
|
||||
array[ serialize-value-obj2 ] [ serialize-value-obj >yaml yaml> ] unit-test
|
||||
f value [
|
||||
${ serialize-value-obj } [ $ serialize-value-obj >yaml yaml> ] unit-test
|
||||
array[ serialize-value-obj ] [ serialize-value-obj >yaml yaml> ] unit-test
|
||||
] with-variable
|
||||
|
||||
! !!!!!!!!!!!!!!!
|
||||
|
|
Loading…
Reference in New Issue