Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
gmock-generated-function-mockers_test.cc
Go to the documentation of this file.
1// Copyright 2007, Google Inc.
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met:
7//
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
13// distribution.
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.
17//
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.
29//
30// Author: wan@google.com (Zhanyong Wan)
31
32// Google Mock - a framework for writing C++ mock classes.
33//
34// This file tests the function mocker classes.
35
37
38#if GTEST_OS_WINDOWS
39// MSDN says the header file to be included for STDMETHOD is BaseTyps.h but
40// we are getting compiler errors if we use basetyps.h, hence including
41// objbase.h for definition of STDMETHOD.
42# include <objbase.h>
43#endif // GTEST_OS_WINDOWS
44
45#include <map>
46#include <string>
47#include "gmock/gmock.h"
48#include "gtest/gtest.h"
49
50// There is a bug in MSVC (fixed in VS 2008) that prevents creating a
51// mock for a function with const arguments, so we don't test such
52// cases for MSVC versions older than 2008.
53#if !GTEST_OS_WINDOWS || (_MSC_VER >= 1500)
54# define GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
55#endif // !GTEST_OS_WINDOWS || (_MSC_VER >= 1500)
56
57namespace testing {
58namespace gmock_generated_function_mockers_test {
59
60using testing::_;
61using testing::A;
62using testing::An;
64using testing::Const;
66using testing::Eq;
67using testing::Lt;
69using testing::Ref;
70using testing::Return;
73
75 public:
76 virtual ~FooInterface() {}
77
78 virtual void VoidReturning(int x) = 0;
79
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;
86
87 virtual bool TakesNonConstReference(int& n) = 0; // NOLINT
88 virtual std::string TakesConstReference(const int& n) = 0;
89#ifdef GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
90 virtual bool TakesConst(const int x) = 0;
91#endif // GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
92
93 virtual int OverloadedOnArgumentNumber() = 0;
94 virtual int OverloadedOnArgumentNumber(int n) = 0;
95
96 virtual int OverloadedOnArgumentType(int n) = 0;
97 virtual char OverloadedOnArgumentType(char c) = 0;
98
99 virtual int OverloadedOnConstness() = 0;
100 virtual char OverloadedOnConstness() const = 0;
101
102 virtual int TypeWithHole(int (*func)()) = 0;
103 virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0;
104
105#if GTEST_OS_WINDOWS
106 STDMETHOD_(int, CTNullary)() = 0;
107 STDMETHOD_(bool, CTUnary)(int x) = 0;
108 STDMETHOD_(int, CTDecimal)
109 (bool b, char c, short d, int e, long f, // NOLINT
110 float g, double h, unsigned i, char* j, const std::string& k) = 0;
111 STDMETHOD_(char, CTConst)(int x) const = 0;
112#endif // GTEST_OS_WINDOWS
113};
114
115// Const qualifiers on arguments were once (incorrectly) considered
116// significant in determining whether two virtual functions had the same
117// signature. This was fixed in Visual Studio 2008. However, the compiler
118// still emits a warning that alerts about this change in behavior.
119#ifdef _MSC_VER
120# pragma warning(push)
121# pragma warning(disable : 4373)
122#endif
123class MockFoo : public FooInterface {
124 public:
126
127 // Makes sure that a mock function parameter can be named.
128 MOCK_METHOD1(VoidReturning, void(int n)); // NOLINT
129
130 MOCK_METHOD0(Nullary, int()); // NOLINT
131
132 // Makes sure that a mock function parameter can be unnamed.
133 MOCK_METHOD1(Unary, bool(int)); // NOLINT
134 MOCK_METHOD2(Binary, long(short, int)); // NOLINT
135 MOCK_METHOD10(Decimal, int(bool, char, short, int, long, float, // NOLINT
136 double, unsigned, char*, const std::string& str));
137
138 MOCK_METHOD1(TakesNonConstReference, bool(int&)); // NOLINT
139 MOCK_METHOD1(TakesConstReference, std::string(const int&));
140
141#ifdef GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
142 MOCK_METHOD1(TakesConst, bool(const int)); // NOLINT
143#endif
144
145 // Tests that the function return type can contain unprotected comma.
146 MOCK_METHOD0(ReturnTypeWithComma, std::map<int, std::string>());
147 MOCK_CONST_METHOD1(ReturnTypeWithComma,
148 std::map<int, std::string>(int)); // NOLINT
149
152
155
158
159 MOCK_METHOD1(TypeWithHole, int(int (*)())); // NOLINT
161 int(const std::map<int, std::string>&)); // NOLINT
162
163#if GTEST_OS_WINDOWS
164 MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTNullary, int());
165 MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTUnary, bool(int));
166 MOCK_METHOD10_WITH_CALLTYPE(STDMETHODCALLTYPE, CTDecimal,
167 int(bool b, char c, short d, int e, long f,
168 float g, double h, unsigned i, char* j,
169 const std::string& k));
170 MOCK_CONST_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTConst, char(int));
171
172 // Tests that the function return type can contain unprotected comma.
173 MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTReturnTypeWithComma,
174 std::map<int, std::string>());
175#endif // GTEST_OS_WINDOWS
176
177 private:
179};
180#ifdef _MSC_VER
181# pragma warning(pop)
182#endif
183
191
192// Tests mocking a void-returning function.
193TEST_F(FunctionMockerTest, MocksVoidFunction) {
194 EXPECT_CALL(mock_foo_, VoidReturning(Lt(100)));
195 foo_->VoidReturning(0);
196}
197
198// Tests mocking a nullary function.
199TEST_F(FunctionMockerTest, MocksNullaryFunction) {
200 EXPECT_CALL(mock_foo_, Nullary())
201 .WillOnce(DoDefault())
202 .WillOnce(Return(1));
203
204 EXPECT_EQ(0, foo_->Nullary());
205 EXPECT_EQ(1, foo_->Nullary());
206}
207
208// Tests mocking a unary function.
209TEST_F(FunctionMockerTest, MocksUnaryFunction) {
210 EXPECT_CALL(mock_foo_, Unary(Eq(2)))
211 .Times(2)
212 .WillOnce(Return(true));
213
214 EXPECT_TRUE(foo_->Unary(2));
215 EXPECT_FALSE(foo_->Unary(2));
216}
217
218// Tests mocking a binary function.
219TEST_F(FunctionMockerTest, MocksBinaryFunction) {
220 EXPECT_CALL(mock_foo_, Binary(2, _))
221 .WillOnce(Return(3));
222
223 EXPECT_EQ(3, foo_->Binary(2, 1));
224}
225
226// Tests mocking a decimal function.
227TEST_F(FunctionMockerTest, MocksDecimalFunction) {
228 EXPECT_CALL(mock_foo_, Decimal(true, 'a', 0, 0, 1L, A<float>(),
229 Lt(100), 5U, NULL, "hi"))
230 .WillOnce(Return(5));
231
232 EXPECT_EQ(5, foo_->Decimal(true, 'a', 0, 0, 1, 0, 0, 5, NULL, "hi"));
233}
234
235// Tests mocking a function that takes a non-const reference.
236TEST_F(FunctionMockerTest, MocksFunctionWithNonConstReferenceArgument) {
237 int a = 0;
238 EXPECT_CALL(mock_foo_, TakesNonConstReference(Ref(a)))
239 .WillOnce(Return(true));
240
241 EXPECT_TRUE(foo_->TakesNonConstReference(a));
242}
243
244// Tests mocking a function that takes a const reference.
245TEST_F(FunctionMockerTest, MocksFunctionWithConstReferenceArgument) {
246 int a = 0;
247 EXPECT_CALL(mock_foo_, TakesConstReference(Ref(a)))
248 .WillOnce(Return("Hello"));
249
250 EXPECT_EQ("Hello", foo_->TakesConstReference(a));
251}
252
253#ifdef GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
254// Tests mocking a function that takes a const variable.
255TEST_F(FunctionMockerTest, MocksFunctionWithConstArgument) {
256 EXPECT_CALL(mock_foo_, TakesConst(Lt(10)))
257 .WillOnce(DoDefault());
258
259 EXPECT_FALSE(foo_->TakesConst(5));
260}
261#endif // GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
262
263// Tests mocking functions overloaded on the number of arguments.
264TEST_F(FunctionMockerTest, MocksFunctionsOverloadedOnArgumentNumber) {
265 EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber())
266 .WillOnce(Return(1));
267 EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber(_))
268 .WillOnce(Return(2));
269
270 EXPECT_EQ(2, foo_->OverloadedOnArgumentNumber(1));
271 EXPECT_EQ(1, foo_->OverloadedOnArgumentNumber());
272}
273
274// Tests mocking functions overloaded on the types of argument.
275TEST_F(FunctionMockerTest, MocksFunctionsOverloadedOnArgumentType) {
276 EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(An<int>()))
277 .WillOnce(Return(1));
278 EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(TypedEq<char>('a')))
279 .WillOnce(Return('b'));
280
281 EXPECT_EQ(1, foo_->OverloadedOnArgumentType(0));
282 EXPECT_EQ('b', foo_->OverloadedOnArgumentType('a'));
283}
284
285// Tests mocking functions overloaded on the const-ness of this object.
286TEST_F(FunctionMockerTest, MocksFunctionsOverloadedOnConstnessOfThis) {
287 EXPECT_CALL(mock_foo_, OverloadedOnConstness());
288 EXPECT_CALL(Const(mock_foo_), OverloadedOnConstness())
289 .WillOnce(Return('a'));
290
291 EXPECT_EQ(0, foo_->OverloadedOnConstness());
292 EXPECT_EQ('a', Const(*foo_).OverloadedOnConstness());
293}
294
295TEST_F(FunctionMockerTest, MocksReturnTypeWithComma) {
296 const std::map<int, std::string> a_map;
297 EXPECT_CALL(mock_foo_, ReturnTypeWithComma())
298 .WillOnce(Return(a_map));
299 EXPECT_CALL(mock_foo_, ReturnTypeWithComma(42))
300 .WillOnce(Return(a_map));
301
302 EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma());
303 EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma(42));
304}
305
306#if GTEST_OS_WINDOWS
307// Tests mocking a nullary function with calltype.
308TEST_F(FunctionMockerTest, MocksNullaryFunctionWithCallType) {
309 EXPECT_CALL(mock_foo_, CTNullary())
310 .WillOnce(Return(-1))
311 .WillOnce(Return(0));
312
313 EXPECT_EQ(-1, foo_->CTNullary());
314 EXPECT_EQ(0, foo_->CTNullary());
315}
316
317// Tests mocking a unary function with calltype.
318TEST_F(FunctionMockerTest, MocksUnaryFunctionWithCallType) {
319 EXPECT_CALL(mock_foo_, CTUnary(Eq(2)))
320 .Times(2)
321 .WillOnce(Return(true))
322 .WillOnce(Return(false));
323
324 EXPECT_TRUE(foo_->CTUnary(2));
325 EXPECT_FALSE(foo_->CTUnary(2));
326}
327
328// Tests mocking a decimal function with calltype.
329TEST_F(FunctionMockerTest, MocksDecimalFunctionWithCallType) {
330 EXPECT_CALL(mock_foo_, CTDecimal(true, 'a', 0, 0, 1L, A<float>(),
331 Lt(100), 5U, NULL, "hi"))
332 .WillOnce(Return(10));
333
334 EXPECT_EQ(10, foo_->CTDecimal(true, 'a', 0, 0, 1, 0, 0, 5, NULL, "hi"));
335}
336
337// Tests mocking functions overloaded on the const-ness of this object.
338TEST_F(FunctionMockerTest, MocksFunctionsConstFunctionWithCallType) {
339 EXPECT_CALL(Const(mock_foo_), CTConst(_))
340 .WillOnce(Return('a'));
341
342 EXPECT_EQ('a', Const(*foo_).CTConst(0));
343}
344
345TEST_F(FunctionMockerTest, MocksReturnTypeWithCommaAndCallType) {
346 const std::map<int, std::string> a_map;
347 EXPECT_CALL(mock_foo_, CTReturnTypeWithComma())
348 .WillOnce(Return(a_map));
349
350 EXPECT_EQ(a_map, mock_foo_.CTReturnTypeWithComma());
351}
352
353#endif // GTEST_OS_WINDOWS
354
355class MockB {
356 public:
357 MockB() {}
358
359 MOCK_METHOD0(DoB, void());
360
361 private:
363};
364
365// Tests that functions with no EXPECT_CALL() ruls can be called any
366// number of times.
367TEST(ExpectCallTest, UnmentionedFunctionCanBeCalledAnyNumberOfTimes) {
368 {
369 MockB b;
370 }
371
372 {
373 MockB b;
374 b.DoB();
375 }
376
377 {
378 MockB b;
379 b.DoB();
380 b.DoB();
381 }
382}
383
384// Tests mocking template interfaces.
385
386template <typename T>
388 public:
389 virtual ~StackInterface() {}
390
391 // Template parameter appears in function parameter.
392 virtual void Push(const T& value) = 0;
393 virtual void Pop() = 0;
394 virtual int GetSize() const = 0;
395 // Template parameter appears in function return type.
396 virtual const T& GetTop() const = 0;
397};
398
399template <typename T>
400class MockStack : public StackInterface<T> {
401 public:
403
404 MOCK_METHOD1_T(Push, void(const T& elem));
406 MOCK_CONST_METHOD0_T(GetSize, int()); // NOLINT
408
409 // Tests that the function return type can contain unprotected comma.
410 MOCK_METHOD0_T(ReturnTypeWithComma, std::map<int, int>());
411 MOCK_CONST_METHOD1_T(ReturnTypeWithComma, std::map<int, int>(int)); // NOLINT
412
413 private:
415};
416
417// Tests that template mock works.
418TEST(TemplateMockTest, Works) {
419 MockStack<int> mock;
420
421 EXPECT_CALL(mock, GetSize())
422 .WillOnce(Return(0))
423 .WillOnce(Return(1))
424 .WillOnce(Return(0));
425 EXPECT_CALL(mock, Push(_));
426 int n = 5;
427 EXPECT_CALL(mock, GetTop())
428 .WillOnce(ReturnRef(n));
429 EXPECT_CALL(mock, Pop())
430 .Times(AnyNumber());
431
432 EXPECT_EQ(0, mock.GetSize());
433 mock.Push(5);
434 EXPECT_EQ(1, mock.GetSize());
435 EXPECT_EQ(5, mock.GetTop());
436 mock.Pop();
437 EXPECT_EQ(0, mock.GetSize());
438}
439
440TEST(TemplateMockTest, MethodWithCommaInReturnTypeWorks) {
441 MockStack<int> mock;
442
443 const std::map<int, int> a_map;
444 EXPECT_CALL(mock, ReturnTypeWithComma())
445 .WillOnce(Return(a_map));
446 EXPECT_CALL(mock, ReturnTypeWithComma(1))
447 .WillOnce(Return(a_map));
448
449 EXPECT_EQ(a_map, mock.ReturnTypeWithComma());
450 EXPECT_EQ(a_map, mock.ReturnTypeWithComma(1));
451}
452
453#if GTEST_OS_WINDOWS
454// Tests mocking template interfaces with calltype.
455
456template <typename T>
457class StackInterfaceWithCallType {
458 public:
459 virtual ~StackInterfaceWithCallType() {}
460
461 // Template parameter appears in function parameter.
462 STDMETHOD_(void, Push)(const T& value) = 0;
463 STDMETHOD_(void, Pop)() = 0;
464 STDMETHOD_(int, GetSize)() const = 0;
465 // Template parameter appears in function return type.
466 STDMETHOD_(const T&, GetTop)() const = 0;
467};
468
469template <typename T>
470class MockStackWithCallType : public StackInterfaceWithCallType<T> {
471 public:
472 MockStackWithCallType() {}
473
474 MOCK_METHOD1_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Push, void(const T& elem));
475 MOCK_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Pop, void());
476 MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetSize, int());
477 MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetTop, const T&());
478
479 private:
480 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStackWithCallType);
481};
482
483// Tests that template mock with calltype works.
484TEST(TemplateMockTestWithCallType, Works) {
485 MockStackWithCallType<int> mock;
486
487 EXPECT_CALL(mock, GetSize())
488 .WillOnce(Return(0))
489 .WillOnce(Return(1))
490 .WillOnce(Return(0));
491 EXPECT_CALL(mock, Push(_));
492 int n = 5;
493 EXPECT_CALL(mock, GetTop())
494 .WillOnce(ReturnRef(n));
495 EXPECT_CALL(mock, Pop())
496 .Times(AnyNumber());
497
498 EXPECT_EQ(0, mock.GetSize());
499 mock.Push(5);
500 EXPECT_EQ(1, mock.GetSize());
501 EXPECT_EQ(5, mock.GetTop());
502 mock.Pop();
503 EXPECT_EQ(0, mock.GetSize());
504}
505#endif // GTEST_OS_WINDOWS
506
507#define MY_MOCK_METHODS1_ \
508 MOCK_METHOD0(Overloaded, void()); \
509 MOCK_CONST_METHOD1(Overloaded, int(int n)); \
510 MOCK_METHOD2(Overloaded, bool(bool f, int n))
511
521
522TEST(OverloadedMockMethodTest, CanOverloadOnArgNumberInMacroBody) {
524 EXPECT_CALL(mock, Overloaded());
525 EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2));
526 EXPECT_CALL(mock, Overloaded(true, 1)).WillOnce(Return(true));
527
528 mock.Overloaded();
529 EXPECT_EQ(2, mock.Overloaded(1));
530 EXPECT_TRUE(mock.Overloaded(true, 1));
531}
532
533#define MY_MOCK_METHODS2_ \
534 MOCK_CONST_METHOD1(Overloaded, int(int n)); \
535 MOCK_METHOD1(Overloaded, int(int n));
536
546
547TEST(OverloadedMockMethodTest, CanOverloadOnConstnessInMacroBody) {
549 const MockOverloadedOnConstness* const_mock = &mock;
550 EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2));
551 EXPECT_CALL(*const_mock, Overloaded(1)).WillOnce(Return(3));
552
553 EXPECT_EQ(2, mock.Overloaded(1));
554 EXPECT_EQ(3, const_mock->Overloaded(1));
555}
556
557TEST(MockFunctionTest, WorksForVoidNullary) {
558 MockFunction<void()> foo;
559 EXPECT_CALL(foo, Call());
560 foo.Call();
561}
562
563TEST(MockFunctionTest, WorksForNonVoidNullary) {
564 MockFunction<int()> foo;
566 .WillOnce(Return(1))
567 .WillOnce(Return(2));
568 EXPECT_EQ(1, foo.Call());
569 EXPECT_EQ(2, foo.Call());
570}
571
572TEST(MockFunctionTest, WorksForVoidUnary) {
573 MockFunction<void(int)> foo;
574 EXPECT_CALL(foo, Call(1));
575 foo.Call(1);
576}
577
578TEST(MockFunctionTest, WorksForNonVoidBinary) {
579 MockFunction<int(bool, int)> foo;
580 EXPECT_CALL(foo, Call(false, 42))
581 .WillOnce(Return(1))
582 .WillOnce(Return(2));
583 EXPECT_CALL(foo, Call(true, Ge(100)))
584 .WillOnce(Return(3));
585 EXPECT_EQ(1, foo.Call(false, 42));
586 EXPECT_EQ(2, foo.Call(false, 42));
587 EXPECT_EQ(3, foo.Call(true, 120));
588}
589
590TEST(MockFunctionTest, WorksFor10Arguments) {
591 MockFunction<int(bool a0, char a1, int a2, int a3, int a4,
592 int a5, int a6, char a7, int a8, bool a9)> foo;
593 EXPECT_CALL(foo, Call(_, 'a', _, _, _, _, _, _, _, _))
594 .WillOnce(Return(1))
595 .WillOnce(Return(2));
596 EXPECT_EQ(1, foo.Call(false, 'a', 0, 0, 0, 0, 0, 'b', 0, true));
597 EXPECT_EQ(2, foo.Call(true, 'a', 0, 0, 0, 0, 0, 'b', 1, false));
598}
599
600#if GTEST_HAS_STD_FUNCTION_
601TEST(MockFunctionTest, AsStdFunction) {
602 MockFunction<int(int)> foo;
603 auto call = [](const std::function<int(int)> &f, int i) {
604 return f(i);
605 };
606 EXPECT_CALL(foo, Call(1)).WillOnce(Return(-1));
607 EXPECT_CALL(foo, Call(2)).WillOnce(Return(-2));
608 EXPECT_EQ(-1, call(foo.AsStdFunction(), 1));
609 EXPECT_EQ(-2, call(foo.AsStdFunction(), 2));
610}
611
612TEST(MockFunctionTest, AsStdFunctionReturnsReference) {
613 MockFunction<int&()> foo;
614 int value = 1;
615 EXPECT_CALL(foo, Call()).WillOnce(ReturnRef(value));
616 int& ref = foo.AsStdFunction()();
617 EXPECT_EQ(1, ref);
618 value = 2;
619 EXPECT_EQ(2, ref);
620}
621#endif // GTEST_HAS_STD_FUNCTION_
622
624 MOCK_METHOD0(func, void());
625};
627 MOCK_METHOD1(func, void(int));
628};
630 MOCK_METHOD2(func, void(int, int));
631};
633 MOCK_METHOD3(func, void(int, int, int));
634};
636 MOCK_METHOD4(func, void(int, int, int, int));
637};
638
639TEST(MockFunctionTest, MockMethodSizeOverhead) {
644}
645
646} // namespace gmock_generated_function_mockers_test
647} // namespace testing
virtual int Decimal(bool b, char c, short d, int e, long f, float g, double h, unsigned i, char *j, const std::string &k)=0
virtual int TypeWithComma(const std::map< int, std::string > &a_map)=0
virtual std::string TakesConstReference(const int &n)=0
MOCK_METHOD0(OverloadedOnArgumentNumber, int())
MOCK_METHOD1(TypeWithComma, int(const std::map< int, std::string > &))
MOCK_METHOD1(OverloadedOnArgumentNumber, int(int))
MOCK_METHOD1(TakesNonConstReference, bool(int &))
MOCK_CONST_METHOD1(ReturnTypeWithComma, std::map< int, std::string >(int))
MOCK_METHOD1(TakesConstReference, std::string(const int &))
MOCK_METHOD10(Decimal, int(bool, char, short, int, long, float, double, unsigned, char *, const std::string &str))
MOCK_METHOD1(OverloadedOnArgumentType, char(char))
MOCK_METHOD1(OverloadedOnArgumentType, int(int))
MOCK_METHOD0(ReturnTypeWithComma, std::map< int, std::string >())
MOCK_METHOD0_T(ReturnTypeWithComma, std::map< int, int >())
MOCK_CONST_METHOD1_T(ReturnTypeWithComma, std::map< int, int >(int))
#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m,...)
#define MOCK_METHOD1_WITH_CALLTYPE(ct, m,...)
#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m,...)
#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m,...)
#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m,...)
#define MOCK_METHOD0_WITH_CALLTYPE(ct, m,...)
#define MOCK_METHOD10_WITH_CALLTYPE(ct, m,...)
#define EXPECT_CALL(obj, call)
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
Definition gtest-port.h:917
#define TEST_F(test_fixture, test_name)
Definition gtest.h:2304
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1954
#define EXPECT_TRUE(condition)
Definition gtest.h:1895
#define TEST(test_case_name, test_name)
Definition gtest.h:2275
#define EXPECT_FALSE(condition)
Definition gtest.h:1898
Matcher< Lhs > TypedEq(const Rhs &rhs)
Matcher< T > An()
internal::Lt2Matcher Lt()
PolymorphicAction< internal::ReturnVoidAction > Return()
const internal::AnythingMatcher _
Matcher< T > A()
internal::Ge2Matcher Ge()
const T & Const(const T &x)
GTEST_API_ Cardinality AnyNumber()
internal::Eq2Matcher Eq()
internal::ReturnRefAction< R > ReturnRef(R &x)
internal::DoDefaultAction DoDefault()
internal::RefMatcher< T & > Ref(T &x)
#define value
Definition pkcs11.h:157
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define T(meth, val, expected)
fc::variant call(const std::string &url, const std::string &path, const T &v)
Definition main.cpp:258
CK_ULONG d
uint16_t j