2021-04-12 17:51:24 +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.Online.API;
|
2021-09-10 02:22:08 +00:00
|
|
|
using osu.Game.Rulesets.Osu;
|
2021-04-12 17:51:24 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Mods
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class ModSettingsEqualityComparison
|
|
|
|
{
|
|
|
|
[Test]
|
2021-09-10 02:22:08 +00:00
|
|
|
public void TestAPIMod()
|
2021-04-12 17:51:24 +00:00
|
|
|
{
|
2021-09-10 02:22:08 +00:00
|
|
|
var apiMod1 = new APIMod(new OsuModDoubleTime { SpeedChange = { Value = 1.25 } });
|
|
|
|
var apiMod2 = new APIMod(new OsuModDoubleTime { SpeedChange = { Value = 1.26 } });
|
|
|
|
var apiMod3 = new APIMod(new OsuModDoubleTime { SpeedChange = { Value = 1.26 } });
|
|
|
|
|
|
|
|
Assert.That(apiMod1, Is.Not.EqualTo(apiMod2));
|
|
|
|
Assert.That(apiMod2, Is.EqualTo(apiMod2));
|
|
|
|
Assert.That(apiMod2, Is.EqualTo(apiMod3));
|
|
|
|
Assert.That(apiMod3, Is.EqualTo(apiMod2));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestMod()
|
|
|
|
{
|
|
|
|
var ruleset = new OsuRuleset();
|
|
|
|
|
2021-04-12 17:51:24 +00:00
|
|
|
var mod1 = new OsuModDoubleTime { SpeedChange = { Value = 1.25 } };
|
|
|
|
var mod2 = new OsuModDoubleTime { SpeedChange = { Value = 1.26 } };
|
|
|
|
var mod3 = new OsuModDoubleTime { SpeedChange = { Value = 1.26 } };
|
2021-09-10 02:22:08 +00:00
|
|
|
|
|
|
|
var doubleConvertedMod1 = new APIMod(mod1).ToMod(ruleset);
|
|
|
|
var doulbeConvertedMod2 = new APIMod(mod2).ToMod(ruleset);
|
|
|
|
var doulbeConvertedMod3 = new APIMod(mod3).ToMod(ruleset);
|
2021-04-12 17:51:24 +00:00
|
|
|
|
|
|
|
Assert.That(mod1, Is.Not.EqualTo(mod2));
|
2021-09-10 02:22:08 +00:00
|
|
|
Assert.That(doubleConvertedMod1, Is.Not.EqualTo(doulbeConvertedMod2));
|
2021-04-12 17:51:24 +00:00
|
|
|
|
|
|
|
Assert.That(mod2, Is.EqualTo(mod2));
|
2021-09-10 02:22:08 +00:00
|
|
|
Assert.That(doulbeConvertedMod2, Is.EqualTo(doulbeConvertedMod2));
|
2021-04-12 17:51:24 +00:00
|
|
|
|
|
|
|
Assert.That(mod2, Is.EqualTo(mod3));
|
2021-09-10 02:22:08 +00:00
|
|
|
Assert.That(doulbeConvertedMod2, Is.EqualTo(doulbeConvertedMod3));
|
2021-04-12 17:51:24 +00:00
|
|
|
|
|
|
|
Assert.That(mod3, Is.EqualTo(mod2));
|
2021-09-10 02:22:08 +00:00
|
|
|
Assert.That(doulbeConvertedMod3, Is.EqualTo(doulbeConvertedMod2));
|
2021-04-12 17:51:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|