Skip to content

Commit

Permalink
Added unit test for wait_till_completed
Browse files Browse the repository at this point in the history
  • Loading branch information
coder137 committed Jan 27, 2025
1 parent 9eb2056 commit 3497195
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ticked_async_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ where
pub fn tick_channel(&self) -> tokio::sync::watch::Receiver<f64> {
self.spawner.tick_channel()
}

pub fn wait_till_completed(&self, delta: f64) {
self.ticker.wait_till_completed(delta);
}
}

#[cfg(test)]
Expand Down Expand Up @@ -136,9 +140,7 @@ mod tests {
assert_eq!(executor.num_tasks(), 3);

// Since we have cancelled the tasks above, the loops should eventually end
while executor.num_tasks() != 0 {
executor.tick(DELTA, None);
}
executor.wait_till_completed(DELTA);
}

#[test]
Expand Down

0 comments on commit 3497195

Please sign in to comment.