public void mixedSequence()
        {
            double[] testInput = new double[] { -3, -2, -1, 0, 1, 2, 3 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 0;

            Assert.AreEqual(expected, output);
        }
        public void sequenceDescending()
        {
            double[] testInput = new double[] { 5, 4, 3, 2, 1 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 3;

            Assert.AreEqual(expected, output);
        }
        public void negativeSequence()
        {
            double[] testInput = new double[] { -1, -2, -3, -4, -5 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = -3;

            Assert.AreEqual(expected, output);
        }
        public void singleSequence()
        {
            double[] testInput = new double[] { 1 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 1;

            Assert.AreEqual(expected, output);
        }
        public void evenSequence()
        {
            double[] testInput = new double[] { 1, 2, 3, 4, 5, 6 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 3;

            Assert.AreEqual(expected, output);
        }
        public void randomMedian()
        {
            double[] testInput = new double[] { -4, 2, 3, -2, 5, -1, 0, 4, 1, -3 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 0;

            Assert.AreEqual(expected, output);
        }
        public void backLoaded()
        {
            double[] testInput = new double[] { 1, 1, 1, 1, 5 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 1;

            Assert.AreEqual(expected, output);
        }
        public void endMedian()
        {
            double[] testInput = new double[] { 1, 2, 4, 5, 3 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 3;

            Assert.AreEqual(expected, output);
        }
        public void noneGreater()
        {
            double[] testInput = new double[] { 1, 1, 2, 2, 2 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 2;

            Assert.AreEqual(expected, output);
        }
示例#10
0
        public void homogenous()
        {
            double[] testInput = new double[] { 3, 3, 3, 3, 3 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 3;

            Assert.AreEqual(expected, output);
        }
示例#11
0
        public void floatSequence()
        {
            double[] testInput = new double[] { 0.1, 0.2, 0.3, 0.4, 0.5 };
            double   output    = Median.BruteForceMedian(testInput);
            double   expected  = 0.3;

            Assert.AreEqual(expected, output);
        }
示例#12
0
 public void emptySequence()
 {
     double[] testInput = new double[] { };
     double   output    = Median.BruteForceMedian(testInput);
 }