The MultipleShotsRun test doesn't look very useful now as it waits until the callback count is 6, then checks that it is 6. Also, what happens if the callback count never increments? The other test changes look appropriate.
Perhaps it should test that callback count is within a given range, but I'm unsure of the appropriate tolerance. Just a suggestion:
TEST(TestGLibTimeout, MultipleShotsRun)
{
callback_called = false;
callback_call_count = 0;
{
Timeout timeout(100, &OnSourceCallbackContinue);
Utils::WaitForTimeoutMSec(650);
EXPECT_TRUE(timeout.IsRunning());
}
EXPECT_TRUE(callback_called);
EXPECT_GE(callback_call_count, 5);
EXPECT_LT(callback_call_count, 7);
}
The MultipleShotsRun test doesn't look very useful now as it waits until the callback count is 6, then checks that it is 6. Also, what happens if the callback count never increments? The other test changes look appropriate.
Perhaps it should test that callback count is within a given range, but I'm unsure of the appropriate tolerance. Just a suggestion: meout, MultipleShotsRun) call_count = 0; ckContinue) ; :WaitForTimeout MSec(650) ; TRUE(timeout. IsRunning( )); TRUE(callback_ called) ; GE(callback_ call_count, 5); LT(callback_ call_count, 7);
TEST(TestGLibTi
{
callback_called = false;
callback_
{
Timeout timeout(100, &OnSourceCallba
Utils:
EXPECT_
}
EXPECT_
EXPECT_
EXPECT_
}