@@ -20,27 +20,32 @@ TEST(StackTimerTest, StartStopElapsed)
2020 EXPECT_CALL (clock, currentSteadyTime ()).WillOnce (Return (time2));
2121 timer.start (0.5 );
2222
23- EXPECT_CALL (clock, currentSteadyTime ()).WillOnce (Return (time2));
23+ EXPECT_CALL (clock, currentSteadyTime ()).Times ( 2 ). WillRepeatedly (Return (time2));
2424 ASSERT_FALSE (timer.elapsed ());
2525 ASSERT_FALSE (timer.stopped ());
26+ ASSERT_EQ (timer.elapsedTime (), 0 );
2627
2728 std::chrono::steady_clock::time_point time3 (std::chrono::milliseconds (520 ));
28- EXPECT_CALL (clock, currentSteadyTime ()).WillOnce (Return (time3));
29+ EXPECT_CALL (clock, currentSteadyTime ()).Times ( 2 ). WillRepeatedly (Return (time3));
2930 ASSERT_FALSE (timer.elapsed ());
3031 ASSERT_FALSE (timer.stopped ());
32+ ASSERT_EQ (timer.elapsedTime (), 0.447 );
3133
3234 std::chrono::steady_clock::time_point time4 (std::chrono::milliseconds (573 ));
33- EXPECT_CALL (clock, currentSteadyTime ()).WillOnce (Return (time4));
35+ EXPECT_CALL (clock, currentSteadyTime ()).Times ( 2 ). WillRepeatedly (Return (time4));
3436 ASSERT_TRUE (timer.elapsed ());
3537 ASSERT_FALSE (timer.stopped ());
38+ ASSERT_EQ (timer.elapsedTime (), 0.5 );
3639
3740 std::chrono::steady_clock::time_point time5 (std::chrono::milliseconds (580 ));
38- EXPECT_CALL (clock, currentSteadyTime ()).WillOnce (Return (time5));
41+ EXPECT_CALL (clock, currentSteadyTime ()).Times ( 2 ). WillRepeatedly (Return (time5));
3942 ASSERT_TRUE (timer.elapsed ());
4043 ASSERT_FALSE (timer.stopped ());
44+ ASSERT_EQ (timer.elapsedTime (), 0.507 );
4145
4246 timer.stop ();
4347 EXPECT_CALL (clock, currentSteadyTime).Times (0 );
4448 ASSERT_FALSE (timer.elapsed ());
4549 ASSERT_TRUE (timer.stopped ());
50+ ASSERT_EQ (timer.elapsedTime (), 0 );
4651}
0 commit comments