diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:48:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:48:59 +0000 |
commit | c484829272cd13a738e35412498e12f2c9a194ac (patch) | |
tree | a1f5ec09629ee895bd3963fa8820b45f2f4c574b /test/json-mapped | |
parent | Initial commit. (diff) | |
download | liborcus-upstream/0.19.2.tar.xz liborcus-upstream/0.19.2.zip |
Adding upstream version 0.19.2.upstream/0.19.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/json-mapped')
18 files changed, 493 insertions, 0 deletions
diff --git a/test/json-mapped/array-of-arrays-basic/check.txt b/test/json-mapped/array-of-arrays-basic/check.txt new file mode 100644 index 0000000..28da464 --- /dev/null +++ b/test/json-mapped/array-of-arrays-basic/check.txt @@ -0,0 +1,11 @@ +data/0/2:string:"Simple list of arrays" +data/1/2:string:"This file contains a list of arrays as data and some title strings at the top." +data/3/1:numeric:1 +data/3/2:numeric:2 +data/3/3:numeric:3 +data/4/1:numeric:4 +data/4/2:numeric:5 +data/4/3:numeric:6 +data/5/1:numeric:7 +data/5/2:numeric:8 +data/5/3:numeric:9 diff --git a/test/json-mapped/array-of-arrays-basic/input.json b/test/json-mapped/array-of-arrays-basic/input.json new file mode 100644 index 0000000..a93a012 --- /dev/null +++ b/test/json-mapped/array-of-arrays-basic/input.json @@ -0,0 +1,9 @@ +[ + "Simple list of arrays", + "This file contains a list of arrays as data and some title strings at the top.", + [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9] + ] +] diff --git a/test/json-mapped/array-of-arrays-basic/map.json b/test/json-mapped/array-of-arrays-basic/map.json new file mode 100644 index 0000000..68af455 --- /dev/null +++ b/test/json-mapped/array-of-arrays-basic/map.json @@ -0,0 +1,19 @@ +{ + "sheets": ["data"], + "cells": [ + {"path": "$[0]", "sheet": "data", "row": 0, "column": 2}, + {"path": "$[1]", "sheet": "data", "row": 1, "column": 2} + ], + "ranges": [ + {"sheet": "data", "row": 3, "column": 1, + "fields": [ + {"path": "$[][][0]"}, + {"path": "$[][][1]"}, + {"path": "$[][][2]"} + ], + "row-groups": [ + {"path": "$[]"} + ] + } + ] +} diff --git a/test/json-mapped/array-of-arrays-header/check.txt b/test/json-mapped/array-of-arrays-header/check.txt new file mode 100644 index 0000000..0a8b423 --- /dev/null +++ b/test/json-mapped/array-of-arrays-header/check.txt @@ -0,0 +1,57 @@ +city/0/0:string:"RID" +city/0/1:string:"Country" +city/0/2:string:"City" +city/1/0:string:"1" +city/1/1:string:"Tunisia" +city/1/2:string:"Menzel Bourguiba" +city/2/0:string:"2" +city/2/1:string:"Indonesia" +city/2/2:string:"Jiwuwu" +city/3/0:string:"3" +city/3/1:string:"China" +city/3/2:string:"Dingtou" +city/4/0:string:"4" +city/4/1:string:"China" +city/4/2:string:"Tucheng" +city/5/0:string:"5" +city/5/1:string:"United States" +city/5/2:string:"Charlotte" +city/6/0:string:"6" +city/6/1:string:"China" +city/6/2:string:"Xuwei" +city/7/0:string:"7" +city/7/1:string:"Uganda" +city/7/2:string:"Moroto" +city/8/0:string:"8" +city/8/1:string:"Poland" +city/8/2:string:"Krasne" +city/9/0:string:"10" +city/9/1:string:"Indonesia" +city/9/2:string:"Babakan" +city/10/0:string:"11" +city/10/1:string:"Philippines" +city/10/2:string:"Vigo" +city/11/0:string:"12" +city/11/1:string:"Tajikistan" +city/11/2:string:"Konsoy" +city/12/0:string:"13" +city/12/1:string:"Honduras" +city/12/2:string:"La Estancia" +city/13/0:string:"14" +city/13/1:string:"Japan" +city/13/2:string:"Yatsushiro" +city/14/0:string:"15" +city/14/1:string:"Mexico" +city/14/2:string:"Lindavista" +city/15/0:string:"17" +city/15/1:string:"United States" +city/15/2:string:"San Jose" +city/16/0:string:"18" +city/16/1:string:"Nigeria" +city/16/2:string:"Uyo" +city/17/0:string:"19" +city/17/1:string:"Brazil" +city/17/2:string:"Planaltina" +city/18/0:string:"20" +city/18/1:string:"United States" +city/18/2:string:"Indianapolis" diff --git a/test/json-mapped/array-of-arrays-header/input.json b/test/json-mapped/array-of-arrays-header/input.json new file mode 100644 index 0000000..4f0fbe9 --- /dev/null +++ b/test/json-mapped/array-of-arrays-header/input.json @@ -0,0 +1,19 @@ +[["1","Tunisia","Menzel Bourguiba"], +["2","Indonesia","Jiwuwu"], +["3","China","Dingtou"], +["4","China","Tucheng"], +["5","United States","Charlotte"], +["6","China","Xuwei"], +["7","Uganda","Moroto"], +["8","Poland","Krasne"], +["10","Indonesia","Babakan"], +["11","Philippines","Vigo"], +["12","Tajikistan","Konsoy"], +["13","Honduras","La Estancia"], +["14","Japan","Yatsushiro"], +["15","Mexico","Lindavista"], +["17","United States","San Jose"], +["18","Nigeria","Uyo"], +["19","Brazil","Planaltina"], +["20","United States","Indianapolis"] +] diff --git a/test/json-mapped/array-of-arrays-header/map.json b/test/json-mapped/array-of-arrays-header/map.json new file mode 100644 index 0000000..1c7bfea --- /dev/null +++ b/test/json-mapped/array-of-arrays-header/map.json @@ -0,0 +1,15 @@ +{ + "sheets": ["city"], + "ranges": [ + {"row": 0, "column": 0, "sheet": "city", "row-header": true, + "fields": [ + {"path": "$[][0]", "label": "RID"}, + {"path": "$[][1]", "label": "Country"}, + {"path": "$[][2]", "label": "City"}, + ], + "row-groups": [ + {"path": "$"}, + ] + } + ] +} diff --git a/test/json-mapped/array-of-objects-basic/check.txt b/test/json-mapped/array-of-objects-basic/check.txt new file mode 100644 index 0000000..6aba1bb --- /dev/null +++ b/test/json-mapped/array-of-objects-basic/check.txt @@ -0,0 +1,20 @@ +Imported/0/0:numeric:1 +Imported/0/1:string:"Caitlin" +Imported/0/2:string:"Kealy" +Imported/0/3:string:"ckealy0@hud.gov" +Imported/1/0:numeric:2 +Imported/1/1:string:"Bernice" +Imported/1/2:string:"McEvilly" +Imported/1/3:string:"bmcevilly1@comsenz.com" +Imported/2/0:numeric:3 +Imported/2/1:string:"Ariel" +Imported/2/2:string:"Casajuana" +Imported/2/3:string:"acasajuana2@fema.gov" +Imported/3/0:numeric:4 +Imported/3/1:string:"Grannie" +Imported/3/2:string:"Parlot" +Imported/3/3:string:"gparlot3@soup.io" +Imported/4/0:numeric:5 +Imported/4/1:string:"Merridie" +Imported/4/2:string:"Dungey" +Imported/4/3:string:"mdungey4@nifty.com" diff --git a/test/json-mapped/array-of-objects-basic/input.json b/test/json-mapped/array-of-objects-basic/input.json new file mode 100644 index 0000000..1d10e9e --- /dev/null +++ b/test/json-mapped/array-of-objects-basic/input.json @@ -0,0 +1,32 @@ +[ + { + "id": 1, + "first_name": "Caitlin", + "last_name": "Kealy", + "email": "ckealy0@hud.gov" + }, + { + "id": 2, + "first_name": "Bernice", + "last_name": "McEvilly", + "email": "bmcevilly1@comsenz.com" + }, + { + "id": 3, + "first_name": "Ariel", + "last_name": "Casajuana", + "email": "acasajuana2@fema.gov" + }, + { + "id": 4, + "first_name": "Grannie", + "last_name": "Parlot", + "email": "gparlot3@soup.io" + }, + { + "id": 5, + "first_name": "Merridie", + "last_name": "Dungey", + "email": "mdungey4@nifty.com" + } +]
\ No newline at end of file diff --git a/test/json-mapped/array-of-objects-basic/map.json b/test/json-mapped/array-of-objects-basic/map.json new file mode 100644 index 0000000..a9b949c --- /dev/null +++ b/test/json-mapped/array-of-objects-basic/map.json @@ -0,0 +1,16 @@ +{ + "sheets": ["Imported"], + "ranges": [ + {"sheet": "Imported", "row": 0, "column": 0, + "fields": [ + {"path": "$[]['id']"}, + {"path": "$[]['first_name']"}, + {"path": "$[]['last_name']"}, + {"path": "$[]['email']"} + ], + "row-groups": [ + {"path": "$"} + ] + } + ] +} diff --git a/test/json-mapped/array-of-objects-header/check.txt b/test/json-mapped/array-of-objects-header/check.txt new file mode 100644 index 0000000..63d7e01 --- /dev/null +++ b/test/json-mapped/array-of-objects-header/check.txt @@ -0,0 +1,64 @@ +models/0/0:string:"Record ID" +models/0/1:string:"Model Year" +models/0/2:string:"Make" +models/0/3:string:"Model" +models/1/0:numeric:1 +models/1/1:numeric:1992 +models/1/2:string:"Mazda" +models/1/3:string:"MPV" +models/2/0:numeric:2 +models/2/1:numeric:2008 +models/2/2:string:"GMC" +models/2/3:string:"Savana 1500" +models/3/0:numeric:3 +models/3/1:numeric:1994 +models/3/2:string:"Mitsubishi" +models/3/3:string:"RVR" +models/4/0:numeric:4 +models/4/1:numeric:2005 +models/4/2:string:"Mercury" +models/4/3:string:"Grand Marquis" +models/5/0:numeric:5 +models/5/1:numeric:1994 +models/5/2:string:"Volkswagen" +models/5/3:string:"Golf" +models/6/0:numeric:6 +models/6/1:numeric:1996 +models/6/2:string:"Cadillac" +models/6/3:string:"Eldorado" +models/7/0:numeric:7 +models/7/1:numeric:2000 +models/7/2:string:"Cadillac" +models/7/3:string:"Escalade" +models/8/0:numeric:8 +models/8/1:numeric:2009 +models/8/2:string:"Kia" +models/8/3:string:"Mohave/Borrego" +models/9/0:numeric:9 +models/9/1:numeric:1988 +models/9/2:string:"Volkswagen" +models/9/3:string:"Cabriolet" +models/10/0:numeric:10 +models/10/1:numeric:2008 +models/10/2:string:"Acura" +models/10/3:string:"TSX" +models/11/0:numeric:11 +models/11/1:numeric:1993 +models/11/2:string:"Chrysler" +models/11/3:string:"Imperial" +models/12/0:numeric:12 +models/12/1:numeric:2009 +models/12/2:string:"Hyundai" +models/12/3:string:"Azera" +models/13/0:numeric:13 +models/13/1:numeric:2012 +models/13/2:string:"Ford" +models/13/3:string:"Focus" +models/14/0:numeric:14 +models/14/1:numeric:1999 +models/14/2:string:"GMC" +models/14/3:string:"Suburban 2500" +models/15/0:numeric:15 +models/15/1:numeric:2009 +models/15/2:string:"Pontiac" +models/15/3:string:"G5" diff --git a/test/json-mapped/array-of-objects-header/input.json b/test/json-mapped/array-of-objects-header/input.json new file mode 100644 index 0000000..d9b6605 --- /dev/null +++ b/test/json-mapped/array-of-objects-header/input.json @@ -0,0 +1,15 @@ +[{"Record ID":1,"Model Year":1992,"Make":"Mazda","Model":"MPV"}, +{"Record ID":2,"Model Year":2008,"Make":"GMC","Model":"Savana 1500"}, +{"Record ID":3,"Model Year":1994,"Make":"Mitsubishi","Model":"RVR"}, +{"Record ID":4,"Model Year":2005,"Make":"Mercury","Model":"Grand Marquis"}, +{"Record ID":5,"Model Year":1994,"Make":"Volkswagen","Model":"Golf"}, +{"Record ID":6,"Model Year":1996,"Make":"Cadillac","Model":"Eldorado"}, +{"Record ID":7,"Model Year":2000,"Make":"Cadillac","Model":"Escalade"}, +{"Record ID":8,"Model Year":2009,"Make":"Kia","Model":"Mohave/Borrego"}, +{"Record ID":9,"Model Year":1988,"Make":"Volkswagen","Model":"Cabriolet"}, +{"Record ID":10,"Model Year":2008,"Make":"Acura","Model":"TSX"}, +{"Record ID":11,"Model Year":1993,"Make":"Chrysler","Model":"Imperial"}, +{"Record ID":12,"Model Year":2009,"Make":"Hyundai","Model":"Azera"}, +{"Record ID":13,"Model Year":2012,"Make":"Ford","Model":"Focus"}, +{"Record ID":14,"Model Year":1999,"Make":"GMC","Model":"Suburban 2500"}, +{"Record ID":15,"Model Year":2009,"Make":"Pontiac","Model":"G5"}]
\ No newline at end of file diff --git a/test/json-mapped/array-of-objects-header/map.json b/test/json-mapped/array-of-objects-header/map.json new file mode 100644 index 0000000..0e772f4 --- /dev/null +++ b/test/json-mapped/array-of-objects-header/map.json @@ -0,0 +1,16 @@ +{ + "sheets": ["models"], + "ranges": [ + {"row": 0, "column": 0, "sheet": "models", "row-header": true, + "fields": [ + {"path": "$[]['Record ID']"}, + {"path": "$[]['Model Year']"}, + {"path": "$[]['Make']"}, + {"path": "$[]['Model']"}, + ], + "row-groups": [ + {"path": "$"}, + ] + } + ] +} diff --git a/test/json-mapped/nested-repeats-2/check.txt b/test/json-mapped/nested-repeats-2/check.txt new file mode 100644 index 0000000..0553451 --- /dev/null +++ b/test/json-mapped/nested-repeats-2/check.txt @@ -0,0 +1,25 @@ +nested repeats 2/1/0:string:"foo" +nested repeats 2/1/1:string:"A" +nested repeats 2/1/2:numeric:1000 +nested repeats 2/1/3:string:"A123456789" +nested repeats 2/1/4:string:"en-US" +nested repeats 2/2/0:string:"foo" +nested repeats 2/2/1:string:"A" +nested repeats 2/2/2:numeric:1001 +nested repeats 2/2/3:string:"A987654321" +nested repeats 2/2/4:string:"en-US" +nested repeats 2/3/0:string:"foo" +nested repeats 2/3/1:string:"B" +nested repeats 2/3/2:numeric:2000 +nested repeats 2/3/3:string:"B123456789" +nested repeats 2/3/4:string:"ja-JP" +nested repeats 2/4/0:string:"foo" +nested repeats 2/4/1:string:"B" +nested repeats 2/4/2:numeric:2001 +nested repeats 2/4/3:string:"B987654321" +nested repeats 2/4/4:string:"ja-JP" +nested repeats 2/5/0:string:"foo" +nested repeats 2/5/1:string:"B" +nested repeats 2/5/2:numeric:2002 +nested repeats 2/5/3:string:"B987654323" +nested repeats 2/5/4:string:"ja-JP" diff --git a/test/json-mapped/nested-repeats-2/input.json b/test/json-mapped/nested-repeats-2/input.json new file mode 100644 index 0000000..ac3da5e --- /dev/null +++ b/test/json-mapped/nested-repeats-2/input.json @@ -0,0 +1,20 @@ +[ + {"parent": "foo", + "data": + [ + {"category": "A", "region": "en-US", + "records": [ + {"id": 1000, "ref": "A123456789"}, + {"id": 1001, "ref": "A987654321"} + ] + }, + {"category": "B", "region": "ja-JP", + "records": [ + {"id": 2000, "ref": "B123456789"}, + {"id": 2001, "ref": "B987654321"}, + {"id": 2002, "ref": "B987654323"} + ] + } + ] + } +] diff --git a/test/json-mapped/nested-repeats-2/map.json b/test/json-mapped/nested-repeats-2/map.json new file mode 100644 index 0000000..293462d --- /dev/null +++ b/test/json-mapped/nested-repeats-2/map.json @@ -0,0 +1,24 @@ +{ + "sheets": ["nested repeats 2"], + + "ranges": [ + {"sheet": "nested repeats 2", + "row": 1, + "column": 0, + + "fields": [ + {"path": "$[]['parent']"}, + {"path": "$[]['data'][]['category']"}, + {"path": "$[]['data'][]['records'][]['id']"}, + {"path": "$[]['data'][]['records'][]['ref']"}, + {"path": "$[]['data'][]['region']"} + ], + + "row-groups": [ + {"path": "$"}, + {"path": "$[]['data']"}, + {"path": "$[]['data'][]['records']"} + ] + } + ] +} diff --git a/test/json-mapped/nested-repeats/check.txt b/test/json-mapped/nested-repeats/check.txt new file mode 100644 index 0000000..c089547 --- /dev/null +++ b/test/json-mapped/nested-repeats/check.txt @@ -0,0 +1,64 @@ +nested repeats/3/2:string:"A" +nested repeats/3/3:numeric:1000 +nested repeats/3/4:string:"A123456789" +nested repeats/3/5:string:"en-US" +nested repeats/4/2:string:"A" +nested repeats/4/3:numeric:1001 +nested repeats/4/4:string:"A987654321" +nested repeats/4/5:string:"en-US" +nested repeats/5/2:string:"B" +nested repeats/5/3:numeric:2000 +nested repeats/5/4:string:"B123456789" +nested repeats/5/5:string:"ja-JP" +nested repeats/6/2:string:"B" +nested repeats/6/3:numeric:2001 +nested repeats/6/4:string:"B987654321" +nested repeats/6/5:string:"ja-JP" +nested repeats/7/2:string:"B" +nested repeats/7/3:numeric:2002 +nested repeats/7/4:string:"B987654323" +nested repeats/7/5:string:"ja-JP" +nested repeats/8/2:string:"C" +nested repeats/8/3:numeric:3000 +nested repeats/8/4:string:"C123456789" +nested repeats/8/5:string:"fr-CA" +nested repeats/9/2:string:"C" +nested repeats/9/3:numeric:3001 +nested repeats/9/4:string:"C987654320" +nested repeats/9/5:string:"fr-CA" +nested repeats/10/2:string:"C" +nested repeats/10/3:numeric:3002 +nested repeats/10/4:string:"C987654321" +nested repeats/10/5:string:"fr-CA" +nested repeats/11/2:string:"C" +nested repeats/11/3:numeric:3003 +nested repeats/11/4:string:"C987654322" +nested repeats/11/5:string:"fr-CA" +nested repeats/12/2:string:"C" +nested repeats/12/3:numeric:3004 +nested repeats/12/4:string:"C987654323" +nested repeats/12/5:string:"fr-CA" +nested repeats/13/2:string:"C" +nested repeats/13/3:numeric:3005 +nested repeats/13/4:string:"C987654324" +nested repeats/13/5:string:"fr-CA" +nested repeats/14/2:string:"C" +nested repeats/14/3:numeric:3006 +nested repeats/14/4:string:"C987654325" +nested repeats/14/5:string:"fr-CA" +nested repeats/15/2:string:"D" +nested repeats/15/3:numeric:4000 +nested repeats/15/4:string:"D123456789" +nested repeats/15/5:string:"unknown" +nested repeats/16/2:string:"E" +nested repeats/17/2:string:"F" +nested repeats/17/3:numeric:6000 +nested repeats/17/4:string:"F123456789" +nested repeats/18/2:string:"G" +nested repeats/18/3:numeric:7000 +nested repeats/18/4:string:"G123456789" +nested repeats/18/5:string:"en-GB" +nested repeats/19/2:string:"G" +nested repeats/19/3:numeric:7000 +nested repeats/19/4:string:"G123456780" +nested repeats/19/5:string:"en-GB" diff --git a/test/json-mapped/nested-repeats/input.json b/test/json-mapped/nested-repeats/input.json new file mode 100644 index 0000000..d755f45 --- /dev/null +++ b/test/json-mapped/nested-repeats/input.json @@ -0,0 +1,45 @@ +{ + "data": [ + {"category": "A", "region": "en-US", + "records": [ + {"id": 1000, "ref": "A123456789"}, + {"id": 1001, "ref": "A987654321"} + ] + }, + {"category": "B", "region": "ja-JP", + "records": [ + {"id": 2000, "ref": "B123456789"}, + {"id": 2001, "ref": "B987654321"}, + {"id": 2002, "ref": "B987654323"} + ] + }, + {"category": "C", "region": "fr-CA", + "records": [ + {"id": 3000, "ref": "C123456789"}, + {"id": 3001, "ref": "C987654320"}, + {"id": 3002, "ref": "C987654321"}, + {"id": 3003, "ref": "C987654322"}, + {"id": 3004, "ref": "C987654323"}, + {"id": 3005, "ref": "C987654324"}, + {"id": 3006, "ref": "C987654325"} + ] + }, + {"category": "D", "region": "unknown", + "records": [ + {"id": 4000, "ref": "D123456789"}, + ] + }, + {"category": "E", "records": []}, + {"category": "F", + "records": [ + {"id": 6000, "ref": "F123456789"} + ] + }, + {"category": "G", "region": "en-GB", + "records": [ + {"id": 7000, "ref": "G123456789"}, + {"id": 7000, "ref": "G123456780"} + ] + } + ] +}
\ No newline at end of file diff --git a/test/json-mapped/nested-repeats/map.json b/test/json-mapped/nested-repeats/map.json new file mode 100644 index 0000000..668863e --- /dev/null +++ b/test/json-mapped/nested-repeats/map.json @@ -0,0 +1,22 @@ +{ + "sheets": ["nested repeats"], + + "ranges": [ + {"sheet": "nested repeats", + "row": 3, + "column": 2, + + "fields": [ + {"path": "$['data'][]['category']"}, + {"path": "$['data'][]['records'][]['id']"}, + {"path": "$['data'][]['records'][]['ref']"}, + {"path": "$['data'][]['region']"} + ], + + "row-groups": [ + {"path": "$['data']"}, + {"path": "$['data'][]['records']"} + ] + } + ] +} |