我有以下模拟方法:
MOCK_METHOD1(send, void(const std::vector<int>& data));
如何检查是否使用特定参数调用该方法,例如 std::vector<int> vec{1,2,3}
?
最佳答案
根据 container matchers 上的 gmock 文档,对于建议的用例,您可以简单地执行以下操作:
EXPECT_CALL(mockObj, send(std::vector<int>{1,2,3}).Times(1);
关于c++ - gmock - 测试模拟方法参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35603345/