]> Repositorios git - scryer-prolog.git/commitdiff
Seem to be generating JSON correctly and at a good speed too!
authorpanasenco <[email protected]>
Wed, 21 Apr 2021 00:26:38 +0000 (17:26 -0700)
committerpanasenco <[email protected]>
Wed, 21 Apr 2021 00:33:30 +0000 (17:33 -0700)
src/tests/json/pass_everything.json
src/tests/json/pass_everything.min.json [new file with mode: 0644]
src/tests/json/test_json.pl

index 086b5562b8129572073b179d71a01e4a350f7164..35d7ea34d5d82f6ed5f6ef4fbb18879d44b82ef7 100644 (file)
@@ -24,7 +24,7 @@
         "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
         "digit": "0123456789",
         "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
-        "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
+        "hex": "\u0123\u4567\u89AB\u0001\uCDEF\uabcd\u001A\uef4A",
         "true": true,
         "false": false,
         "null": null,
diff --git a/src/tests/json/pass_everything.min.json b/src/tests/json/pass_everything.min.json
new file mode 100644 (file)
index 0000000..85cf7ac
--- /dev/null
@@ -0,0 +1 @@
+["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},{},[],-42.0,true,false,null,{"":23456789011999997000000000000000000000000000000000000000000000000000000000000.0," s p a c e d ":[1.0,2.0,3.0,4.0,5.0,6.0,7.0],"# -- --> *\/":" ","\/\\\"쫾몾ꮘﳞ볚\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","E":12345678900000000000000000000000000.0,"address":"50 St. James Street","alpha":"abcdefghijklmnopqrstuvwyz","array":[],"backslash":"\\","comment":"\/\/ \/* <!-- --","compact":[1.0,2.0,3.0,4.0,5.0,6.0,7.0],"controls":"\b\f\n\r\t","digit":"0123456789","e":0.000000000000123456789,"false":false,"hex":"ģ䕧覫\u0001췯ꯍ\u001a","integer":1234567890.0,"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","null":null,"object":{},"one":1.0,"quote":"\"","quotes":"&#34; \" %22 0x22 034 &#x22;","real":-9876.54321,"slash":"\/ & \/","space":" ","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","true":true,"url":"http:\/\/www.JSON.org\/","zero":0.0},0.5,98.6,99.44,1066.0,"rosebud"]
\ No newline at end of file
index ff1969114a47d317ffa9495bb2675147a55330f6..c0c931f9a327950b8272753a3a3d62ce7d8deb3a 100644 (file)
@@ -1,5 +1,7 @@
-:- module(test_json, [test_json_read/0]).
+:- module(test_json, [test_json_read/0, test_json_minify/0]).
 
+:- use_module(library(charsio)).
+:- use_module(library(dcgs)).
 :- use_module(library(json)).
 :- use_module(library(lists)).
 :- use_module(library(os)).
@@ -25,3 +27,12 @@ test_json_read :-
     name_parse("pass_smallfloat.json", _),
     name_parse("pass_bigfloat.json", _),
     time(name_parse("pass_everything.json", _)).
+
+test_json_minify :-
+    test_path("pass_everything.min.json", MinPath),
+    open(MinPath, read, RefMin),
+    read_line_to_chars(RefMin, RefChars, []),
+    close(RefMin),
+    name_parse("pass_everything.json", Json),
+    time(once(phrase(json_chars(Json), MinChars))),
+    RefChars = MinChars.