I am using ceedling to unit test a C application and trying to achieve high coverage ~100%.
I have a static callback function in one of my application module, which is registered to SDK function with function pointer and is called at certain event from the SDK.
In appModule.c,
typedef void( *type_appCallback ) ( void );
static void appCallback( void );
I want to unit test this function and since this functions is static will not be seen in the ceedling test_appModule.c.
I have a work around to this define TEST_STATIC
instead of static
,
#ifdef TEST
TEST_STATIC
#else
TEST_STATIC static
#endif
But I am not big fan of this work around, any suggestions to above problem?
As a workaround you could use a wrapper module that includes the C file.
wrap_app_Module.c
Instead of the
static
function you can call the wrapper function in your tests.