1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 21:13:20 +08:00

Simplify test case further

This commit is contained in:
Bartłomiej Dach 2021-05-04 22:48:57 +02:00
parent 45c0b74151
commit 9734758237

View File

@ -284,33 +284,31 @@ namespace osu.Game.Tests.NonVisual
{ {
const double repeating_time = 5000; const double repeating_time = 5000;
int incrementingData = 0;
// add a range of frames randomized in time but have a "data" assigned to them in ascending order. // add a range of frames randomized in time but have a "data" assigned to them in ascending order.
replay.Frames.AddRange(new[] replay.Frames.AddRange(new[]
{ {
new TestReplayFrame(repeating_time, true), repeating_time,
new TestReplayFrame(0, true), 0,
new TestReplayFrame(3000, true), 3000,
new TestReplayFrame(repeating_time, true), repeating_time,
new TestReplayFrame(repeating_time, true), repeating_time,
new TestReplayFrame(6000, true), 6000,
new TestReplayFrame(9000, true), 9000,
new TestReplayFrame(repeating_time, true), repeating_time,
new TestReplayFrame(repeating_time, true), repeating_time,
new TestReplayFrame(1000, true), 1000,
new TestReplayFrame(11000, true), 11000,
new TestReplayFrame(21000, true), 21000,
new TestReplayFrame(4000, true), 4000,
new TestReplayFrame(repeating_time, true), repeating_time,
new TestReplayFrame(repeating_time, true), repeating_time,
new TestReplayFrame(8000, true), 8000,
new TestReplayFrame(2000, true), 2000,
new TestReplayFrame(7000, true), 7000,
new TestReplayFrame(repeating_time, true), repeating_time,
new TestReplayFrame(repeating_time, true), repeating_time,
new TestReplayFrame(10000, true), 10000
}.Select(f => new TestReplayFrame(f.Time, true, incrementingData++))); }.Select((time, index) => new TestReplayFrame(time, true, index)));
replay.HasReceivedAllFrames = true; replay.HasReceivedAllFrames = true;
@ -321,7 +319,7 @@ namespace osu.Game.Tests.NonVisual
var repeatingTimeFramesData = replay.Frames var repeatingTimeFramesData = replay.Frames
.Cast<TestReplayFrame>() .Cast<TestReplayFrame>()
.Where(f => f.Time == repeating_time) .Where(f => f.Time == repeating_time)
.Select(f => f.Data); .Select(f => f.FrameIndex);
Assert.That(repeatingTimeFramesData, Is.Ordered.Ascending); Assert.That(repeatingTimeFramesData, Is.Ordered.Ascending);
} }
@ -372,13 +370,13 @@ namespace osu.Game.Tests.NonVisual
private class TestReplayFrame : ReplayFrame private class TestReplayFrame : ReplayFrame
{ {
public readonly bool IsImportant; public readonly bool IsImportant;
public readonly int Data; public readonly int FrameIndex;
public TestReplayFrame(double time, bool isImportant = false, int data = 0) public TestReplayFrame(double time, bool isImportant = false, int frameIndex = 0)
: base(time) : base(time)
{ {
IsImportant = isImportant; IsImportant = isImportant;
Data = data; FrameIndex = frameIndex;
} }
} }