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