gcc -Wall -Werror -ansi -pedantic -lm -ftest-coverage -fprofile-arcs your-program.c
gcov
to check if your tests test all your code:gcov your-program.c
Your tests should achieve 100% coverage for all non-I/O code.
You can read more about gcc support for test-coverage here.