1 // Copyright 2007, Google Inc.
2 // All rights reserved.
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 // Google Mock - a framework for writing C++ mock classes.
33 // This file tests the function mocker classes.
34 #include "gmock/gmock-generated-function-mockers.h"
37 // MSDN says the header file to be included for STDMETHOD is BaseTyps.h but
38 // we are getting compiler errors if we use basetyps.h, hence including
39 // objbase.h for definition of STDMETHOD.
41 #endif // GTEST_OS_WINDOWS
45 #include "gmock/gmock.h"
46 #include "gtest/gtest.h"
49 namespace gmock_function_mocker_test {
54 using testing::AnyNumber;
56 using testing::DoDefault;
59 using testing::MockFunction;
61 using testing::Return;
62 using testing::ReturnRef;
63 using testing::TypedEq;
66 class TemplatedCopyable {
68 TemplatedCopyable() {}
71 TemplatedCopyable(const U& other) {} // NOLINT
76 virtual ~FooInterface() {}
78 virtual void VoidReturning(int x) = 0;
80 virtual int Nullary() = 0;
81 virtual bool Unary(int x) = 0;
82 virtual long Binary(short x, int y) = 0; // NOLINT
83 virtual int Decimal(bool b, char c, short d, int e, long f, // NOLINT
84 float g, double h, unsigned i, char* j,
85 const std::string& k) = 0;
87 virtual bool TakesNonConstReference(int& n) = 0; // NOLINT
88 virtual std::string TakesConstReference(const int& n) = 0;
89 virtual bool TakesConst(const int x) = 0;
91 virtual int OverloadedOnArgumentNumber() = 0;
92 virtual int OverloadedOnArgumentNumber(int n) = 0;
94 virtual int OverloadedOnArgumentType(int n) = 0;
95 virtual char OverloadedOnArgumentType(char c) = 0;
97 virtual int OverloadedOnConstness() = 0;
98 virtual char OverloadedOnConstness() const = 0;
100 virtual int TypeWithHole(int (*func)()) = 0;
101 virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0;
102 virtual int TypeWithTemplatedCopyCtor(const TemplatedCopyable<int>&) = 0;
105 STDMETHOD_(int, CTNullary)() = 0;
106 STDMETHOD_(bool, CTUnary)(int x) = 0;
107 STDMETHOD_(int, CTDecimal)
108 (bool b, char c, short d, int e, long f, // NOLINT
109 float g, double h, unsigned i, char* j, const std::string& k) = 0;
110 STDMETHOD_(char, CTConst)(int x) const = 0;
111 #endif // GTEST_OS_WINDOWS
114 // Const qualifiers on arguments were once (incorrectly) considered
115 // significant in determining whether two virtual functions had the same
116 // signature. This was fixed in Visual Studio 2008. However, the compiler
117 // still emits a warning that alerts about this change in behavior.
119 # pragma warning(push)
120 # pragma warning(disable : 4373)
122 class MockFoo : public FooInterface {
126 // Makes sure that a mock function parameter can be named.
127 MOCK_METHOD(void, VoidReturning, (int n)); // NOLINT
129 MOCK_METHOD(int, Nullary, ()); // NOLINT
131 // Makes sure that a mock function parameter can be unnamed.
132 MOCK_METHOD(bool, Unary, (int)); // NOLINT
133 MOCK_METHOD(long, Binary, (short, int)); // NOLINT
134 MOCK_METHOD(int, Decimal,
135 (bool, char, short, int, long, float, // NOLINT
136 double, unsigned, char*, const std::string& str),
139 MOCK_METHOD(bool, TakesNonConstReference, (int&)); // NOLINT
140 MOCK_METHOD(std::string, TakesConstReference, (const int&));
141 MOCK_METHOD(bool, TakesConst, (const int)); // NOLINT
143 // Tests that the function return type can contain unprotected comma.
144 MOCK_METHOD((std::map<int, std::string>), ReturnTypeWithComma, (), ());
145 MOCK_METHOD((std::map<int, std::string>), ReturnTypeWithComma, (int),
148 MOCK_METHOD(int, OverloadedOnArgumentNumber, ()); // NOLINT
149 MOCK_METHOD(int, OverloadedOnArgumentNumber, (int)); // NOLINT
151 MOCK_METHOD(int, OverloadedOnArgumentType, (int)); // NOLINT
152 MOCK_METHOD(char, OverloadedOnArgumentType, (char)); // NOLINT
154 MOCK_METHOD(int, OverloadedOnConstness, (), (override)); // NOLINT
155 MOCK_METHOD(char, OverloadedOnConstness, (), (override, const)); // NOLINT
157 MOCK_METHOD(int, TypeWithHole, (int (*)()), ()); // NOLINT
158 MOCK_METHOD(int, TypeWithComma, ((const std::map<int, std::string>&)));
159 MOCK_METHOD(int, TypeWithTemplatedCopyCtor,
160 (const TemplatedCopyable<int>&)); // NOLINT
163 MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE)));
164 MOCK_METHOD(bool, CTUnary, (int), (Calltype(STDMETHODCALLTYPE)));
165 MOCK_METHOD(int, CTDecimal,
166 (bool b, char c, short d, int e, long f, float g, double h,
167 unsigned i, char* j, const std::string& k),
168 (Calltype(STDMETHODCALLTYPE)));
169 MOCK_METHOD(char, CTConst, (int), (const, Calltype(STDMETHODCALLTYPE)));
170 MOCK_METHOD((std::map<int, std::string>), CTReturnTypeWithComma, (),
171 (Calltype(STDMETHODCALLTYPE)));
172 #endif // GTEST_OS_WINDOWS
175 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
178 # pragma warning(pop)
181 class MockMethodFunctionMockerTest : public testing::Test {
183 MockMethodFunctionMockerTest() : foo_(&mock_foo_) {}
185 FooInterface* const foo_;
189 // Tests mocking a void-returning function.
190 TEST_F(MockMethodFunctionMockerTest, MocksVoidFunction) {
191 EXPECT_CALL(mock_foo_, VoidReturning(Lt(100)));
192 foo_->VoidReturning(0);
195 // Tests mocking a nullary function.
196 TEST_F(MockMethodFunctionMockerTest, MocksNullaryFunction) {
197 EXPECT_CALL(mock_foo_, Nullary())
198 .WillOnce(DoDefault())
199 .WillOnce(Return(1));
201 EXPECT_EQ(0, foo_->Nullary());
202 EXPECT_EQ(1, foo_->Nullary());
205 // Tests mocking a unary function.
206 TEST_F(MockMethodFunctionMockerTest, MocksUnaryFunction) {
207 EXPECT_CALL(mock_foo_, Unary(Eq(2)))
209 .WillOnce(Return(true));
211 EXPECT_TRUE(foo_->Unary(2));
212 EXPECT_FALSE(foo_->Unary(2));
215 // Tests mocking a binary function.
216 TEST_F(MockMethodFunctionMockerTest, MocksBinaryFunction) {
217 EXPECT_CALL(mock_foo_, Binary(2, _))
218 .WillOnce(Return(3));
220 EXPECT_EQ(3, foo_->Binary(2, 1));
223 // Tests mocking a decimal function.
224 TEST_F(MockMethodFunctionMockerTest, MocksDecimalFunction) {
225 EXPECT_CALL(mock_foo_, Decimal(true, 'a', 0, 0, 1L, A<float>(),
226 Lt(100), 5U, NULL, "hi"))
227 .WillOnce(Return(5));
229 EXPECT_EQ(5, foo_->Decimal(true, 'a', 0, 0, 1, 0, 0, 5, nullptr, "hi"));
232 // Tests mocking a function that takes a non-const reference.
233 TEST_F(MockMethodFunctionMockerTest,
234 MocksFunctionWithNonConstReferenceArgument) {
236 EXPECT_CALL(mock_foo_, TakesNonConstReference(Ref(a)))
237 .WillOnce(Return(true));
239 EXPECT_TRUE(foo_->TakesNonConstReference(a));
242 // Tests mocking a function that takes a const reference.
243 TEST_F(MockMethodFunctionMockerTest, MocksFunctionWithConstReferenceArgument) {
245 EXPECT_CALL(mock_foo_, TakesConstReference(Ref(a)))
246 .WillOnce(Return("Hello"));
248 EXPECT_EQ("Hello", foo_->TakesConstReference(a));
251 // Tests mocking a function that takes a const variable.
252 TEST_F(MockMethodFunctionMockerTest, MocksFunctionWithConstArgument) {
253 EXPECT_CALL(mock_foo_, TakesConst(Lt(10)))
254 .WillOnce(DoDefault());
256 EXPECT_FALSE(foo_->TakesConst(5));
259 // Tests mocking functions overloaded on the number of arguments.
260 TEST_F(MockMethodFunctionMockerTest, MocksFunctionsOverloadedOnArgumentNumber) {
261 EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber())
262 .WillOnce(Return(1));
263 EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber(_))
264 .WillOnce(Return(2));
266 EXPECT_EQ(2, foo_->OverloadedOnArgumentNumber(1));
267 EXPECT_EQ(1, foo_->OverloadedOnArgumentNumber());
270 // Tests mocking functions overloaded on the types of argument.
271 TEST_F(MockMethodFunctionMockerTest, MocksFunctionsOverloadedOnArgumentType) {
272 EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(An<int>()))
273 .WillOnce(Return(1));
274 EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(TypedEq<char>('a')))
275 .WillOnce(Return('b'));
277 EXPECT_EQ(1, foo_->OverloadedOnArgumentType(0));
278 EXPECT_EQ('b', foo_->OverloadedOnArgumentType('a'));
281 // Tests mocking functions overloaded on the const-ness of this object.
282 TEST_F(MockMethodFunctionMockerTest,
283 MocksFunctionsOverloadedOnConstnessOfThis) {
284 EXPECT_CALL(mock_foo_, OverloadedOnConstness());
285 EXPECT_CALL(Const(mock_foo_), OverloadedOnConstness())
286 .WillOnce(Return('a'));
288 EXPECT_EQ(0, foo_->OverloadedOnConstness());
289 EXPECT_EQ('a', Const(*foo_).OverloadedOnConstness());
292 TEST_F(MockMethodFunctionMockerTest, MocksReturnTypeWithComma) {
293 const std::map<int, std::string> a_map;
294 EXPECT_CALL(mock_foo_, ReturnTypeWithComma())
295 .WillOnce(Return(a_map));
296 EXPECT_CALL(mock_foo_, ReturnTypeWithComma(42))
297 .WillOnce(Return(a_map));
299 EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma());
300 EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma(42));
303 TEST_F(MockMethodFunctionMockerTest, MocksTypeWithTemplatedCopyCtor) {
304 EXPECT_CALL(mock_foo_, TypeWithTemplatedCopyCtor(_)).WillOnce(Return(true));
305 EXPECT_TRUE(foo_->TypeWithTemplatedCopyCtor(TemplatedCopyable<int>()));
309 // Tests mocking a nullary function with calltype.
310 TEST_F(MockMethodFunctionMockerTest, MocksNullaryFunctionWithCallType) {
311 EXPECT_CALL(mock_foo_, CTNullary())
312 .WillOnce(Return(-1))
313 .WillOnce(Return(0));
315 EXPECT_EQ(-1, foo_->CTNullary());
316 EXPECT_EQ(0, foo_->CTNullary());
319 // Tests mocking a unary function with calltype.
320 TEST_F(MockMethodFunctionMockerTest, MocksUnaryFunctionWithCallType) {
321 EXPECT_CALL(mock_foo_, CTUnary(Eq(2)))
323 .WillOnce(Return(true))
324 .WillOnce(Return(false));
326 EXPECT_TRUE(foo_->CTUnary(2));
327 EXPECT_FALSE(foo_->CTUnary(2));
330 // Tests mocking a decimal function with calltype.
331 TEST_F(MockMethodFunctionMockerTest, MocksDecimalFunctionWithCallType) {
332 EXPECT_CALL(mock_foo_, CTDecimal(true, 'a', 0, 0, 1L, A<float>(),
333 Lt(100), 5U, NULL, "hi"))
334 .WillOnce(Return(10));
336 EXPECT_EQ(10, foo_->CTDecimal(true, 'a', 0, 0, 1, 0, 0, 5, NULL, "hi"));
339 // Tests mocking functions overloaded on the const-ness of this object.
340 TEST_F(MockMethodFunctionMockerTest, MocksFunctionsConstFunctionWithCallType) {
341 EXPECT_CALL(Const(mock_foo_), CTConst(_))
342 .WillOnce(Return('a'));
344 EXPECT_EQ('a', Const(*foo_).CTConst(0));
347 TEST_F(MockMethodFunctionMockerTest, MocksReturnTypeWithCommaAndCallType) {
348 const std::map<int, std::string> a_map;
349 EXPECT_CALL(mock_foo_, CTReturnTypeWithComma())
350 .WillOnce(Return(a_map));
352 EXPECT_EQ(a_map, mock_foo_.CTReturnTypeWithComma());
355 #endif // GTEST_OS_WINDOWS
361 MOCK_METHOD(void, DoB, ());
364 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB);
367 // Tests that functions with no EXPECT_CALL() rules can be called any
369 TEST(MockMethodExpectCallTest, UnmentionedFunctionCanBeCalledAnyNumberOfTimes) {
386 // Tests mocking template interfaces.
388 template <typename T>
389 class StackInterface {
391 virtual ~StackInterface() {}
393 // Template parameter appears in function parameter.
394 virtual void Push(const T& value) = 0;
395 virtual void Pop() = 0;
396 virtual int GetSize() const = 0;
397 // Template parameter appears in function return type.
398 virtual const T& GetTop() const = 0;
401 template <typename T>
402 class MockStack : public StackInterface<T> {
406 MOCK_METHOD(void, Push, (const T& elem), ());
407 MOCK_METHOD(void, Pop, (), (final));
408 MOCK_METHOD(int, GetSize, (), (const, override));
409 MOCK_METHOD(const T&, GetTop, (), (const));
411 // Tests that the function return type can contain unprotected comma.
412 MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (), ());
413 MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (int), (const));
416 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStack);
419 // Tests that template mock works.
420 TEST(MockMethodTemplateMockTest, Works) {
423 EXPECT_CALL(mock, GetSize())
426 .WillOnce(Return(0));
427 EXPECT_CALL(mock, Push(_));
429 EXPECT_CALL(mock, GetTop())
430 .WillOnce(ReturnRef(n));
431 EXPECT_CALL(mock, Pop())
434 EXPECT_EQ(0, mock.GetSize());
436 EXPECT_EQ(1, mock.GetSize());
437 EXPECT_EQ(5, mock.GetTop());
439 EXPECT_EQ(0, mock.GetSize());
442 TEST(MockMethodTemplateMockTest, MethodWithCommaInReturnTypeWorks) {
445 const std::map<int, int> a_map;
446 EXPECT_CALL(mock, ReturnTypeWithComma())
447 .WillOnce(Return(a_map));
448 EXPECT_CALL(mock, ReturnTypeWithComma(1))
449 .WillOnce(Return(a_map));
451 EXPECT_EQ(a_map, mock.ReturnTypeWithComma());
452 EXPECT_EQ(a_map, mock.ReturnTypeWithComma(1));
456 // Tests mocking template interfaces with calltype.
458 template <typename T>
459 class StackInterfaceWithCallType {
461 virtual ~StackInterfaceWithCallType() {}
463 // Template parameter appears in function parameter.
464 STDMETHOD_(void, Push)(const T& value) = 0;
465 STDMETHOD_(void, Pop)() = 0;
466 STDMETHOD_(int, GetSize)() const = 0;
467 // Template parameter appears in function return type.
468 STDMETHOD_(const T&, GetTop)() const = 0;
471 template <typename T>
472 class MockStackWithCallType : public StackInterfaceWithCallType<T> {
474 MockStackWithCallType() {}
476 MOCK_METHOD(void, Push, (const T& elem),
477 (Calltype(STDMETHODCALLTYPE), override));
478 MOCK_METHOD(void, Pop, (), (Calltype(STDMETHODCALLTYPE), override));
479 MOCK_METHOD(int, GetSize, (), (Calltype(STDMETHODCALLTYPE), override, const));
480 MOCK_METHOD(const T&, GetTop, (),
481 (Calltype(STDMETHODCALLTYPE), override, const));
484 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStackWithCallType);
487 // Tests that template mock with calltype works.
488 TEST(MockMethodTemplateMockTestWithCallType, Works) {
489 MockStackWithCallType<int> mock;
491 EXPECT_CALL(mock, GetSize())
494 .WillOnce(Return(0));
495 EXPECT_CALL(mock, Push(_));
497 EXPECT_CALL(mock, GetTop())
498 .WillOnce(ReturnRef(n));
499 EXPECT_CALL(mock, Pop())
502 EXPECT_EQ(0, mock.GetSize());
504 EXPECT_EQ(1, mock.GetSize());
505 EXPECT_EQ(5, mock.GetTop());
507 EXPECT_EQ(0, mock.GetSize());
509 #endif // GTEST_OS_WINDOWS
511 #define MY_MOCK_METHODS1_ \
512 MOCK_METHOD(void, Overloaded, ()); \
513 MOCK_METHOD(int, Overloaded, (int), (const)); \
514 MOCK_METHOD(bool, Overloaded, (bool f, int n))
516 class MockOverloadedOnArgNumber {
518 MockOverloadedOnArgNumber() {}
523 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnArgNumber);
526 TEST(MockMethodOverloadedMockMethodTest, CanOverloadOnArgNumberInMacroBody) {
527 MockOverloadedOnArgNumber mock;
528 EXPECT_CALL(mock, Overloaded());
529 EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2));
530 EXPECT_CALL(mock, Overloaded(true, 1)).WillOnce(Return(true));
533 EXPECT_EQ(2, mock.Overloaded(1));
534 EXPECT_TRUE(mock.Overloaded(true, 1));
537 #define MY_MOCK_METHODS2_ \
538 MOCK_CONST_METHOD1(Overloaded, int(int n)); \
539 MOCK_METHOD1(Overloaded, int(int n))
541 class MockOverloadedOnConstness {
543 MockOverloadedOnConstness() {}
548 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnConstness);
551 TEST(MockMethodOverloadedMockMethodTest, CanOverloadOnConstnessInMacroBody) {
552 MockOverloadedOnConstness mock;
553 const MockOverloadedOnConstness* const_mock = &mock;
554 EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2));
555 EXPECT_CALL(*const_mock, Overloaded(1)).WillOnce(Return(3));
557 EXPECT_EQ(2, mock.Overloaded(1));
558 EXPECT_EQ(3, const_mock->Overloaded(1));
561 TEST(MockMethodMockFunctionTest, WorksForVoidNullary) {
562 MockFunction<void()> foo;
563 EXPECT_CALL(foo, Call());
567 TEST(MockMethodMockFunctionTest, WorksForNonVoidNullary) {
568 MockFunction<int()> foo;
569 EXPECT_CALL(foo, Call())
571 .WillOnce(Return(2));
572 EXPECT_EQ(1, foo.Call());
573 EXPECT_EQ(2, foo.Call());
576 TEST(MockMethodMockFunctionTest, WorksForVoidUnary) {
577 MockFunction<void(int)> foo;
578 EXPECT_CALL(foo, Call(1));
582 TEST(MockMethodMockFunctionTest, WorksForNonVoidBinary) {
583 MockFunction<int(bool, int)> foo;
584 EXPECT_CALL(foo, Call(false, 42))
586 .WillOnce(Return(2));
587 EXPECT_CALL(foo, Call(true, Ge(100)))
588 .WillOnce(Return(3));
589 EXPECT_EQ(1, foo.Call(false, 42));
590 EXPECT_EQ(2, foo.Call(false, 42));
591 EXPECT_EQ(3, foo.Call(true, 120));
594 TEST(MockMethodMockFunctionTest, WorksFor10Arguments) {
595 MockFunction<int(bool a0, char a1, int a2, int a3, int a4,
596 int a5, int a6, char a7, int a8, bool a9)> foo;
597 EXPECT_CALL(foo, Call(_, 'a', _, _, _, _, _, _, _, _))
599 .WillOnce(Return(2));
600 EXPECT_EQ(1, foo.Call(false, 'a', 0, 0, 0, 0, 0, 'b', 0, true));
601 EXPECT_EQ(2, foo.Call(true, 'a', 0, 0, 0, 0, 0, 'b', 1, false));
604 TEST(MockMethodMockFunctionTest, AsStdFunction) {
605 MockFunction<int(int)> foo;
606 auto call = [](const std::function<int(int)> &f, int i) {
609 EXPECT_CALL(foo, Call(1)).WillOnce(Return(-1));
610 EXPECT_CALL(foo, Call(2)).WillOnce(Return(-2));
611 EXPECT_EQ(-1, call(foo.AsStdFunction(), 1));
612 EXPECT_EQ(-2, call(foo.AsStdFunction(), 2));
615 TEST(MockMethodMockFunctionTest, AsStdFunctionReturnsReference) {
616 MockFunction<int&()> foo;
618 EXPECT_CALL(foo, Call()).WillOnce(ReturnRef(value));
619 int& ref = foo.AsStdFunction()();
625 TEST(MockMethodMockFunctionTest, AsStdFunctionWithReferenceParameter) {
626 MockFunction<int(int &)> foo;
627 auto call = [](const std::function<int(int& )> &f, int &i) {
631 EXPECT_CALL(foo, Call(i)).WillOnce(Return(-1));
632 EXPECT_EQ(-1, call(foo.AsStdFunction(), i));
636 struct MockMethodSizes0 {
637 MOCK_METHOD(void, func, ());
639 struct MockMethodSizes1 {
640 MOCK_METHOD(void, func, (int));
642 struct MockMethodSizes2 {
643 MOCK_METHOD(void, func, (int, int));
645 struct MockMethodSizes3 {
646 MOCK_METHOD(void, func, (int, int, int));
648 struct MockMethodSizes4 {
649 MOCK_METHOD(void, func, (int, int, int, int));
652 TEST(MockMethodMockFunctionTest, MockMethodSizeOverhead) {
653 EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes1));
654 EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes2));
655 EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes3));
656 EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes4));
659 } // namespace gmock_function_mocker_test
660 } // namespace testing