Skip to content

Commit

Permalink
test: assert only relevant values
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxOhn committed Nov 10, 2023
1 parent a142375 commit 7bf3e66
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 54 deletions.
17 changes: 4 additions & 13 deletions src/catch/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,21 +552,12 @@ mod test {
let (map, attrs) = DATA.get_or_init(|| {
let path = "./maps/2118524.osu";
let map = Beatmap::from_path(path).unwrap();

let attrs = CatchStars::new(&map).calculate();

let expected = CatchDifficultyAttributes {
stars: 3.2502669316166624,
ar: 8.0,
n_fruits: 728,
n_droplets: 2,
n_tiny_droplets: 291,
};

assert_eq!(attrs, expected);
assert_eq!(N_FRUITS, attrs.n_fruits);
assert_eq!(N_DROPLETS, attrs.n_droplets);
assert_eq!(N_TINY_DROPLETS, attrs.n_tiny_droplets);
assert_eq!(
(N_FRUITS, N_DROPLETS, N_TINY_DROPLETS),
(attrs.n_fruits, attrs.n_droplets, attrs.n_tiny_droplets)
);

(map, attrs)
});
Expand Down
10 changes: 0 additions & 10 deletions src/mania/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,16 +930,8 @@ mod tests {
let (map, attrs) = DATA.get_or_init(|| {
let path = "./maps/1638954.osu";
let map = Beatmap::from_path(path).unwrap();

let attrs = ManiaStars::new(&map).calculate();

let expected = ManiaDifficultyAttributes {
stars: 3.441830819988125,
hit_window: 40.0,
max_combo: 956,
};

assert_eq!(attrs, expected);
assert_eq!(
N_OBJECTS,
(map.n_circles + map.n_sliders + map.n_spinners) as usize
Expand Down Expand Up @@ -1250,7 +1242,6 @@ mod tests {
};

assert_eq!(state, expected);
assert_eq!(state.total_hits(), N_OBJECTS);
}

#[test]
Expand All @@ -1275,6 +1266,5 @@ mod tests {
};

assert_eq!(state, expected);
assert_eq!(state.total_hits(), N_OBJECTS);
}
}
24 changes: 5 additions & 19 deletions src/osu/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,29 +805,15 @@ mod test {
let (map, attrs) = DATA.get_or_init(|| {
let path = "./maps/2785319.osu";
let map = Beatmap::from_path(path).unwrap();

let attrs = OsuStars::new(&map).calculate();

let expected = OsuDifficultyAttributes {
aim: 2.8693628443424104,
speed: 2.533869745015772,
flashlight: 2.288770487900865,
slider_factor: 0.9803052946037858,
speed_note_count: 210.36373973116545,
ar: 9.300000190734863,
od: 8.800000190734863,
hp: 5.0,
n_circles: 307,
n_sliders: 293,
n_spinners: 1,
stars: 5.669858729379628,
max_combo: 909,
};

assert_eq!(attrs, expected);
assert_eq!(
(attrs.n_circles, attrs.n_sliders, attrs.n_spinners),
(307, 293, 1)
);
assert_eq!(
attrs.n_circles + attrs.n_sliders + attrs.n_spinners,
N_OBJECTS,
attrs.n_circles + attrs.n_sliders + attrs.n_spinners
);

(map, attrs)
Expand Down
12 changes: 0 additions & 12 deletions src/taiko/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,20 +540,8 @@ mod test {
let (map, attrs) = DATA.get_or_init(|| {
let path = "./maps/1028484.osu";
let map = Beatmap::from_path(path).unwrap();

let attrs = TaikoStars::new(&map).calculate();

let expected = TaikoDifficultyAttributes {
stamina: 1.4528845068865617,
rhythm: 0.20130047251681948,
colour: 1.0487315549761433,
peak: 1.8881824429738323,
hit_window: 35.0,
stars: 2.9778030386845606,
max_combo: 289,
};

assert_eq!(attrs, expected);
assert_eq!(MAX_COMBO, attrs.max_combo);

(map, attrs)
Expand Down

0 comments on commit 7bf3e66

Please sign in to comment.