1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 01:22:59 +08:00

Add failing test case

This commit is contained in:
Salman Ahmed 2022-04-26 22:19:20 +03:00
parent b82ccb816c
commit a884f20c65

View File

@ -160,6 +160,43 @@ namespace osu.Game.Tests.Gameplay
assertHealthNotEqualTo(1);
}
[Test]
public void TestFailConditions()
{
var beatmap = createBeatmap(0, 1000);
createProcessor(beatmap);
AddStep("setup fail conditions", () => processor.FailConditions += ((_, result) => result.Type == HitResult.Miss));
AddStep("apply perfect hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Perfect }));
AddAssert("not failed", () => !processor.HasFailed);
AddStep("apply miss hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Miss }));
AddAssert("failed", () => processor.HasFailed);
}
[Test]
public void TestMultipleFailConditions([Values] bool applyFirstCondition)
{
var beatmap = createBeatmap(0, 1000);
createProcessor(beatmap);
AddStep("setup multiple fail conditions", () =>
{
processor.FailConditions += ((_, result) => result.Type == HitResult.Miss);
processor.FailConditions += ((_, result) => result.Type == HitResult.Meh);
});
AddStep("apply perfect hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Perfect }));
AddAssert("not failed", () => !processor.HasFailed);
if (applyFirstCondition)
AddStep("apply miss hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Miss }));
else
AddStep("apply meh hit result", () => processor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new Judgement()) { Type = HitResult.Meh }));
AddAssert("failed", () => processor.HasFailed);
}
[Test]
public void TestBonusObjectsExcludedFromDrain()
{