Important note: gMock requires expectations to be set before the mock functions are called, otherwise the behavior is undefined. Do not alternate between calls to EXPECT_CALL() and calls to the mock functions, and do not set any expectations on a mock after passing the mock to an API.
We have code with interleaved calls to EXPECT_CALL and tested methods in the following files:
Sprite.test.cpp
Signal.test.cpp
Delegate.test.cpp (passed to API, but not used before setting expectations)
Note that this often appears to work, though there is no guarantee it will work.
https://google.github.io/googletest/gmock_for_dummies.html#expectation-ordering
We have code with interleaved calls to
EXPECT_CALL
and tested methods in the following files:Note that this often appears to work, though there is no guarantee it will work.