Refactor test

This commit is contained in:
Dan Balasescu 2023-12-15 16:13:34 +09:00
parent 6bd190c55d
commit 3b8a73bf2c
No known key found for this signature in database
1 changed files with 6 additions and 13 deletions

View File

@ -296,7 +296,7 @@ public void TestHitLateInRangeDoesNotHitOutOfRange()
private void assertHeadJudgement(HitResult result)
{
AddAssert(
"check head result",
$"head = {result}",
() => judgementResults.SingleOrDefault(r => r.HitObject is SliderHeadCircle)?.Type,
() => Is.EqualTo(result));
}
@ -304,7 +304,7 @@ private void assertHeadJudgement(HitResult result)
private void assertTickJudgement(int index, HitResult result)
{
AddAssert(
$"check tick({index}) result",
$"tick({index}) = {result}",
() => judgementResults.Where(r => r.HitObject is SliderTick).ElementAtOrDefault(index)?.Type,
() => Is.EqualTo(result));
}
@ -312,7 +312,7 @@ private void assertTickJudgement(int index, HitResult result)
private void assertAllTickJudgements(HitResult result)
{
AddAssert(
"check all tick results",
$"all ticks = {result}",
() => judgementResults.Where(r => r.HitObject is SliderTick).Select(t => t.Type),
() => Has.All.EqualTo(result));
}
@ -320,7 +320,7 @@ private void assertAllTickJudgements(HitResult result)
private void assertRepeatJudgement(HitResult result)
{
AddAssert(
"check repeat result",
$"repeat = {result}",
() => judgementResults.SingleOrDefault(r => r.HitObject is SliderRepeat)?.Type,
() => Is.EqualTo(result));
}
@ -328,7 +328,7 @@ private void assertRepeatJudgement(HitResult result)
private void assertTailJudgement(HitResult result)
{
AddAssert(
"check tail result",
$"tail = {result}",
() => judgementResults.SingleOrDefault(r => r.HitObject is SliderTailCircle)?.Type,
() => Is.EqualTo(result));
}
@ -336,18 +336,11 @@ private void assertTailJudgement(HitResult result)
private void assertSliderJudgement(HitResult result)
{
AddAssert(
"check slider result",
$"slider = {result}",
() => judgementResults.SingleOrDefault(r => r.HitObject is Slider)?.Type,
() => Is.EqualTo(result));
}
private Vector2 computePositionFromTime(double time)
{
Vector2 dist = slider_end_position - slider_start_position;
double t = (time - time_slider_start) / (time_slider_end - time_slider_start);
return slider_start_position + dist * (float)t;
}
private void performTest(List<ReplayFrame> frames, Action<Slider>? adjustSliderFunc = null, bool classic = false)
{
Slider slider = new Slider