File: run-collate-tests.sh

package info (click to toggle)
glib2.0 2.58.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, buster-proposed-updates
  • size: 48,744 kB
  • sloc: ansic: 452,196; xml: 16,781; python: 6,149; makefile: 3,776; sh: 1,499; perl: 1,140; cpp: 9
file content (38 lines) | stat: -rwxr-xr-x 873 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/sh

fail ()
{
  echo "Test failed: $*"
  exit 1
}

echo_v ()
{
  if [ "$verbose" = "1" ]; then
    echo "$*"
  fi
}

error_out=/dev/null
if [ "$1" = "-v" ]; then
  verbose=1
  error_out=/dev/stderr
fi  
for I in ${srcdir:-.}/collate/*.in; do
  echo_v "Sorting $I"
  name=`basename $I .in`
  ./unicode-collate $I > collate.out
  if [ $? -eq 2 ]; then
    exit 0
  fi   
  diff collate.out ${srcdir:-.}/collate/$name.unicode || 
    fail "unexpected error when using g_utf8_collate() on $I"
  ./unicode-collate --key $I > collate.out
  diff collate.out ${srcdir:-.}/collate/$name.unicode ||
    fail "unexpected error when using g_utf8_collate_key() on $I"
  ./unicode-collate --file $I > collate.out
  diff collate.out ${srcdir:-.}/collate/$name.file ||
    fail "unexpected error when using g_utf8_collate_key_for_filename() on $I"
done

echo_v "All tests passed."