When I am writing unit tests in C++, often I need to create some stub method definitions of free functions which are declared in a header file actions.h:
#ifdef __cplusplus
extern "C" {
#endif
void action1(void);
void action2(void);
int action3(void);
#ifdef __cplusplus
}
#endif
Instead of creating the stubs in a separate file
void action1() {}
void action2() {}
int action3() { return 0; }
it would be convenient to define the stubs on the fly in the test code when including this header:
create_stubs(#include <actions.h>)