proxygen
gmock_link_test.h File Reference
#include "gmock/gmock.h"
#include <errno.h>
#include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h"
#include <iostream>
#include <vector>

Go to the source code of this file.

Classes

class  Interface
 
class  Mock
 
class  InvokeHelper
 
class  FieldHelper
 

Functions

 TEST (LinkTest, TestReturnVoid)
 
 TEST (LinkTest, TestReturn)
 
 TEST (LinkTest, TestReturnNull)
 
 TEST (LinkTest, TestReturnRef)
 
 TEST (LinkTest, TestAssign)
 
 TEST (LinkTest, TestSetArgPointee)
 
 TEST (LinkTest, TestSetArrayArgument)
 
 TEST (LinkTest, TestSetErrnoAndReturn)
 
 TEST (LinkTest, TestInvoke)
 
 TEST (LinkTest, TestInvokeWithoutArgs)
 
 TEST (LinkTest, TestInvokeArgument)
 
 TEST (LinkTest, TestWithArg)
 
 TEST (LinkTest, TestWithArgs)
 
 TEST (LinkTest, TestWithoutArgs)
 
 TEST (LinkTest, TestDoAll)
 
 TEST (LinkTest, TestDoDefault)
 
 TEST (LinkTest, TestIgnoreResult)
 
 TEST (LinkTest, TestActionMacro)
 
 TEST (LinkTest, TestActionPMacro)
 
 TEST (LinkTest, TestActionP2Macro)
 
 TEST (LinkTest, TestMatcherAnything)
 
 TEST (LinkTest, TestMatcherA)
 
 TEST (LinkTest, TestMatchersEq)
 
 TEST (LinkTest, TestMatchersRelations)
 
 TEST (LinkTest, TestMatcherNotNull)
 
 TEST (LinkTest, TestMatcherIsNull)
 
 TEST (LinkTest, TestMatcherRef)
 
 TEST (LinkTest, TestMatcherTypedEq)
 
 TEST (LinkTest, TestMatchersFloatingPoint)
 
 TEST (LinkTest, TestMatcherContainsRegex)
 
 TEST (LinkTest, TestMatcherMatchesRegex)
 
 TEST (LinkTest, TestMatchersSubstrings)
 
 TEST (LinkTest, TestMatchersStringEquality)
 
 TEST (LinkTest, TestMatcherElementsAre)
 
 TEST (LinkTest, TestMatcherElementsAreArray)
 
 TEST (LinkTest, TestMatcherContainerEq)
 
 TEST (LinkTest, TestMatcherField)
 
 TEST (LinkTest, TestMatcherProperty)
 
 TEST (LinkTest, TestMatcherResultOf)
 
 TEST (LinkTest, TestMatcherPointee)
 
 TEST (LinkTest, TestMatcherTruly)
 
 TEST (LinkTest, TestMatcherAllOf)
 
 TEST (LinkTest, TestMatcherAnyOf)
 
 TEST (LinkTest, TestMatcherNot)
 
 TEST (LinkTest, TestMatcherCast)
 

Function Documentation

TEST ( LinkTest  ,
TestReturnVoid   
)

Definition at line 242 of file gmock_link_test.h.

References testing::_, EXPECT_CALL, testing::Return(), and Interface::VoidFromString().

242  {
243  Mock mock;
244 
245  EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Return());
246  mock.VoidFromString(NULL);
247 }
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestReturn   
)

Definition at line 250 of file gmock_link_test.h.

References testing::_, ch, EXPECT_CALL, testing::Return(), and Interface::StringFromString().

250  {
251  Mock mock;
252  char ch = 'x';
253 
254  EXPECT_CALL(mock, StringFromString(_)).WillOnce(Return(&ch));
255  mock.StringFromString(NULL);
256 }
auto ch
virtual char * StringFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestReturnNull   
)

Definition at line 259 of file gmock_link_test.h.

References testing::_, EXPECT_CALL, testing::Return(), and Interface::VoidFromString().

259  {
260  Mock mock;
261 
262  EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Return());
263  mock.VoidFromString(NULL);
264 }
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestReturnRef   
)

Definition at line 267 of file gmock_link_test.h.

References testing::_, EXPECT_CALL, Interface::IntRefFromString(), and testing::ReturnRef().

267  {
268  Mock mock;
269  int n = 42;
270 
271  EXPECT_CALL(mock, IntRefFromString(_)).WillOnce(ReturnRef(n));
272  mock.IntRefFromString(NULL);
273 }
virtual int & IntRefFromString(char *str)=0
internal::ReturnRefAction< R > ReturnRef(R &x)
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestAssign   
)

Definition at line 276 of file gmock_link_test.h.

References testing::_, testing::Assign(), ch, EXPECT_CALL, and Interface::VoidFromString().

276  {
277  Mock mock;
278  char ch = 'x';
279 
280  EXPECT_CALL(mock, VoidFromString(_)).WillOnce(Assign(&ch, 'y'));
281  mock.VoidFromString(NULL);
282 }
auto ch
virtual void VoidFromString(char *str)=0
PolymorphicAction< internal::AssignAction< T1, T2 > > Assign(T1 *ptr, T2 val)
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestSetArgPointee   
)

Definition at line 285 of file gmock_link_test.h.

References testing::_, ch, EXPECT_CALL, and Interface::VoidFromString().

285  {
286  Mock mock;
287  char ch = 'x';
288 
289  EXPECT_CALL(mock, VoidFromString(_)).WillOnce(SetArgPointee<0>('y'));
290  mock.VoidFromString(&ch);
291 }
auto ch
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestSetArrayArgument   
)

Definition at line 294 of file gmock_link_test.h.

References testing::_, ch, EXPECT_CALL, and Interface::VoidFromString().

294  {
295  Mock mock;
296  char ch = 'x';
297  char ch2 = 'y';
298 
299  EXPECT_CALL(mock, VoidFromString(_)).WillOnce(SetArrayArgument<0>(&ch2,
300  &ch2 + 1));
301  mock.VoidFromString(&ch);
302 }
auto ch
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestSetErrnoAndReturn   
)

Definition at line 307 of file gmock_link_test.h.

References testing::_, EXPECT_CALL, Interface::IntFromString(), and testing::SetErrnoAndReturn().

307  {
308  Mock mock;
309 
310  int saved_errno = errno;
311  EXPECT_CALL(mock, IntFromString(_)).WillOnce(SetErrnoAndReturn(1, -1));
312  mock.IntFromString(NULL);
313  errno = saved_errno;
314 }
virtual int IntFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
PolymorphicAction< internal::SetErrnoAndReturnAction< T > > SetErrnoAndReturn(int errval, T result)
TEST ( LinkTest  ,
TestInvoke   
)

Definition at line 319 of file gmock_link_test.h.

References testing::_, EXPECT_CALL, testing::Invoke(), InvokeHelper::StaticVoidFromString(), Interface::VoidFromString(), and InvokeHelper::VoidFromString().

319  {
320  Mock mock;
321  InvokeHelper test_invoke_helper;
322 
323  EXPECT_CALL(mock, VoidFromString(_))
325  .WillOnce(Invoke(&test_invoke_helper, &InvokeHelper::VoidFromString));
326  mock.VoidFromString(NULL);
327  mock.VoidFromString(NULL);
328 }
void VoidFromString(char *)
static void StaticVoidFromString(char *)
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestInvokeWithoutArgs   
)

Definition at line 331 of file gmock_link_test.h.

References testing::_, EXPECT_CALL, testing::InvokeWithoutArgs(), InvokeHelper::StaticVoidFromVoid(), Interface::VoidFromString(), and InvokeHelper::VoidFromVoid().

331  {
332  Mock mock;
333  InvokeHelper test_invoke_helper;
334 
335  EXPECT_CALL(mock, VoidFromString(_))
337  .WillOnce(InvokeWithoutArgs(&test_invoke_helper,
339  mock.VoidFromString(NULL);
340  mock.VoidFromString(NULL);
341 }
static void StaticVoidFromVoid()
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestInvokeArgument   
)

Definition at line 344 of file gmock_link_test.h.

References testing::_, ch, EXPECT_CALL, InvokeHelper::StaticVoidFromString(), and Interface::VoidFromFunc().

344  {
345  Mock mock;
346  char ch = 'x';
347 
348  EXPECT_CALL(mock, VoidFromFunc(_)).WillOnce(InvokeArgument<0>(&ch));
350 }
static void StaticVoidFromString(char *)
auto ch
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
virtual void VoidFromFunc(void(*func)(char *str))=0
TEST ( LinkTest  ,
TestWithArg   
)

Definition at line 353 of file gmock_link_test.h.

References testing::_, EXPECT_CALL, testing::Invoke(), InvokeHelper::StaticVoidFromString(), and Interface::VoidFromString().

353  {
354  Mock mock;
355 
356  EXPECT_CALL(mock, VoidFromString(_))
357  .WillOnce(WithArg<0>(Invoke(&InvokeHelper::StaticVoidFromString)));
358  mock.VoidFromString(NULL);
359 }
static void StaticVoidFromString(char *)
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestWithArgs   
)

Definition at line 362 of file gmock_link_test.h.

References testing::_, EXPECT_CALL, testing::Invoke(), InvokeHelper::StaticVoidFromString(), and Interface::VoidFromString().

362  {
363  Mock mock;
364 
365  EXPECT_CALL(mock, VoidFromString(_))
366  .WillOnce(WithArgs<0>(Invoke(&InvokeHelper::StaticVoidFromString)));
367  mock.VoidFromString(NULL);
368 }
static void StaticVoidFromString(char *)
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestWithoutArgs   
)

Definition at line 371 of file gmock_link_test.h.

References testing::_, EXPECT_CALL, testing::Return(), Interface::VoidFromString(), and testing::WithoutArgs().

371  {
372  Mock mock;
373 
374  EXPECT_CALL(mock, VoidFromString(_)).WillOnce(WithoutArgs(Return()));
375  mock.VoidFromString(NULL);
376 }
internal::WithArgsAction< InnerAction > WithoutArgs(const InnerAction &action)
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestDoAll   
)

Definition at line 379 of file gmock_link_test.h.

References testing::_, ch, testing::DoAll(), EXPECT_CALL, testing::Return(), and Interface::VoidFromString().

379  {
380  Mock mock;
381  char ch = 'x';
382 
383  EXPECT_CALL(mock, VoidFromString(_))
384  .WillOnce(DoAll(SetArgPointee<0>('y'), Return()));
385  mock.VoidFromString(&ch);
386 }
auto ch
virtual void VoidFromString(char *str)=0
internal::DoBothAction< Action1, Action2 > DoAll(Action1 a1, Action2 a2)
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestDoDefault   
)

Definition at line 389 of file gmock_link_test.h.

References testing::_, ch, testing::DoDefault(), EXPECT_CALL, ON_CALL, testing::Return(), and Interface::VoidFromString().

389  {
390  Mock mock;
391  char ch = 'x';
392 
393  ON_CALL(mock, VoidFromString(_)).WillByDefault(Return());
394  EXPECT_CALL(mock, VoidFromString(_)).WillOnce(DoDefault());
395  mock.VoidFromString(&ch);
396 }
auto ch
virtual void VoidFromString(char *str)=0
internal::DoDefaultAction DoDefault()
#define ON_CALL(obj, call)
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestIgnoreResult   
)

Definition at line 399 of file gmock_link_test.h.

References testing::_, ACTION, EXPECT_CALL, EXPECT_THROW, testing::IgnoreResult(), LinkTest, testing::Return(), TEST(), and Interface::VoidFromString().

399  {
400  Mock mock;
401 
402  EXPECT_CALL(mock, VoidFromString(_)).WillOnce(IgnoreResult(Return(42)));
403  mock.VoidFromString(NULL);
404 }
virtual void VoidFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
internal::IgnoreResultAction< A > IgnoreResult(const A &an_action)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestActionMacro   
)

Definition at line 431 of file gmock_link_test.h.

References testing::_, ACTION_P, EXPECT_CALL, and Interface::IntFromString().

431  {
432  Mock mock;
433 
434  EXPECT_CALL(mock, IntFromString(_)).WillOnce(Return1());
435  mock.IntFromString(NULL);
436 }
virtual int IntFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestActionPMacro   
)

Definition at line 443 of file gmock_link_test.h.

References testing::_, ACTION_P2, EXPECT_CALL, folly::gen::first, and Interface::IntFromString().

443  {
444  Mock mock;
445 
446  EXPECT_CALL(mock, IntFromString(_)).WillOnce(ReturnArgument(42));
447  mock.IntFromString(NULL);
448 }
virtual int IntFromString(char *str)=0
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestActionP2Macro   
)

Definition at line 461 of file gmock_link_test.h.

References testing::_, ch, EXPECT_CALL, and Interface::IntFromString().

461  {
462  Mock mock;
463  char ch = 'x';
464 
465  EXPECT_CALL(mock, IntFromString(_))
466  .WillOnce(ReturnEqualsEitherOf("one", "two"));
467  mock.IntFromString(&ch);
468 }
virtual int IntFromString(char *str)=0
auto ch
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestMatcherAnything   
)

Definition at line 471 of file gmock_link_test.h.

References testing::_, ON_CALL, testing::Return(), and Interface::VoidFromString().

471  {
472  Mock mock;
473 
474  ON_CALL(mock, VoidFromString(_)).WillByDefault(Return());
475 }
#define ON_CALL(obj, call)
const internal::AnythingMatcher _
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherA   
)

Definition at line 478 of file gmock_link_test.h.

References ON_CALL, testing::Return(), and Interface::VoidFromString().

478  {
479  Mock mock;
480 
481  ON_CALL(mock, VoidFromString(A<char*>())).WillByDefault(Return());
482 }
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatchersEq   
)

Definition at line 485 of file gmock_link_test.h.

References testing::Eq(), ON_CALL, testing::Return(), and Interface::VoidFromString().

485  {
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")))
491  .WillByDefault(Return());
492 }
internal::EqMatcher< T > Eq(T x)
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatchersRelations   
)

Definition at line 495 of file gmock_link_test.h.

References f, testing::Ge(), testing::Gt(), testing::Le(), testing::Lt(), testing::Ne(), ON_CALL, testing::Return(), and Interface::VoidFromFloat().

495  {
496  Mock mock;
497 
498  ON_CALL(mock, VoidFromFloat(Lt(1.0f))).WillByDefault(Return());
499  ON_CALL(mock, VoidFromFloat(Gt(1.0f))).WillByDefault(Return());
500  ON_CALL(mock, VoidFromFloat(Le(1.0f))).WillByDefault(Return());
501  ON_CALL(mock, VoidFromFloat(Ge(1.0f))).WillByDefault(Return());
502  ON_CALL(mock, VoidFromFloat(Ne(1.0f))).WillByDefault(Return());
503 }
internal::GtMatcher< Rhs > Gt(Rhs x)
internal::NeMatcher< Rhs > Ne(Rhs x)
auto f
internal::LtMatcher< Rhs > Lt(Rhs x)
internal::LeMatcher< Rhs > Le(Rhs x)
#define ON_CALL(obj, call)
internal::GeMatcher< Rhs > Ge(Rhs x)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherNotNull   
)

Definition at line 506 of file gmock_link_test.h.

References testing::NotNull(), ON_CALL, testing::Return(), and Interface::VoidFromString().

506  {
507  Mock mock;
508 
509  ON_CALL(mock, VoidFromString(NotNull())).WillByDefault(Return());
510 }
PolymorphicMatcher< internal::NotNullMatcher > NotNull()
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherIsNull   
)

Definition at line 513 of file gmock_link_test.h.

References testing::IsNull(), ON_CALL, testing::Return(), and Interface::VoidFromString().

513  {
514  Mock mock;
515 
516  ON_CALL(mock, VoidFromString(IsNull())).WillByDefault(Return());
517 }
PolymorphicMatcher< internal::IsNullMatcher > IsNull()
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherRef   
)

Definition at line 520 of file gmock_link_test.h.

References a, ON_CALL, testing::Ref(), testing::Return(), and Interface::VoidFromIntRef().

520  {
521  Mock mock;
522  int a = 0;
523 
524  ON_CALL(mock, VoidFromIntRef(Ref(a))).WillByDefault(Return());
525 }
internal::RefMatcher< T & > Ref(T &x)
char a
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherTypedEq   
)

Definition at line 528 of file gmock_link_test.h.

References a, ON_CALL, testing::Return(), and Interface::VoidFromIntRef().

528  {
529  Mock mock;
530  long a = 0;
531 
532  ON_CALL(mock, VoidFromIntRef(TypedEq<int&>(a))).WillByDefault(Return());
533 }
char a
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatchersFloatingPoint   
)

Definition at line 537 of file gmock_link_test.h.

References a, testing::DoubleEq(), testing::FloatEq(), testing::NanSensitiveDoubleEq(), testing::NanSensitiveFloatEq(), ON_CALL, testing::Return(), Interface::VoidFromDouble(), and Interface::VoidFromFloat().

537  {
538  Mock mock;
539  float a = 0;
540 
541  ON_CALL(mock, VoidFromFloat(FloatEq(a))).WillByDefault(Return());
542  ON_CALL(mock, VoidFromDouble(DoubleEq(a))).WillByDefault(Return());
543  ON_CALL(mock, VoidFromFloat(NanSensitiveFloatEq(a))).WillByDefault(Return());
544  ON_CALL(mock, VoidFromDouble(NanSensitiveDoubleEq(a)))
545  .WillByDefault(Return());
546 }
internal::FloatingEqMatcher< double > NanSensitiveDoubleEq(double rhs)
internal::FloatingEqMatcher< double > DoubleEq(double rhs)
internal::FloatingEqMatcher< float > NanSensitiveFloatEq(float rhs)
char a
#define ON_CALL(obj, call)
internal::FloatingEqMatcher< float > FloatEq(float rhs)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherContainsRegex   
)

Definition at line 549 of file gmock_link_test.h.

References testing::ContainsRegex(), ON_CALL, testing::Return(), and Interface::VoidFromString().

549  {
550  Mock mock;
551 
552  ON_CALL(mock, VoidFromString(ContainsRegex(".*"))).WillByDefault(Return());
553 }
PolymorphicMatcher< internal::MatchesRegexMatcher > ContainsRegex(const internal::RE *regex)
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherMatchesRegex   
)

Definition at line 556 of file gmock_link_test.h.

References testing::MatchesRegex(), ON_CALL, testing::Return(), and Interface::VoidFromString().

556  {
557  Mock mock;
558 
559  ON_CALL(mock, VoidFromString(MatchesRegex(".*"))).WillByDefault(Return());
560 }
PolymorphicMatcher< internal::MatchesRegexMatcher > MatchesRegex(const internal::RE *regex)
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatchersSubstrings   
)

Definition at line 563 of file gmock_link_test.h.

References testing::EndsWith(), testing::HasSubstr(), ON_CALL, testing::Return(), testing::StartsWith(), and Interface::VoidFromString().

563  {
564  Mock mock;
565 
566  ON_CALL(mock, VoidFromString(StartsWith("a"))).WillByDefault(Return());
567  ON_CALL(mock, VoidFromString(EndsWith("c"))).WillByDefault(Return());
568  ON_CALL(mock, VoidFromString(HasSubstr("b"))).WillByDefault(Return());
569 }
PolymorphicMatcher< internal::StartsWithMatcher< internal::string > > StartsWith(const internal::string &prefix)
PolymorphicMatcher< internal::EndsWithMatcher< internal::string > > EndsWith(const internal::string &suffix)
PolymorphicMatcher< internal::HasSubstrMatcher< internal::string > > HasSubstr(const internal::string &substring)
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatchersStringEquality   
)

Definition at line 572 of file gmock_link_test.h.

References ON_CALL, testing::Return(), testing::StrCaseEq(), testing::StrCaseNe(), testing::StrEq(), testing::StrNe(), and Interface::VoidFromString().

572  {
573  Mock mock;
574  ON_CALL(mock, VoidFromString(StrEq("a"))).WillByDefault(Return());
575  ON_CALL(mock, VoidFromString(StrNe("a"))).WillByDefault(Return());
576  ON_CALL(mock, VoidFromString(StrCaseEq("a"))).WillByDefault(Return());
577  ON_CALL(mock, VoidFromString(StrCaseNe("a"))).WillByDefault(Return());
578 }
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrEq(const internal::string &str)
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrCaseNe(const internal::string &str)
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrNe(const internal::string &str)
#define ON_CALL(obj, call)
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrCaseEq(const internal::string &str)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherElementsAre   
)

Definition at line 581 of file gmock_link_test.h.

References testing::_, testing::ElementsAre(), ON_CALL, testing::Return(), and Interface::VoidFromVector().

581  {
582  Mock mock;
583 
584  ON_CALL(mock, VoidFromVector(ElementsAre('a', _))).WillByDefault(Return());
585 }
#define ON_CALL(obj, call)
const internal::AnythingMatcher _
internal::ElementsAreMatcher< ::testing::tuple<> > ElementsAre()
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherElementsAreArray   
)

Definition at line 588 of file gmock_link_test.h.

References testing::ElementsAreArray(), ON_CALL, testing::Return(), and Interface::VoidFromVector().

588  {
589  Mock mock;
590  char arr[] = { 'a', 'b' };
591 
592  ON_CALL(mock, VoidFromVector(ElementsAreArray(arr))).WillByDefault(Return());
593 }
internal::ElementsAreArrayMatcher< typename::std::iterator_traits< Iter >::value_type > ElementsAreArray(Iter first, Iter last)
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherContainerEq   
)

Definition at line 596 of file gmock_link_test.h.

References testing::ContainerEq(), ON_CALL, testing::Return(), v, and Interface::VoidFromVector().

596  {
597  Mock mock;
598  std::vector<int> v;
599 
600  ON_CALL(mock, VoidFromVector(ContainerEq(v))).WillByDefault(Return());
601 }
auto v
PolymorphicMatcher< internal::ContainerEqMatcher< GTEST_REMOVE_CONST_(Container)> > ContainerEq(const Container &rhs)
#define ON_CALL(obj, call)
internal::ReturnAction< R > Return(R value)
TEST ( LinkTest  ,
TestMatcherField   
)

Definition at line 604 of file gmock_link_test.h.

References testing::Eq(), EXPECT_TRUE, testing::Field(), FieldHelper::field_, m, and testing::internal::MatcherBase< T >::Matches().

604  {
605  FieldHelper helper(0);
606 
608  EXPECT_TRUE(m.Matches(helper));
609 
611  EXPECT_TRUE(m2.Matches(&helper));
612 }
internal::EqMatcher< T > Eq(T x)
static map< string, int > m
PolymorphicMatcher< internal::FieldMatcher< Class, FieldType > > Field(FieldType Class::*field, const FieldMatcher &matcher)
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
TEST ( LinkTest  ,
TestMatcherProperty   
)

Definition at line 615 of file gmock_link_test.h.

References testing::Eq(), EXPECT_TRUE, FieldHelper::field(), m, testing::internal::MatcherBase< T >::Matches(), and testing::Property().

615  {
616  FieldHelper helper(0);
617 
619  EXPECT_TRUE(m.Matches(helper));
620 
622  EXPECT_TRUE(m2.Matches(&helper));
623 }
internal::EqMatcher< T > Eq(T x)
int field() const
static map< string, int > m
PolymorphicMatcher< internal::PropertyMatcher< Class, PropertyType > > Property(PropertyType(Class::*property)() const, const PropertyMatcher &matcher)
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
TEST ( LinkTest  ,
TestMatcherResultOf   
)

Definition at line 626 of file gmock_link_test.h.

References testing::Eq(), EXPECT_TRUE, m, testing::internal::MatcherBase< T >::Matches(), and InvokeHelper::StaticIntFromString().

626  {
628  EXPECT_TRUE(m.Matches(NULL));
629 }
internal::EqMatcher< T > Eq(T x)
typename NonSharedPtr< invoke_result_t< F >>::type ResultOf
Definition: Observer-pre.h:40
static map< string, int > m
static int StaticIntFromString(char *)
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
TEST ( LinkTest  ,
TestMatcherPointee   
)

Definition at line 632 of file gmock_link_test.h.

References testing::Eq(), EXPECT_TRUE, m, testing::internal::MatcherBase< T >::Matches(), and testing::Pointee().

632  {
633  int n = 1;
634 
635  Matcher<int*> m = Pointee(Eq(1));
636  EXPECT_TRUE(m.Matches(&n));
637 }
internal::EqMatcher< T > Eq(T x)
static map< string, int > m
internal::PointeeMatcher< InnerMatcher > Pointee(const InnerMatcher &inner_matcher)
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
TEST ( LinkTest  ,
TestMatcherTruly   
)

Definition at line 640 of file gmock_link_test.h.

References EXPECT_TRUE, m, testing::internal::MatcherBase< T >::Matches(), InvokeHelper::StaticBoolFromString(), and testing::Truly().

640  {
642  EXPECT_TRUE(m.Matches(NULL));
643 }
static bool StaticBoolFromString(const char *)
static map< string, int > m
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
PolymorphicMatcher< internal::TrulyMatcher< Predicate > > Truly(Predicate pred)
TEST ( LinkTest  ,
TestMatcherAllOf   
)

Definition at line 646 of file gmock_link_test.h.

References testing::_, testing::Eq(), EXPECT_TRUE, m, and testing::internal::MatcherBase< T >::Matches().

646  {
647  Matcher<int> m = AllOf(_, Eq(1));
648  EXPECT_TRUE(m.Matches(1));
649 }
internal::EqMatcher< T > Eq(T x)
static map< string, int > m
StrictConjunction< T< As >... > AllOf
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestMatcherAnyOf   
)

Definition at line 652 of file gmock_link_test.h.

References testing::_, testing::AnyOf(), testing::Eq(), EXPECT_TRUE, m, and testing::internal::MatcherBase< T >::Matches().

652  {
653  Matcher<int> m = AnyOf(_, Eq(1));
654  EXPECT_TRUE(m.Matches(1));
655 }
internal::EqMatcher< T > Eq(T x)
internal::AnyOfResult2< M1, M2 >::type AnyOf(M1 m1, M2 m2)
static map< string, int > m
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
const internal::AnythingMatcher _
TEST ( LinkTest  ,
TestMatcherNot   
)

Definition at line 658 of file gmock_link_test.h.

References testing::_, EXPECT_FALSE, m, testing::internal::MatcherBase< T >::Matches(), and testing::Not().

658  {
659  Matcher<int> m = Not(_);
660  EXPECT_FALSE(m.Matches(1));
661 }
internal::NotMatcher< InnerMatcher > Not(InnerMatcher m)
static map< string, int > m
const internal::AnythingMatcher _
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862
TEST ( LinkTest  ,
TestMatcherCast   
)

Definition at line 664 of file gmock_link_test.h.

References testing::_, EXPECT_TRUE, m, and testing::internal::MatcherBase< T >::Matches().

664  {
665  Matcher<const char*> m = MatcherCast<const char*>(_);
666  EXPECT_TRUE(m.Matches(NULL));
667 }
static map< string, int > m
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
const internal::AnythingMatcher _