]> gitweb.factorcode.org Git - factor.git/blob - basis/json/writer/writer-tests.factor
merge project-euler.factor
[factor.git] / basis / json / writer / writer-tests.factor
1 USING: json.writer tools.test json.reader json ;
2 IN: json.writer.tests
3
4 { "false" } [ f >json ] unit-test
5 { "true" } [ t >json ] unit-test
6 { "null" } [ json-null >json ] unit-test
7 { "0" } [ 0 >json ] unit-test
8 { "102" } [ 102 >json ] unit-test
9 { "-102" } [ -102 >json ] unit-test
10 { "102.0" } [ 102.0 >json ] unit-test
11 { "102.5" } [ 102.5 >json ] unit-test
12
13 { "[1,\"two\",3.0]" } [ { 1 "two" 3.0 } >json ] unit-test
14 { """{"US$":1.0,"EU€":1.5}""" } [ H{ { "US$" 1.0 } { "EU€" 1.5 } } >json ] unit-test
15
16 ! Random symbols are written simply as strings
17 SYMBOL: testSymbol
18 { """"testSymbol"""" } [ testSymbol >json ] unit-test
19
20 [ { 0.5 } ] [ { 1/2 } >json json> ] unit-test