本文整理汇总了C++中MockExpectedCallsListForTest类的典型用法代码示例。如果您正苦于以下问题:C++ MockExpectedCallsListForTest类的具体用法?C++ MockExpectedCallsListForTest怎么用?C++ MockExpectedCallsListForTest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MockExpectedCallsListForTest类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST
TEST(MockStrictOrderTest, orderViolatedWorksWithExtraUnexpectedCall)
{
MockFailureReporterInstaller failureReporterInstaller;
mock().strictOrder();
mock("bla").strictOrder();
mock().ignoreOtherCalls();
MockExpectedCallsListForTest expectations;
expectations.addFunction("foo::foo1", 1)->callWasMade(2);
expectations.addFunction("foo::foo2", 2)->callWasMade(1);
MockCallOrderFailure expectedFailure(mockFailureTest(), expectations);
mock("bla").expectOneCall("foo1");
mock("foo").expectOneCall("foo1");
mock("foo").expectOneCall("foo2");
mock("bla").actualCall("foo1");
mock("foo").actualCall("foo2");
mock("foo").actualCall("unexpected1");
mock("foo").actualCall("foo1");
mock("foo").actualCall("unexpected2");
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
示例2: TEST
TEST(MockParameterTest, noActualCallForOutputParameter)
{
MockFailureReporterInstaller failureReporterInstaller;
int output;
MockExpectedCallsListForTest expectations;
mock().expectOneCall("foo").withOutputParameterReturning("output", &output, sizeof(output));
expectations.addFunction("foo")->withOutputParameterReturning("output", &output, sizeof(output));
MockExpectedCallsDidntHappenFailure expectedFailure(mockFailureTest(), expectations);
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
示例3: TEST
TEST(MockHierarchyTest, checkExpectationsWorksHierarchicallyForLastCallNotFinished)
{
MockFailureReporterInstaller failureReporterInstaller;
MockExpectedCallsListForTest expectations;
expectations.addFunction("foobar")->withParameter("boo", 1);
MockExpectedParameterDidntHappenFailure expectedFailure(mockFailureTest(), "foobar", expectations);
mock("first").expectOneCall("foobar").withParameter("boo", 1);
mock("first").actualCall("foobar");
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
示例4: TEST
TEST(MockCallTest, checkExpectationsClearsTheExpectations)
{
MockFailureReporterInstaller failureReporterInstaller;
MockExpectedCallsListForTest expectations;
expectations.addFunction("foobar");
MockExpectedCallsDidntHappenFailure expectedFailure(mockFailureTest(), expectations);
mock().expectOneCall("foobar");
mock().checkExpectations();
CHECK(! mock().expectedCallsLeft());
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
示例5: TEST
TEST(MockComparatorCopierTest, noCopierForCustomTypeOutputParameter)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting expectedObject(123464);
MyTypeForTesting actualObject(8834);
MockExpectedCallsListForTest expectations;
expectations.addFunction("foo")->withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
MockNoWayToCopyCustomTypeFailure expectedFailure(mockFailureTest(), "MyTypeForTesting");
mock().expectOneCall("foo").withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
mock().actualCall("foo").withOutputParameterOfType("MyTypeForTesting", "output", &actualObject);
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
示例6: TEST
TEST(MockStrictOrderTest, orderViolatedWithinAScope)
{
MockFailureReporterInstaller failureReporterInstaller;
mock().strictOrder();
MockExpectedCallsListForTest expectations;
expectations.addFunction("foo1", 1)->callWasMade(2);
expectations.addFunction("foo2", 2)->callWasMade(1);
MockCallOrderFailure expectedFailure(mockFailureTest(), expectations);
mock("scope").expectOneCall("foo1");
mock("scope").expectOneCall("foo2");
mock("scope").actualCall("foo2");
mock("scope").actualCall("foo1");
mock("scope").checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
示例7: TEST
TEST(MockComparatorCopierTest, customTypeOutputParameterOfWrongType)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting expectedObject(123464);
MyTypeForTesting actualObject(75646);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
MockExpectedCallsListForTest expectations;
expectations.addFunction("foo")->withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
MockNamedValue parameter("output");
parameter.setObjectPointer("OtherTypeForTesting", &actualObject);
MockUnexpectedOutputParameterFailure expectedFailure(mockFailureTest(), "foo", parameter, expectations);
mock().expectOneCall("foo").withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
mock().actualCall("foo").withOutputParameterOfType("OtherTypeForTesting", "output", &actualObject);
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
mock().removeAllComparatorsAndCopiers();
}