Home | History | Annotate | Download | only in tests
      1 #! /bin/sh
      2 
      3 fail ()
      4 {
      5   echo "Test failed: $*"
      6   exit 1
      7 }
      8 
      9 echo_v ()
     10 {
     11   if [ "$verbose" = "1" ]; then
     12     echo "$*"
     13   fi
     14 }
     15 
     16 error_out=/dev/null
     17 if [ "$1" = "-v" ]; then
     18   verbose=1
     19   error_out=/dev/stderr
     20 fi  
     21 for I in ${srcdir:-.}/collate/*.in; do
     22   echo_v "Sorting $I"
     23   name=`basename $I .in`
     24   ./unicode-collate $I > collate.out
     25   if [ $? -eq 2 ]; then
     26     exit 0
     27   fi   
     28   diff collate.out ${srcdir:-.}/collate/$name.unicode || 
     29     fail "unexpected error when using g_utf8_collate() on $I"
     30   ./unicode-collate --key $I > collate.out
     31   diff collate.out ${srcdir:-.}/collate/$name.unicode ||
     32     fail "unexpected error when using g_utf8_collate_key() on $I"
     33   ./unicode-collate --file $I > collate.out
     34   diff collate.out ${srcdir:-.}/collate/$name.file ||
     35     fail "unexpected error when using g_utf8_collate_key_for_filename() on $I"
     36 done
     37 
     38 echo_v "All tests passed."
     39