google mock - 如何期望不使用参数集调用函数
google mock - how to expect function to NOT be called with set of parameters
假设您有 void Class::func(Type_t arg)
我想说
this function can be called except with arguments arg1
or arg2
or ... argN
这是正确的方法吗?
EXPECT_CALL(Class_MockObj, func(arg1)).Times(0);
EXPECT_CALL(Class_MockObj, func(arg2)).Times(0);
...
EXPECT_CALL(Class_MockObj, func(argN)).Times(0);
欢迎为问题想出更好的标题
你也可以这样写 AnyOf:
EXPECT_CALL(Class_MockObj, func(AnyOf(arg1, arg2, .., argN))).Times(0);
假设您有 void Class::func(Type_t arg)
我想说
this function can be called except with arguments
arg1
orarg2
or ...argN
这是正确的方法吗?
EXPECT_CALL(Class_MockObj, func(arg1)).Times(0);
EXPECT_CALL(Class_MockObj, func(arg2)).Times(0);
...
EXPECT_CALL(Class_MockObj, func(argN)).Times(0);
欢迎为问题想出更好的标题
你也可以这样写 AnyOf:
EXPECT_CALL(Class_MockObj, func(AnyOf(arg1, arg2, .., argN))).Times(0);