From 22f703cab05b7cd368f4de9e03991b7664dc5022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Mon, 1 Sep 2014 13:56:46 +0200 Subject: Initial import of argyll version 1.5.1-8 --- jcnf/yajl/run_tests.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 jcnf/yajl/run_tests.sh (limited to 'jcnf/yajl/run_tests.sh') diff --git a/jcnf/yajl/run_tests.sh b/jcnf/yajl/run_tests.sh new file mode 100644 index 0000000..174932f --- /dev/null +++ b/jcnf/yajl/run_tests.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +DIFF_FLAGS="-u" +if [[ `uname` == *W32* ]] ; then + DIFF_FLAGS="-wu" +fi + +# find test binary on both platforms. allow the caller to force a +# particular test binary (useful for non-cmake build systems). +if [ -z "$testBin" ]; then + testBin="../build/test/Debug/yajl_test.exe" + if [[ ! -x $testBin ]] ; then + testBin="../build/test/yajl_test" + if [[ ! -x $testBin ]] ; then + echo "cannot execute test binary: '$testBin'" + exit 1; + fi + fi +fi + +echo "using test binary: $testBin" + +let testsSucceeded=0 +let testsTotal=0 + +for file in cases/*.json ; do + allowComments="-c" + + # if the filename starts with dc_, we disallow comments for this test + if [[ $(basename $file) == dc_* ]] ; then + allowComments="" + fi + echo -n " test case: '$file': " + let iter=1 + success="success" + + # parse with a read buffer size ranging from 1-31 to stress stream parsing + while (( $iter < 32 )) && [ $success == "success" ] ; do + $testBin $allowComments -b $iter < $file > ${file}.test 2>&1 + diff ${DIFF_FLAGS} ${file}.gold ${file}.test + if [[ $? == 0 ]] ; then + if (( $iter == 31 )) ; then let testsSucceeded+=1 ; fi + else + success="FAILURE" + let iter=32 + fi + let iter+=1 + rm ${file}.test + done + + echo $success + let testsTotal+=1 +done + +echo $testsSucceeded/$testsTotal tests successful + +if [[ $testsSucceeded != $testsTotal ]] ; then + exit 1 +fi + +exit 0 -- cgit v1.2.3