독립 검증 도구 추가와 앱 상태 책임 분리
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using NUnit.Framework;
|
||||
using ProjectQuint.Probes;
|
||||
|
||||
namespace ProjectQuint.Tests
|
||||
{
|
||||
public sealed class CoreBenchmarkTests
|
||||
{
|
||||
[Test]
|
||||
public void Benchmark_CheckpointsAreIncompleteUntilEverySampleFinishes()
|
||||
{
|
||||
var checkpoints = 0;
|
||||
var report = CoreBenchmark.Run(100, 42, 60, 3, checkpoint =>
|
||||
{
|
||||
++checkpoints;
|
||||
Assert.That(checkpoint.Complete, Is.False);
|
||||
Assert.That(checkpoint.Samples.Length, Is.EqualTo(checkpoints));
|
||||
Assert.That(checkpoint.Samples[0].Judgement.Finished, Is.True);
|
||||
});
|
||||
Assert.That(report.Complete, Is.True);
|
||||
Assert.That(checkpoints, Is.EqualTo(3));
|
||||
Assert.That(report.Samples.Length, Is.EqualTo(3));
|
||||
Assert.That(report.WarmupIterations, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[TestCase(0)]
|
||||
[TestCase(101)]
|
||||
public void Benchmark_RejectsInvalidIterationCount(int iterations) =>
|
||||
Assert.Throws<System.ArgumentOutOfRangeException>(() =>
|
||||
CoreBenchmark.Run(100, 42, 60, iterations, _ => { }));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user