AllOf() troubles

46 views
Skip to first unread message

abisco

unread,
Mar 31, 2011, 11:46:29 AM3/31/11
to Google C++ Mocking Framework
I ran into a strange problem using AllOf() with Property(). Here's a
call that works:

EXPECT_CALL(myMock, makeWidget(AllOf(Property(&ParamsClass::getArg1,
expectedArg1),
Property(&ParamsClass::getArg2, expectedArg2),
Property(&ParamsClass::getArg3, expectedArg3),
Property(&ParamsClass::getArg4, expectedArg4),
Property(&ParamsClass::getArg5, expectedArg5))))
.Times(1)
.WillOnce(Return(expectedRetValue));

As soon as I add another Property() matcher, I get:

error: no matching function for call to
'AllOf(testing::PolymorphicMatcher<testing::internal::PropertyMatcher<ParamsClass,
int> >,
testing::PolymorphicMatcher<testing::internal::PropertyMatcher<ParamsClass,
int> >,
testing::PolymorphicMatcher<testing::internal::PropertyMatcher<ParamsClass,
double> >,
testing::PolymorphicMatcher<testing::internal::PropertyMatcher<ParamsClass,
int> >,
testing::PolymorphicMatcher<testing::internal::PropertyMatcher<ParamsClass,
double> >,
testing::PolymorphicMatcher<testing::internal::PropertyMatcher<ParamsClass,
int> >)'

from my MinGW-5.1.4\bin\make.exe

I think it's clear that I'm trying to test
myMock::makeWidget(ParamsClass& paramsObject) ,
where I have several ParamsClass::getArg#() const getters.

Any ideas as to what can cause this?

Build under Eclipse Galileo3.5 on Windows XP 32, with Eclipse 6.0.2 C/C
++ dev platform and the CDT GCC cross compiler 1.0.0

Vlad Losev

unread,
Mar 31, 2011, 2:17:06 PM3/31/11
to abisco, Google C++ Mocking Framework
AllOf only supports up to 5 arguments in release 1.5. This has been increased to 10 in the svn head. You can either grab the latest version of Google Mock from svn, wait for the release 1.6, or cascade your AllOff calls like this:

EXPECT_CALL(
    mock,
    makeWidget(AllOff(AllOff(
        Property(&ParamsClass::getArg1, expectedArg1),
        ...), AllOff(
        Property(&ParamsClass::getArg6, expectedArg6),
        ...))));
HTH,
Vlad
Reply all
Reply to author
Forward
0 new messages