I am newer for google mock. Now I have one question about how to match the argument reference? here are the codes
class Parameter{
public:
int m_idata;
char m_cdata;
bool Parameter::operator ==(const Parameter& element) const{
return (m_idata == element.m_idata && m_cdata == element.m_cdata);
}
};
class FooInterface{
public:
virtual ~FooInterface() {}
virtual void SetParameter(Parameter& val) = 0;
};
// mock class
class MockFoo: public FooInterface {
public:
MOCK_METHOD1(SetParameter, void(Parameter& val));
};
TEST(FooTest, setParameterTest)
{
MockFoo mockFoo;
EXPECT_CALL(mockFoo, SetParameter(An<Parameter&>())); // How to match argument reference???
Parameter para;
mockFoo.SetParameter(para); // there is an exception here, why???
}and I also try those codes to match SetParameter()
Parameter test_para;
EXPECT_CALL(mockFoo, SetParameter(Ref(test_para)));And
EXPECT_CALL(mockFoo, SetParameter(A<Parameter&>()));Both those two codes can also cause exception... Could any one tell me how to match the argument reference Parameter& in the function SetParameter()?
--
---
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/276dcced-9ca3-4953-a738-319c0c953917%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.