public IReadOnlyList<AssertionResult> RunAssertions(BenchmarkSettings settings, BenchmarkResults results) { Contract.Requires(settings != null); var assertionResults = new List<AssertionResult>(); // Not in testing mode, therefore we don't need to apply these BenchmarkAssertions if (settings.TestMode == TestMode.Measurement) { return assertionResults; } // collect all benchmark settings with non-empty BenchmarkAssertions IReadOnlyList<IBenchmarkSetting> allSettings = settings.Measurements.Where(x => !x.Assertion.Equals(Assertion.Empty)).ToList(); foreach (var setting in allSettings) { var stats = results.StatsByMetric[setting.MetricName]; double valueToBeTested; if (setting.AssertionType == AssertionType.Throughput) { valueToBeTested = stats.PerSecondStats.Average; } else { valueToBeTested = stats.Stats.Average; } var assertionResult = AssertionResult.CreateResult(setting.MetricName, stats.Unit, valueToBeTested, setting.Assertion); assertionResults.Add(assertionResult); } return assertionResults; }
public BenchmarkFinalResults(BenchmarkResults data, IReadOnlyList <AssertionResult> assertionResults) { Data = data; AssertionResults = assertionResults; }
public BenchmarkFinalResults AssertResults(BenchmarkResults result) { var assertionResults = AssertionRunner.RunAssertions(Settings, result); return new BenchmarkFinalResults(result, assertionResults); }
public BenchmarkFinalResults(BenchmarkResults data, IReadOnlyList<AssertionResult> assertionResults) { Data = data; AssertionResults = assertionResults; }