mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 02:37:25 +09:00
Add failing test
This commit is contained in:
parent
c288873365
commit
486ea153fe
@ -7,6 +7,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Difficulty;
|
using osu.Game.Rulesets.Difficulty;
|
||||||
@ -355,6 +356,28 @@ namespace osu.Game.Tests.Rulesets.Scoring
|
|||||||
}
|
}
|
||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAccuracyWhenNearPerfect()
|
||||||
|
{
|
||||||
|
const int count_judgements = 1000;
|
||||||
|
const int count_misses = 1;
|
||||||
|
|
||||||
|
double actual = new TestScoreProcessor().ComputeAccuracy(new ScoreInfo
|
||||||
|
{
|
||||||
|
Statistics = new Dictionary<HitResult, int>
|
||||||
|
{
|
||||||
|
{ HitResult.Great, count_judgements - count_misses },
|
||||||
|
{ HitResult.Miss, count_misses }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const double expected = (count_judgements - count_misses) / (double)count_judgements;
|
||||||
|
|
||||||
|
Assert.That(actual, Is.Not.EqualTo(0.0));
|
||||||
|
Assert.That(actual, Is.Not.EqualTo(1.0));
|
||||||
|
Assert.That(actual, Is.EqualTo(expected).Within(Precision.FLOAT_EPSILON));
|
||||||
|
}
|
||||||
|
|
||||||
private class TestRuleset : Ruleset
|
private class TestRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override IEnumerable<Mod> GetModsFor(ModType type) => throw new NotImplementedException();
|
public override IEnumerable<Mod> GetModsFor(ModType type) => throw new NotImplementedException();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user