It would work better if you use CMock or another C-language-based mocking tool. In order to stub or mock a C function, you have to have your test link against a different implementation of that C function. (Or use function pointers.)
One way of using function-pointers is something like this (pseudo C/C++ code):
Instead of this in the header:
void inner(int x);
use this:
typedef void (*InnerFunc)(int x);
extern InnerFunc inner;
In the implementation of inner:
static void inner_impl(int x) {
... etc.....
}
InnerFunc inner = inner_impl;
In the test:
static void inner_mock(int x) {
... etc.....
}
...blah blah gmock test stuff....
setup() {
save_inner = inner;
inner = inner_mock;
}
teardown()
{
inner = save_inner;
}
test()
{
set expectations for inner_impl
outer();
assert that expectations for inner_impl were satisfied
}
Syntax of the production code remains the same (though now it is actually calling a function-pointer instead of direct reference to the function.)
void outer(void)
{
inner(1234);
}
This book explains how you can do TDD and mocking in C: