독립 검증 도구 추가와 앱 상태 책임 분리
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user