Changeset: 934f4b0cef72 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=934f4b0cef72 Modified Files: monetdb5/extras/jaql/Tests/All monetdb5/extras/jaql/Tests/json00.mal monetdb5/extras/jaql/Tests/json00.stable.err monetdb5/extras/jaql/Tests/json00.stable.out monetdb5/extras/jaql/jsontest.mal Branch: jacqueline Log Message:
json: add test for the JSON shredder and serialiser diffs (167 lines): diff --git a/monetdb5/extras/jaql/Tests/All b/monetdb5/extras/jaql/Tests/All --- a/monetdb5/extras/jaql/Tests/All +++ b/monetdb5/extras/jaql/Tests/All @@ -1,3 +1,5 @@ +json00 + expand00 filter00 transform00 diff --git a/monetdb5/extras/jaql/Tests/json00.mal b/monetdb5/extras/jaql/Tests/json00.mal new file mode 100644 --- /dev/null +++ b/monetdb5/extras/jaql/Tests/json00.mal @@ -0,0 +1,25 @@ +s := io.stdout(); + +(j1,j2,j3,j4,j5,j6,j7) := json.shred("[ 1,3, 5]"); +json.print(s, j1,j2,j3,j4,j5,j6,j7); + +(j1,j2,j3,j4,j5,j6,j7) := json.shred("[\"hello\",\"world\"]"); +json.print(s, j1,j2,j3,j4,j5,j6,j7); + +(j1,j2,j3,j4,j5,j6,j7) := json.shred("[ { \"key\": \"value\", \"key2\": 5.3 }, null, 4, true ]"); +json.print(s, j1,j2,j3,j4,j5,j6,j7); + +(j1,j2,j3,j4,j5,j6,j7) := json.shred("[{\"from\":101,\"to\":[20,81,94],\"ts\":1234567,\"msg\":\"Hello world!\"}]"); +json.print(s, j1,j2,j3,j4,j5,j6,j7); + +# this shouldn't exist +(i1,i2,i3,i4,i5,i6,i7) := json.load("demo"); +catch MALException:str; + io.printf("!%s\n", MALException); +exit MALException; + +json.store("demo", j1,j2,j3,j4,j5,j6,j7); +(i1,i2,i3,i4,i5,i6,i7) := json.load("demo"); +json.print(s, i1,i2,i3,i4,i5,i6,i7); + +json.drop("demo"); diff --git a/monetdb5/extras/jaql/Tests/json00.stable.err b/monetdb5/extras/jaql/Tests/json00.stable.err new file mode 100644 --- /dev/null +++ b/monetdb5/extras/jaql/Tests/json00.stable.err @@ -0,0 +1,31 @@ +stderr of test 'json00` in directory 'extras/jaql` itself: + + +# 11:20:37 > +# 11:20:37 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "gdk_dbfarm=/net/sofia.ins.cwi.nl/export/scratch1/fabian/tmp/mtest-jacqueline-sofia.ins.cwi.nl/five/dbfarm" "--set" "mapi_open=true" "--set" "mapi_port=39682" "--set" "monet_prompt=" "--trace" "--forcemito" "--set" "mal_listing=2" "--dbname=mTests_extras_jaql" "json00.mal" +# 11:20:37 > + +# builtin opt gdk_dbname = demo +# builtin opt gdk_dbfarm = /ufs/fabian/scratch/ssd/monetdb/jacqueline/program-x86_64/var/lib/monetdb5/dbfarm +# builtin opt gdk_debug = 0 +# builtin opt gdk_alloc_map = no +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt gdk_dbfarm = /net/sofia.ins.cwi.nl/export/scratch1/fabian/tmp/mtest-jacqueline-sofia.ins.cwi.nl/five/dbfarm +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 39682 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbname = mTests_extras_jaql + +# 11:20:37 > +# 11:20:37 > "Done." +# 11:20:37 > + diff --git a/monetdb5/extras/jaql/Tests/json00.stable.out b/monetdb5/extras/jaql/Tests/json00.stable.out new file mode 100644 --- /dev/null +++ b/monetdb5/extras/jaql/Tests/json00.stable.out @@ -0,0 +1,49 @@ +stdout of test 'json00` in directory 'extras/jaql` itself: + + +# 11:20:37 > +# 11:20:37 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "gdk_dbfarm=/net/sofia.ins.cwi.nl/export/scratch1/fabian/tmp/mtest-jacqueline-sofia.ins.cwi.nl/five/dbfarm" "--set" "mapi_open=true" "--set" "mapi_port=39682" "--set" "monet_prompt=" "--trace" "--forcemito" "--set" "mal_listing=2" "--dbname=mTests_extras_jaql" "json00.mal" +# 11:20:37 > + +# MonetDB 5 server v11.8.0 "jacqueline-497cf791babb+" +# Serving database 'mTests_extras_jaql', using 8 threads +# Compiled for x86_64-pc-linux-gnu/64bit with 64bit OIDs dynamically linked +# Found 15.662 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2012 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://sofia.ins.cwi.nl:39682/ +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded +# MonetDB/DataCell module not loaded: MALException:jaql.context:JAQL environment not found +function user.main():void; + s := io.stdout(); + (j1,j2,j3,j4,j5,j6,j7) := json.shred("[ 1,3, 5]"); + json.print(s,j1,j2,j3,j4,j5,j6,j7); + (j1,j2,j3,j4,j5,j6,j7) := json.shred("[\"hello\",\"world\"]"); + json.print(s,j1,j2,j3,j4,j5,j6,j7); + (j1,j2,j3,j4,j5,j6,j7) := json.shred("[ { \"key\": \"value\", \"key2\": 5.3 }, null, 4, true ]"); + json.print(s,j1,j2,j3,j4,j5,j6,j7); + (j1,j2,j3,j4,j5,j6,j7) := json.shred("[{\"from\":101,\"to\":[20,81,94],\"ts\":1234567,\"msg\":\"Hello world!\"}]"); + json.print(s,j1,j2,j3,j4,j5,j6,j7); +# this shouldn't exist + (i1,i2,i3,i4,i5,i6,i7) := json.load("demo"); +catch MALException:str ; + io.printf("!%s\n",MALException); +exit MALException:str ; + json.store("demo",j1,j2,j3,j4,j5,j6,j7); + (i1,i2,i3,i4,i5,i6,i7) := json.load("demo"); + json.print(s,i1,i2,i3,i4,i5,i6,i7); + json.drop("demo"); +end main; +[ 1, 3, 5 ] +[ "hello", "world" ] +[ { "key": "value", "key2": 5.300000 }, null, 4, true ] +[ { "from": 101, "to": [ 20, 81, 94 ], "ts": 1234567, "msg": "Hello world!" } ] +!MALException:json.store:no such JSON object with name: demo +[ { "from": 101, "to": [ 20, 81, 94 ], "ts": 1234567, "msg": "Hello world!" } ] + +# 11:20:37 > +# 11:20:37 > "Done." +# 11:20:37 > + diff --git a/monetdb5/extras/jaql/jsontest.mal b/monetdb5/extras/jaql/jsontest.mal deleted file mode 100644 --- a/monetdb5/extras/jaql/jsontest.mal +++ /dev/null @@ -1,33 +0,0 @@ -# JSON: [ "hello", "world" ] - -include json; - -x := json.shred("[ 1,3, 5]"); -s := io.stdout(); -json.print(s, x); - -x := json.shred("[\"hello\",\"world\"]"); -json.print(s, x); - -x := json.shred("[ { \"key\": \"value\", \"key2\": 5.3 }, null, 4, true ]"); -json.print(s, x); - -x := json.shred("[{\"from\":101,\"to\":[20,81,94],\"ts\":1234567,\"msg\":\"Hello world!\"}]"); -json.print(s, x); - -a := json.bind_str(x); -io.print(a); -b := json.bind_dbl(x); -io.print(b); - -# this shouldn't exist -y := json.load("demo"); -catch MALException:str; - io.printf("!%s\n", MALException); -exit MALException; - -json.store(x, "demo"); -y := json.load("demo"); -json.print(s, y); - -json.drop("demo"); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list