當前位置: 首頁>>代碼示例>>C++>>正文


C++ CHECK_EXPECTED_MOCK_FAILURE函數代碼示例

本文整理匯總了C++中CHECK_EXPECTED_MOCK_FAILURE函數的典型用法代碼示例。如果您正苦於以下問題:C++ CHECK_EXPECTED_MOCK_FAILURE函數的具體用法?C++ CHECK_EXPECTED_MOCK_FAILURE怎麽用?C++ CHECK_EXPECTED_MOCK_FAILURE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CHECK_EXPECTED_MOCK_FAILURE函數的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);
}
開發者ID:13coders,項目名稱:cookiecutter-kata-cpputest,代碼行數:25,代碼來源:MockStrictOrderTest.cpp

示例2: TEST

TEST(MockHierarchyTest, reporterIsInheritedInHierarchicalMocks)
{
    MockFailureReporterInstaller failureReporterInstaller;
    MockExpectedCallsListForTest expectations;

    mock("differentScope").actualCall("foobar");

    MockUnexpectedCallHappenedFailure expectedFailure(mockFailureTest(), "foobar", expectations);
    CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
開發者ID:FelixAdrianL,項目名稱:cpputest,代碼行數:10,代碼來源:MockHierarchyTest.cpp

示例3: TEST

TEST(MockCallTest, OnObjectExpectedButNotCalled)
{
    MockFailureReporterInstaller failureReporterInstaller;

    void* objectPtr = (void*) 0x001;
    MockExpectedCallsListForTest expectations;
    expectations.addFunction("boo")->onObject(objectPtr);
    expectations.addFunction("boo")->onObject(objectPtr);

    mock().expectOneCall("boo").onObject(objectPtr);
    mock().expectOneCall("boo").onObject(objectPtr);
    mock().actualCall("boo");
    mock().actualCall("boo");

    MockExpectedObjectDidntHappenFailure expectedFailure(mockFailureTest(), "boo", expectations);
    CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
    mock().checkExpectations();
    CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
開發者ID:DynonAvionics,項目名稱:cpputest,代碼行數:19,代碼來源:MockCallTest.cpp

示例4: TEST

TEST(MockComparatorCopierTest, customObjectParameterFailsWhenNotHavingACopierRepository)
{
    MockFailureReporterInstaller failureReporterInstaller;

    MyTypeForTesting object(1);
    mock().expectOneCall("function").withOutputParameterOfTypeReturning("MyTypeForTesting", "parameterName", &object);
    mock().actualCall("function").withOutputParameterOfType("MyTypeForTesting", "parameterName", &object);

    MockNoWayToCopyCustomTypeFailure expectedFailure(mockFailureTest(), "MyTypeForTesting");
    CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
開發者ID:KisImre,項目名稱:cpputest,代碼行數:11,代碼來源:MockComparatorCopierTest.cpp

示例5: TEST

TEST(MockCallTest, expectNoCallInScopeButActualCallInGlobal)
{
    MockFailureReporterInstaller failureReporterInstaller;

    MockExpectedCallsListForTest expectations;
    MockUnexpectedCallHappenedFailure expectedFailure(mockFailureTest(), "lazy", expectations);

    mock("scope1").expectNoCall("lazy");
    mock().actualCall("lazy");

    CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
開發者ID:13coders,項目名稱:cookiecutter-kata-cpputest,代碼行數:12,代碼來源:MockCallTest.cpp

示例6: 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);
}
開發者ID:FelixAdrianL,項目名稱:cpputest,代碼行數:14,代碼來源:MockParameterTest.cpp

示例7: 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);
}
開發者ID:adustm,項目名稱:cpputest,代碼行數:18,代碼來源:MockStrictOrderTest.cpp


注:本文中的CHECK_EXPECTED_MOCK_FAILURE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。