Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: ignore doc tests for timers to reduce CI time. #254

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions framework_crates/bones_framework/src/time/stopwatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::time::Duration;
///
/// # Examples
///
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
Expand Down Expand Up @@ -32,7 +32,7 @@ impl Stopwatch {
/// Create a new unpaused `Stopwatch` with no elapsed time.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// let stopwatch = Stopwatch::new();
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
Expand All @@ -46,7 +46,7 @@ impl Stopwatch {
/// of the stopwatch.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
Expand All @@ -67,7 +67,7 @@ impl Stopwatch {
/// of the stopwatch, in seconds.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
Expand Down Expand Up @@ -99,7 +99,7 @@ impl Stopwatch {
/// Sets the elapsed time of the stopwatch.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
Expand All @@ -116,7 +116,7 @@ impl Stopwatch {
/// on elapsed time.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
Expand All @@ -134,7 +134,7 @@ impl Stopwatch {
/// paused will not have any effect on the elapsed time.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
Expand All @@ -151,7 +151,7 @@ impl Stopwatch {
/// Unpauses the stopwatch. Resume the effect of ticking on elapsed time.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
Expand All @@ -170,7 +170,7 @@ impl Stopwatch {
/// Returns `true` if the stopwatch is paused.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// let mut stopwatch = Stopwatch::new();
/// assert!(!stopwatch.paused());
Expand All @@ -187,7 +187,7 @@ impl Stopwatch {
/// Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
Expand Down
41 changes: 21 additions & 20 deletions framework_crates/bones_framework/src/time/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Timer {
/// Creates a new timer with a given duration in seconds.
///
/// # Example
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
/// ```
Expand All @@ -51,7 +51,7 @@ impl Timer {
/// See also [`Timer::just_finished`](Timer::just_finished).
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Expand All @@ -68,7 +68,7 @@ impl Timer {
/// Returns `true` only on the tick the timer reached its duration.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Expand All @@ -88,7 +88,7 @@ impl Timer {
/// See also [`Stopwatch::elapsed`](Stopwatch::elapsed).
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Expand All @@ -110,7 +110,7 @@ impl Timer {
/// Sets the elapsed time of the timer without any other considerations.
///
/// # Example
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Expand All @@ -127,7 +127,7 @@ impl Timer {
/// Returns the duration of the timer.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let timer = Timer::new(Duration::from_secs(1), TimerMode::Once);
Expand All @@ -141,7 +141,7 @@ impl Timer {
/// Sets the duration of the timer.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.5, TimerMode::Once);
Expand All @@ -156,7 +156,7 @@ impl Timer {
/// Returns the mode of the timer.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating);
/// assert_eq!(timer.mode(), TimerMode::Repeating);
Expand All @@ -169,7 +169,7 @@ impl Timer {
/// Sets the mode of the timer.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating);
/// timer.set_mode(TimerMode::Once);
Expand All @@ -193,7 +193,7 @@ impl Timer {
/// See also [`Stopwatch::tick`](Stopwatch::tick).
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Expand Down Expand Up @@ -242,7 +242,7 @@ impl Timer {
/// See also [`Stopwatch::pause`](Stopwatch::pause).
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Expand All @@ -260,7 +260,7 @@ impl Timer {
/// See also [`Stopwatch::unpause()`](Stopwatch::unpause).
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Expand All @@ -280,7 +280,7 @@ impl Timer {
/// See also [`Stopwatch::paused`](Stopwatch::paused).
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
/// assert!(!timer.paused());
Expand All @@ -299,7 +299,7 @@ impl Timer {
/// See also [`Stopwatch::reset`](Stopwatch::reset).
///
/// Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Expand All @@ -318,7 +318,7 @@ impl Timer {
/// Returns the percentage of the timer elapsed time (goes from 0.0 to 1.0).
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once);
Expand All @@ -333,7 +333,7 @@ impl Timer {
/// Returns the percentage of the timer remaining time (goes from 1.0 to 0.0).
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once);
Expand All @@ -348,7 +348,7 @@ impl Timer {
/// Returns the remaining time in seconds
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::cmp::Ordering;
/// use std::time::Duration;
Expand All @@ -365,7 +365,7 @@ impl Timer {
/// Returns the remaining time using Duration
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once);
Expand All @@ -384,7 +384,7 @@ impl Timer {
/// return 0 or 1.
///
/// # Examples
/// ```
/// ```no_run
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating);
Expand Down Expand Up @@ -412,7 +412,8 @@ pub enum TimerMode {
Repeating,
}

#[cfg(test)]
// To speed up CI, only do these on miri, where they complete without waiting for time to pass.
#[cfg(miri)]
#[allow(clippy::float_cmp)]
mod tests {
use super::*;
Expand Down
Loading