1
比方說,你有這樣的:谷歌模擬 - 保存EXPECT_CALL然後重新使用和更改條款
EXPECT_CALL(MockClass_obj, f1(55)).Times(1);
// use the expectation
// ...
// Now clear it
Mock::VerifyAndClear(&MockClass_obj)
有可能是到 1)保存預期
和
2)後重新使用它並更改條款?
從here我知道這是可以節省expectations
,但沒有其他地方說明還有什麼可以做。
參考上面的代碼,我想要做的事,如:
Expecatation exp1 = EXPECT_CALL(MockClass_obj, f1(55)).Times(1);
// use the expectation
// ...
// Now clear it
Mock::VerifyAndClear(&MockClass_obj)
// Somehow modify exp1 to change the cardinality or any of the clauses
// so that I can make the test immediately readable and convey that it's very much related to the one above":
// Instead of this:
EXPECT_CALL(MockClass_obj, f1(55)).Times(0);
// I wanna do something like
exp1.Times(0)