summaryrefslogtreecommitdiff
path: root/conformance/test
blob: d2dccf9eee3420e7e7234d122327c3834bca9b71 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
# Test ../fribidi with reference/bidiref, using stdin, and diff the outputs.
# use --debug switch to see the debug info into stderr.

path=`dirname $0`

if ! test -f "$path/../fribidi"; then
  echo "test: you must make fribidi first"
  exit 1
fi

if ! test -f "$path/reference/bidiref"; then
# fribidi does not set MAX_LEVEL to 15 if debug enabled, then reference
# should not be compiled with debug enabled.

#  if test -z "`echo -n | $path/../fribidi --debug 2>&1`"; then
#    debug="-DDEBUGGING"
#  else
#    debug=""
#  fi
  debug=""
  g++ $debug -o $path/reference/bidiref $path/reference/bidiref.cpp
fi

convertsub () {
  refline="`echo \"$refline\" | sed s/$1/$2/g`"
}

p1="--clean"
p2="-clean"
while [ -n "$1" ]; do
  if test "$1" = "--debug"; then
    p1=$p1" --debug"
    p2=$p2" -verbose"
  else
    par=$par" $1"
  fi
  shift
done

 > $path/test.out
 > $path/test.ref

cat $par | 
while read line; do
  echo "$line" | $path/../fribidi --charset CapRTL --nopad $p1 >> $path/test.out
#  echo "$line" | $path/reference/bidiref $p2 >> $path/test.ref
  refline="$line"
  convertsub "_R" "`echo -e \"\\16\"`"
  convertsub "_r" "`echo -e \"\\17\"`"
  convertsub "_L" "`echo -e \"\\20\"`"
  convertsub "_l" "`echo -e \"\\21\"`"
  convertsub "_o" "`echo -e \"\\22\"`"
  refline=`echo "$refline" | $path/reference/bidiref $p2`
  convertsub "`echo -e \"\\16\"`" "_R"
  convertsub "`echo -e \"\\17\"`" "_r"
  convertsub "`echo -e \"\\20\"`" "_L"
  convertsub "`echo -e \"\\21\"`" "_l"
  convertsub "`echo -e \"\\22\"`" "_o"
  echo "$refline" >> $path/test.ref
done

diff $path/test.out $path/test.ref