simdjson/tests/testjson2json.sh

40 lines
1.2 KiB
Bash
Raw Normal View History

2018-12-07 06:22:22 +08:00
#!/bin/bash
set -e
2018-12-07 06:22:22 +08:00
2018-12-07 06:36:41 +08:00
TMPDIR1=$(mktemp -d -t simdjsonXXXXXXXX)
TMPDIR2=$(mktemp -d -t simdjsonXXXXXXXX)
2018-12-07 06:22:22 +08:00
trap "exit 1" HUP INT PIPE QUIT TERM
2020-03-27 08:08:54 +08:00
trap "rm -rf $TMPDIR1 $TMPDIR2" EXIT
2018-12-07 06:22:22 +08:00
echo "running json2json on jsonexamples and jsonchecker files (prints test successful on success) ..."
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
JSONEXAMPLES=$SCRIPTPATH/../jsonexamples
JSONCHECKER=$SCRIPTPATH/../jsonchecker
for i in `cd $JSONEXAMPLES && ls -1 *.json`; do
2018-12-07 06:22:22 +08:00
echo $i
./json2json $JSONEXAMPLES/$i > $TMPDIR1/$i
2018-12-07 06:22:22 +08:00
./json2json $TMPDIR1/$i > $TMPDIR2/$i
cmp $TMPDIR1/$i $TMPDIR2/$i
./minify $TMPDIR1/$i > $TMPDIR1/minify$i
./minify $TMPDIR2/$i > $TMPDIR2/minify$i
cmp $TMPDIR1/minify$i $TMPDIR2/minify$i
./json2json $TMPDIR1/minify$i > $TMPDIR2/bisminify$i
cmp $TMPDIR1/$i $TMPDIR2/bisminify$i
done
2018-12-10 09:47:02 +08:00
for i in `cd $JSONCHECKER && ls -1 pass*.json`; do
2018-12-10 09:47:02 +08:00
echo $i
./json2json $JSONCHECKER/$i > $TMPDIR1/$i
2018-12-10 09:47:02 +08:00
./json2json $TMPDIR1/$i > $TMPDIR2/$i
cmp $TMPDIR1/$i $TMPDIR2/$i
./minify $TMPDIR1/$i > $TMPDIR1/minify$i
./minify $TMPDIR2/$i > $TMPDIR2/minify$i
cmp $TMPDIR1/minify$i $TMPDIR2/minify$i
./json2json $TMPDIR1/minify$i > $TMPDIR2/bisminify$i
cmp $TMPDIR1/$i $TMPDIR2/bisminify$i
done
2018-12-07 06:22:22 +08:00
echo "test successful"
exit 0