0

I would like to ignore one call placed between other ones that I want to call under the same case test. If I use ignoreothercalls I have not clear if the rest of the calls, following this, will be called. I need the rest, after ignored call, will be called. Or at least, to find the way of stopping ignoreothercalls effect before the end of the test case.

TEST(group, test1){

    ...
    mock().expectOneCall("HAL_AS393x_CommandStrobes").withParameter("cCommandCode",AS393X_CMD_CALIB_RCO_LC);    
    /*-------------------------------------------------------*/
    mock().expectOneCall("HAL_AS393x_ReadRegisters");//I want ignore only this mocked function call
    /*-------------------------------------------------*/
    mock().expectOneCall("HAL_AS393x_Deinit");
    ...

}

I would like to leave this call without being tested, and remove it from de test case without gettig expecting calls errors for it: mock().xxxCall("HAL_AS393x_ReadRegisters"); //-where xxxCall = unkown keyword used for this-

Suvi_Eu
  • 255
  • 1
  • 3
  • 16

1 Answers1

1

You have to check expectation in between:

mock().expect...
do_something_that_call_mocks();
mock().checkExpectations();

/* Start all over again */

Complete example using checkExpectations() to reset mock() here

Felipe Lavratti
  • 2,887
  • 16
  • 34
  • Hi Eugenia, did it help? – Felipe Lavratti Jan 02 '17 at 20:49
  • Hello Felipe, sorry I was occuped and I could not try this option yet. If I understood well, are you telling me I can ignore one mocked call by writing mock().checkExpectations(); after it? What do you mean with start all over againg? The idea is not to evaluate a concret mocked call in a test case. You know, if I comment or suppess the code line from the test, there will be a console error message. Sorry if I'm so new on this. So I don't know if cpputest has some way to do it. – Suvi_Eu Jan 04 '17 at 10:31