From f2edb3ea54ef0bd5cbc181bd6b25a4ba20eaba8d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 19 Dec 2023 14:01:08 +0900 Subject: [PATCH] Add test --- .../TestSceneTaikoScoreProcessor.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs new file mode 100644 index 0000000000..6f3b9f9748 --- /dev/null +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs @@ -0,0 +1,41 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Scoring; + +namespace osu.Game.Rulesets.Taiko.Tests +{ + [TestFixture] + public class TestSceneTaikoScoreProcessor + { + [Test] + public void TestInaccurateHitScore() + { + var beatmap = new Beatmap + { + HitObjects = + { + new Hit(), + new Hit { StartTime = 1000 } + } + }; + + var scoreProcessor = new TaikoScoreProcessor(); + scoreProcessor.ApplyBeatmap(beatmap); + + // Apply a miss judgement + scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new TaikoJudgement()) { Type = HitResult.Great }); + scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], new TaikoJudgement()) { Type = HitResult.Ok }); + + Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(453745)); + Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo(0.75).Within(0.0001)); + } + } +}