【发布时间】:2019-02-25 16:31:22
【问题描述】:
我在 googletest 中运行了一些单元测试。我希望某些对模拟函数 (EXPECT_CALL(*rtosMock, xQueueGenericSend( arg , _, _, _)).Times(AtLeast(1));) 的调用具有一些不同的 arg 值。我最终接到一个意外值的电话。
unknown file: Failure
Unexpected mock function call - returning default value.
Function call: xQueueGenericSend(NULL, 0x7fff38c99e80, 100, 0)
Returns: 0
Google Mock tried the following 24 expectations, but none matched:
test.cpp:95: tried expectation #0: EXPECT_CALL(*rtosMock, xQueueGenericSend( arg , _, _, _))...
Expected arg #0: is equal to 0x561fede86f74
Actual: NULL
Expected: to be called at least once
Actual: called twice - satisfied and active
[...]
在控制台中,它现在向我显示它期望的值和不适合的值,但不会显示意外调用的位置。除了单步执行程序之外,有没有办法知道意外调用的来源(例如打印文件、行号或调用堆栈)?
【问题讨论】:
标签: c++ unit-testing googletest googlemock