X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Ftstmarccol.sh;fp=test%2Ftstmarccol.sh;h=f201ae3cbe1dd7ac8604c18d8c4471e568a02dac;hb=b925ea17d6f146a28d745b0d34e9eec6eafda21f;hp=0000000000000000000000000000000000000000;hpb=3a78b70f2e785e67e08b26c8e50101d10e054dbb;p=yaz-moved-to-github.git diff --git a/test/tstmarccol.sh b/test/tstmarccol.sh new file mode 100755 index 0000000..f201ae3 --- /dev/null +++ b/test/tstmarccol.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# $Id: tstmarccol.sh,v 1.1 2006-08-28 12:34:42 adam Exp $ +# Tests reading of a bunch of non-roman UTF-8 ISO2709 and see if +# we can encode it in MARC-8 +# +# Reads marccol?.u8.marc files , Generates marccol?.u8.{1,2}.lst +srcdir=${srcdir:-.} +ecode=0 +for f in ${srcdir}/marccol?.u8.marc; do + + fb=`basename ${f} .marc` + + DIFF=${fb}.1.lst.diff + NEW=${fb}.1.lst.new + OLD=${srcdir}/${fb}.1.lst + ../util/yaz-marcdump -f utf-8 -t utf-8 $f >$NEW + if test $? != "0"; then + echo "$f: yaz-marcdump returned error" + ecode=1 + break + 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 + fi + + filem=`echo $fb | sed 's/u8/m8/'`.marc + ../util/yaz-marcdump -I -f utf8 -t marc8 $f >$filem + + DIFF=${fb}.2.lst.diff + NEW=${fb}.2.lst.new + OLD=${srcdir}/${fb}.2.lst + ../util/yaz-marcdump -f marc8 -t utf-8 $filem >$NEW + if test $? != "0"; then + echo "$f: yaz-marcdump returned error" + ecode=1 + break + elif test -f $OLD; then + if diff $OLD $NEW >$DIFF; then + rm $DIFF + rm $NEW + rm $filem + else + echo "$f: $NEW and $OLD differ" + ecode=1 + fi + else + echo "$f: Making test result $OLD for the first time" + mv $NEW $OLD + rm $filem + fi +done +exit $ecode + +# Local Variables: +# mode:shell-script +# sh-indentation: 2 +# sh-basic-offset: 4 +# End: