2023-11-13 16:11: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;
|
|
|
|
using osu.Game.Beatmaps.Timing;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Scoring;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Tests
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2023-12-17 10:33:38 +00:00
|
|
|
public class TestSceneOsuLegacyHealthProcessor
|
2023-11-13 16:11:17 +00:00
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void TestNoBreak()
|
|
|
|
{
|
2023-12-17 10:33:02 +00:00
|
|
|
OsuLegacyHealthProcessor hp = new OsuLegacyHealthProcessor(-1000);
|
2023-11-13 16:11:17 +00:00
|
|
|
hp.ApplyBeatmap(new Beatmap<OsuHitObject>
|
|
|
|
{
|
|
|
|
HitObjects =
|
|
|
|
{
|
|
|
|
new HitCircle { StartTime = 0 },
|
|
|
|
new HitCircle { StartTime = 2000 }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Assert.That(hp.DrainRate, Is.EqualTo(1.4E-5).Within(0.1E-5));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestSingleBreak()
|
|
|
|
{
|
2023-12-17 10:33:02 +00:00
|
|
|
OsuLegacyHealthProcessor hp = new OsuLegacyHealthProcessor(-1000);
|
2023-11-13 16:11:17 +00:00
|
|
|
hp.ApplyBeatmap(new Beatmap<OsuHitObject>
|
|
|
|
{
|
|
|
|
HitObjects =
|
|
|
|
{
|
|
|
|
new HitCircle { StartTime = 0 },
|
|
|
|
new HitCircle { StartTime = 2000 }
|
|
|
|
},
|
|
|
|
Breaks =
|
|
|
|
{
|
|
|
|
new BreakPeriod(500, 1500)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Assert.That(hp.DrainRate, Is.EqualTo(4.3E-5).Within(0.1E-5));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestOverlappingBreak()
|
|
|
|
{
|
2023-12-17 10:33:02 +00:00
|
|
|
OsuLegacyHealthProcessor hp = new OsuLegacyHealthProcessor(-1000);
|
2023-11-13 16:11:17 +00:00
|
|
|
hp.ApplyBeatmap(new Beatmap<OsuHitObject>
|
|
|
|
{
|
|
|
|
HitObjects =
|
|
|
|
{
|
|
|
|
new HitCircle { StartTime = 0 },
|
|
|
|
new HitCircle { StartTime = 2000 }
|
|
|
|
},
|
|
|
|
Breaks =
|
|
|
|
{
|
|
|
|
new BreakPeriod(500, 1400),
|
|
|
|
new BreakPeriod(750, 1500),
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Assert.That(hp.DrainRate, Is.EqualTo(4.3E-5).Within(0.1E-5));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestSequentialBreak()
|
|
|
|
{
|
2023-12-17 10:33:02 +00:00
|
|
|
OsuLegacyHealthProcessor hp = new OsuLegacyHealthProcessor(-1000);
|
2023-11-13 16:11:17 +00:00
|
|
|
hp.ApplyBeatmap(new Beatmap<OsuHitObject>
|
|
|
|
{
|
|
|
|
HitObjects =
|
|
|
|
{
|
|
|
|
new HitCircle { StartTime = 0 },
|
|
|
|
new HitCircle { StartTime = 2000 }
|
|
|
|
},
|
|
|
|
Breaks =
|
|
|
|
{
|
|
|
|
new BreakPeriod(500, 1000),
|
|
|
|
new BreakPeriod(1000, 1500),
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Assert.That(hp.DrainRate, Is.EqualTo(4.3E-5).Within(0.1E-5));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|