Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaybd committed Jan 21, 2024
1 parent 7ed616f commit 4a029f1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/util/SchedulerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ TEST_CASE("Test Watchdog", "[util][scheduler]") {

SECTION("Test keep calling while starved") {
auto l = std::make_shared<latch>(1);
Watchdog<fake_clock> wd(
100ms, [&]() { l->count_down(); }, true);
Watchdog<fake_clock> wd(100ms, [&]() { l->count_down(); }, true);
for (int i = 0; i < 5; i++) {
REQUIRE_FALSE(l->wait_for(50ms));
advanceFakeClock(50ms, 5ms, wd);
Expand Down Expand Up @@ -182,17 +181,19 @@ TEST_CASE("Test PeriodicTask", "[util][scheduler]") {
REQUIRE(l->wait_for(50ms));
}

TEST_CASE("Test AsyncTask" "[util][scheduler]") {
TEST_CASE("Test AsyncTask", "[util][scheduler]") {
// since PeriodicTask uses AsyncTask, a lot of the functionality is already tested.
SECTION("Test AsyncTask with task that terminates") {
class ExitingAsyncTask : public AsyncTask<fake_clock> {
public:
ExitingAsyncTask(latch& l) : l_(l) {}

protected:
void task(std::unique_lock<std::mutex>& lock) override {
wait_for(lock, 100ms);
l_.count_down();
}

private:
latch& l_;
};
Expand All @@ -212,11 +213,13 @@ TEST_CASE("Test AsyncTask" "[util][scheduler]") {
class WaitingAsyncTask : public AsyncTask<fake_clock> {
public:
WaitingAsyncTask(latch& l) : l_(l) {}

protected:
void task(std::unique_lock<std::mutex>& lock) override {
wait_for(lock, 100ms);
l_.count_down();
}

private:
latch& l_;
};
Expand Down

0 comments on commit 4a029f1

Please sign in to comment.