Hi,
The code I'm testing is on a Windows dll. I wrote a test program that links in the dll and runs tests on it.
It looks like this:
test_runner<-library<-collaborator (another library being mocked).
This pseudocode fails with "mock_func not called" and upon step-debugging I step into the real function.
REQUIRE_CALL(mock_api, mockedfunc()).RETURN(retval);
err = mocked_func(arg);
REQUIRE(err == ERR_OK);
I'm assuming (haven't verified) that Windows us loading the real collaborator library (as it's a dependency for it) and then the test binary runs that code instead of the mocked call. The issue is that I can't run tests that mock return values to test error handling.
Does this make sense? I'm a firmware guy, my windows-fu is not the strongest.
Hi, The code I'm testing is on a Windows dll. I wrote a test program that links in the dll and runs tests on it. It looks like this: test_runner<-library<-collaborator (another library being mocked).
This pseudocode fails with "mock_func not called" and upon step-debugging I step into the real function. REQUIRE_CALL(mock_api, mockedfunc()).RETURN(retval); err = mocked_func(arg); REQUIRE(err == ERR_OK);
I'm assuming (haven't verified) that Windows us loading the real collaborator library (as it's a dependency for it) and then the test binary runs that code instead of the mocked call. The issue is that I can't run tests that mock return values to test error handling.
Does this make sense? I'm a firmware guy, my windows-fu is not the strongest.
Thanks!