I'm currently trying to evaluate different testing frameworks. When using mocking frameworks (I'm leaning towards FakeIt, but google mock is good too), I know that you can roll your own "performance" testing by using the OS's timer calls before and after calling a function to verify the function's performance. This is not what I'm after.
What I do have are classes that implement delays on outputs given certain inputs. For example:
- input 1 goes from low to high
- output 1 goes from low to high after 1.5 seconds.
I'd like to be able to do something where I specify a boundary:
myMock.theInput();
EXPECT_CALL(myMock, theDelayedOutput())
.Times(1)
.Before(1.6sec)
.After(1.4sec);
For clarification, the Before
and After
lines are not supported. This is just an example of what I'd prefer as an easy syntax.
Is it possible to just implement a "delay" function within windows between making the input call and before checking EXPECT_CALL
?
That's part of the way - I'd still have to then start a proprietary timer. Something like this?
myMock.theInput();
windowSleep(1.4);
startTimer();
EXPECT_CALL(myMock, theDelayedOutput())
.Times(1)
endTimer();
ASSERT_TRUE(elapsedTime() <= 0.2);