Coming at C from a “test legacy code first” point of view is tricky. All those neat test framework features for testing code not written under test (i.e. mocks, etc.) rely on a language’s dynamic nature for implementation details.
You don’t get that easily in C, so it was a pleasure to be introduced to the cmocka framework. In addition to being a fully featured unit test framework (pass/fail tests, fixtures, etc.), cmocka allows you to “mock” specific C functions in a particular test suite using the linker’s
I use the term mock loosely here. The system itself is better described as a monkey patching system (replace one function definition with another), but as userland C lacks the concept of an “object with methods attached”, monkey patching serves the same purpose as mock objects in other languages.