--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 C2IEC=c99
+TESTS=$(patsubst %.c, %.test, $(wildcard test/*.c))
 TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c))
 
 check:
@@ -18,10 +19,16 @@
 y.dot: c99.y
 	yacc -g $^
 
+commit: ${TEST_LOGS}
+	for i in ${TEST_LOGS}; do \
+		cp $$i $$(dirname $$i)/$$(basename $$i .log).expected; \
+	done
 
 .PHONY: test
-test: ${TEST_LOGS}
-	grep failed $^ && false || true
+test: ${TESTS}
+
+%.test: %.test.log
+	diff $< $*.test.expected
 
 %.test.log: %.test.txt
 	cat $< | tee $@