feat(cordis): 完成阶段5配置与调试工具

This commit is contained in:
2026-08-17 01:58:46 +08:00
parent 8738e633ee
commit 5765f411e9
29 changed files with 1322 additions and 18 deletions
@@ -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);
}
}
}