From abd7f486a0fb34320e3afae6780677cfd4ff85cc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 25 Apr 2021 19:19:28 +0100 Subject: Erring toward complete JSON loader --- test/fixtures/json/abs.json | 7 +++++ test/fixtures/json/empty.json | 6 ++++ test/fixtures/json/empty_abs.json | 6 ++++ test/fixtures/json/implicit.json | 8 ++++++ test/fixtures/json/implicit_abs.json | 8 ++++++ test/fixtures/json/load_object.json | 55 ++++++++++++++++++++++++++++++++++++ test/fixtures/json/nested.json | 21 ++++++++++++++ test/fixtures/json/vector_ptr.json | 13 +++++++++ 8 files changed, 124 insertions(+) create mode 100644 test/fixtures/json/abs.json create mode 100644 test/fixtures/json/empty.json create mode 100644 test/fixtures/json/empty_abs.json create mode 100644 test/fixtures/json/implicit.json create mode 100644 test/fixtures/json/implicit_abs.json create mode 100644 test/fixtures/json/load_object.json create mode 100644 test/fixtures/json/nested.json create mode 100644 test/fixtures/json/vector_ptr.json (limited to 'test/fixtures') diff --git a/test/fixtures/json/abs.json b/test/fixtures/json/abs.json new file mode 100644 index 0000000..8492df3 --- /dev/null +++ b/test/fixtures/json/abs.json @@ -0,0 +1,7 @@ +{ + "aptr": { + "@typeid": "SubObject", + "base": "set base", + "sub": "set sub" + } +} diff --git a/test/fixtures/json/empty.json b/test/fixtures/json/empty.json new file mode 100644 index 0000000..a9193a3 --- /dev/null +++ b/test/fixtures/json/empty.json @@ -0,0 +1,6 @@ +{ + "@typeid": "TestObject", + "flt": 1, + "ptr": {}, + "str": "after" +} diff --git a/test/fixtures/json/empty_abs.json b/test/fixtures/json/empty_abs.json new file mode 100644 index 0000000..7d22001 --- /dev/null +++ b/test/fixtures/json/empty_abs.json @@ -0,0 +1,6 @@ +{ + "@typeid": "TestObject", + "flt": 1, + "aptr": {}, + "str": "after" +} diff --git a/test/fixtures/json/implicit.json b/test/fixtures/json/implicit.json new file mode 100644 index 0000000..03dec4b --- /dev/null +++ b/test/fixtures/json/implicit.json @@ -0,0 +1,8 @@ +{ + "@typeid": "TestObject", + "flt": 1, + "ptr": { + "str": "trigger" + }, + "str": "after" +} diff --git a/test/fixtures/json/implicit_abs.json b/test/fixtures/json/implicit_abs.json new file mode 100644 index 0000000..573b323 --- /dev/null +++ b/test/fixtures/json/implicit_abs.json @@ -0,0 +1,8 @@ +{ + "@typeid": "TestObject", + "flt": 1, + "aptr": { + "str": "trigger" + }, + "str": "after" +} diff --git a/test/fixtures/json/load_object.json b/test/fixtures/json/load_object.json new file mode 100644 index 0000000..bb32298 --- /dev/null +++ b/test/fixtures/json/load_object.json @@ -0,0 +1,55 @@ +{ + "@typeid": "TestObject", + "flt": 3.14, + "str": "Lovely string", + "bl": true, + "pos": [ + 3.14, + 6.28, + 1.57 + ], + "flts": [ + 3.14, + 6.28, + 1.57, + 0, + -1, + -3.14 + ], + "poss": [ + [ + 3.14, + 6.28, + 1.57 + ], + [ + 0, + -1, + -3.14 + ] + ], + "nest": [ + [ + [ + "a", + "b" + ], + [ + "c", + "d", + "e" + ] + ], + [ + [ + "f" + ] + ], + [] + ], + "ptr": { + "@typeid": "TestObject", + "flt": 3.14, + "str": "Lovely string" + } +} diff --git a/test/fixtures/json/nested.json b/test/fixtures/json/nested.json new file mode 100644 index 0000000..98951fc --- /dev/null +++ b/test/fixtures/json/nested.json @@ -0,0 +1,21 @@ +{ + "@typeid": "TestObject", + "flt": 1, + "ptr": { + "@typeid": "TestObject", + "flt": 2, + "ptr": { + "@typeid": "TestObject", + "flt": 3, + "ptr": { + "@typeid": "TestObject", + "flt": 4, + "ptr": null, + "str": "four" + }, + "str": "three" + }, + "str": "two" + }, + "str": "one" +} diff --git a/test/fixtures/json/vector_ptr.json b/test/fixtures/json/vector_ptr.json new file mode 100644 index 0000000..8a07a2e --- /dev/null +++ b/test/fixtures/json/vector_ptr.json @@ -0,0 +1,13 @@ +{ + "vptr": [ + { + "@typeid": "TestObject", + "str": "type" + }, + { + "flt": 3.14 + }, + null, + {} + ] +} -- cgit v1.2.3