2020-08-28 13:12:17 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Game.Beatmaps;
|
2020-11-06 05:31:21 +00:00
|
|
|
using osu.Game.Rulesets;
|
2020-08-28 13:12:17 +00:00
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Beatmaps
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class BeatmapDifficultyManagerTest
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void TestKeyEqualsWithDifferentModInstances()
|
|
|
|
{
|
2020-11-06 05:31:21 +00:00
|
|
|
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
|
|
|
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
2020-08-28 13:12:17 +00:00
|
|
|
|
|
|
|
Assert.That(key1, Is.EqualTo(key2));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestKeyEqualsWithDifferentModOrder()
|
|
|
|
{
|
2020-11-06 05:31:21 +00:00
|
|
|
var key1 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
|
|
|
|
var key2 = new BeatmapDifficultyCache.DifficultyCacheLookup(new BeatmapInfo { ID = 1234 }, new RulesetInfo { ID = 0 }, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
|
2020-08-28 13:12:17 +00:00
|
|
|
|
|
|
|
Assert.That(key1, Is.EqualTo(key2));
|
|
|
|
}
|
2020-10-10 16:08:19 +00:00
|
|
|
|
|
|
|
[TestCase(1.3, DifficultyRating.Easy)]
|
|
|
|
[TestCase(1.993, DifficultyRating.Easy)]
|
|
|
|
[TestCase(1.998, DifficultyRating.Normal)]
|
|
|
|
[TestCase(2.4, DifficultyRating.Normal)]
|
|
|
|
[TestCase(2.693, DifficultyRating.Normal)]
|
|
|
|
[TestCase(2.698, DifficultyRating.Hard)]
|
|
|
|
[TestCase(3.5, DifficultyRating.Hard)]
|
|
|
|
[TestCase(3.993, DifficultyRating.Hard)]
|
|
|
|
[TestCase(3.997, DifficultyRating.Insane)]
|
|
|
|
[TestCase(5.0, DifficultyRating.Insane)]
|
|
|
|
[TestCase(5.292, DifficultyRating.Insane)]
|
|
|
|
[TestCase(5.297, DifficultyRating.Expert)]
|
|
|
|
[TestCase(6.2, DifficultyRating.Expert)]
|
|
|
|
[TestCase(6.493, DifficultyRating.Expert)]
|
|
|
|
[TestCase(6.498, DifficultyRating.ExpertPlus)]
|
|
|
|
[TestCase(8.3, DifficultyRating.ExpertPlus)]
|
|
|
|
public void TestDifficultyRatingMapping(double starRating, DifficultyRating expectedBracket)
|
|
|
|
{
|
2020-11-06 04:14:23 +00:00
|
|
|
var actualBracket = BeatmapDifficultyCache.GetDifficultyRating(starRating);
|
2020-10-10 16:08:19 +00:00
|
|
|
|
|
|
|
Assert.AreEqual(expectedBracket, actualBracket);
|
|
|
|
}
|
2020-08-28 13:12:17 +00:00
|
|
|
}
|
|
|
|
}
|