mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Add failing test case
This commit is contained in:
parent
479401e533
commit
f642546d6a
@ -74,6 +74,29 @@ namespace osu.Game.Tests.Beatmaps
|
||||
AddUntilStep($"star difficulty -> {BASE_STARS + 1.75}", () => starDifficultyBindable.Value?.Stars == BASE_STARS + 1.75);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStarDifficultyAdjustHashCodeConflict()
|
||||
{
|
||||
OsuModDifficultyAdjust difficultyAdjust = null;
|
||||
|
||||
AddStep("set computation function", () => difficultyCache.ComputeDifficulty = lookup =>
|
||||
{
|
||||
var modDifficultyAdjust = (ModDifficultyAdjust)lookup.OrderedMods.SingleOrDefault(mod => mod is ModDifficultyAdjust);
|
||||
return new StarDifficulty(BASE_STARS * (modDifficultyAdjust?.OverallDifficulty.Value ?? 1), 0);
|
||||
});
|
||||
|
||||
AddStep("change selected mod to DA", () => SelectedMods.Value = new[] { difficultyAdjust = new OsuModDifficultyAdjust() });
|
||||
AddUntilStep($"star difficulty -> {BASE_STARS}", () => starDifficultyBindable.Value?.Stars == BASE_STARS);
|
||||
|
||||
AddStep("change DA difficulty to 0.5", () => difficultyAdjust.OverallDifficulty.Value = 0.5f);
|
||||
AddUntilStep($"star difficulty -> {BASE_STARS * 0.5f}", () => starDifficultyBindable.Value?.Stars == BASE_STARS / 2);
|
||||
|
||||
// hash code of 0 (the value) conflicts with the hash code of null (the initial/default value).
|
||||
// it's important that the mod reference and its underlying bindable references stay the same to demonstrate this failure.
|
||||
AddStep("change DA difficulty to 0", () => difficultyAdjust.OverallDifficulty.Value = 0);
|
||||
AddUntilStep($"star difficulty -> 0", () => starDifficultyBindable.Value?.Stars == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestKeyEqualsWithDifferentModInstances()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user