Skip to content

Commit

Permalink
Add more test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rnburn authored and Johannes Tax committed Jul 7, 2020
1 parent 8f358c9 commit e086e77
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sdk/test/event/async_timer/dispatcher_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,20 @@ TEST(DispatcherTest, TimerOrder)

EXPECT_EQ(order, (std::vector<int>{2, 1, 3}));
}

TEST(DispatcherTest, ReuseTimer)
{
Dispatcher dispatcher;
std::vector<int> order;

auto t1 = dispatcher.CreateTimer([&] { order.push_back(1); });
t1->EnableTimer(std::chrono::milliseconds{5});

dispatcher.Run();

t1->EnableTimer(std::chrono::milliseconds{5});

dispatcher.Run();

EXPECT_EQ(order, (std::vector<int>{1, 1}));
}

0 comments on commit e086e77

Please sign in to comment.