slight integration test restructure
This commit is contained in:
+35
-55
@@ -30,34 +30,38 @@ macro_rules! assert_result {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(feature = "async_std", feature = "async_tokio")))]
|
fn fruits_test(map: Beatmap, result: &MapResult) {
|
||||||
#[test]
|
|
||||||
fn fruits_sync() {
|
|
||||||
let star_margin = 0.0001;
|
let star_margin = 0.0001;
|
||||||
let pp_margin = 0.0001;
|
let pp_margin = 0.0001;
|
||||||
|
|
||||||
for result in RESULTS {
|
let MapResult {
|
||||||
let MapResult {
|
map_id,
|
||||||
map_id,
|
mods,
|
||||||
mods,
|
stars,
|
||||||
stars,
|
pp,
|
||||||
pp,
|
} = result;
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match std::fs::File::open(format!("./maps/{}.osu", map_id)) {
|
let result = rosu_pp::FruitsPP::new(&map).mods(*mods).calculate();
|
||||||
|
|
||||||
|
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
||||||
|
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(feature = "async_std", feature = "async_tokio")))]
|
||||||
|
#[test]
|
||||||
|
fn fruits_sync() {
|
||||||
|
for result in RESULTS {
|
||||||
|
let file = match std::fs::File::open(format!("./maps/{}.osu", result.map_id)) {
|
||||||
Ok(file) => file,
|
Ok(file) => file,
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let map = match Beatmap::parse(file) {
|
let map = match Beatmap::parse(file) {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::FruitsPP::new(&map).mods(*mods).calculate();
|
fruits_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,31 +71,19 @@ fn fruits_async_tokio() {
|
|||||||
tokio::runtime::Runtime::new()
|
tokio::runtime::Runtime::new()
|
||||||
.expect("could not start runtime")
|
.expect("could not start runtime")
|
||||||
.block_on(async {
|
.block_on(async {
|
||||||
let star_margin = 0.0001;
|
|
||||||
let pp_margin = 0.0001;
|
|
||||||
|
|
||||||
for result in RESULTS {
|
for result in RESULTS {
|
||||||
let MapResult {
|
let file =
|
||||||
map_id,
|
match tokio::fs::File::open(format!("./maps/{}.osu", result.map_id)).await {
|
||||||
mods,
|
Ok(file) => file,
|
||||||
stars,
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
pp,
|
};
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match tokio::fs::File::open(format!("./maps/{}.osu", map_id)).await {
|
|
||||||
Ok(file) => file,
|
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
|
||||||
};
|
|
||||||
|
|
||||||
let map = match Beatmap::parse(file).await {
|
let map = match Beatmap::parse(file).await {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::FruitsPP::new(&map).mods(*mods).calculate();
|
fruits_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -100,31 +92,19 @@ fn fruits_async_tokio() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn fruits_async_std() {
|
fn fruits_async_std() {
|
||||||
async_std::task::block_on(async {
|
async_std::task::block_on(async {
|
||||||
let star_margin = 0.0001;
|
|
||||||
let pp_margin = 0.0001;
|
|
||||||
|
|
||||||
for result in RESULTS {
|
for result in RESULTS {
|
||||||
let MapResult {
|
let file =
|
||||||
map_id,
|
match async_std::fs::File::open(format!("./maps/{}.osu", result.map_id)).await {
|
||||||
mods,
|
Ok(file) => file,
|
||||||
stars,
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
pp,
|
};
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match async_std::fs::File::open(format!("./maps/{}.osu", map_id)).await {
|
|
||||||
Ok(file) => file,
|
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
|
||||||
};
|
|
||||||
|
|
||||||
let map = match Beatmap::parse(file).await {
|
let map = match Beatmap::parse(file).await {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::FruitsPP::new(&map).mods(*mods).calculate();
|
fruits_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-55
@@ -30,34 +30,38 @@ macro_rules! assert_result {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(feature = "async_std", feature = "async_tokio")))]
|
fn mania_test(map: Beatmap, result: &MapResult) {
|
||||||
#[test]
|
|
||||||
fn mania_sync() {
|
|
||||||
let star_margin = 0.00001;
|
let star_margin = 0.00001;
|
||||||
let pp_margin = 0.00001;
|
let pp_margin = 0.00001;
|
||||||
|
|
||||||
for result in RESULTS {
|
let MapResult {
|
||||||
let MapResult {
|
map_id,
|
||||||
map_id,
|
mods,
|
||||||
mods,
|
stars,
|
||||||
stars,
|
pp,
|
||||||
pp,
|
} = result;
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match std::fs::File::open(format!("./maps/{}.osu", map_id)) {
|
let result = rosu_pp::ManiaPP::new(&map).mods(*mods).calculate();
|
||||||
|
|
||||||
|
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
||||||
|
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(feature = "async_std", feature = "async_tokio")))]
|
||||||
|
#[test]
|
||||||
|
fn mania_sync() {
|
||||||
|
for result in RESULTS {
|
||||||
|
let file = match std::fs::File::open(format!("./maps/{}.osu", result.map_id)) {
|
||||||
Ok(file) => file,
|
Ok(file) => file,
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let map = match Beatmap::parse(file) {
|
let map = match Beatmap::parse(file) {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::ManiaPP::new(&map).mods(*mods).calculate();
|
mania_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,31 +71,19 @@ fn mania_async_tokio() {
|
|||||||
tokio::runtime::Runtime::new()
|
tokio::runtime::Runtime::new()
|
||||||
.expect("could not start runtime")
|
.expect("could not start runtime")
|
||||||
.block_on(async {
|
.block_on(async {
|
||||||
let star_margin = 0.00001;
|
|
||||||
let pp_margin = 0.00001;
|
|
||||||
|
|
||||||
for result in RESULTS {
|
for result in RESULTS {
|
||||||
let MapResult {
|
let file =
|
||||||
map_id,
|
match tokio::fs::File::open(format!("./maps/{}.osu", result.map_id)).await {
|
||||||
mods,
|
Ok(file) => file,
|
||||||
stars,
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
pp,
|
};
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match tokio::fs::File::open(format!("./maps/{}.osu", map_id)).await {
|
|
||||||
Ok(file) => file,
|
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
|
||||||
};
|
|
||||||
|
|
||||||
let map = match Beatmap::parse(file).await {
|
let map = match Beatmap::parse(file).await {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::ManiaPP::new(&map).mods(*mods).calculate();
|
mania_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -100,31 +92,19 @@ fn mania_async_tokio() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn mania_async_std() {
|
fn mania_async_std() {
|
||||||
async_std::task::block_on(async {
|
async_std::task::block_on(async {
|
||||||
let star_margin = 0.00001;
|
|
||||||
let pp_margin = 0.00001;
|
|
||||||
|
|
||||||
for result in RESULTS {
|
for result in RESULTS {
|
||||||
let MapResult {
|
let file =
|
||||||
map_id,
|
match async_std::fs::File::open(format!("./maps/{}.osu", result.map_id)).await {
|
||||||
mods,
|
Ok(file) => file,
|
||||||
stars,
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
pp,
|
};
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match async_std::fs::File::open(format!("./maps/{}.osu", map_id)).await {
|
|
||||||
Ok(file) => file,
|
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
|
||||||
};
|
|
||||||
|
|
||||||
let map = match Beatmap::parse(file).await {
|
let map = match Beatmap::parse(file).await {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::ManiaPP::new(&map).mods(*mods).calculate();
|
mania_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-59
@@ -42,36 +42,40 @@ fn margin() -> f32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(feature = "async_std", feature = "async_tokio")))]
|
fn osu_test(map: Beatmap, result: &MapResult) {
|
||||||
#[test]
|
|
||||||
fn osu_sync() {
|
|
||||||
let margin = margin();
|
let margin = margin();
|
||||||
|
|
||||||
let star_margin = margin;
|
let star_margin = margin;
|
||||||
let pp_margin = margin;
|
let pp_margin = margin;
|
||||||
|
|
||||||
for result in RESULTS {
|
let MapResult {
|
||||||
let MapResult {
|
map_id,
|
||||||
map_id,
|
mods,
|
||||||
mods,
|
stars,
|
||||||
stars,
|
pp,
|
||||||
pp,
|
} = result;
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match std::fs::File::open(format!("./maps/{}.osu", map_id)) {
|
let result = rosu_pp::OsuPP::new(&map).mods(*mods).calculate();
|
||||||
|
|
||||||
|
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
||||||
|
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(feature = "async_std", feature = "async_tokio")))]
|
||||||
|
#[test]
|
||||||
|
fn osu_sync() {
|
||||||
|
for result in RESULTS {
|
||||||
|
let file = match std::fs::File::open(format!("./maps/{}.osu", result.map_id)) {
|
||||||
Ok(file) => file,
|
Ok(file) => file,
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let map = match Beatmap::parse(file) {
|
let map = match Beatmap::parse(file) {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::OsuPP::new(&map).mods(*mods).calculate();
|
osu_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,33 +85,19 @@ fn osu_async_tokio() {
|
|||||||
tokio::runtime::Runtime::new()
|
tokio::runtime::Runtime::new()
|
||||||
.expect("could not start runtime")
|
.expect("could not start runtime")
|
||||||
.block_on(async {
|
.block_on(async {
|
||||||
let margin = margin();
|
|
||||||
|
|
||||||
let star_margin = margin;
|
|
||||||
let pp_margin = margin;
|
|
||||||
|
|
||||||
for result in RESULTS {
|
for result in RESULTS {
|
||||||
let MapResult {
|
let file =
|
||||||
map_id,
|
match tokio::fs::File::open(format!("./maps/{}.osu", result.map_id)).await {
|
||||||
mods,
|
Ok(file) => file,
|
||||||
stars,
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
pp,
|
};
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match tokio::fs::File::open(format!("./maps/{}.osu", map_id)).await {
|
|
||||||
Ok(file) => file,
|
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
|
||||||
};
|
|
||||||
|
|
||||||
let map = match Beatmap::parse(file).await {
|
let map = match Beatmap::parse(file).await {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::OsuPP::new(&map).mods(*mods).calculate();
|
osu_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -116,33 +106,19 @@ fn osu_async_tokio() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn osu_async_std() {
|
fn osu_async_std() {
|
||||||
async_std::task::block_on(async {
|
async_std::task::block_on(async {
|
||||||
let margin = margin();
|
|
||||||
|
|
||||||
let star_margin = margin;
|
|
||||||
let pp_margin = margin;
|
|
||||||
|
|
||||||
for result in RESULTS {
|
for result in RESULTS {
|
||||||
let MapResult {
|
let file =
|
||||||
map_id,
|
match async_std::fs::File::open(format!("./maps/{}.osu", result.map_id)).await {
|
||||||
mods,
|
Ok(file) => file,
|
||||||
stars,
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
pp,
|
};
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match async_std::fs::File::open(format!("./maps/{}.osu", map_id)).await {
|
|
||||||
Ok(file) => file,
|
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
|
||||||
};
|
|
||||||
|
|
||||||
let map = match Beatmap::parse(file).await {
|
let map = match Beatmap::parse(file).await {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::OsuPP::new(&map).mods(*mods).calculate();
|
osu_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-55
@@ -30,34 +30,38 @@ macro_rules! assert_result {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(feature = "async_std", feature = "async_tokio")))]
|
fn taiko_test(map: Beatmap, result: &MapResult) {
|
||||||
#[test]
|
|
||||||
fn taiko_sync() {
|
|
||||||
let star_margin = 0.0001;
|
let star_margin = 0.0001;
|
||||||
let pp_margin = 0.0001;
|
let pp_margin = 0.0001;
|
||||||
|
|
||||||
for result in RESULTS {
|
let MapResult {
|
||||||
let MapResult {
|
map_id,
|
||||||
map_id,
|
mods,
|
||||||
mods,
|
stars,
|
||||||
stars,
|
pp,
|
||||||
pp,
|
} = result;
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match std::fs::File::open(format!("./maps/{}.osu", map_id)) {
|
let result = rosu_pp::TaikoPP::new(&map).mods(*mods).calculate();
|
||||||
|
|
||||||
|
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
||||||
|
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(feature = "async_std", feature = "async_tokio")))]
|
||||||
|
#[test]
|
||||||
|
fn taiko_sync() {
|
||||||
|
for result in RESULTS {
|
||||||
|
let file = match std::fs::File::open(format!("./maps/{}.osu", result.map_id)) {
|
||||||
Ok(file) => file,
|
Ok(file) => file,
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let map = match Beatmap::parse(file) {
|
let map = match Beatmap::parse(file) {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::TaikoPP::new(&map).mods(*mods).calculate();
|
taiko_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,31 +71,19 @@ fn taiko_async_tokio() {
|
|||||||
tokio::runtime::Runtime::new()
|
tokio::runtime::Runtime::new()
|
||||||
.expect("could not start runtime")
|
.expect("could not start runtime")
|
||||||
.block_on(async {
|
.block_on(async {
|
||||||
let star_margin = 0.0001;
|
|
||||||
let pp_margin = 0.0001;
|
|
||||||
|
|
||||||
for result in RESULTS {
|
for result in RESULTS {
|
||||||
let MapResult {
|
let file =
|
||||||
map_id,
|
match tokio::fs::File::open(format!("./maps/{}.osu", result.map_id)).await {
|
||||||
mods,
|
Ok(file) => file,
|
||||||
stars,
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
pp,
|
};
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match tokio::fs::File::open(format!("./maps/{}.osu", map_id)).await {
|
|
||||||
Ok(file) => file,
|
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
|
||||||
};
|
|
||||||
|
|
||||||
let map = match Beatmap::parse(file).await {
|
let map = match Beatmap::parse(file).await {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::TaikoPP::new(&map).mods(*mods).calculate();
|
taiko_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -100,31 +92,19 @@ fn taiko_async_tokio() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn taiko_async_std() {
|
fn taiko_async_std() {
|
||||||
async_std::task::block_on(async {
|
async_std::task::block_on(async {
|
||||||
let star_margin = 0.0001;
|
|
||||||
let pp_margin = 0.0001;
|
|
||||||
|
|
||||||
for result in RESULTS {
|
for result in RESULTS {
|
||||||
let MapResult {
|
let file =
|
||||||
map_id,
|
match async_std::fs::File::open(format!("./maps/{}.osu", result.map_id)).await {
|
||||||
mods,
|
Ok(file) => file,
|
||||||
stars,
|
Err(why) => panic!("Could not open file {}.osu: {}", result.map_id, why),
|
||||||
pp,
|
};
|
||||||
} = result;
|
|
||||||
|
|
||||||
let file = match async_std::fs::File::open(format!("./maps/{}.osu", map_id)).await {
|
|
||||||
Ok(file) => file,
|
|
||||||
Err(why) => panic!("Could not open file {}.osu: {}", map_id, why),
|
|
||||||
};
|
|
||||||
|
|
||||||
let map = match Beatmap::parse(file).await {
|
let map = match Beatmap::parse(file).await {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(why) => panic!("Error while parsing map {}: {}", map_id, why),
|
Err(why) => panic!("Error while parsing map {}: {}", result.map_id, why),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = rosu_pp::TaikoPP::new(&map).mods(*mods).calculate();
|
taiko_test(map, result);
|
||||||
|
|
||||||
assert_result!("Stars" => result.stars(), star_margin, stars, map_id, mods);
|
|
||||||
assert_result!("PP" => result.pp(), pp_margin, pp, map_id, mods);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user