Files
cneicy 2e8cc588c4
Publish UPM package / publish (push) Failing after 1s
chore: initialize standalone UPM package
2026-08-26 02:49:53 +08:00

28 lines
1.0 KiB
C#

#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);
}
}
}