Skip to content

Commit

Permalink
fix: doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxOhn committed Nov 18, 2024
1 parent 420e4c0 commit dae2eb4
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 36 deletions.
6 changes: 2 additions & 4 deletions src/catch/difficulty/gradual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ use super::{
/// use rosu_pp::{Beatmap, Difficulty};
/// use rosu_pp::catch::{Catch, CatchGradualDifficulty};
///
/// let converted = Beatmap::from_path("./resources/2118524.osu")
/// .unwrap()
/// .unchecked_into_converted::<Catch>();
/// let map = Beatmap::from_path("./resources/2118524.osu").unwrap();
///
/// let difficulty = Difficulty::new().mods(64); // DT
/// let mut iter = CatchGradualDifficulty::new(difficulty, &converted);
/// let mut iter = CatchGradualDifficulty::new(difficulty, &map).unwrap();
///
/// // the difficulty of the map after the first hit object
/// let attrs1 = iter.next();
Expand Down
6 changes: 2 additions & 4 deletions src/catch/performance/gradual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ use crate::{
/// use rosu_pp::{Beatmap, Difficulty};
/// use rosu_pp::catch::{Catch, CatchGradualPerformance, CatchScoreState};
///
/// let converted = Beatmap::from_path("./resources/2118524.osu")
/// .unwrap()
/// .unchecked_into_converted::<Catch>();
/// let map = Beatmap::from_path("./resources/2118524.osu").unwrap();
///
/// let difficulty = Difficulty::new().mods(64); // DT
/// let mut gradual = CatchGradualPerformance::new(difficulty, &converted);
/// let mut gradual = CatchGradualPerformance::new(difficulty, &map).unwrap();
/// let mut state = CatchScoreState::new(); // empty state, everything is on 0.
///
/// // The first 10 hitresults are only fruits
Expand Down
6 changes: 2 additions & 4 deletions src/mania/difficulty/gradual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ use super::{
/// use rosu_pp::{Beatmap, Difficulty};
/// use rosu_pp::mania::ManiaGradualDifficulty;
///
/// let converted = Beatmap::from_path("./resources/1638954.osu")
/// .unwrap()
/// .unchecked_into_converted();
/// let map = Beatmap::from_path("./resources/1638954.osu").unwrap();
///
/// let difficulty = Difficulty::new().mods(64); // DT
/// let mut iter = ManiaGradualDifficulty::new(difficulty, &converted);
/// let mut iter = ManiaGradualDifficulty::new(difficulty, &map).unwrap();
///
/// // the difficulty of the map after the first hit object
/// let attrs1 = iter.next();
Expand Down
6 changes: 2 additions & 4 deletions src/mania/performance/gradual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ use super::{ManiaPerformanceAttributes, ManiaScoreState};
/// use rosu_pp::{Beatmap, Difficulty};
/// use rosu_pp::mania::{Mania, ManiaGradualPerformance, ManiaScoreState};
///
/// let converted = Beatmap::from_path("./resources/1638954.osu")
/// .unwrap()
/// .unchecked_into_converted::<Mania>();
/// let map = Beatmap::from_path("./resources/1638954.osu").unwrap();
///
/// let difficulty = Difficulty::new().mods(64); // DT
/// let mut gradual = ManiaGradualPerformance::new(difficulty, &converted);
/// let mut gradual = ManiaGradualPerformance::new(difficulty, &map).unwrap();
/// let mut state = ManiaScoreState::new(); // empty state, everything is on 0.
///
/// // The first 10 hitresults are 320s
Expand Down
6 changes: 2 additions & 4 deletions src/osu/difficulty/gradual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ use super::{
/// use rosu_pp::{Beatmap, Difficulty};
/// use rosu_pp::osu::{Osu, OsuGradualDifficulty};
///
/// let converted = Beatmap::from_path("./resources/2785319.osu")
/// .unwrap()
/// .unchecked_into_converted::<Osu>();
/// let map = Beatmap::from_path("./resources/2785319.osu").unwrap();
///
/// let difficulty = Difficulty::new().mods(64); // DT
/// let mut iter = OsuGradualDifficulty::new(difficulty, &converted);
/// let mut iter = OsuGradualDifficulty::new(difficulty, &map).unwrap();
///
/// // the difficulty of the map after the first hit object
/// let attrs1 = iter.next();
Expand Down
6 changes: 2 additions & 4 deletions src/osu/performance/gradual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ use super::{OsuPerformanceAttributes, OsuScoreState};
/// use rosu_pp::{Beatmap, Difficulty};
/// use rosu_pp::osu::{Osu, OsuGradualPerformance, OsuScoreState};
///
/// let converted = Beatmap::from_path("./resources/2785319.osu")
/// .unwrap()
/// .unchecked_into_converted::<Osu>();
/// let map = Beatmap::from_path("./resources/2785319.osu").unwrap();
///
/// let difficulty = Difficulty::new().mods(64); // DT
/// let mut gradual = OsuGradualPerformance::new(difficulty, &converted);
/// let mut gradual = OsuGradualPerformance::new(difficulty, &map).unwrap();
/// let mut state = OsuScoreState::new(); // empty state, everything is on 0.
///
/// // The first 10 hits are 300s and there are no sliders for additional combo
Expand Down
6 changes: 2 additions & 4 deletions src/taiko/difficulty/gradual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ use super::{
/// use rosu_pp::{Beatmap, Difficulty};
/// use rosu_pp::taiko::{Taiko, TaikoGradualDifficulty};
///
/// let converted = Beatmap::from_path("./resources/1028484.osu")
/// .unwrap()
/// .unchecked_into_converted::<Taiko>();
/// let map = Beatmap::from_path("./resources/1028484.osu").unwrap();
///
/// let difficulty = Difficulty::new().mods(64); // DT
/// let mut iter = TaikoGradualDifficulty::new(difficulty, &converted);
/// let mut iter = TaikoGradualDifficulty::new(difficulty, &map).unwrap();
///
/// // the difficulty of the map after the first hit object
/// let attrs1 = iter.next();
Expand Down
6 changes: 2 additions & 4 deletions src/taiko/performance/gradual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ use super::TaikoPerformanceAttributes;
/// use rosu_pp::{Beatmap, Difficulty};
/// use rosu_pp::taiko::{Taiko, TaikoGradualPerformance, TaikoScoreState};
///
/// let converted = Beatmap::from_path("./resources/1028484.osu")
/// .unwrap()
/// .unchecked_into_converted::<Taiko>();
/// let map = Beatmap::from_path("./resources/1028484.osu").unwrap();
///
/// let difficulty = Difficulty::new().mods(64); // DT
/// let mut gradual = TaikoGradualPerformance::new(difficulty, &converted);
/// let mut gradual = TaikoGradualPerformance::new(difficulty, &map).unwrap();
/// let mut state = TaikoScoreState::new(); // empty state, everything is on 0.
///
/// // The first 10 hitresults are 300s
Expand Down
8 changes: 4 additions & 4 deletions src/util/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ impl<T: fmt::Debug> fmt::Debug for Weak<T> {
/// ```compile_fail
/// use rosu_pp::{taiko::TaikoGradualDifficulty, Beatmap, Difficulty};
///
/// let converted = Beatmap::from_bytes(&[]).unwrap().unchecked_into_converted();
/// let map = Beatmap::from_bytes(&[]).unwrap();
/// let difficulty = Difficulty::new();
/// let mut gradual = TaikoGradualDifficulty::new(&difficulty, &converted);
/// let mut gradual = TaikoGradualDifficulty::new(&difficulty, &map).unwrap();
///
/// // Rc<RefCell<_>> cannot be shared across threads so compilation should fail
/// std::thread::spawn(move || { let _ = gradual.next(); });
Expand All @@ -155,8 +155,8 @@ mod tests {
fn share_gradual_taiko() {
use crate::{taiko::TaikoGradualDifficulty, Beatmap, Difficulty};

let converted = Beatmap::from_bytes(&[]).unwrap().unchecked_into_converted();
let mut gradual = TaikoGradualDifficulty::new(Difficulty::new(), &converted);
let map = Beatmap::from_bytes(&[]).unwrap();
let mut gradual = TaikoGradualDifficulty::new(Difficulty::new(), &map).unwrap();

// Arc<RwLock<_>> *can* be shared across threads so this should compile
std::thread::spawn(move || {
Expand Down

0 comments on commit dae2eb4

Please sign in to comment.