From 34c2cc08bdd4dfafc604775811275c340b1d0e99 Mon Sep 17 00:00:00 2001 From: Natelytle Date: Sun, 16 Apr 2023 00:11:51 -0400 Subject: [PATCH] Add comments and fail messages to UR estimation tests --- .../ManiaUnstableRateEstimationTest.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaUnstableRateEstimationTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaUnstableRateEstimationTest.cs index 698e4c4b49..0c9850e0ea 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaUnstableRateEstimationTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaUnstableRateEstimationTest.cs @@ -27,15 +27,18 @@ namespace osu.Game.Rulesets.Mania.Tests private const string resource_namespace = "Testing.Beatmaps"; protected string ResourceAssembly => "osu.Game.Rulesets.Mania"; + // Test that both SS scores and near 0% scores are handled properly, within a margin of +-0.001 UR [TestCase(42.978515625d, new[] { 11847, 0, 0, 0, 0, 0 }, "ur-estimation-test")] [TestCase(9523485.0d, new[] { 0, 0, 0, 0, 1, 11846 }, "ur-estimation-test")] public void Test1(double expectedEstimatedUnstableRate, int[] judgements, string name) => TestUnstableRate(expectedEstimatedUnstableRate, judgements, name); + // General test to make sure UR estimation isn't changed by anything, within a margin of +-0.001 UR. Tests rate changes as well. [TestCase(309.990234375d, new[] { 5336, 3886, 1661, 445, 226, 293 }, "ur-estimation-test")] public void Test1ClockRateAdjusted(double expectedEstimatedUnstableRate, int[] judgements, string name) => TestUnstableRate(expectedEstimatedUnstableRate, judgements, name, new ManiaModDoubleTime()); + // Compares the true hit windows to the hit windows computed manually in perfcalc, within a margin of error of +-0.000001ms. [TestCase(7.0d, "ur-estimation-test")] public void Test2(double overallDifficulty, string name) => TestHitWindows(overallDifficulty, name); @@ -61,7 +64,7 @@ namespace osu.Game.Rulesets.Mania.Tests }, attributes); // Platform-dependent math functions (Pow, Cbrt, Exp, etc) and advanced math functions (Erf, FindMinimum) may result in slight differences. - Assert.That(perfAttributes.EstimatedUr, Is.EqualTo(expectedEstimatedUnstableRate).Within(0.001)); + Assert.That(perfAttributes.EstimatedUr, Is.EqualTo(expectedEstimatedUnstableRate).Within(0.001), "The estimated mania UR differed from the expected value."); } protected void TestHitWindows(double overallDifficulty, string name) @@ -83,7 +86,7 @@ namespace osu.Game.Rulesets.Mania.Tests ManiaPerformanceAttributes perfAttributes = new ManiaPerformanceCalculator().Calculate(new ScoreInfo(getBeatmap(name).BeatmapInfo), attributes); // Platform-dependent math functions (Pow, Cbrt, Exp, etc) may result in minute differences. - Assert.That(perfAttributes.HitWindows, Is.EqualTo(trueHitWindows).Within(0.000001)); + Assert.That(perfAttributes.HitWindows, Is.EqualTo(trueHitWindows).Within(0.000001), "The true mania hit windows are different to the ones calculated in ManiaPerformanceCalculator."); } private WorkingBeatmap getBeatmap(string name)