Beispiel #1
0
        public void Day11()
        {
            var d = new Day11();

            Assert.AreEqual(2346, d.StabalizedNeighborSeatCount());
            Assert.AreEqual(2111, d.StabalizedVisibleSeatCount());
        }
Beispiel #2
0
        public void ContainsTwoNoOverlappingPairs(string input, bool expected)
        {
            var day11  = new Day11();
            var actual = day11.ContainsTwoNoOverlappingPairs(input);

            Assert.Equal(expected, actual);
        }
Beispiel #3
0
        public void FindNextPassword(string input, string expected)
        {
            var day11  = new Day11();
            var actual = day11.FindNextPassword(input);

            Assert.Equal(expected, actual);
        }
Beispiel #4
0
        public void Part2_Answer()
        {
            var day11 = new Day11();

            var(_, actual) = day11.Walk(PUZZLE_INPUT);
            Assert.Equal(1558, actual);
        }
Beispiel #5
0
        public void ContainsStraight(string input, bool expected)
        {
            var day11  = new Day11();
            var actual = day11.ContainsStraight(input);

            Assert.Equal(expected, actual);
        }
Beispiel #6
0
        public void EmptyEight(string file, int expected, int x, int y)
        {
            day11 = new Day11(file);
            var result = day11.GetNeighborsInSight(x, y, day11.GetInitialState( ));

            Assert.AreEqual(expected, result.Where(c => c == '#').Count( ));
        }
Beispiel #7
0
        public void Part1(string route, int expected)
        {
            var day11 = new Day11();

            var(actual, _) = day11.Walk(route);
            Assert.Equal(expected, actual);
        }
Beispiel #8
0
        public void CanSolvePart2(string[] room, int expected)
        {
            var day    = new Day11();
            var result = day.Solve(room.Select(str => str.ToCharArray()).ToArray(), true);

            Assert.Equal(expected, result);
        }
Beispiel #9
0
        public void GetDay11Part02AnswerTest()
        {
            int expected = 2214;
            int actual   = Day11.GetDay11Part02Answer();

            Assert.Equal(expected, actual);
        }
Beispiel #10
0
        public void Day11_Part1_Examples_Passwords()
        {
            var d = new Day11();

            Assert.AreEqual("abcdffaa", d.Solution("abcdefgh"));
            Assert.AreEqual("ghjaabcc", d.Solution("ghijklmn"));
        }
Beispiel #11
0
        public void TestSeatChaosVisible()
        {
            var input = Day11.ParseSeatGrid("Advent_of_Code_2020.Day11.SampleInput.txt");
            var grid  = Day11.SimulateSeatsVisible(input);

            Assert.Equal(26, grid.Sum(row => row.Count(c => c == '#')));
        }
Beispiel #12
0
        public void RunDay11Part2Test()
        {
            int expected = 249;
            int actual   = Day11.RunDay11Part2();

            Assert.Equal(expected, actual);
        }
Beispiel #13
0
 public void Examples1()
 {
     Assert.That(Day11.Solve("ne,ne,ne").Item1, Is.EqualTo(3));
     Assert.That(Day11.Solve("ne,ne,sw,sw").Item1, Is.EqualTo(0));
     Assert.That(Day11.Solve("ne,ne,s,s").Item1, Is.EqualTo(2));
     Assert.That(Day11.Solve("se,sw,se,sw,sw").Item1, Is.EqualTo(3));
 }
Beispiel #14
0
        public void Part1_getpowerlevel_should_return_correct_result(int x, int y, int serialNumber, int expectedResult)
        {
            Assert.That(Day11.GetPowerLevel((x, y), serialNumber), Is.EqualTo(expectedResult));

            Assert.That(Day11.GetHighestSquarePowerLevel(18), Is.EqualTo(29));
            Assert.That(Day11.GetHighestSquarePowerLevel(42), Is.EqualTo(30));
        }
Beispiel #15
0
        public void ResolvePart2__Test2()
        {
            Day11  day    = new Day11();
            string result = day.ResolvePart2(new string[] { "42" });

            Assert.AreEqual("232,251,12", result);
        }
Beispiel #16
0
        public void PartBTests(string input, string expectedOutput)
        {
            var day    = new Day11();
            var result = day.SolveB(input);

            Assert.AreEqual(expectedOutput, result);
        }
Beispiel #17
0
        public void Part2( )
        {
            day11 = new Day11("day11test6");
            var actual = day11.SolvePart2( );

            Assert.AreEqual(26.ToString( ), actual);
        }
Beispiel #18
0
        public void GetPowerTest(int x, int y, int serial, sbyte expectedPower)
        {
            var day   = new Day11();
            var power = day.GetPower(x, y, serial);

            Assert.AreEqual(expectedPower, power);
        }
Beispiel #19
0
        public void Stars()
        {
            var run = new Day11();

            Assert.Equal("2310", run.Result1());
            Assert.Equal("2074", run.Result2());
        }
Beispiel #20
0
    static void Main(string[] args)
    {
        Day11.Puzzle1();

        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
Beispiel #21
0
        public void Part1_Answer()
        {
            var day11 = new Day11();

            var(actual, _) = day11.Walk(PUZZLE_INPUT);
            Assert.Equal(784, actual);
        }
Beispiel #22
0
    public void Part1(int numSteps, int expected)
    {
        var day    = new Day11();
        var actual = Day11.Part1(_input, numSteps);

        Assert.Equal(expected, actual);
    }
Beispiel #23
0
        public void Day11()
        {
            var day = new Day11();

            Assert.Equal(805, day.FirstPart());
            Assert.Equal(1535, day.SecondPart());
        }
Beispiel #24
0
        public void CalculatePowerLevelOfRegion__Test1_WithSumationField()
        {
            int[,] summationFiled = Day11.GenerateSumationField(300, 300, 18);
            int powerLevel = Day11.CalculatePowerLevelOfRegion(33, 45, 3, summationFiled);

            Assert.AreEqual(29, powerLevel);
        }
Beispiel #25
0
        public void ContainsForbiddenCharacters(string input, bool expected)
        {
            var day11  = new Day11();
            var actual = day11.ContainsForbiddenCharacters(input);

            Assert.Equal(expected, actual);
        }
Beispiel #26
0
        public void CalculatePowerLevelOfRegion__Test2_WithSumationField()
        {
            int[,] summationFiled = Day11.GenerateSumationField(300, 300, 42);
            int powerLevel = Day11.CalculatePowerLevelOfRegion(21, 61, 3, summationFiled);

            Assert.AreEqual(30, powerLevel);
        }
Beispiel #27
0
        public void PasswordIsValid(string input, bool expected)
        {
            var day11  = new Day11();
            var actual = day11.PasswordIsValid(input);

            Assert.Equal(expected, actual);
        }
Beispiel #28
0
        public void ResolvePart2__Test1()
        {
            Day11  day    = new Day11();
            string result = day.ResolvePart2(new string[] { "18" });

            Assert.AreEqual("90,269,16", result);
        }
Beispiel #29
0
 public void Task2()
 {
     Assert.AreEqual(3, Day11.Task2("ne,ne,ne".Split(',').ToList()));
     Assert.AreEqual(2, Day11.Task2("ne,ne,sw,sw".Split(',').ToList()));
     Assert.AreEqual(2, Day11.Task2("ne,ne,s,s".Split(',').ToList()));
     Assert.AreEqual(3, Day11.Task2("se,sw,se,sw,sw".Split(',').ToList()));
 }
Beispiel #30
0
        public void Test_Step1()
        {
            var d11 = new Day11();

            d11.Step(defaultInput);
            Assert.AreEqual("#.##.##.##", d11.Rows[0]);
            Assert.AreEqual("#.#####.##", d11.Rows[^ 1]);