cunit-testingcmockceedling

CMock mock some functions but not others from same module


//myfuncs.h
void func1(void);

void func2(void;

I'm doing unit testing. Using CMock with ceedling, is there any way to mock func1(), but run func2() as it was originally written?


Solution

  • To my knowledge, you can't. You must split the header file into two and generate mocks for one of them.

    There are unit test frameworks that can mock one or more functions in a header file, Nala (which I'm maintaining) for example. But I guess you want to use CMock with Ceedling, so it's not really an option.