Files
Anubis/tests/Anubis.Tests/Property.cs
T
Alby96andClaude Opus 5.5 cfa2a4da0e
ci / test (postgres) (push) Successful in 9m13s
ci / test (sqlite) (push) Successful in 7m33s
ci / image (push) Successful in 2m48s
Fase 13 — Campionato: unità di lavoro, piano e statistica (#188)
The tournament judge before the contenders (ADR 0029): the trial judge split into resumable work units on a pool of low-priority workers, the common count of trials and field statistics, the control against chance on surrogate prices, and the immutable tournament plan with a final tract read once.

refs #122, refs #123, refs #124, refs #125, refs #126

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
2026-12-04 15:53:40 +01:00

32 lines
1.0 KiB
C#

using System.Globalization;
namespace Anubis.Tests;
/// <summary>
/// Property tests without external packages (ADR 0003, 0004): many generated cases from a fixed
/// seed, so a failure always repeats, and a message that names the seed and the failing case.
/// </summary>
internal static class Property
{
public const int DefaultSeed = 20261110;
public const int DefaultCases = 200;
public static void ForAll<T>(Func<Gen, T> generate, Action<T> property, int cases = DefaultCases, int seed = DefaultSeed)
{
var gen = new Gen(seed);
for (var i = 0; i < cases; i++)
{
var value = generate(gen);
try
{
property(value);
}
catch (Exception ex) when (ex is not AssertInconclusiveException)
{
throw new AssertFailedException(
string.Create(CultureInfo.InvariantCulture, $"Proprietà violata al caso {i} (seme {seed}): {value}"), ex);
}
}
}
}