Source-distributed test helpers for the ZeroAlloc.* ecosystem.
<PackageReference Include="ZeroAlloc.TestHelpers" Version="1.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>contentfiles;build</IncludeAssets>
</PackageReference>The single file AllocationGate.cs compiles directly into your assembly under namespace ZeroAlloc.TestHelpers as internal static class AllocationGate. No runtime DLL dependency.
AllocationGate.AssertBudget(int budgetBytes, int iterations, Action action, string label)— runsactioniterationstimes after a warmup + forced GC, throwsInvalidOperationExceptionif total allocations exceedbudgetBytes * iterations.AllocationGate.AssertBudgetValueTask<T>(int budgetBytes, int iterations, Func<ValueTask<T>> action, string label)— same shape forValueTask<T>-returning APIs; throws if the suppliedValueTask<T>did not complete synchronously (awaiter machinery would pollute the measurement).
Test infrastructure should never appear on a consumer package's public API surface. By compiling into the consumer's assembly as internal, the helper is per-consumer-scoped and zero-cost at consumer-runtime.