1 USING: bson.reader bson.writer bson.constants byte-arrays io.encodings.binary
2 io.streams.byte-array tools.test literals calendar kernel math ;
6 : turnaround ( value -- value )
7 assoc>bv binary [ H{ } clone stream>assoc ] with-byte-reader ;
9 { H{ { "a" "a string" } } } [ H{ { "a" "a string" } } turnaround ] unit-test
11 { H{ { "a" "a string" } { "b" H{ { "a" "アップルからの最新のニュースや情報を読む" } } } } }
12 [ H{ { "a" "a string" } { "b" H{ { "a" "アップルからの最新のニュースや情報を読む" } } } } turnaround ] unit-test
14 { H{ { "a list" { 1 2.234 "hello world" } } } }
15 [ H{ { "a list" { 1 2.234 "hello world" } } } turnaround ] unit-test
17 { H{ { "a quotation" [ 1 2 + ] } } }
18 [ H{ { "a quotation" [ 1 2 + ] } } turnaround ] unit-test
20 { H{ { "ref" T{ dbref f "a" "b" "c" } } } }
21 [ H{ { "ref" T{ dbref f "a" "b" "c" } } } turnaround ] unit-test
23 { H{ { "a date" T{ timestamp { year 2009 }
28 { second 40+77/1000 } } } }
30 [ H{ { "a date" T{ timestamp { year 2009 }
35 { second 40+15437/200000 }
36 { gmt-offset T{ duration { hour 2 } } } } } } turnaround
39 { H{ { "nested" H{ { "a" "a string" } { "b" H{ { "a" "a string" } } } } }
40 { "ref" T{ dbref f "a" "b" "c" } }
41 { "array" H{ { "a list" { 1 2.234 "hello world" } } } }
42 { "quot" [ 1 2 + ] } }
44 [ H{ { "nested" H{ { "a" "a string" } { "b" H{ { "a" "a string" } } } } }
45 { "ref" T{ dbref f "a" "b" "c" } }
46 { "array" H{ { "a list" { 1 2.234 "hello world" } } } }
47 { "quot" [ 1 2 + ] } } turnaround ] unit-test