renamed the package to libgedcom-dev
[gedcom-parse.git] / t / anselconv.test
index f0e3876159f683551bd4690849c59cf63549f7f0..a78cf46e080822170ca36bbc115bfb827dc4d2d0 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+logfile=check.out
+
 # For use outside Makefile
 if [ -z "$srcdir" ]
 then
@@ -7,7 +9,8 @@ then
 fi
 builddir=`pwd`
 
-export GCONV_PATH=.:$GCONV_PATH
+GCONV_PATH=.:$GCONV_PATH
+export GCONV_PATH
 ln -s $srcdir/../data/gedcom.enc .
 ln -s $builddir/../iconv/glibc/.libs/ANSI_Z39.47.so .
 ln -s $srcdir/../iconv/glibc/gconv-modules .
@@ -16,19 +19,31 @@ retval=0
 
 if [ "$ICONV_PATH" ]
 then
-  export PATH=$ICONV_PATH:$PATH
+  PATH=$ICONV_PATH:$PATH
+  export PATH
 fi
 
-iconv --from-code=ANSEL --to-code=UTF-8 input/ansel.ged -o anselutf8.out
-if ! diff input/anselutf8.ged anselutf8.out
+echo "======================================================">> $logfile
+echo "Performing test 'anselconv'" >> $logfile
+echo "Testing conversion from ANSEL to UTF-8" >> $logfile
+iconv -f ANSEL -t UTF-8 $srcdir/input/ansel.ged > anselconv_utf8.out 2>>$logfile
+if diff $srcdir/input/anselutf8.ged anselconv_utf8.out >/dev/null 2>> $logfile
 then
-  retval=1
-else
-  iconv --to-code=ANSEL --from-code=UTF-8 input/anselutf8.ged -o ansel.out
-  if ! diff input/ansel.ged ansel.out
+  echo "Output agrees with reference output" >> $logfile
+  rm anselconv_utf8.out
+  echo "Testing conversion from UTF-8 to ANSEL" >> $logfile
+  iconv -f UTF-8 -t ANSEL $srcdir/input/anselutf8.ged > anselconv_ansel.out 2>>$logfile
+  if diff $srcdir/input/ansel.ged anselconv_ansel.out >/dev/null 2>> $logfile
   then
+    echo "Output agrees with reference output" >> $logfile
+    rm anselconv_ansel.out
+  else
+    echo "Difference with reference output detected!" >> $logfile
     retval=1
   fi
+else
+  echo "Difference with reference output detected!" >> $logfile
+  retval=1
 fi
 
 rm gedcom.enc