More EasyTree compatibility.
[gedcom-parse.git] / t / anselconv.test
1 #!/bin/sh
2
3 logfile=check.out
4
5 # For use outside Makefile
6 if [ -z "$srcdir" ]
7 then
8   srcdir=.
9 fi
10 builddir=`pwd`
11
12 GCONV_PATH=.:$GCONV_PATH
13 export GCONV_PATH
14 ln -s $srcdir/../data/gedcom.enc .
15 ln -s $builddir/../iconv/glibc/.libs/ANSI_Z39.47.so .
16 ln -s $srcdir/../iconv/glibc/gconv-modules .
17
18 retval=0
19
20 if [ "$ICONV_PATH" ]
21 then
22   PATH=$ICONV_PATH:$PATH
23   export PATH
24 fi
25
26 echo "======================================================">> $logfile
27 echo "Performing test 'anselconv'" >> $logfile
28 echo "Testing conversion from ANSEL to UTF-8" >> $logfile
29 iconv -f ANSEL -t UTF-8 $srcdir/input/ansel.ged > anselconv_utf8.out 2>>$logfile
30 if diff $srcdir/input/anselutf8.ged anselconv_utf8.out >/dev/null 2>> $logfile
31 then
32   echo "Output agrees with reference output" >> $logfile
33   rm anselconv_utf8.out
34   echo "Testing conversion from UTF-8 to ANSEL" >> $logfile
35   iconv -f UTF-8 -t ANSEL $srcdir/input/anselutf8.ged > anselconv_ansel.out 2>>$logfile
36   if diff $srcdir/input/ansel.ged anselconv_ansel.out >/dev/null 2>> $logfile
37   then
38     echo "Output agrees with reference output" >> $logfile
39     rm anselconv_ansel.out
40   else
41     echo "Difference with reference output detected!" >> $logfile
42     retval=1
43   fi
44 else
45   echo "Difference with reference output detected!" >> $logfile
46   retval=1
47 fi
48
49 rm gedcom.enc
50 rm ANSI_Z39.47.so
51 rm gconv-modules
52 exit $retval