Skip to content

Commit

Permalink
Fixed overlooked doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile committed Aug 18, 2021
1 parent ac222fd commit a0f4cf7
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions crates/bevy_core/src/time/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ impl Timer {
/// # use bevy_core::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, false);
/// timer.set_elapsed(Duration::from_secs(2));
/// assert_eq!(timer.elapsed(), Duration::from_secs(2));
/// timer.set_elapsed(Duration::from_secs(2.0));
/// assert_eq!(timer.elapsed(), Duration::from_secs(2.0));
/// // the timer is not finished even if the elapsed time is greater than the duration.
/// assert!(!timer.finished());
/// ```
Expand Down Expand Up @@ -453,10 +453,9 @@ impl DiscreteTimer {
/// #
/// ```
/// # use bevy_core::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, false);
/// timer.set_elapsed(Duration::from_secs(2));
/// assert_eq!(timer.elapsed(), Duration::from_secs(2));
/// let mut timer = DiscreteTimer::new(1, false);
/// timer.set_elapsed(2);
/// assert_eq!(timer.elapsed(), 2);
/// // the timer is not finished even if the elapsed time is greater than the duration.
/// assert!(!timer.finished());
/// ```
Expand Down Expand Up @@ -629,13 +628,12 @@ impl DiscreteTimer {
/// Examples
/// ```
/// # use bevy_core::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, false);
/// timer.tick(Duration::from_secs_f32(1.5));
/// let mut timer = DiscreteTimer::new(1, false);
/// timer.tick(2);
/// timer.reset();
/// assert!(!timer.finished());
/// assert!(!timer.just_finished());
/// assert_eq!(timer.elapsed_secs(), 0.0);
/// assert_eq!(timer.elapsed(), 0);
/// ```
pub fn reset(&mut self) {
self.stopwatch.reset();
Expand Down

0 comments on commit a0f4cf7

Please sign in to comment.