相关疑难解决方法(0)

如何在google mock中设置一组值的void*参数?

我正在使用谷歌模拟单元测试我的代码,我试图通过void*返回作为输出参数的一组值.

uint32_t bigEndianTestValues[BIG_ENDIAN_FIELD_MAX_ELEMENTS] = {0xDEADBEEF, 0xFFFF0000, 0x00000000, 0x00A00F10, 0x11234211};

for (int i = 0; i < BIG_ENDIAN_FIELD_MAX_ELEMENTS; ++i)
{
   EXPECT_CALL( deviceWindow, get(_,sizeof(bigEndianTestValues[0]),_,_) )
   .WillOnce(SetArgPointee<2>(bigEndianTestValues[i]))
   .RetiresOnSaturation();
}
Run Code Online (Sandbox Code Playgroud)

我的mock包含一个方法调用,如下所示

MOCK_METHOD4(get, void(const size_t, const size_t, void*, nNIAPALS100::tStatus&));
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误

....\include\gmock/gmock-actions.h(693) : error C2100: illegal indirection
....\gmock/gmock-actions.h(369) : see reference to function template instantiation 'void testing::internal::SetArgumentPointeeAction<N,A,kIsProto>::Perform<void,std::tr1::tuple<T0,T1,T2,T3>>(const ArgumentTuple &) const' being compiled with
            [
                N=0x02,
                A=uint32_t,
                kIsProto=false,
                T0=size_t,
                T1=size_t,
                T2=void *,
                T3=nNIAPALS100::tStatus &,
                ArgumentTuple=std::tr1::tuple<size_t,size_t,void *,nNIAPALS100::tStatus &>
            ]
            z:\Perforce\jperetzm_JPERETZM-DT\ThirdPartyExports\googlemock\export\1.6\1.6.0a0\includes\gmock\include\gmock/gmock-actions.h(368) : while compiling class template member function 'void …
Run Code Online (Sandbox Code Playgroud)

googlemock

5
推荐指数
1
解决办法
5043
查看次数

标签 统计

googlemock ×1