I'm new to Cmock
a mocking framework in C
, and trying to start using it.
I took the 'make_example' supplied in the exmaples dir and modified it a bit.
My code is appearing underneath:
/////////////////////////// foo.c ///////////////////////////
#include "foo.h"
int foo_init(int number)
{
return 0;
}
int func_using_foo_init(int number)
{
int ret = -1;
ret = foo_init(number);
return ret;
}
//////////////////////////////////////////////////////
/////////////////////////// test_main.c ///////////////////////////
#include "unity.h"
#include "mock_foo.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_main_should_initialize_foo(void)
{
int ret = -1;
foo_init_ExpectAndReturn(1, 0);
ret = func_using_foo_init(1);
TEST_ASSERT_FALSE(ret);
}
//////////////////////////////////////////////////////
when running the shown test, i'm getting the next error:
FAIL:Function func_using_foo_init. Called more times than expected.
in addition if i'm adding a call to func_using_foo_init_ExpectAndReturn, i'm getting the next error:
Function foo_init. Called less times than expected.
seems like function calls are not recognized.. any help will be highly appreciated ! liad