Add test coverage of hidden scores on accuracy circle

This commit is contained in:
Dean Herbert 2024-01-25 15:02:43 +09:00
parent 254dcfcebc
commit f22bfa350a
No known key found for this signature in database
1 changed files with 18 additions and 4 deletions

View File

@ -46,6 +46,16 @@ public void TestOsuRank()
addCircleStep(createScore(1, new OsuRuleset()));
}
[Test]
public void TestOsuRankHidden()
{
addCircleStep(createScore(0, new OsuRuleset(), 20, true));
addCircleStep(createScore(0.8, new OsuRuleset(), 5, true));
addCircleStep(createScore(0.95, new OsuRuleset(), 0, true));
addCircleStep(createScore(0.97, new OsuRuleset(), 1, true));
addCircleStep(createScore(1, new OsuRuleset(), 0, true));
}
[Test]
public void TestCatchRank()
{
@ -66,7 +76,7 @@ public void TestCatchRank()
addCircleStep(createScore(1, new CatchRuleset()));
}
private void addCircleStep(ScoreInfo score) => AddStep($"add panel ({score.DisplayAccuracy})", () =>
private void addCircleStep(ScoreInfo score) => AddStep($"add panel ({score.DisplayAccuracy}, {score.Statistics.GetValueOrDefault(HitResult.Miss)} miss)", () =>
{
Children = new Drawable[]
{
@ -93,18 +103,22 @@ private void addCircleStep(ScoreInfo score) => AddStep($"add panel ({score.Displ
};
});
private ScoreInfo createScore(double accuracy, Ruleset ruleset)
private ScoreInfo createScore(double accuracy, Ruleset ruleset, int missCount = 0, bool hidden = false)
{
var scoreProcessor = ruleset.CreateScoreProcessor();
var statistics = new Dictionary<HitResult, int>
{
{ HitResult.Miss, 1 },
{ HitResult.Miss, missCount },
{ HitResult.Meh, 50 },
{ HitResult.Good, 100 },
{ HitResult.Great, 300 },
};
var mods = hidden
? new[] { new OsuModHidden() }
: new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() };
return new ScoreInfo
{
User = new APIUser
@ -114,7 +128,7 @@ private ScoreInfo createScore(double accuracy, Ruleset ruleset)
},
BeatmapInfo = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo,
Ruleset = ruleset.RulesetInfo,
Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() },
Mods = mods,
TotalScore = 2845370,
Accuracy = accuracy,
MaxCombo = 999,