2010-01-12 14:40:57 -05:00
|
|
|
USING: bson.reader bson.writer bson.constants byte-arrays io.encodings.binary
|
2009-07-11 05:14:17 -04:00
|
|
|
io.streams.byte-array tools.test literals calendar kernel math ;
|
|
|
|
|
|
|
|
IN: bson.tests
|
|
|
|
|
|
|
|
: turnaround ( value -- value )
|
2013-11-25 20:40:15 -05:00
|
|
|
assoc>bv binary [ H{ } clone stream>assoc ] with-byte-reader ;
|
2009-07-11 05:14:17 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ H{ { "a" "a string" } } } [ H{ { "a" "a string" } } turnaround ] unit-test
|
2009-07-11 05:14:17 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ H{ { "a" "a string" } { "b" H{ { "a" "アップルからの最新のニュースや情報を読む" } } } } }
|
2010-06-18 06:51:35 -04:00
|
|
|
[ H{ { "a" "a string" } { "b" H{ { "a" "アップルからの最新のニュースや情報を読む" } } } } turnaround ] unit-test
|
2009-07-11 05:14:17 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ H{ { "a list" { 1 2.234 "hello world" } } } }
|
2009-07-11 05:14:17 -04:00
|
|
|
[ H{ { "a list" { 1 2.234 "hello world" } } } turnaround ] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ H{ { "a quotation" [ 1 2 + ] } } }
|
2009-07-11 05:14:17 -04:00
|
|
|
[ H{ { "a quotation" [ 1 2 + ] } } turnaround ] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ H{ { "ref" T{ dbref f "a" "b" "c" } } } }
|
2010-01-12 14:40:57 -05:00
|
|
|
[ H{ { "ref" T{ dbref f "a" "b" "c" } } } turnaround ] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ H{ { "a date" T{ timestamp { year 2009 }
|
2009-07-11 05:14:17 -04:00
|
|
|
{ month 7 }
|
|
|
|
{ day 11 }
|
2009-07-13 23:59:51 -04:00
|
|
|
{ hour 9 }
|
2009-07-11 05:14:17 -04:00
|
|
|
{ minute 8 }
|
2009-07-13 23:59:51 -04:00
|
|
|
{ second 40+77/1000 } } } }
|
2015-07-03 12:39:59 -04:00
|
|
|
}
|
2009-07-11 05:14:17 -04:00
|
|
|
[ H{ { "a date" T{ timestamp { year 2009 }
|
|
|
|
{ month 7 }
|
|
|
|
{ day 11 }
|
|
|
|
{ hour 11 }
|
|
|
|
{ minute 8 }
|
|
|
|
{ second 40+15437/200000 }
|
|
|
|
{ gmt-offset T{ duration { hour 2 } } } } } } turnaround
|
|
|
|
] unit-test
|
2013-11-25 20:40:15 -05:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ H{ { "nested" H{ { "a" "a string" } { "b" H{ { "a" "a string" } } } } }
|
2010-01-12 14:40:57 -05:00
|
|
|
{ "ref" T{ dbref f "a" "b" "c" } }
|
2009-07-11 05:14:17 -04:00
|
|
|
{ "array" H{ { "a list" { 1 2.234 "hello world" } } } }
|
|
|
|
{ "quot" [ 1 2 + ] } }
|
2015-07-03 12:39:59 -04:00
|
|
|
}
|
2009-07-11 05:14:17 -04:00
|
|
|
[ H{ { "nested" H{ { "a" "a string" } { "b" H{ { "a" "a string" } } } } }
|
2010-01-12 14:40:57 -05:00
|
|
|
{ "ref" T{ dbref f "a" "b" "c" } }
|
2009-07-11 05:14:17 -04:00
|
|
|
{ "array" H{ { "a list" { 1 2.234 "hello world" } } } }
|
|
|
|
{ "quot" [ 1 2 + ] } } turnaround ] unit-test
|