aboutsummaryrefslogtreecommitdiff
path: root/test/run-tests
blob: 860d2437956eefea9e807db2b6685ff2fda0b9fd (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
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh

set -e
cd "${0%/*}"

download()
{
	s="$(basename "$1" .txt)"
	test -f "data/$s" ||
		wget -q "https://www.unicode.org/Public/15.1.0/ucd/$1" -O "data/$s"
}

readonly FLAGS='
	-std=c23 -I../include
	-O0 -g -ggdb3
	-Wall -Wextra -Wpedantic
	-Wno-pointer-sign
	-Wno-attributes
	-fsanitize=address,undefined
'

(cd ..; ./make)

download 'auxiliary/GraphemeBreakTest.txt'
download 'auxiliary/WordBreakTest.txt'
download 'NormalizationTest.txt'

grep '^[^#]'                           data/CasefoldTest       >casefold.in
grep '^[^#]'                           data/LowercaseTest      >lower.in
grep '^[^#]'                           data/TitlecaseTest      >title.in
grep '^[^#]'                           data/UppercaseTest      >upper.in
grep '^[^#]'                           data/WordHumanBreakTest >wbrk-human.in
sed -En 's/\s+//g; s/÷?#.*//g; /./p'   data/GraphemeBreakTest  >gbrk.in
sed -En 's/\s+//g; s/÷?#.*//g; /./p'   data/WordBreakTest      >wbrk.in
sed -En 's/(#|^@).*//; s/\s+$//; /./p' data/NormalizationTest  >norm-nfd.in

for src in *.c
do
	cc $FLAGS -o "${src%.*}" "$src" ../libmlib.a
done

trap "$(
	find . -maxdepth 1       \
		-type f -executable  \
		-not -name run-tests \
		-exec echo rm "*.in" {} +
)" EXIT

find . -type f -executable -not -name run-tests -exec {} \;