예제 #1
0
        public void DoesFindMedianInSortedArray()
        {
            var data   = new double[] { 1, 2, 3 };
            var median = MedianCalculator.median(data);

            Assert.Equal(2, median);
        }
예제 #2
0
        public void ReturnsTheOnlyElementAsMedian()
        {
            var data   = new double[] { 5.5 };
            var median = MedianCalculator.median(data);

            Assert.Equal(5.5, median);
        }
예제 #3
0
        public void DoesFindMedianInTwoElementArray()
        {
            var data   = new double[] { 10, 20 };
            var median = MedianCalculator.median(data);

            Assert.Equal(15, median);
        }
예제 #4
0
        public void AveragesOutMiddleNumbers()
        {
            var data   = new double[] { 1, 2, 3, 4 };
            var median = MedianCalculator.median(data);

            Assert.Equal(2.5, median);
        }