2eb049585291826ce8be9521750e97bf40462475
[gedcom-parse.git] / t / anselconv.test
1 #!/bin/sh
2
3 # For use outside Makefile
4 if [ -z "$srcdir" ]
5 then
6   srcdir=.
7 fi
8 builddir=`pwd`
9
10 GCONV_PATH=.:$GCONV_PATH
11 export GCONV_PATH
12 ln -s $srcdir/../data/gedcom.enc .
13 ln -s $builddir/../iconv/glibc/.libs/ANSI_Z39.47.so .
14 ln -s $srcdir/../iconv/glibc/gconv-modules .
15
16 retval=0
17
18 if [ "$ICONV_PATH" ]
19 then
20   PATH=$ICONV_PATH:$PATH
21   export PATH
22 fi
23
24 echo "Testing conversion from ANSEL to UTF-8" >> testgedcom.out
25 iconv -f ANSEL -t UTF-8 $srcdir/input/ansel.ged > anselutf8.out
26 if ! diff $srcdir/input/anselutf8.ged anselutf8.out >> testgedcom.out
27 then
28   retval=1
29 else
30   echo "Testing conversion from UTF-8 to ANSEL" >> testgedcom.out
31   iconv -f UTF-8 -t ANSEL $srcdir/input/anselutf8.ged > ansel.out
32   if ! diff $srcdir/input/ansel.ged ansel.out >> testgedcom.out
33   then
34     retval=1
35   fi
36 fi
37
38 rm gedcom.enc
39 rm ANSI_Z39.47.so
40 rm gconv-modules
41 exit $retval