• Home
  • Raw
  • Download

Lines Matching +full:test +full:- +full:expectations

30 // Google Mock - a framework for writing C++ mock classes.
34 #include "gmock/gmock-spec-builders.h"
43 #include "gmock/internal/gmock-port.h"
44 #include "gtest/gtest-spi.h"
46 #include "gtest/internal/gtest-port.h"
68 // This line verifies that a mock method can take a by-reference
76 TEST(MockMethodTest, CanInstantiateWithIncompleteArgType) { in TEST() function
78 // by-reference an argument whose type is incomplete, we can still in TEST()
161 TEST(OnCallSyntaxTest, CompilesWithMethodNameExpandedFromMacro) { in TEST() function
168 TEST(OnCallSyntaxTest, WorksWithMethodNameExpandedFromMacro) { in TEST() function
175 TEST(ExpectCallSyntaxTest, CompilesWithMethodNameExpandedFromMacro) { in TEST() function
182 TEST(ExpectCallSyntaxTest, WorksWithMethodNameExpandedFromMacro) { in TEST() function
192 TEST(OnCallSyntaxTest, EvaluatesFirstArgumentOnce) { in TEST() function
200 TEST(OnCallSyntaxTest, EvaluatesSecondArgumentOnce) { in TEST() function
210 TEST(OnCallSyntaxTest, WithIsOptional) { in TEST() function
217 TEST(OnCallSyntaxTest, WithCanAppearAtMostOnce) { in TEST() function
230 TEST(OnCallSyntaxTest, WillByDefaultIsMandatory) { in TEST() function
241 TEST(OnCallSyntaxTest, WillByDefaultCanAppearAtMostOnce) { in TEST() function
253 TEST(ExpectCallSyntaxTest, EvaluatesFirstArgumentOnce) { in TEST() function
262 TEST(ExpectCallSyntaxTest, EvaluatesSecondArgumentOnce) { in TEST() function
273 TEST(ExpectCallSyntaxTest, WithIsOptional) { in TEST() function
280 TEST(ExpectCallSyntaxTest, WithCanAppearAtMostOnce) { in TEST() function
292 TEST(ExpectCallSyntaxTest, WithMustBeFirstClause) { in TEST() function
312 TEST(ExpectCallSyntaxTest, TimesCanBeInferred) { in TEST() function
324 TEST(ExpectCallSyntaxTest, TimesCanAppearAtMostOnce) { in TEST() function
337 TEST(ExpectCallSyntaxTest, TimesMustBeBeforeInSequence) { in TEST() function
350 TEST(ExpectCallSyntaxTest, InSequenceIsOptional) { in TEST() function
361 TEST(ExpectCallSyntaxTest, InSequenceCanAppearMultipleTimes) { in TEST() function
370 TEST(ExpectCallSyntaxTest, InSequenceMustBeBeforeAfter) { in TEST() function
384 TEST(ExpectCallSyntaxTest, InSequenceMustBeBeforeWillOnce) { in TEST() function
397 TEST(ExpectCallSyntaxTest, AfterMustBeBeforeWillOnce) { in TEST() function
409 TEST(ExpectCallSyntaxTest, WillIsOptional) { in TEST() function
419 TEST(ExpectCallSyntaxTest, WillCanAppearMultipleTimes) { in TEST() function
429 TEST(ExpectCallSyntaxTest, WillMustBeBeforeWillRepeatedly) { in TEST() function
441 TEST(ExpectCallSyntaxTest, WillRepeatedlyIsOptional) { in TEST() function
452 TEST(ExpectCallSyntaxTest, WillRepeatedlyCannotAppearMultipleTimes) { in TEST() function
464 TEST(ExpectCallSyntaxTest, WillRepeatedlyMustBeBeforeRetiresOnSaturation) { in TEST() function
474 TEST(ExpectCallSyntaxTest, RetiresOnSaturationIsOptional) { in TEST() function
484 TEST(ExpectCallSyntaxTest, RetiresOnSaturationCannotAppearMultipleTimes) { in TEST() function
496 TEST(ExpectCallSyntaxTest, DefaultCardinalityIsOnce) { in TEST() function
522 TEST(ExpectCallSyntaxTest, DoesNotWarnOnAdequateActionCount) { in TEST() function
543 // Satisfies the above expectations. in TEST()
552 TEST(ExpectCallSyntaxTest, WarnsOnTooManyActions) { in TEST() function
573 // Satisfies the above expectations. in TEST()
607 TEST(ExpectCallSyntaxTest, WarnsOnTooFewActions) { in TEST() function
623 TEST(ExpectCallSyntaxTest, WarningIsErrorWithFlag) { in TEST() function
655 GMOCK_FLAG_SET(default_mock_behavior, -1); in TEST()
683 // Tests that the built-in default action is taken when no ON_CALL()
685 TEST(OnCallTest, TakesBuiltInDefaultActionWhenNoOnCall) { in TEST() function
692 // Tests that the built-in default action is taken when no ON_CALL()
694 TEST(OnCallTest, TakesBuiltInDefaultActionWhenNoOnCallMatches) { in TEST() function
703 TEST(OnCallTest, PicksLastMatchingOnCall) { in TEST() function
716 TEST(ExpectCallTest, AllowsAnyCallWhenNoSpec) { in TEST() function
729 TEST(ExpectCallTest, PicksLastMatchingExpectCall) { in TEST() function
737 // Tests lower-bound violation.
738 TEST(ExpectCallTest, CatchesTooFewCalls) { in TEST() function
749 " Actual: called once - unsatisfied and active"); in TEST()
754 TEST(ExpectCallTest, InfersCardinalityWhenThereIsNoWillRepeatedly) { in TEST() function
782 TEST(ExpectCallTest, InfersCardinality1WhenThereIsWillRepeatedly) { in TEST() function
809 // It should be possible to return a non-moveable type from a mock action in
812 TEST(ExpectCallTest, NonMoveableType) { in TEST() function
813 // Define a non-moveable result type. in TEST()
851 // Tests that the n-th action is taken for the n-th matching
853 TEST(ExpectCallTest, NthMatchTakesNthAction) { in TEST() function
865 TEST(ExpectCallTest, TakesRepeatedActionWhenWillListIsExhausted) { in TEST() function
878 TEST(ExpectCallTest, TakesDefaultActionWhenWillListIsExhausted) { in TEST() function
901 " - returning default value.")); in TEST()
905 " - returning default value.")); in TEST()
908 TEST(FunctionMockerMessageTest, ReportsExpectCallLocationForExhausedActions) { in TEST() function
922 TEST(FunctionMockerMessageTest, in TEST() function
938 TEST(UninterestingCallTest, DoesDefaultAction) { in TEST() function
952 TEST(UnexpectedCallTest, DoesDefaultAction) { in TEST() function
968 int n = -1; in TEST()
975 TEST(UnexpectedCallTest, GeneratesFailureForVoidFunction) { in TEST() function
981 // EXPECT_NONFATAL_FAILURE doesn't support that, so we test for in TEST()
982 // multiple sub-strings instead. in TEST()
985 "Unexpected mock function call - returning directly.\n" in TEST()
993 " Actual: called once - saturated and active"); in TEST()
1002 "Unexpected mock function call - returning directly.\n" in TEST()
1004 "Google Mock tried the following 2 expectations, but none matched:"); in TEST()
1011 " Actual: called once - saturated and active"); in TEST()
1018 " Actual: never called - unsatisfied and active"); in TEST()
1022 // Tests that an unexpected non-void function generates the right
1024 TEST(UnexpectedCallTest, GeneartesFailureForNonVoidFunction) { in TEST() function
1030 "Unexpected mock function call - returning default value.\n" in TEST()
1039 " Actual: called once - saturated and active"); in TEST()
1044 TEST(UnexpectedCallTest, RetiredExpectation) { in TEST() function
1056 TEST(UnexpectedCallTest, UnmatchedArguments) { in TEST() function
1067 // unsatisfied pre-requisites doesn't match the call.
1068 TEST(UnexpectedCallTest, UnsatisfiedPrerequisites) { in TEST() function
1080 // Now 'failures' contains the Google Test failures generated by in TEST()
1084 // There should be one non-fatal failure. in TEST()
1090 // pre-requisites but not the satisfied one. in TEST()
1097 "(?s)the following immediate pre-requisites are not satisfied:\n" in TEST()
1098 ".*: pre-requisite #0\n" in TEST()
1099 ".*: pre-requisite #1")); in TEST()
1105 "the following immediate pre-requisites are not satisfied:\n" in TEST()
1106 "(.|\n)*: pre-requisite #0\n" in TEST()
1107 "(.|\n)*: pre-requisite #1")); in TEST()
1109 // We can only use Google Test's own simple regex. in TEST()
1112 "the following immediate pre-requisites are not satisfied:")); in TEST()
1113 EXPECT_THAT(r.message(), ContainsRegex(": pre-requisite #0")); in TEST()
1114 EXPECT_THAT(r.message(), ContainsRegex(": pre-requisite #1")); in TEST()
1122 TEST(UndefinedReturnValueTest, in TEST() function
1137 TEST(ExcessiveCallTest, DoesDefaultAction) { in TEST() function
1153 int n = -1; in TEST()
1162 TEST(ExcessiveCallTest, GeneratesFailureForVoidFunction) { in TEST() function
1167 "Mock function \"DoA Method\" called more times than expected - " in TEST()
1171 " Actual: called once - over-saturated and active"); in TEST()
1174 // Tests that when a non-void function is called too many times, the
1176 TEST(ExcessiveCallTest, GeneratesFailureForNonVoidFunction) { in TEST() function
1182 "Mock function called more times than expected - " in TEST()
1187 " Actual: called twice - over-saturated and active"); in TEST()
1192 TEST(InSequenceTest, AllExpectationInScopeAreInSequence) { in TEST() function
1211 TEST(InSequenceTest, NestedInSequence) { in TEST() function
1236 TEST(InSequenceTest, ExpectationsOutOfScopeAreNotAffected) { in TEST() function
1258 TEST(SequenceTest, AnyOrderIsOkByDefault) { in TEST() function
1284 TEST(SequenceTest, CallsMustBeInStrictOrderWhenSaidSo1) { in TEST() function
1304 TEST(SequenceTest, CallsMustBeInStrictOrderWhenSaidSo2) { in TEST() function
1320 class PartialOrderTest : public testing::Test {
1382 TEST(SequenceTest, Retirement) { in TEST() function
1397 TEST(ExpectationTest, ConstrutorsWork) { in TEST() function
1429 TEST(ExpectationTest, AssignmentWorks) { in TEST() function
1444 TEST(ExpectationSetTest, MemberTypesAreCorrect) { in TEST() function
1448 TEST(ExpectationSetTest, ConstructorsWork) { in TEST() function
1477 TEST(ExpectationSetTest, AssignmentWorks) { in TEST() function
1487 TEST(ExpectationSetTest, InsertionWorks) { in TEST() function
1507 TEST(ExpectationSetTest, SizeWorks) { in TEST() function
1521 TEST(ExpectationSetTest, IsEnumerable) { in TEST() function
1535 TEST(AfterTest, SucceedsWhenPartialOrderIsSatisfied) { in TEST() function
1547 TEST(AfterTest, SucceedsWhenTotalOrderIsSatisfied) { in TEST() function
1563 TEST(AfterTest, CallsMustBeInStrictOrderWhenSpecifiedSo1) { in TEST() function
1583 TEST(AfterTest, CallsMustBeInStrictOrderWhenSpecifiedSo2) { in TEST() function
1604 TEST(AfterTest, CallsMustSatisfyPartialOrderWhenSpecifiedSo) { in TEST() function
1624 TEST(AfterTest, CallsMustSatisfyPartialOrderWhenSpecifiedSo2) { in TEST() function
1644 TEST(AfterTest, CanBeUsedWithInSequence) { in TEST() function
1661 TEST(AfterTest, CanBeCalledManyTimes) { in TEST() function
1675 TEST(AfterTest, AcceptsUpToFiveArguments) { in TEST() function
1692 // .After() allows input to contain duplicated Expectations.
1693 TEST(AfterTest, AcceptsDuplicatedInput) { in TEST() function
1718 TEST(AfterTest, ChangesToExpectationSetHaveNoEffectAfterwards) { in TEST() function
1731 // after a mock object owning one of their pre-requisites has died.
1734 TEST(DeletingMockEarlyTest, Success1) { in TEST() function
1748 EXPECT_EQ(1, b1->DoB(1)); in TEST()
1750 // a's pre-requisite has died. in TEST()
1751 EXPECT_TRUE(a->Binary(0, 1)); in TEST()
1754 EXPECT_TRUE(a->Binary(1, 2)); in TEST()
1759 TEST(DeletingMockEarlyTest, Success2) { in TEST() function
1772 EXPECT_EQ(1, b1->DoB(1)); in TEST()
1773 EXPECT_EQ(2, b2->DoB(2)); in TEST()
1781 // -W4.
1793 TEST(DeletingMockEarlyTest, CanDeleteSelfInActionReturningVoid) { in TEST() function
1796 a->DoA(42); // This will cause a to be deleted. in TEST()
1799 TEST(DeletingMockEarlyTest, CanDeleteSelfInActionReturningValue) { in TEST() function
1802 a->ReturnResult(42); // This will cause a to be deleted. in TEST()
1806 TEST(DeletingMockEarlyTest, Failure1) { in TEST() function
1819 EXPECT_NONFATAL_FAILURE({ b2->DoB(2); }, "Unexpected mock function call"); in TEST()
1820 EXPECT_EQ(1, b1->DoB(1)); in TEST()
1826 TEST(DeletingMockEarlyTest, Failure2) { in TEST() function
1839 EXPECT_NONFATAL_FAILURE(a->Binary(0, 1), "Unexpected mock function call"); in TEST()
1840 EXPECT_NONFATAL_FAILURE(b2->DoB(1), "Unexpected mock function call"); in TEST()
1867 TEST(ExpectationBaseTest, in TEST() function
1876 a->DoA(3); in TEST()
1877 a->DoA(1); in TEST()
1878 EXPECT_NONFATAL_FAILURE(a->DoA(2), "Unexpected mock function call"); in TEST()
1909 class VerboseFlagPreservingFixture : public testing::Test {
1930 // --gmock_verbose=warning is specified.
1931 TEST(FunctionCallMessageTest, in TEST() function
1944 // --gmock_verbose=info is specified.
1945 TEST(FunctionCallMessageTest, in TEST() function
1957 // We check the stack trace content in dbg-mode only, as opt-mode in TEST()
1964 // Verifies that a non-void mock function's name appears in the in TEST()
1976 TEST(FunctionCallMessageTest, in TEST() function
1978 // A non-void mock function. in TEST()
1985 "Uninteresting mock function call - returning default value.\n" in TEST()
1998 ContainsRegex("Uninteresting mock function call - returning directly\\.\n" in TEST()
2001 "Printable, 4-byte object <00-00 00-00>\\)")); in TEST()
2005 // Tests how the --gmock_verbose flag affects Google Mock's output.
2019 // We check the stack trace content in dbg-mode only, as opt-mode in VerifyOutput()
2037 // A void-returning function. in TestExpectedCall()
2046 // A non-void-returning function. in TestExpectedCall()
2067 "knowing-when-to-expect for details."; in TestUninterestingCallOnNaggyMock()
2069 // A void-returning function. in TestUninterestingCallOnNaggyMock()
2074 "Uninteresting mock function call - returning directly.\n" in TestUninterestingCallOnNaggyMock()
2079 // A non-void-returning function. in TestUninterestingCallOnNaggyMock()
2084 "Uninteresting mock function call - returning default value.\n" in TestUninterestingCallOnNaggyMock()
2092 // Tests that --gmock_verbose=info causes both expected and
2100 // Tests that --gmock_verbose=warning causes uninteresting calls to be
2108 // Tests that --gmock_verbose=warning causes neither expected nor
2116 // Tests that --gmock_verbose=SOME_INVALID_VALUE has the same effect
2117 // as --gmock_verbose=warning.
2172 TEST(AllowLeakTest, AllowsLeakingUnusedMockObject) { in TEST() function
2177 TEST(AllowLeakTest, CanBeCalledBeforeOnCall) { in TEST() function
2181 a->DoA(0); in TEST()
2184 TEST(AllowLeakTest, CanBeCalledAfterOnCall) { in TEST() function
2190 TEST(AllowLeakTest, CanBeCalledBeforeExpectCall) { in TEST() function
2194 a->DoA(0); in TEST()
2197 TEST(AllowLeakTest, CanBeCalledAfterExpectCall) { in TEST() function
2203 TEST(AllowLeakTest, WorksWhenBothOnCallAndExpectCallArePresent) { in TEST() function
2210 // Tests that we can verify and clear a mock object's expectations
2211 // when none of its methods has expectations.
2212 TEST(VerifyAndClearExpectationsTest, NoMethodHasExpectations) { in TEST() function
2216 // There should be no expectations on the methods now, so we can in TEST()
2222 // Tests that we can verify and clear a mock object's expectations
2223 // when some, but not all, of its methods have expectations *and* the
2225 TEST(VerifyAndClearExpectationsTest, SomeMethodsHaveExpectationsAndSucceed) { in TEST() function
2231 // There should be no expectations on the methods now, so we can in TEST()
2237 // Tests that we can verify and clear a mock object's expectations
2238 // when some, but not all, of its methods have expectations *and* the
2240 TEST(VerifyAndClearExpectationsTest, SomeMethodsHaveExpectationsAndFail) { in TEST() function
2248 // There should be no expectations on the methods now, so we can in TEST()
2254 // Tests that we can verify and clear a mock object's expectations
2255 // when all of its methods have expectations.
2256 TEST(VerifyAndClearExpectationsTest, AllMethodsHaveExpectations) { in TEST() function
2264 // There should be no expectations on the methods now, so we can in TEST()
2270 // Tests that we can verify and clear a mock object's expectations
2272 TEST(VerifyAndClearExpectationsTest, AMethodHasManyExpectations) { in TEST() function
2282 // There should be no expectations on the methods now, so we can in TEST()
2290 TEST(VerifyAndClearExpectationsTest, CanCallManyTimes) { in TEST() function
2301 // There should be no expectations on the methods now, so we can in TEST()
2309 TEST(VerifyAndClearTest, NoMethodHasDefaultActions) { in TEST() function
2311 // If this crashes or generates a failure, the test will catch it. in TEST()
2318 TEST(VerifyAndClearTest, SomeMethodsHaveDefaultActions) { in TEST() function
2330 TEST(VerifyAndClearTest, AllMethodsHaveDefaultActions) { in TEST() function
2346 TEST(VerifyAndClearTest, AMethodHasManyDefaultActions) { in TEST() function
2361 TEST(VerifyAndClearTest, CanCallManyTimes) { in TEST() function
2375 TEST(VerifyAndClearTest, Success) { in TEST() function
2384 // There should be no expectations on the methods now, so we can in TEST()
2391 TEST(VerifyAndClearTest, Failure) { in TEST() function
2402 // There should be no expectations on the methods now, so we can in TEST()
2409 // expectations are set on a const mock object.
2410 TEST(VerifyAndClearTest, Const) { in TEST() function
2420 // There should be no expectations on the methods now, so we can in TEST()
2426 // Tests that we can set default actions and expectations on a mock
2428 TEST(VerifyAndClearTest, CanSetDefaultActionsAndExpectationsAfterwards) { in TEST() function
2445 TEST(VerifyAndClearTest, DoesNotAffectOtherMockObjects) { in TEST() function
2462 // Verifies that the default actions and expectations of a and b1 in TEST()
2471 TEST(VerifyAndClearTest, in TEST() function
2491 TEST(VerifyAndClearTest, in TEST() function
2515 TEST(SynchronizationTest, CanCallMockMethodInAction) { in TEST() function
2533 TEST(ParameterlessExpectationsTest, CanSetExpectationsWithoutMatchers) { in TEST() function
2553 TEST(ParameterlessExpectationsTest, CanSetExpectationsForOverloadedMethods) { in TEST() function
2569 TEST(ParameterlessExpectationsTest, CanSetExpectationsForConstMethods) { in TEST() function
2584 TEST(ParameterlessExpectationsTest, in TEST() function
2615 // --gmock_catch_leaked_mocks and --gmock_verbose the user specifies.