Merge remote-tracking branch 'upstream/main'
This commit is contained in:
+5
-7
@@ -1,6 +1,4 @@
|
||||
use akatsuki_pp::{
|
||||
catch::Catch, mania::Mania, model::mode::GameMode, osu::Osu, taiko::Taiko, Beatmap,
|
||||
};
|
||||
use akatsuki_pp::{model::mode::GameMode, Beatmap, GameMods};
|
||||
|
||||
use crate::common::assert_eq_float;
|
||||
|
||||
@@ -94,23 +92,23 @@ fn mania() {
|
||||
#[test]
|
||||
fn empty_osu() {
|
||||
let map = Beatmap::from_bytes(&[]).unwrap();
|
||||
let _ = map.unchecked_as_converted::<Osu>();
|
||||
let _ = map.convert(GameMode::Osu, &GameMods::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_taiko() {
|
||||
let map = Beatmap::from_bytes(&[]).unwrap();
|
||||
let _ = map.unchecked_as_converted::<Taiko>();
|
||||
let _ = map.convert(GameMode::Taiko, &GameMods::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_catch() {
|
||||
let map = Beatmap::from_bytes(&[]).unwrap();
|
||||
let _ = map.unchecked_as_converted::<Catch>();
|
||||
let _ = map.convert(GameMode::Catch, &GameMods::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_mania() {
|
||||
let map = Beatmap::from_bytes(&[]).unwrap();
|
||||
let _ = map.unchecked_as_converted::<Mania>();
|
||||
let _ = map.convert(GameMode::Mania, &GameMods::default());
|
||||
}
|
||||
|
||||
+7
-4
@@ -18,14 +18,17 @@ macro_rules! test_cases {
|
||||
$( $key:ident: $value:literal $( , )? )*
|
||||
} $( ; )? )*
|
||||
} ) => {
|
||||
let map = Beatmap::from_path(common::$path)
|
||||
.unwrap()
|
||||
.unchecked_into_converted::<$mode>();
|
||||
let map = Beatmap::from_path(common::$path).unwrap();
|
||||
|
||||
$(
|
||||
let mods = 0 $( + $mods )*;
|
||||
let expected = test_cases!(@$mode { $( $key: $value, )* });
|
||||
let actual = Difficulty::new().mods(mods).with_mode().calculate(&map);
|
||||
|
||||
let actual = Difficulty::new()
|
||||
.mods(mods)
|
||||
.calculate_for_mode::<$mode>(&map)
|
||||
.unwrap();
|
||||
|
||||
run(&actual, &expected, mods);
|
||||
)*
|
||||
};
|
||||
|
||||
@@ -18,14 +18,12 @@ macro_rules! test_cases {
|
||||
$( $key:ident: $value:expr $( , )? )*
|
||||
} ;)*
|
||||
} ) => {
|
||||
let map = Beatmap::from_path(common::$path)
|
||||
.unwrap()
|
||||
.unchecked_into_converted();
|
||||
let map = Beatmap::from_path(common::$path).unwrap();
|
||||
|
||||
$(
|
||||
let mods = 0 $( + $mods )*;
|
||||
let (calc, expected) = test_cases!(@$mode { map, $( $key: $value, )* });
|
||||
let actual = calc.mods(mods).calculate();
|
||||
let actual = calc.mods(mods).calculate().unwrap();
|
||||
run(&actual, &expected, mods);
|
||||
)*
|
||||
};
|
||||
@@ -39,7 +37,7 @@ macro_rules! test_cases {
|
||||
effective_miss_count: $effective_miss_count:expr,
|
||||
}) => {
|
||||
(
|
||||
OsuPerformance::from($map.as_owned()).lazer(true),
|
||||
OsuPerformance::from(&$map).lazer(true),
|
||||
OsuPerformanceAttributes {
|
||||
pp: $pp,
|
||||
pp_acc: $pp_acc,
|
||||
@@ -60,7 +58,7 @@ macro_rules! test_cases {
|
||||
estimated_unstable_rate: $estimated_unstable_rate:expr,
|
||||
}) => {
|
||||
(
|
||||
TaikoPerformance::from($map.as_owned()),
|
||||
TaikoPerformance::from(&$map),
|
||||
TaikoPerformanceAttributes {
|
||||
pp: $pp,
|
||||
pp_acc: $pp_acc,
|
||||
@@ -76,7 +74,7 @@ macro_rules! test_cases {
|
||||
pp: $pp:expr,
|
||||
}) => {
|
||||
(
|
||||
CatchPerformance::from($map.as_owned()),
|
||||
CatchPerformance::from(&$map),
|
||||
CatchPerformanceAttributes {
|
||||
pp: $pp,
|
||||
..Default::default()
|
||||
@@ -89,7 +87,7 @@ macro_rules! test_cases {
|
||||
pp_difficulty: $pp_difficulty:expr,
|
||||
}) => {
|
||||
(
|
||||
ManiaPerformance::from($map.as_owned()),
|
||||
ManiaPerformance::from(&$map),
|
||||
ManiaPerformanceAttributes {
|
||||
pp: $pp,
|
||||
pp_difficulty: $pp_difficulty,
|
||||
|
||||
Reference in New Issue
Block a user