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