Open metc opened 6 years ago
Just run above file through C pre-processor and you will get all the defines nicely defined. Then put that file to CMock.
Or just use Ceedling for building.
Also referenced here: https://github.com/ThrowTheSwitch/CMock/issues/126
@Letme we have a quite complex tools/flow to do CMock and run our unit-tests. I could add a step to run the C processor first. I was hoping the processor was part of CMock. @Xunnamius thanks for the link. Looking forward for the next version!
Hi,
I have a similar header file as the example below:
Using a define, I want to expose more functions to my existing API. I would like to include the required header file only if those functions are enabled.
Observation: It seems CMock ignores the "#ifdef USE_API" guard and always generates a mock of
function2
. Workaround: The "api.h" file has to be included (without the guard) or my unit test will not compile.Is there a way to tell to CMock to ignore function2 when a define is set?
Thank you in advance for your help.