我正在上课operator[]
,像这样:
class Base
{
public:
virtual ~Base(){}
virtual const int & operator[]( const unsigned int index ) const = 0;
};
如何使用谷歌模拟框架为这个方法创建一个模拟类?
我试过这个:
class MockBase : public Base
{
public:
MOCK_CONST_METHOD1( operator[],
const int& ( const unsigned int )
);
};
但这会产生下一个错误:
error: pasting "]" and "_" does not give a valid preprocessing token
error: pasting "]" and "_" does not give a valid preprocessing token
error: pasting "]" and "_" does not give a valid preprocessing token
error: pasting "]" and "_" does not give a valid preprocessing token