Gmock EXPECT_CALL Pointer as Input Parameter

1803 views
Skip to first unread message

nomec

unread,
Apr 15, 2016, 5:53:40 PM4/15/16
to Google C++ Mocking Framework
Hi,

im trying to set an Expectation to a method with a pointer as input parameter.

MOCK_METHOD1(myMock, eval(int * arr));

How can i expect call with an pointer as input parameter?
This doesnt work:

int arr[2] = {7, 7};
EXPECT_CALL(myMock, eval(arr));


Expected arg #0: is equal to 0000000000A6F4C4 Actual: 0000000000A6DF04 Expected: to be called once Actual: never called - unsatisfied and active



Samuel Benzaquen

unread,
Apr 15, 2016, 5:57:42 PM4/15/16
to nomec, Google C++ Mocking Framework
On Wed, Apr 13, 2016 at 8:38 AM, 'nomec' via Google C++ Mocking Framework <googl...@googlegroups.com> wrote:
Hi,

im trying to set an Expectation to a method with a pointer as input parameter.

MOCK_METHOD1(myMock, eval(int * arr));

How can i expect call with an pointer as input parameter?

Do you want to expect that a specific pointer is passed? Or that the pointee has some property?
 
This doesnt work:

int arr[2] = {7, 7};
EXPECT_CALL(myMock, eval(arr));


Expected arg #0: is equal to 0000000000A6F4C4 Actual: 0000000000A6DF04

This is telling you the pointer you passed is not the expected one, but it is comparing the pointer themselves.
It is not comparing the pointees.

_Sam
 
Expected: to be called once Actual: never called - unsatisfied and active



--

---
You received this message because you are subscribed to the Google Groups "Google C++ Mocking Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlemock+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/googlemock/5c38b5ed-3def-4842-8c3c-5891c74eeb62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages