blob: e728773925a252b464bd48f593a24a42ad8224d7 (
plain) (
blame)
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
report()
{
case $1 in
0) printf 'All tests passed\n' >&2 ;;
1) printf '1 test failed\n' >&2 ;;
*) printf '%d tests failed\n' $1 >&2
esac
}
readonly src=../data/GraphemeBreakTest.txt
set -e
cd "${0%/*}"
find ../lib -name '*.c' -exec cc -I../include -o gbrk gbrk.c {} +
trap 'rm -f gbrk' EXIT
n=$(
./gbrk $src \
| diff -y --suppress-common-lines $src - \
| tee failures \
| wc -l
)
test $n -eq 0 && rm failures
if test -t 2
then
case $n in
0) printf '\033[0;32m' ;;
*) printf '\033[0;31m'
esac
report $n
printf '\033[0m' >&2
else
report $n
fi
|