Implement first iteration of parser and write test scripts

This commit is contained in:
2024-10-25 13:33:31 +01:00
parent 63facb3954
commit 584e92c29c
6 changed files with 190 additions and 1 deletions

View File

@@ -7,5 +7,11 @@ CFLAGS="$CFLAGS -O0 -ggdb"
mkdir -p build
# Build library
clang $CFLAGS -Ilib -c lib/parser.c -o build/parser.o
clang $CFLAGS -Ilib -c lib/regex.c -o build/regex.o
ar -crs build/lib.a build/regex.o
ar -crs build/lib.a build/parser.o build/regex.o
# Build tests
clang $CFLAGS -Itests -c tests/testing.c -o build/testing.o
clang $CFLAGS -Ilib -Itests -o build/parser_tests \
tests/parser_tests.c build/testing.o build/lib.a

3
scripts/entr.sh Normal file
View File

@@ -0,0 +1,3 @@
cd "$(git rev-parse --show-toplevel)"
find . -not \( -path './.git' -prune \) -not \( -path './build' -prune \) \
| entr -s 'clear && sh scripts/build.sh && sh scripts/test.sh'

7
scripts/test.sh Normal file
View File

@@ -0,0 +1,7 @@
cd "$(git rev-parse --show-toplevel)"
fails=0
build/parser_tests || fails=`expr $fails + 1`
if [ $fails -eq 0 ]; then echo Tests OK; fi