ZOOM: use size_t for scan hit counts and str size
[yaz-moved-to-github.git] / test / tstmarccol.sh
1 #!/bin/sh
2 # Tests reading of a bunch of non-roman UTF-8 ISO2709 and see if
3 # we can encode it in MARC-8
4 #
5 # Reads marccol?.u8.marc files , Generates marccol?.u8.{1,2}.lst
6 srcdir=${srcdir:-.}
7 ecode=0
8 for f in ${srcdir}/marccol?.u8.marc; do
9
10     fb=`basename ${f} .marc`
11
12     DIFF=${fb}.1.lst.diff
13     NEW=${fb}.1.lst.new
14     OLD=${srcdir}/${fb}.1.lst
15     ../util/yaz-marcdump -f utf-8 -t utf-8 $f >$NEW
16     if test $? != "0"; then
17         echo "$f: yaz-marcdump returned error"
18         ecode=1
19         break
20     elif test -f $OLD; then
21         if diff $OLD $NEW >$DIFF; then
22             rm $DIFF
23             rm $NEW
24         else
25             echo "$f: $NEW and $OLD differ"
26             ecode=1
27         fi
28     else
29         echo "$f: Making test result $OLD for the first time"
30         mv $NEW $OLD
31     fi
32
33     filem=`echo $fb | sed 's/u8/m8/'`.marc
34     ../util/yaz-marcdump -o marc -f utf8 -t marc8lossless $f >$filem
35
36     DIFF=${fb}.2.lst.diff
37     NEW=${fb}.2.lst.new
38     OLD=${srcdir}/${fb}.2.lst
39     ../util/yaz-marcdump -f marc8 -t utf-8 $filem >$NEW
40     if test $? != "0"; then
41         echo "$f: yaz-marcdump returned error"
42         ecode=1
43         break
44     elif test -f $OLD; then
45         if diff $OLD $NEW >$DIFF; then
46             rm $DIFF
47             rm $NEW
48             rm $filem
49         else
50             echo "$f: $NEW and $OLD differ"
51             ecode=1
52         fi
53     else
54         echo "$f: Making test result $OLD for the first time"
55         mv $NEW $OLD
56         rm $filem
57     fi
58 done
59 exit $ecode
60
61 # Local Variables:
62 # mode:shell-script
63 # sh-indentation: 2
64 # sh-basic-offset: 4
65 # End: