예제 #1
0
        public void TestPart1()
        {
            var input = @"35
20
15
25
47
40
62
55
65
95
102
117
150
182
127
219
299
277
309
576";
            var lines = input.Split('\n');

            var result = Day09Solver.Part1(lines, 5);

            Assert.Equal(127, result);
        }
예제 #2
0
        public void TestSolvePartB()
        {
            Day09Solver          s     = new Day09Solver();
            IEnumerable <string> input = new List <string>
            {
                "35",
                "20",
                "15",
                "25",
                "47",
                "40",
                "62",
                "55",
                "65",
                "95",
                "102",
                "117",
                "150",
                "182",
                "127",
                "219",
                "299",
                "277",
                "309",
                "576"
            };

            Assert.AreEqual("62", s.SolvePartB(input, 127));
        }
예제 #3
0
        public void TestPartOne(string expected, string[] input)
        {
            Solver s      = new Day09Solver();
            string result = s.SolvePartOne(input);

            Assert.That(result, Is.EqualTo(expected));
        }
예제 #4
0
        public void TestPart1Solution(string inputFile, int expected, int preamble)
        {
            // Arrange
            string[] lines = System.IO.File.ReadAllLines($"../../../{inputFile}");

            // Act
            var result = Day09Solver.Part1Solution(lines, preamble);

            // Assert
            Assert.Equal(expected, result);
        }
예제 #5
0
        internal static void Part1()
        {
            var input = Input.Lines(9);

            Console.WriteLine(Day09Solver.Part1(input));
        }