1 #include "gtest/gtest.h" 15 TEST(timer_tests, short_intervals) {
16 for (
int trial = 0; trial < 100; trial++)
18 uint32_t ms = rand() % 20;
21 int32_t r = mt.remaining();
24 EXPECT_NEAR(r+1, 0, 1);
28 TEST(timer_tests, overlapping_long_intervals) {
33 const int slush_factor = 14;
36 for (
int t = 0; t < 10; t++)
44 for (
int t = 0; t < 10; t++)
46 EXPECT_NEAR(timers[t]->remaining(), 500 - slush_factor + t, 5);
51 for (
int t = 0; t < 10; t++)
53 EXPECT_NEAR(timers[t]->remaining(), -slush_factor + t, 5);
60 int main(
int argc,
char **argv) {
61 ::testing::InitGoogleTest(&argc, argv);
62 return RUN_ALL_TESTS();
int main(int argc, char **argv)