public void ImprovementsreDetected(StatisticalTestKind statisticalTestKind, ThresholdUnit thresholdUnit, double thresholdValue) { var baseline = new[] { 10.0, 10.01, 10.02, 10.0, 10.03, 10.02, 9.99, 9.98, 10.0, 10.02 }; var current = baseline.Select(value => value * 0.97).ToArray(); Compare(statisticalTestKind, thresholdUnit, thresholdValue, baseline, current, "Faster"); }
private static void Compare(StatisticalTestKind statisticalTestKind, ThresholdUnit thresholdUnit, double thresholdValue, double[] baseline, double[] current, string expectedResult) { var sut = new StatisticalTestColumn(statisticalTestKind, Threshold.Create(thresholdUnit, thresholdValue)); Assert.Equal(expectedResult, sut.GetValue(null, null, new Statistics(baseline), new Statistics(current), isBaseline: true)); Assert.Equal(expectedResult, sut.GetValue(null, null, new Statistics(baseline), new Statistics(current), isBaseline: false)); }
public void RegressionsAreDetected(StatisticalTestKind statisticalTestKind, ThresholdUnit thresholdUnit, double thresholdValue) { var baseline = new[] { 10.0, 10.01, 10.02, 10.0, 10.03, 10.02, 9.99, 9.98, 10.0, 10.02 }; var current = baseline.Select(value => value * 1.03).ToArray(); Compare(statisticalTestKind, thresholdUnit, thresholdValue, baseline, current, "Slower"); }
public void CanCompareDifferentSampleSizes(StatisticalTestKind statisticalTestKind, ThresholdUnit thresholdUnit, double thresholdValue) { var baseline = new[] { 10.0, 10.01, 10.02, 10.0, 10.03, 10.02, 9.99, 9.98, 10.0, 10.02 }; var current = baseline .Skip(1) // we skip one element to make sure the sample size is different .Select(value => value * 1.03).ToArray(); Compare(statisticalTestKind, thresholdUnit, thresholdValue, baseline, current, "Slower"); }
public void NoDifferenceIfValuesAreTheSame(StatisticalTestKind statisticalTestKind, ThresholdUnit thresholdUnit, double thresholdValue) { var values = Enumerable.Repeat(100.0, 20).ToArray(); Compare(statisticalTestKind, thresholdUnit, thresholdValue, values, values, "Base"); }
public StatisticalTestColumnAttribute(StatisticalTestKind testKind, bool showPValues = false) : this(testKind, ThresholdUnit.Ratio, 0.1, showPValues) { }
public StatisticalTestColumnAttribute(StatisticalTestKind testKind, ThresholdUnit thresholdUnit, double value, bool showPValues = false) : base(StatisticalTestColumn.Create(testKind, Threshold.Create(thresholdUnit, value), showPValues)) { }
public StatisticalTestColumn(StatisticalTestKind kind, Threshold threshold, bool showPValues = false) { Kind = kind; Threshold = threshold; ShowPValues = showPValues; }
public static StatisticalTestColumn Create(StatisticalTestKind kind, Threshold threshold, bool showPValues = false) => new StatisticalTestColumn(kind, threshold, showPValues);