c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -
c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -
i'm having problem expect_call method, when trying :
boost::program_options::variables_map vm; mymock mock; expect_call(mock, mymethod(vm)).willonce(return(l""));
mymethod looks :
std::wstring mymethod(const boost::program_options::variables_map &vm)
when compiling got errors :
error 17 error c2676: binary '==' : 'const boost::program_options::variable_value' not define operator or conversion type acceptable predefined operator c:\program files (x86)\microsoft visual studio 9.0\vc\include\utility error 10 error c2784: 'bool std::operator ==(const _elem *,const std::basic_string<_elem,_traits,_alloc> &)' : not deduce template argument 'const _elem *' 'const boost::program_options::variable_value' c:\program files (x86)\microsoft visual studio 9.0\vc\include\utility
and few more similar errors.
to utilize expect_call, class needs back upwards operator==
. since boost::program_options::variables_map
has no operator==
, can not utilize that.
you define own matcher boost::program_options::variables_map
, advise pass function check expected values (or can ignore, set flag, or whatever please). :
int called = 0; void foo( const boost::program_options::variables_map &) { ++ called; }
in test :
boost::program_options::variables_map vm; mymock mock; called = 0; expect_call(mock, mymethod(_)).willonce(invoke(&foo)); // assert called 1
c++ boost gmock
Comments
Post a Comment