void checkUnexpectedNthCallMessage(unsigned int count, const char* expectedOrdinal) { MockExpectedCallsList callList; MockCheckedExpectedCall expCall; expCall.withName("bar"); for (unsigned int i = 0; i < (count - 1); i++) { expCall.callWasMade(1); callList.addExpectedCall(&expCall); } MockUnexpectedCallHappenedFailure failure(UtestShell::getCurrent(), "bar", callList); SimpleString expectedMessage = StringFromFormat("Mock Failure: Unexpected additional (%s) call to function: bar\n\tEXPECTED", expectedOrdinal); STRCMP_CONTAINS(expectedMessage.asCharString(), failure.getMessage().asCharString()); }
TEST(MockParameterTest, ignoreOtherParametersMultipleCallsButOneDidntHappen) { MockFailureReporterInstaller failureReporterInstaller; MockExpectedCallsListForTest expectations; MockCheckedExpectedCall* call = expectations.addFunction("boo"); call->ignoreOtherParameters(); call->callWasMade(1); call->parametersWereIgnored(); call->ignoreOtherParameters(); expectations.addFunction("boo")->ignoreOtherParameters(); MockExpectedCallsDidntHappenFailure expectedFailure(mockFailureTest(), expectations); mock().expectOneCall("boo").ignoreOtherParameters(); mock().expectOneCall("boo").ignoreOtherParameters(); mock().actualCall("boo"); mock().checkExpectations(); CHECK_EXPECTED_MOCK_FAILURE(expectedFailure); }