feat(cordis): 完成阶段5配置与调试工具
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#nullable enable
|
||||
using NUnit.Framework;
|
||||
using ShrinkContext.AppAdapter.Editor;
|
||||
|
||||
namespace ShrinkContext.AppAdapter.Tests
|
||||
{
|
||||
public class ContextBenchmarkTests
|
||||
{
|
||||
[Test]
|
||||
public void Benchmark_UsesIndexedCandidatesAndRestoresEveryFailedReplacement()
|
||||
{
|
||||
var report = TestAwait.Run(ShrinkContextBenchmarkRunner.RunAsync(
|
||||
unrelatedFiberCount: 10,
|
||||
reloadIterations: 3,
|
||||
failureIterations: 2));
|
||||
|
||||
Assert.AreEqual(3, report.ConsumerApplyCount);
|
||||
Assert.AreEqual(12L, report.NotificationDispatchCount);
|
||||
Assert.AreEqual(12L, report.NotificationCandidateVisits,
|
||||
"每次 provider 生命周期有四次键通知,每次只访问目标 consumer");
|
||||
Assert.Less(report.NotificationCandidateVisits, report.NaiveFiberVisits);
|
||||
Assert.AreEqual(2, report.RestoredFailureCount);
|
||||
Assert.GreaterOrEqual(report.NotifyMilliseconds, 0d);
|
||||
Assert.GreaterOrEqual(report.RestoreMilliseconds, 0d);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user