Exemplo n.º 1
0
        public void TestGCD()
        {
            Day12Solver s = new Day12Solver();

            Assert.That(s.GCD(5, 15), Is.EqualTo(5));
            Assert.That(s.GCD(15, 5), Is.EqualTo(5));
        }
Exemplo n.º 2
0
        public void TestLCM()
        {
            Day12Solver s = new Day12Solver();

            Assert.That(s.LCM(21, 6), Is.EqualTo(42));
            Assert.That(s.LCM(6, 21), Is.EqualTo(42));
        }
Exemplo n.º 3
0
        public void TestPartTwo(string expected, string[] input)
        {
            Solver s      = new Day12Solver();
            string result = s.SolvePartTwo(input);

            Assert.That(result, Is.EqualTo(expected));
        }
Exemplo n.º 4
0
        public void TestPartOne(string expected, int steps, string[] input)
        {
            Day12Solver s      = new Day12Solver();
            string      result = s.SolvePartOne(input, steps);

            Assert.That(result, Is.EqualTo(expected));
        }
Exemplo n.º 5
0
        public void CalculateTotalEnergyTest(string input, int expectedTotalEnergy)
        {
            Day12Solver solver = new Day12Solver(input);

            solver.SimulateSteps(10);

            Assert.AreEqual(expectedTotalEnergy, solver.CalculateTotalEnergy());
        }
Exemplo n.º 6
0
        public void Solve()
        {
            var p1 = new Day12Solver(FetchInput(), false);

            Console.WriteLine($"P1: {p1.Solve()}");
            var p2 = new Day12Solver(FetchInput(), true);

            Console.WriteLine($"P2: {p2.Solve()}");
        }
Exemplo n.º 7
0
        public void TestPart2Solution(string inputFile, long expected)
        {
            // Arrange
            int[][] lines = Helpers.ReadJupiterMoons($"../../../{inputFile}");

            // Act
            var result = Day12Solver.Part2Solution(lines);

            // Assert
            Assert.Equal(expected, result);
        }
Exemplo n.º 8
0
        public void TestPart1Solution(string inputFile, int expected)
        {
            // Arrange
            string[] lines = System.IO.File.ReadAllLines($"../../../{inputFile}");

            // Act
            var result = Day12Solver.Part1Solution(lines);

            // Assert
            Assert.Equal(expected, result);
        }
Exemplo n.º 9
0
 public void SetUp()
 {
     _solver = new Day12Solver();
     _parser = new Day12Parser();
 }
Exemplo n.º 10
0
 public void SetUp()
 {
     _solver = new Day12Solver();
     _input  = new Day12Input();
 }