I am maintaining a server application written in C many years ago. It has very few unit tests (cxxtest) and I am thinking about developing more.
I read on the subject of unit testing C programs in the last days and tried a few things also. The right thing to do appears to be to include the .c file containing the function to test from my test suite. However, because that .c file contains many functions calling many others, there are lots dependencies I have to deal with before I can start the real work.
What I would like to do is to "turn off" all functions I'm not interested with for a particular test. I would stub those called by my function under test. I am considering putting ifdef around my functions if it's what it takes.
Is there a better solution or a framework addressing this problem?