I am writing Unit test and wondering how would I test function pointers with Cmockery.
A.c
void (*FunctionPtr)(void) = &funcA;
void funcA()
{
// calls func B
funcB();
}
TestA.c
void Test_A( void ** state )
{
// test for FunA; working as expected
}
void Test_FunctionPtr( void** state )
{
// how to check here that FunctionPtr holds memory location of funcA?
// I tried something like below:
assert_memory_equal( FunctionPtr, funcA(), sizeof( funcA() ) );
}
During runtime I am getting error and I have no clue how to resolve that. May be I using wrong API to assert but don't know which one to call.
Below is my error:
error during runtime:
Test_FunctionPtr: Starting test
No entries for symbol funcB.