-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当测函数有多个参数时还可以指定出参吗? #30
Comments
引用传值可以用在 或者也可以用 |
就是比如只想指定out2的出参,out1不管,那么.with(outBound(var, <输入参数约束>)) 这里的输入参数约束该怎么指定为out2呢 |
这里的 |
试了下没问题,但是我发现如果在多个test宏中mock了同一个函数,每次返回不同值,但实际这个函数每次的返回值都只会按第一次mock时指定的参数来。也就是说不同的test宏所mock的函数会相互影响,这个有办法避免么?只让mock的函数在当前的test宏里生效 |
没有看太明白,每一个
这个本来应该有一个 |
再问一下,我看到以前也有人问到常函数的mock,现在可以直接mock了吗,我试了以前说的用全局函数的方式并不行 |
b7f60ef 14707f4 这两个提交增加了常成员函数的支持,感谢反馈 可以参考例子: emock/tests/ut/TestNonvirtualMethodMocker.h Line 157 in c0fa6b6
|
.with(eq(const_cast<CUT const*>(&cut)), eq(2)) |
可以呀, EMOCK(&CUT::normal_method_2)
.stubs()
.will(invoke(normal_method_2)); 像例子的 EMOCK(&CUT::normal_method_2)
.stubs()
.with(any(), eq(2))
.will(invoke(normal_method_2)); 这种情况下,主要是为了说明后面第二个参数的 |
好的,感谢大佬 |
比如测试函数 void function(int in1, int2, int &out1, int &out2),可以分别指定出参out1 out2为某个值吗
The text was updated successfully, but these errors were encountered: