cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
gmock_link_test.h
Go to the documentation of this file.
1// Copyright 2009, 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// Google Mock - a framework for writing C++ mock classes.
31//
32// This file tests that:
33// a. A header file defining a mock class can be included in multiple
34// translation units without causing a link error.
35// b. Actions and matchers can be instantiated with identical template
36// arguments in different translation units without causing link
37// errors.
38// The following constructs are currently tested:
39// Actions:
40// Return()
41// Return(value)
42// ReturnNull
43// ReturnRef
44// Assign
45// SetArgPointee
46// SetArrayArgument
47// SetErrnoAndReturn
48// Invoke(function)
49// Invoke(object, method)
50// InvokeWithoutArgs(function)
51// InvokeWithoutArgs(object, method)
52// InvokeArgument
53// WithArg
54// WithArgs
55// WithoutArgs
56// DoAll
57// DoDefault
58// IgnoreResult
59// Throw
60// ACTION()-generated
61// ACTION_P()-generated
62// ACTION_P2()-generated
63// Matchers:
64// _
65// A
66// An
67// Eq
68// Gt, Lt, Ge, Le, Ne
69// NotNull
70// Ref
71// TypedEq
72// DoubleEq
73// FloatEq
74// NanSensitiveDoubleEq
75// NanSensitiveFloatEq
76// ContainsRegex
77// MatchesRegex
78// EndsWith
79// HasSubstr
80// StartsWith
81// StrCaseEq
82// StrCaseNe
83// StrEq
84// StrNe
85// ElementsAre
86// ElementsAreArray
87// ContainerEq
88// Field
89// Property
90// ResultOf(function)
91// ResultOf(callback)
92// Pointee
93// Truly(predicate)
94// AddressSatisfies
95// AllOf
96// AnyOf
97// Not
98// MatcherCast<T>
99//
100// Please note: this test does not verify the functioning of these
101// constructs, only that the programs using them will link successfully.
102//
103// Implementation note:
104// This test requires identical definitions of Interface and Mock to be
105// included in different translation units. We achieve this by writing
106// them in this header and #including it in gmock_link_test.cc and
107// gmock_link2_test.cc. Because the symbols generated by the compiler for
108// those constructs must be identical in both translation units,
109// definitions of Interface and Mock tests MUST be kept in the SAME
110// NON-ANONYMOUS namespace in this file. The test fixture class LinkTest
111// is defined as LinkTest1 in gmock_link_test.cc and as LinkTest2 in
112// gmock_link2_test.cc to avoid producing linker errors.
113
114#ifndef GOOGLEMOCK_TEST_GMOCK_LINK_TEST_H_
115#define GOOGLEMOCK_TEST_GMOCK_LINK_TEST_H_
116
117#include "gmock/gmock.h"
118
119#ifndef GTEST_OS_WINDOWS_MOBILE
120#include <errno.h>
121#endif
122
123#include <iostream>
124#include <vector>
125
126#include "gtest/gtest.h"
128
129using testing::_;
130using testing::A;
131using testing::Action;
132using testing::AllOf;
133using testing::AnyOf;
134using testing::Assign;
135using testing::ContainerEq;
136using testing::DoAll;
138using testing::DoubleEq;
139using testing::ElementsAre;
140using testing::ElementsAreArray;
141using testing::EndsWith;
142using testing::Eq;
143using testing::Field;
144using testing::FloatEq;
145using testing::Ge;
146using testing::Gt;
147using testing::HasSubstr;
149using testing::Invoke;
152using testing::IsNull;
153using testing::IsSubsetOf;
154using testing::IsSupersetOf;
155using testing::Le;
156using testing::Lt;
157using testing::Matcher;
158using testing::MatcherCast;
159using testing::NanSensitiveDoubleEq;
160using testing::NanSensitiveFloatEq;
161using testing::Ne;
162using testing::Not;
163using testing::NotNull;
164using testing::Pointee;
165using testing::Property;
166using testing::Ref;
167using testing::ResultOf;
168using testing::Return;
173using testing::StartsWith;
174using testing::StrCaseEq;
175using testing::StrCaseNe;
176using testing::StrEq;
177using testing::StrNe;
178using testing::Truly;
179using testing::TypedEq;
180using testing::WithArg;
183
184#ifndef GTEST_OS_WINDOWS_MOBILE
186#endif
187
188#if GTEST_HAS_EXCEPTIONS
189using testing::Throw;
190#endif
191
192using testing::ContainsRegex;
193using testing::MatchesRegex;
194
196 public:
197 virtual ~Interface() = default;
198 virtual void VoidFromString(char* str) = 0;
199 virtual char* StringFromString(char* str) = 0;
200 virtual int IntFromString(char* str) = 0;
201 virtual int& IntRefFromString(char* str) = 0;
202 virtual void VoidFromFunc(void (*func)(char* str)) = 0;
203 virtual void VoidFromIntRef(int& n) = 0; // NOLINT
204 virtual void VoidFromFloat(float n) = 0;
205 virtual void VoidFromDouble(double n) = 0;
206 virtual void VoidFromVector(const std::vector<int>& v) = 0;
207};
208
209class Mock : public Interface {
210 public:
211 Mock() = default;
212
213 MOCK_METHOD1(VoidFromString, void(char* str));
214 MOCK_METHOD1(StringFromString, char*(char* str));
215 MOCK_METHOD1(IntFromString, int(char* str));
217 MOCK_METHOD1(VoidFromFunc, void(void (*func)(char* str)));
218 MOCK_METHOD1(VoidFromIntRef, void(int& n)); // NOLINT
220 MOCK_METHOD1(VoidFromDouble, void(double n));
221 MOCK_METHOD1(VoidFromVector, void(const std::vector<int>& v));
222
223 private:
224 Mock(const Mock&) = delete;
225 Mock& operator=(const Mock&) = delete;
226};
227
229 public:
230 static void StaticVoidFromVoid() {}
231 void VoidFromVoid() {}
232 static void StaticVoidFromString(char* /* str */) {}
233 void VoidFromString(char* /* str */) {}
234 static int StaticIntFromString(char* /* str */) { return 1; }
235 static bool StaticBoolFromString(const char* /* str */) { return true; }
236};
237
239 public:
240 explicit FieldHelper(int a_field) : field_(a_field) {}
241 int field() const { return field_; }
242 int field_; // NOLINT -- need external access to field_ to test
243 // the Field matcher.
244};
245
246// Tests the linkage of the ReturnVoid action.
247TEST(LinkTest, TestReturnVoid) {
248 Mock mock;
249
250 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Return());
251 mock.VoidFromString(nullptr);
252}
253
254// Tests the linkage of the Return action.
255TEST(LinkTest, TestReturn) {
256 Mock mock;
257 char ch = 'x';
258
259 EXPECT_CALL(mock, StringFromString(_)).WillOnce(Return(&ch));
260 mock.StringFromString(nullptr);
261}
262
263// Tests the linkage of the ReturnNull action.
264TEST(LinkTest, TestReturnNull) {
265 Mock mock;
266
267 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Return());
268 mock.VoidFromString(nullptr);
269}
270
271// Tests the linkage of the ReturnRef action.
272TEST(LinkTest, TestReturnRef) {
273 Mock mock;
274 int n = 42;
275
276 EXPECT_CALL(mock, IntRefFromString(_)).WillOnce(ReturnRef(n));
277 mock.IntRefFromString(nullptr);
278}
279
280// Tests the linkage of the Assign action.
281TEST(LinkTest, TestAssign) {
282 Mock mock;
283 char ch = 'x';
284
285 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Assign(&ch, 'y'));
286 mock.VoidFromString(nullptr);
287}
288
289// Tests the linkage of the SetArgPointee action.
290TEST(LinkTest, TestSetArgPointee) {
291 Mock mock;
292 char ch = 'x';
293
294 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(SetArgPointee<0>('y'));
295 mock.VoidFromString(&ch);
296}
297
298// Tests the linkage of the SetArrayArgument action.
299TEST(LinkTest, TestSetArrayArgument) {
300 Mock mock;
301 char ch = 'x';
302 char ch2 = 'y';
303
304 EXPECT_CALL(mock, VoidFromString(_))
305 .WillOnce(SetArrayArgument<0>(&ch2, &ch2 + 1));
306 mock.VoidFromString(&ch);
307}
308
309#ifndef GTEST_OS_WINDOWS_MOBILE
310
311// Tests the linkage of the SetErrnoAndReturn action.
312TEST(LinkTest, TestSetErrnoAndReturn) {
313 Mock mock;
314
315 int saved_errno = errno;
316 EXPECT_CALL(mock, IntFromString(_)).WillOnce(SetErrnoAndReturn(1, -1));
317 mock.IntFromString(nullptr);
318 errno = saved_errno;
319}
320
321#endif // !GTEST_OS_WINDOWS_MOBILE
322
323// Tests the linkage of the Invoke(function) and Invoke(object, method) actions.
324TEST(LinkTest, TestInvoke) {
325 Mock mock;
326 InvokeHelper test_invoke_helper;
327
328 EXPECT_CALL(mock, VoidFromString(_))
329 .WillOnce(Invoke(&InvokeHelper::StaticVoidFromString))
330 .WillOnce(Invoke(&test_invoke_helper, &InvokeHelper::VoidFromString));
331 mock.VoidFromString(nullptr);
332 mock.VoidFromString(nullptr);
333}
334
335// Tests the linkage of the InvokeWithoutArgs action.
336TEST(LinkTest, TestInvokeWithoutArgs) {
337 Mock mock;
338 InvokeHelper test_invoke_helper;
339
340 EXPECT_CALL(mock, VoidFromString(_))
341 .WillOnce(InvokeWithoutArgs(&InvokeHelper::StaticVoidFromVoid))
342 .WillOnce(
343 InvokeWithoutArgs(&test_invoke_helper, &InvokeHelper::VoidFromVoid));
344 mock.VoidFromString(nullptr);
345 mock.VoidFromString(nullptr);
346}
347
348// Tests the linkage of the InvokeArgument action.
349TEST(LinkTest, TestInvokeArgument) {
350 Mock mock;
351 char ch = 'x';
352
353 EXPECT_CALL(mock, VoidFromFunc(_)).WillOnce(InvokeArgument<0>(&ch));
355}
356
357// Tests the linkage of the WithArg action.
358TEST(LinkTest, TestWithArg) {
359 Mock mock;
360
361 EXPECT_CALL(mock, VoidFromString(_))
362 .WillOnce(WithArg<0>(Invoke(&InvokeHelper::StaticVoidFromString)));
363 mock.VoidFromString(nullptr);
364}
365
366// Tests the linkage of the WithArgs action.
367TEST(LinkTest, TestWithArgs) {
368 Mock mock;
369
370 EXPECT_CALL(mock, VoidFromString(_))
371 .WillOnce(WithArgs<0>(Invoke(&InvokeHelper::StaticVoidFromString)));
372 mock.VoidFromString(nullptr);
373}
374
375// Tests the linkage of the WithoutArgs action.
376TEST(LinkTest, TestWithoutArgs) {
377 Mock mock;
378
379 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(WithoutArgs(Return()));
380 mock.VoidFromString(nullptr);
381}
382
383// Tests the linkage of the DoAll action.
384TEST(LinkTest, TestDoAll) {
385 Mock mock;
386 char ch = 'x';
387
388 EXPECT_CALL(mock, VoidFromString(_))
389 .WillOnce(DoAll(SetArgPointee<0>('y'), Return()));
390 mock.VoidFromString(&ch);
391}
392
393// Tests the linkage of the DoDefault action.
394TEST(LinkTest, TestDoDefault) {
395 Mock mock;
396 char ch = 'x';
397
398 ON_CALL(mock, VoidFromString(_)).WillByDefault(Return());
399 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(DoDefault());
400 mock.VoidFromString(&ch);
401}
402
403// Tests the linkage of the IgnoreResult action.
404TEST(LinkTest, TestIgnoreResult) {
405 Mock mock;
406
407 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(IgnoreResult(Return(42)));
408 mock.VoidFromString(nullptr);
409}
410
411#if GTEST_HAS_EXCEPTIONS
412// Tests the linkage of the Throw action.
413TEST(LinkTest, TestThrow) {
414 Mock mock;
415
416 EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Throw(42));
417 EXPECT_THROW(mock.VoidFromString(nullptr), int);
418}
419#endif // GTEST_HAS_EXCEPTIONS
420
421// The ACTION*() macros trigger warning C4100 (unreferenced formal
422// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
423// the macro definition, as the warnings are generated when the macro
424// is expanded and macro expansion cannot contain #pragma. Therefore
425// we suppress them here.
427
428// Tests the linkage of actions created using ACTION macro.
429namespace {
430ACTION(Return1) { return 1; }
431} // namespace
432
433TEST(LinkTest, TestActionMacro) {
434 Mock mock;
435
436 EXPECT_CALL(mock, IntFromString(_)).WillOnce(Return1());
437 mock.IntFromString(nullptr);
438}
439
440// Tests the linkage of actions created using ACTION_P macro.
441namespace {
442ACTION_P(ReturnArgument, ret_value) { return ret_value; }
443} // namespace
444
445TEST(LinkTest, TestActionPMacro) {
446 Mock mock;
447
448 EXPECT_CALL(mock, IntFromString(_)).WillOnce(ReturnArgument(42));
449 mock.IntFromString(nullptr);
450}
451
452// Tests the linkage of actions created using ACTION_P2 macro.
453namespace {
454ACTION_P2(ReturnEqualsEitherOf, first, second) {
455 return arg0 == first || arg0 == second;
456}
457} // namespace
458
460
461TEST(LinkTest, TestActionP2Macro) {
462 Mock mock;
463 char ch = 'x';
464
465 EXPECT_CALL(mock, IntFromString(_))
466 .WillOnce(ReturnEqualsEitherOf("one", "two"));
467 mock.IntFromString(&ch);
468}
469
470// Tests the linkage of the "_" matcher.
471TEST(LinkTest, TestMatcherAnything) {
472 Mock mock;
473
474 ON_CALL(mock, VoidFromString(_)).WillByDefault(Return());
475}
476
477// Tests the linkage of the A matcher.
478TEST(LinkTest, TestMatcherA) {
479 Mock mock;
480
481 ON_CALL(mock, VoidFromString(A<char*>())).WillByDefault(Return());
482}
483
484// Tests the linkage of the Eq and the "bare value" matcher.
485TEST(LinkTest, TestMatchersEq) {
486 Mock mock;
487 const char* p = "x";
488
489 ON_CALL(mock, VoidFromString(Eq(p))).WillByDefault(Return());
490 ON_CALL(mock, VoidFromString(const_cast<char*>("y"))).WillByDefault(Return());
491}
492
493// Tests the linkage of the Lt, Gt, Le, Ge, and Ne matchers.
494TEST(LinkTest, TestMatchersRelations) {
495 Mock mock;
496
497 ON_CALL(mock, VoidFromFloat(Lt(1.0f))).WillByDefault(Return());
498 ON_CALL(mock, VoidFromFloat(Gt(1.0f))).WillByDefault(Return());
499 ON_CALL(mock, VoidFromFloat(Le(1.0f))).WillByDefault(Return());
500 ON_CALL(mock, VoidFromFloat(Ge(1.0f))).WillByDefault(Return());
501 ON_CALL(mock, VoidFromFloat(Ne(1.0f))).WillByDefault(Return());
502}
503
504// Tests the linkage of the NotNull matcher.
505TEST(LinkTest, TestMatcherNotNull) {
506 Mock mock;
507
508 ON_CALL(mock, VoidFromString(NotNull())).WillByDefault(Return());
509}
510
511// Tests the linkage of the IsNull matcher.
512TEST(LinkTest, TestMatcherIsNull) {
513 Mock mock;
514
515 ON_CALL(mock, VoidFromString(IsNull())).WillByDefault(Return());
516}
517
518// Tests the linkage of the Ref matcher.
519TEST(LinkTest, TestMatcherRef) {
520 Mock mock;
521 int a = 0;
522
523 ON_CALL(mock, VoidFromIntRef(Ref(a))).WillByDefault(Return());
524}
525
526// Tests the linkage of the TypedEq matcher.
527TEST(LinkTest, TestMatcherTypedEq) {
528 Mock mock;
529 long a = 0;
530
531 ON_CALL(mock, VoidFromIntRef(TypedEq<int&>(a))).WillByDefault(Return());
532}
533
534// Tests the linkage of the FloatEq, DoubleEq, NanSensitiveFloatEq and
535// NanSensitiveDoubleEq matchers.
536TEST(LinkTest, TestMatchersFloatingPoint) {
537 Mock mock;
538 float a = 0;
539
540 ON_CALL(mock, VoidFromFloat(FloatEq(a))).WillByDefault(Return());
541 ON_CALL(mock, VoidFromDouble(DoubleEq(a))).WillByDefault(Return());
542 ON_CALL(mock, VoidFromFloat(NanSensitiveFloatEq(a))).WillByDefault(Return());
543 ON_CALL(mock, VoidFromDouble(NanSensitiveDoubleEq(a)))
544 .WillByDefault(Return());
545}
546
547// Tests the linkage of the ContainsRegex matcher.
548TEST(LinkTest, TestMatcherContainsRegex) {
549 Mock mock;
550
551 ON_CALL(mock, VoidFromString(ContainsRegex(".*"))).WillByDefault(Return());
552}
553
554// Tests the linkage of the MatchesRegex matcher.
555TEST(LinkTest, TestMatcherMatchesRegex) {
556 Mock mock;
557
558 ON_CALL(mock, VoidFromString(MatchesRegex(".*"))).WillByDefault(Return());
559}
560
561// Tests the linkage of the StartsWith, EndsWith, and HasSubstr matchers.
562TEST(LinkTest, TestMatchersSubstrings) {
563 Mock mock;
564
565 ON_CALL(mock, VoidFromString(StartsWith("a"))).WillByDefault(Return());
566 ON_CALL(mock, VoidFromString(EndsWith("c"))).WillByDefault(Return());
567 ON_CALL(mock, VoidFromString(HasSubstr("b"))).WillByDefault(Return());
568}
569
570// Tests the linkage of the StrEq, StrNe, StrCaseEq, and StrCaseNe matchers.
571TEST(LinkTest, TestMatchersStringEquality) {
572 Mock mock;
573 ON_CALL(mock, VoidFromString(StrEq("a"))).WillByDefault(Return());
574 ON_CALL(mock, VoidFromString(StrNe("a"))).WillByDefault(Return());
575 ON_CALL(mock, VoidFromString(StrCaseEq("a"))).WillByDefault(Return());
576 ON_CALL(mock, VoidFromString(StrCaseNe("a"))).WillByDefault(Return());
577}
578
579// Tests the linkage of the ElementsAre matcher.
580TEST(LinkTest, TestMatcherElementsAre) {
581 Mock mock;
582
583 ON_CALL(mock, VoidFromVector(ElementsAre('a', _))).WillByDefault(Return());
584}
585
586// Tests the linkage of the ElementsAreArray matcher.
587TEST(LinkTest, TestMatcherElementsAreArray) {
588 Mock mock;
589 char arr[] = {'a', 'b'};
590
591 ON_CALL(mock, VoidFromVector(ElementsAreArray(arr))).WillByDefault(Return());
592}
593
594// Tests the linkage of the IsSubsetOf matcher.
595TEST(LinkTest, TestMatcherIsSubsetOf) {
596 Mock mock;
597 char arr[] = {'a', 'b'};
598
599 ON_CALL(mock, VoidFromVector(IsSubsetOf(arr))).WillByDefault(Return());
600}
601
602// Tests the linkage of the IsSupersetOf matcher.
603TEST(LinkTest, TestMatcherIsSupersetOf) {
604 Mock mock;
605 char arr[] = {'a', 'b'};
606
607 ON_CALL(mock, VoidFromVector(IsSupersetOf(arr))).WillByDefault(Return());
608}
609
610// Tests the linkage of the ContainerEq matcher.
611TEST(LinkTest, TestMatcherContainerEq) {
612 Mock mock;
613 std::vector<int> v;
614
615 ON_CALL(mock, VoidFromVector(ContainerEq(v))).WillByDefault(Return());
616}
617
618// Tests the linkage of the Field matcher.
619TEST(LinkTest, TestMatcherField) {
620 FieldHelper helper(0);
621
623 EXPECT_TRUE(m.Matches(helper));
624
626 EXPECT_TRUE(m2.Matches(&helper));
627}
628
629// Tests the linkage of the Property matcher.
630TEST(LinkTest, TestMatcherProperty) {
631 FieldHelper helper(0);
632
634 EXPECT_TRUE(m.Matches(helper));
635
636 Matcher<const FieldHelper*> m2 = Property(&FieldHelper::field, Eq(0));
637 EXPECT_TRUE(m2.Matches(&helper));
638}
639
640// Tests the linkage of the ResultOf matcher.
641TEST(LinkTest, TestMatcherResultOf) {
643 EXPECT_TRUE(m.Matches(nullptr));
644}
645
646// Tests the linkage of the ResultOf matcher.
647TEST(LinkTest, TestMatcherPointee) {
648 int n = 1;
649
650 Matcher<int*> m = Pointee(Eq(1));
651 EXPECT_TRUE(m.Matches(&n));
652}
653
654// Tests the linkage of the Truly matcher.
655TEST(LinkTest, TestMatcherTruly) {
657 EXPECT_TRUE(m.Matches(nullptr));
658}
659
660// Tests the linkage of the AllOf matcher.
661TEST(LinkTest, TestMatcherAllOf) {
662 Matcher<int> m = AllOf(_, Eq(1));
663 EXPECT_TRUE(m.Matches(1));
664}
665
666// Tests the linkage of the AnyOf matcher.
667TEST(LinkTest, TestMatcherAnyOf) {
668 Matcher<int> m = AnyOf(_, Eq(1));
669 EXPECT_TRUE(m.Matches(1));
670}
671
672// Tests the linkage of the Not matcher.
673TEST(LinkTest, TestMatcherNot) {
674 Matcher<int> m = Not(_);
675 EXPECT_FALSE(m.Matches(1));
676}
677
678// Tests the linkage of the MatcherCast<T>() function.
679TEST(LinkTest, TestMatcherCast) {
680 Matcher<const char*> m = MatcherCast<const char*>(_);
681 EXPECT_TRUE(m.Matches(nullptr));
682}
683
684#endif // GOOGLEMOCK_TEST_GMOCK_LINK_TEST_H_
Definition gmock_link_test.h:238
FieldHelper(int a_field)
Definition gmock_link_test.h:240
int field_
Definition gmock_link_test.h:242
int field() const
Definition gmock_link_test.h:241
Definition gmock_link_test.h:195
virtual void VoidFromString(char *str)=0
virtual ~Interface()=default
virtual void VoidFromFunc(void(*func)(char *str))=0
virtual int & IntRefFromString(char *str)=0
virtual void VoidFromIntRef(int &n)=0
virtual void VoidFromDouble(double n)=0
virtual char * StringFromString(char *str)=0
virtual int IntFromString(char *str)=0
virtual void VoidFromFloat(float n)=0
virtual void VoidFromVector(const std::vector< int > &v)=0
Definition gmock_link_test.h:228
static int StaticIntFromString(char *)
Definition gmock_link_test.h:234
static void StaticVoidFromString(char *)
Definition gmock_link_test.h:232
void VoidFromVoid()
Definition gmock_link_test.h:231
void VoidFromString(char *)
Definition gmock_link_test.h:233
static void StaticVoidFromVoid()
Definition gmock_link_test.h:230
static bool StaticBoolFromString(const char *)
Definition gmock_link_test.h:235
Definition gmock-nice-strict_test.cc:41
MOCK_METHOD1(IntRefFromString, int &(char *str))
MOCK_METHOD1(StringFromString, char *(char *str))
Mock()=default
MOCK_METHOD1(VoidFromFloat, void(float n))
MOCK_METHOD1(VoidFromVector, void(const std::vector< int > &v))
MOCK_METHOD1(VoidFromDouble, void(double n))
MOCK_METHOD1(VoidFromFunc, void(void(*func)(char *str)))
MOCK_METHOD1(VoidFromString, void(char *str))
MOCK_METHOD1(VoidFromIntRef, void(int &n))
MOCK_METHOD1(IntFromString, int(char *str))
Definition gmock-actions.h:717
Definition gmock-internal-utils.h:55
#define ACTION(name)
Definition gmock-actions.h:2238
#define ACTION_P2(name,...)
Definition gmock-actions.h:2266
#define ACTION_P(name,...)
Definition gmock-actions.h:2263
const char * p
Definition gmock-matchers-containers_test.cc:379
char ch
Definition gmock-matchers-containers_test.cc:384
#define EXPECT_CALL(obj, call)
Definition gmock-spec-builders.h:2145
#define ON_CALL(obj, call)
Definition gmock-spec-builders.h:2142
#define LinkTest
Definition gmock_link2_test.cc:36
#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
Definition gtest-port.h:360
#define GTEST_DISABLE_MSC_WARNINGS_POP_()
Definition gtest-port.h:361
#define EXPECT_THROW(statement, expected_exception)
Definition gtest.h:1775
#define TEST(test_suite_name, test_name)
Definition gtest.h:2176
#define EXPECT_TRUE(condition)
Definition gtest.h:1807
#define EXPECT_FALSE(condition)
Definition gtest.h:1811
internal::WithArgsAction< typename std::decay< InnerAction >::type > WithoutArgs(InnerAction &&action)
Definition gmock-actions.h:1815
internal::IgnoreResultAction< A > IgnoreResult(const A &an_action)
Definition gmock-actions.h:1979
internal::SetArrayArgumentAction< k, I1, I2 > SetArrayArgument(I1 first, I2 last)
Definition gmock-actions.h:2041
internal::DoAllAction< typename std::decay< Action >::type... > DoAll(Action &&... action)
Definition gmock-actions.h:1783
PolymorphicAction< internal::ReturnVoidAction > Return()
Definition gmock-actions.h:1855
internal::WithArgsAction< typename std::decay< InnerAction >::type, k, ks... > WithArgs(InnerAction &&action)
Definition gmock-actions.h:1806
PolymorphicAction< internal::AssignAction< T1, T2 > > Assign(T1 *ptr, T2 val)
Definition gmock-actions.h:1925
internal::SetArgumentPointeeAction< N, T > SetArgPointee(T value)
Definition gmock-actions.h:1913
PolymorphicAction< internal::SetErrnoAndReturnAction< T > > SetErrnoAndReturn(int errval, T result)
Definition gmock-actions.h:1933
internal::InvokeArgumentAction< index, typename std::decay< Params >::type... > InvokeArgument(Params &&...params)
Definition gmock-more-actions.h:649
internal::InvokeWithoutArgsAction< typename std::decay< FunctionImpl >::type > InvokeWithoutArgs(FunctionImpl function_impl)
Definition gmock-actions.h:1963
internal::WithArgsAction< typename std::decay< InnerAction >::type, k > WithArg(InnerAction &&action)
Definition gmock-actions.h:1795
internal::ReturnRefAction< R > ReturnRef(R &x)
Definition gmock-actions.h:1861
internal::DoDefaultAction DoDefault()
Definition gmock-actions.h:1906
PolymorphicAction< internal::ReturnNullAction > ReturnNull()
Definition gmock-actions.h:1850
std::decay< FunctionImpl >::type Invoke(FunctionImpl &&function_impl)
Definition gmock-actions.h:1948