【发布时间】:2021-02-05 04:30:33
【问题描述】:
我有工会
using my_union = union my_union {
struct {
int var1;
int var2;
};
long
var;
bool operator == (const my_union & oth) {
return var == oth.var;
}
};
using my_union_1d = std::array < my_union, 2 > ;
using my_union_2d = std::array < my_union_1d, 3 > ;
我有一些函数可以接受这个数组
class test {
public:
void Foo(my_union_2d & arg1);
};
现在我需要检查是否使用我预期的参数调用了 Mocked-Foo
class TestMock: Public Test {
public: MOCK_METHOD(void, Foo, (my_union_2d & ));
};
my_union_2d expected_args;
EXPECT_CALL( * (TestMock * ) obj, Foo(expected_args)).Times(1):
但是代码无法编译,因为没有找到数组 == 运算符的数组。我尝试更改 AllOfArray,但我似乎迷失在 GTest 的文档中。有谁知道需要做什么或参考点?
【问题讨论】:
标签: arrays c++11 googletest matcher