Commit e8c790b3 authored by Carl Worth's avatar Carl Worth

Add a very simple test for the pre-processor.

Validate desired test cases by ensuring the output of glcpp matches
the output of the gcc preprocessor, (ignoring any lines of the gcc
output beginning with '#').

Only one test case so far with a trivial #define.
parent 0b27b5f0
......@@ -4,3 +4,6 @@ glcpp-parse.c
glcpp-parse.h
*.o
*~
tests/*.expected
tests/*.gcc
tests/*.out
......@@ -10,5 +10,9 @@ glcpp: glcpp.o glcpp-lex.o glcpp-parse.o hash_table.o
glcpp-lex.c: glcpp-parse.h
test:
@(cd tests; ./glcpp-test)
clean:
rm -f glcpp-lex.c glcpp-parse.c *.o *~
rm -f tests/*.out tests/*.gcc tests/*.expected
#define foo 1
foo
#!/bin/sh
for test in *.c; do
echo "Testing $test"
../glcpp < $test > $test.out
gcc -E $test -o $test.gcc
grep -v '^#' < $test.gcc > $test.expected
diff -u $test.expected $test.out
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment