2

I am writing some unit test on unity (http://www.throwtheswitch.org/unity/), however I am not getting the expected results and the test is failing when asserting.

Is there a way I can do printfs to do some debuggin on the mock callback functions?

For instance, the below assert is failing, I need to be able to know what I am getting in _myfunction_test to understand why this is failing:

myfunction_StubWithCallback((CMOCK_myfunction_CALLBACK) _myfunction_test);

TEST_ASSERT_EQUAL_UINT16(5, Request_function(a, u8In, u8Out));

Any help is much appreciated.

Blue
  • 820
  • 4
  • 17
maverick
  • 31
  • 4
  • 1
    Why not simply use a debugger with a breakpoint at the return statement of `_myfunction_test`? If the code you write does not do what you expect, writing yet more code to debug it is perhaps a flawed proposition. – Clifford Oct 19 '18 at 12:39
  • Just sprinkle printfs in `_myfunction_test` or anywhere else you want them. You do run the tests on a host system with standard IO, right? – Jens Oct 19 '18 at 14:03
  • I don't see how the assertion relates to `_myfunction_test`. – Dirk Herrmann Mar 13 '19 at 17:05

0 Answers0