示例#1
0
        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");
        }
示例#2
0
        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));
        }
示例#3
0
        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");
        }
示例#4
0
        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");
        }
示例#5
0
        public void NoDifferenceIfValuesAreTheSame(StatisticalTestKind statisticalTestKind, ThresholdUnit thresholdUnit, double thresholdValue)
        {
            var values = Enumerable.Repeat(100.0, 20).ToArray();

            Compare(statisticalTestKind, thresholdUnit, thresholdValue, values, values, "Base");
        }
示例#6
0
 public StatisticalTestColumnAttribute(StatisticalTestKind testKind, bool showPValues = false) : this(testKind, ThresholdUnit.Ratio, 0.1, showPValues)
 {
 }
示例#7
0
 public StatisticalTestColumnAttribute(StatisticalTestKind testKind, ThresholdUnit thresholdUnit, double value, bool showPValues = false)
     : base(StatisticalTestColumn.Create(testKind, Threshold.Create(thresholdUnit, value), showPValues))
 {
 }
示例#8
0
 public StatisticalTestColumn(StatisticalTestKind kind, Threshold threshold, bool showPValues = false)
 {
     Kind        = kind;
     Threshold   = threshold;
     ShowPValues = showPValues;
 }
示例#9
0
 public static StatisticalTestColumn Create(StatisticalTestKind kind, Threshold threshold, bool showPValues = false)
 => new StatisticalTestColumn(kind, threshold, showPValues);