mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Fix check not accounting for mods not existing in certain rulesets
Also check all instances, rather than first.
This commit is contained in:
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -30,17 +29,19 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
IEnumerable<Mod> modInstances = mods.Select(mod => mod.CreateInstance());
|
IEnumerable<Mod> modInstances = mods.Select(mod => mod.CreateInstance());
|
||||||
|
|
||||||
foreach (var mod in modInstances)
|
foreach (var modToCheck in modInstances)
|
||||||
{
|
{
|
||||||
var modIncompatibilities = mod.IncompatibleMods;
|
var incompatibleMods = modToCheck.IncompatibleMods;
|
||||||
|
|
||||||
foreach (var incompatibleModType in modIncompatibilities)
|
foreach (var incompatible in incompatibleMods)
|
||||||
{
|
{
|
||||||
var incompatibleMod = modInstances.First(m => incompatibleModType.IsInstanceOfType(m));
|
foreach (var incompatibleMod in modInstances.Where(m => incompatible.IsInstanceOfType(m)))
|
||||||
Assert.That(
|
{
|
||||||
incompatibleMod.IncompatibleMods.Any(m => m.IsInstanceOfType(mod)),
|
Assert.That(
|
||||||
$"{mod} has {incompatibleMod} in it's incompatible mods, but {incompatibleMod} does not have {mod} in it's incompatible mods."
|
incompatibleMod.IncompatibleMods.Any(m => m.IsInstanceOfType(modToCheck)),
|
||||||
);
|
$"{modToCheck} has {incompatibleMod} in it's incompatible mods, but {incompatibleMod} does not have {modToCheck} in it's incompatible mods."
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user