How to test a static function

I have a test harness. In dire cases – like trying to test a static function, I use:

#include "code_under_test.c"
...test framework...

That is, I include the whole of the file containing the function under test in the test harness. It is a last resort – but it works.

Leave a Comment