Esempio n. 1
0
        public void ForumTest4()
        {
            List <int> data = new[] { 23, 9, 35, 4, 13, 24, 2, 5, 27, 1, 34, 8 }.ToList();
            int        result = MedianCalculator.SumMedians(data);

            Assert.AreEqual(156, result);
        }
Esempio n. 2
0
        public void ForumTest3()
        {
            List <int> data = new[] { 23, 9, 35, 4, 13, 24, 2, 5, 27, 1, 34, 8, 15, 39, 32, 22, 29, 21, 19, 20, 36, 33, 7, 31, 14, 17, 26, 16, 38, 6, 30, 40, 25, 28, 11, 37, 3, 10, 18, 12 }.ToList();
            int        result = MedianCalculator.SumMedians(data);

            Assert.AreEqual(717, result);
        }
Esempio n. 3
0
        public void ForumTest2()
        {
            List <int> data = new[] { 6331, 2793, 1640, 9290, 225, 625, 6195, 2303, 5685, 1354 }.ToList();
            int        result = MedianCalculator.SumMedians(data);

            Assert.AreEqual(9335, result);
        }
Esempio n. 4
0
        public void ForumTest1()
        {
            List <int> data = new[] { 1, 666, 10, 667, 100, 2, 3 }.ToList();
            int        result = MedianCalculator.SumMedians(data);

            Assert.AreEqual(142, result);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            var data          = DataLoader.LoadData("medianData.txt");
            var rollingMedian = MedianCalculator.SumMedians(data);

            Console.WriteLine(rollingMedian);
            Console.ReadLine();
        }
Esempio n. 6
0
        public void CorrectRollingMedian(string inputFile, string outputFile)
        {
            List <int> data     = DataLoader.LoadData(inputFile);
            int        result   = MedianCalculator.SumMedians(data);
            int        expected = File.ReadAllLines(outputFile)
                                  .First()
                                  .Split('\t', ' ', ',')
                                  .Where(n => !string.IsNullOrWhiteSpace(n))
                                  .Select(int.Parse)
                                  .First();

            Assert.AreEqual(expected, result);
        }