From b8e9fedc5f1694164707c810dd9dae3f6468edb6 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 7 Feb 2022 09:36:16 +0100 Subject: test: Add int64 min/max testcase for JSON parser --- test/Makefile.am | 6 ++++-- test/data/int64_min_max.json | 1 + test/json-int64-min-max.test | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 test/data/int64_min_max.json create mode 100755 test/json-int64-min-max.test diff --git a/test/Makefile.am b/test/Makefile.am index 0d99d92..cd3b940 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -53,7 +53,8 @@ TESTS = \ json1.test \ json2.test \ json3.test \ - json-invalid-types.test + json-invalid-types.test \ + json-int64-min-max.test EXTRA_DIST = \ $(TESTS) \ @@ -100,7 +101,8 @@ EXTRA_DIST = \ data/uid.bplist \ data/data.bplist \ data/j1.json \ - data/j2.json + data/j2.json \ + data/int64_min_max.json TESTS_ENVIRONMENT = \ top_srcdir=$(top_srcdir) \ diff --git a/test/data/int64_min_max.json b/test/data/int64_min_max.json new file mode 100644 index 0000000..7707090 --- /dev/null +++ b/test/data/int64_min_max.json @@ -0,0 +1 @@ +{"INT64_MIN":-9223372036854775808,"INT64_MAX":9223372036854775807} \ No newline at end of file diff --git a/test/json-int64-min-max.test b/test/json-int64-min-max.test new file mode 100755 index 0000000..f6ed731 --- /dev/null +++ b/test/json-int64-min-max.test @@ -0,0 +1,19 @@ +## -*- sh -*- + +set -e + +DATASRC=$top_srcdir/test/data +DATAOUT=$top_builddir/test/data +TESTFILE=int64_min_max.json + +if ! test -d "$DATAOUT"; then + mkdir -p $DATAOUT +fi + +export PLIST_JSON_DEBUG=1 + +echo "Converting" +$top_builddir/test/plist_jtest $DATASRC/$TESTFILE $DATAOUT/$TESTFILE.out + +echo "Comparing" +$top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/$TESTFILE.out -- cgit v1.1-32-gdbae