45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
using System.Linq;
|
|
using NUnit.Framework;
|
|
using ProjectQuint.Probes;
|
|
|
|
namespace ProjectQuint.Tests
|
|
{
|
|
public sealed class CoreReplayTests
|
|
{
|
|
[Test]
|
|
public void SyntheticWorkload_IsReproducibleWithoutMedia()
|
|
{
|
|
var first = SyntheticWorkload.Create(500, 42);
|
|
var second = SyntheticWorkload.Create(500, 42);
|
|
Assert.That(first.Events, Is.EqualTo(second.Events));
|
|
Assert.That(first.Notes.Select(n => (n.Id, n.Lane, n.StartTime, n.EndTime)),
|
|
Is.EqualTo(second.Notes.Select(n => (n.Id, n.Lane, n.StartTime, n.EndTime))));
|
|
}
|
|
|
|
[TestCase(30)]
|
|
[TestCase(60)]
|
|
[TestCase(144)]
|
|
[TestCase(240)]
|
|
public void Replay_KeepsTheSameJudgementsAcrossFrameSchedules(int frameRate)
|
|
{
|
|
var workload = SyntheticWorkload.Create(1000, 42);
|
|
var expected = ReplayRunner.Run(workload, 1000).Judgement;
|
|
var actual = ReplayRunner.Run(workload, frameRate).Judgement;
|
|
Assert.That(actual, Is.EqualTo(expected));
|
|
Assert.That(actual.Finished, Is.True);
|
|
Assert.That(actual.MissCount, Is.GreaterThan(0));
|
|
Assert.That(actual.JudgedUnits, Is.GreaterThan(workload.Notes.Length));
|
|
}
|
|
|
|
[TestCase(0)]
|
|
[TestCase(-1)]
|
|
public void InvalidWorkloadSize_IsRejected(int notes) =>
|
|
Assert.Throws<System.ArgumentOutOfRangeException>(() => SyntheticWorkload.Create(notes, 42));
|
|
|
|
[Test]
|
|
public void InvalidFrameRate_IsRejected() =>
|
|
Assert.Throws<System.ArgumentOutOfRangeException>(() =>
|
|
ReplayRunner.Run(SyntheticWorkload.Create(10, 42), 0));
|
|
}
|
|
}
|