Added new regression test using yaz-icu
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 30 Dec 2008 10:54:52 +0000 (11:54 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 30 Dec 2008 10:54:52 +0000 (11:54 +0100)
test/Makefile.am
test/tsticu-0.input [new file with mode: 0644]
test/tsticu-0.output [new file with mode: 0644]
test/tsticu-0.xml [new file with mode: 0644]
test/tsticu.sh [new file with mode: 0755]

index 676a0a4..58dd782 100644 (file)
@@ -5,7 +5,7 @@ check_PROGRAMS = tsticonv tstnmem tstmatchstr tstwrbuf tstodr tstccl tstlog \
  tstsoap1 tstsoap2 tstodrstack tstlogthread tstxmlquery tstpquery \
  tst_comstack tst_filepath tst_record_conv tst_retrieval tst_tpath \
  tst_timing tst_query_charset tst_oid tst_icu_I18N tst_match_glob tst_rpn2cql
-check_SCRIPTS = tstmarc.sh tstmarccol.sh tstcql2xcql.sh tstcql2pqf.sh
+check_SCRIPTS = tstmarc.sh tstmarccol.sh tstcql2xcql.sh tstcql2pqf.sh tsticu.sh
 
 TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
 
@@ -26,7 +26,8 @@ EXTRA_DIST = tstodr.asn tstodrcodec.c tstodrcodec.h cql2xcqlsample \
  marccol3.u8.marc marccol3.u8.1.lst marccol3.u8.2.lst \
  marccol4.u8.marc marccol4.u8.1.lst marccol4.u8.2.lst \
  marccol5.u8.marc marccol5.u8.1.lst marccol5.u8.2.lst \
- tst_record_conv.xsl 
+ tst_record_conv.xsl \
+ tsticu-0.xml tsticu-0.input tsticu-0.output
 
 YAZCOMP = ../util/yaz-asncomp
 YAZCOMPLINE = $(YAZCOMP) -d z.tcl -i yaz -I../include $(YCFLAGS)
diff --git a/test/tsticu-0.input b/test/tsticu-0.input
new file mode 100644 (file)
index 0000000..688e379
--- /dev/null
@@ -0,0 +1 @@
+Børn
diff --git a/test/tsticu-0.output b/test/tsticu-0.output
new file mode 100644 (file)
index 0000000..a76b5eb
--- /dev/null
@@ -0,0 +1 @@
+1 1 'børn' 'Børn' '+EKC\x01\x85\xA5\x06\x01\x09'
diff --git a/test/tsticu-0.xml b/test/tsticu-0.xml
new file mode 100644 (file)
index 0000000..537cc9b
--- /dev/null
@@ -0,0 +1,7 @@
+<icu_chain locale="en">
+  <transform rule="[:Control:] Any-Remove"/>
+  <tokenize rule="l"/>
+  <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
+  <display/>
+  <casemap rule="l"/>
+</icu_chain>
diff --git a/test/tsticu.sh b/test/tsticu.sh
new file mode 100755 (executable)
index 0000000..bb195a3
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+# Tests a couple of yaz-icu conversions
+# 
+# Reads tsticu-[0-9].input files
+# Writes tsticu-[0-9].output / output.tmp files
+# Config tsticu-[0-9].xml
+
+set -x
+srcdir=${srcdir:-.}
+ecode=0
+
+../util/yaz-icu >/dev/null 2>&1
+if test $? = "3"; then
+    exit 0
+fi
+
+for f in ${srcdir}/tsticu-[0-9].input; do
+    fb=`basename ${f} .input`
+    CONFIG=${srcdir}/${fb}.xml
+    NEW=${fb}.output.tmp
+    OLD=${srcdir}/${fb}.output
+    DIFF=`basename ${f}`.diff
+    ../util/yaz-icu -c $CONFIG <$f > $NEW
+    if test $? != "0"; then
+       echo "$f: yaz-icu returned error"
+       ecode=1
+    elif test -f $OLD; then
+        if diff $OLD $NEW >$DIFF; then
+           rm $DIFF
+           rm $NEW
+       else
+           echo "$f: $NEW and $OLD differ"
+           ecode=1
+       fi
+    else
+       echo "$f: Making test result $OLD for the first time"
+       mv $NEW $OLD
+       ecode=1
+    fi
+done
+exit $ecode
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation: 2
+# sh-basic-offset: 4
+# End: