Files
Just.PreciseMath/2-benchmarks/Just.PreciseMath.Benchmarks/Program.cs
T
just cb2524980d
.NET Test / .NET tests (push) Successful in 1m9s
basic arithmetic benchmarks added
2026-09-14 00:04:39 +04:00

32 lines
1.2 KiB
C#

using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
namespace Just.PreciseMath.Benchmarks;
internal static class Program
{
private static int Main(string[] args)
{
BenchmarkSwitcher switcher = BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly);
// Only these standalone discovery/help forms intentionally produce no reports.
if (args is ["--list", "flat" or "tree"] or ["--help"] or ["-h"])
{
switcher.Run(args);
return 0;
}
Summary[] summaries = switcher.Run(args.Length == 0 ? ["--filter", "*"] : args).ToArray();
// BenchmarkDotNet can return normally after validation, build, or execution
// failures. Do not let CI mistake an empty or failed run for a passing smoke test.
if (summaries.Length == 0 || summaries.Any(summary =>
summary.HasCriticalValidationErrors || summary.Reports.Length == 0 ||
summary.Reports.Any(report => !report.Success || report.ResultStatistics is null)))
{
Console.Error.WriteLine("Benchmark run failed or produced no measurements.");
return 1;
}
return 0;
}
}