summaryrefslogtreecommitdiffstats
path: root/test/test_examples.sh.in
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/test_examples.sh.in91
1 files changed, 91 insertions, 0 deletions
diff --git a/test/test_examples.sh.in b/test/test_examples.sh.in
new file mode 100644
index 0000000..f4c18e8
--- /dev/null
+++ b/test/test_examples.sh.in
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+unset ERR
+
+DIR="@abs_top_srcdir@"
+ZBARIMG="@abs_top_builddir@/zbarimg/zbarimg --nodbus"
+
+test()
+{
+ if [ "$2" != "" ]; then
+ i="$DIR/examples/$2"
+ j="$1 $2"
+ else
+ i="$DIR/examples/$1"
+ j="$1"
+ fi;
+ if [ "$2" != "" ]; then
+ CMD="$ZBARIMG $1"
+ else
+ CMD="$ZBARIMG"
+ fi
+ CK=`$CMD "$i" 2>/dev/null|sha1sum|cut -d" " -f1`
+ ORG=`grep "zbarimg $j" "$DIR/examples/sha1sum"|cut -d " " -f1`
+
+ if [ "$CK" != "$ORG" ]; then
+ echo "FAILED: $i ($CK instead of $ORG)"
+ echo -e "\tcmd: $CMD '$i'"
+ echo -en "\tresults: "
+ $CMD "$i" 2>/dev/null
+ ERR=1
+ fi
+}
+
+if [ "@ENABLE_CODE128@" == "1" ]; then
+ test code-128.png
+fi
+
+if [ "@ENABLE_CODE93@" == "1" ]; then
+ test code-93.png
+fi
+
+if [ "@ENABLE_CODE39@" == "1" ]; then
+ test code-39.png
+fi
+
+if [ "@ENABLE_CODABAR@" == "1" ]; then
+ test codabar.png
+fi
+
+if [ "@ENABLE_DATABAR@" == "1" ]; then
+ test databar.png
+ test databar-exp.png
+fi
+
+if [ "@ENABLE_EAN@" == "1" ]; then
+ test -Sean2.enable ean-2.png
+ test -Sean5.enable ean-5.png
+ test ean-8.png
+ test ean-13.png
+ test -Sisbn10.enable ean-13.png
+ test -Sisbn13.enable ean-13.png
+ test -Supca.enable code-upc-a.png
+fi
+
+if [ "@ENABLE_I25@" == "1" ]; then
+ test i2-5.png
+fi
+
+if [ "@ENABLE_QRCODE@" == "1" ]; then
+ test qr-code.png
+ test -Stest-inverted qr-code-inverted.png
+ test '--raw --oneshot -Sbinary' qr-code-binary.png
+fi
+
+if [ "@ENABLE_SQCODE@" == "1" ]; then
+ test sqcode1-generated.png
+ test sqcode1-scanned.png
+fi
+
+# The pdf417 code is incomplete: it doesn't output any results
+#
+#if [ "@ENABLE_PDF417@" == "1" ]; then
+# test code-pdf417.png
+#fi
+
+if [ "$ERR" == "" ]; then
+ echo "zbarimg PASSED."
+else
+ exit 1
+fi
+