aboutsummaryrefslogtreecommitdiff
path: root/test/run-tests
blob: 82d3e008da8321ba2f417055f6abd3e6e84bcb52 (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
#!/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
	-Og -ggdb3
	-Wall -Wextra -Wpedantic
	-Wno-pointer-sign
	-Wno-attributes
'

(cd ..; ./make)

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

grep '^[^#]'                         data/LowercaseTest     >lower.in
grep '^[^#]'                         data/TitlecaseTest     >title.in
grep '^[^#]'                         data/UppercaseTest     >upper.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

for src in *.c
do
	gcc $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 {} \;