Thanks, Vlad - I overlooked MatcherCast in the first place. However,
using MatcherCast<const uint32_t*>(Pointee(EXPECTED_INTEGER)) is to no
avail either. Specifically, my matchers are nested like so:
EXPECT_CALL(backupDestination, send(MatcherCast<const
uint32_t*>(Pointee(Eq(EXPECTED_INTEGER))),
Eq(sizeof(uint32_t)))).Times(1);
But still, the compiler (MSVC) reports this issue:
cannot convert parameter 1 from 'testing::Matcher<T>' to 'const
testing::Matcher<T> &'
where the Ts are const uint32_t* and const void*, respectively.
From the documentation, I would have expected MatcherCast to behave
like static_cast, such that there should not be any issues casting the
void pointer to the uint32_t pointer. Also, I have used the
Truly(someFunction) workaround from the GMock cook book where
"someFunction" implements the predicate that checks for the void*
argument ("buffer") to point to an uint32_t having the expected value
(naturally using static_cast) like so:
bool someFunction(const void* buffer) {
return (buffer != NULL && EXPECTED_INTEGER == *(static_cast<const
uint32_t*>(buffer)));
}
This works just fine.
Any thoughts?
Thanks,
Sören
> On Mon, Sep 5, 2011 at 3:11 AM,
Soeren.Ba...@googlemail.com <