我得到了以下测试来做我想做的事。谷歌测试 - 比较一个数组作为void *参数
MOCK_METHOD2(write, void(unsigned char*, int));
unsigned char bar[] = {1,2,3};
EXPECT_CALL(foo, write(_, sizeof(bar))).With((ElementsAreArray(bar)));
但是,如果我将参数类型更改为void *作为下面的函数它将不会编译。
MOCK_METHOD2(write, void(void*, int));
出现错误:
error C2182: 'abstract declarator' : illegal use of type 'void'
gmock-matchers.h(2536) : see reference to class template instantiation 'testing::internal::ElementsAreMatcherImpl<Container>' being compiled
with
[
Container=const std::tuple<void *,unsigned char>
]
这是有道理的我猜,但我不能找到一种方法来解决这个问题,其中的参数是一个void *,它应该在这里。有没有可能解决这个问题?