Example #1
0
        public void Part2(string instructions, int input, int expected)
        {
            var solver = new Day05();
            var result = solver.Solve(instructions, input);

            result.Single().ShouldBe(expected);
        }
Example #2
0
        public void Stars()
        {
            var run = new Day05();

            Assert.Equal("930", run.Result1());
            Assert.Equal("515", run.Result2());
        }
Example #3
0
        public void TestDay05b(string word, bool isNiceExpected)
        {
            var d      = new Day05();
            var isNice = d.IsWordReallyNice(word);

            Assert.That(isNice, Is.EqualTo(isNiceExpected));
        }
Example #4
0
        public void Day05()
        {
            var d = new Day05();

            Assert.AreEqual(959, d.MaxSeatID());
            Assert.AreEqual(527, d.MySeatID());
        }
Example #5
0
        public void Day05()
        {
            var d = new Day05();

            Assert.AreEqual(13210611, d.DoCalc(1));
            Assert.AreEqual(584126, d.DoCalc(5));
        }
Example #6
0
        public void Day05()
        {
            var day = new Day05();

            Assert.Equal(355965, day.FirstPart());
            Assert.Equal(26948068, day.SecondPart());
        }
Example #7
0
    public void TestParseLines()
    {
        var data = @"0,9 -> 5,9
                     8,0 -> 0,8
                     9,4 -> 3,4
                     2,2 -> 2,1
                     7,0 -> 7,4
                     6,4 -> 2,0
                     0,9 -> 2,9
                     3,4 -> 1,4
                     0,0 -> 8,8
                     5,5 -> 8,2";

        var expected = new List <Day05.VentLine>()
        {
            new Day05.VentLine(0, 9, 5, 9),
            new Day05.VentLine(8, 0, 0, 8),
            new Day05.VentLine(9, 4, 3, 4),
            new Day05.VentLine(2, 2, 2, 1),
            new Day05.VentLine(7, 0, 7, 4),
            new Day05.VentLine(6, 4, 2, 0),
            new Day05.VentLine(0, 9, 2, 9),
            new Day05.VentLine(3, 4, 1, 4),
            new Day05.VentLine(0, 0, 8, 8),
            new Day05.VentLine(5, 5, 8, 2),
        };

        var tested = Day05.ParseLines(data);

        Assert.Equal(expected, tested);
    }
Example #8
0
        public void TestPart2()
        {
            int part2Solution = 636;
            var day5          = new Day05();

            Assert.Equal(part2Solution, actual: day5.ExecutePart2());
        }
Example #9
0
        public void TestColumns()
        {
            var day    = new Day05();
            var result = day.FindId("FBFBBFFRLR");

            result.Should().Be(357);
        }
Example #10
0
        public void Step2()
        {
            var rows   = File.ReadAllLines(@"c:\code\aoc 2017\input_05.txt");
            var indata = rows.Select(r => int.Parse(r.Trim()));

            Console.WriteLine(Day05.Solve2(indata));
        }
Example #11
0
        public void Test2()
        {
            var data   = "dabAcCaCBAcCcaDA";
            var result = Day05.Solve2(data);

            Assert.Equal(4, result);
        }
Example #12
0
        public void Part1(string input, int expected)
        {
            var solver = new Day05();
            var result = solver.GetSeatId(input);

            result.ShouldBe(expected);
        }
Example #13
0
        public void GetDay05Part02AnswerTest()
        {
            int expected = 649;
            int actual   = Day05.GetDay05Part02Answer();

            Assert.Equal(expected, actual);
        }
Example #14
0
        public void Solve2()
        {
            var data   = File.ReadAllText("C:\\Code\\aoc2018\\aoc2018\\Data\\input05.txt").Trim();
            var result = Day05.Solve2(data);

            _output.WriteLine(result.ToString());
        }
Example #15
0
        public void TestPart1()
        {
            int part1Solution = 947;
            var day5          = new Day05();

            Assert.Equal(part1Solution, day5.ExecutePart1());
        }
Example #16
0
        public void ReducePolymer__Remove_cC_AtStart()
        {
            Day05 day05 = new Day05();

            string result = day05.ReducePolymer("cCAAAA");

            Assert.AreEqual("AAAA", result);
        }
Example #17
0
        public void ReducePolymer__Remove_Only_cC()
        {
            Day05 day05 = new Day05();

            string result = day05.ReducePolymer("cC");

            Assert.AreEqual("", result);
        }
Example #18
0
        public void ReducePolymer__Remove_cC_AtEnd()
        {
            Day05 day05 = new Day05();

            string result = day05.ReducePolymer("dabAcC");

            Assert.AreEqual("dabA", result);
        }
Example #19
0
        public void RemoveUnitTypeFromPolymer__Remove_D()
        {
            Day05 day05 = new Day05();

            string result = day05.RemoveUnitTypeFromPolymer("dabAcCaCBAcCcaDA", 'D');

            Assert.AreEqual("abAcCaCBAcCcaA", result);
        }
Example #20
0
        public void FullyReducePolymer__Test()
        {
            Day05 day05 = new Day05();

            string result = day05.FullyReducePolymer("dabAcCaCBAcCcaDA");

            Assert.AreEqual("dabCBAcaDA", result);
        }
Example #21
0
        public void ReducePolymer__Irreductible()
        {
            Day05 day05 = new Day05();

            string result = day05.ReducePolymer("dabCBAcaDA");

            Assert.AreEqual("dabCBAcaDA", result);
        }
Example #22
0
    public async Task Y2019_Day05_RunProgram_Returns_Correct_Output(string program, int input, long expected)
    {
        // Act
        long actual = await Day05.RunProgramAsync(program, input, CancellationToken.None);

        // Assert
        actual.ShouldBe(expected);
    }
Example #23
0
    public static void Y2016_Day05_GeneratePassword_Returns_Correct_Solution(string doorId, bool isPositionSpecifiedByHash, string expected)
    {
        // Act
        string actual = Day05.GeneratePassword(doorId, isPositionSpecifiedByHash);

        // Assert
        actual.ShouldBe(expected);
    }
Example #24
0
        public void Solve2()
        {
            var input  = DataHelper.GetAllRows(5);
            var solver = new Day05();
            var result = solver.Solve2(input);

            Output.WriteLine(result.ToString());
        }
Example #25
0
        public void ResolvePart1__Test()
        {
            Day05 day05 = new Day05();

            string result = day05.ResolvePart1(new string[] { "dabAcCaCBAcCcaDA" });

            Assert.AreEqual("10", result);
        }
Example #26
0
 public void Day05Part2()
 {
     Assert.IsTrue(Day05.IsNice2("qjhvhtzxzqqjkmpb") == true);
     Assert.IsTrue(Day05.IsNice2("xxyxx") == true);
     Assert.IsTrue(Day05.IsNice2("uurcxstgmygtbstg") == false);
     Assert.IsTrue(Day05.IsNice2("ieodomkazucvgmuy") == false);
     Assert.IsTrue(Day05.IsNice2("fbuqqaatackrvemm") == false);
 }
Example #27
0
        public void ReducePolymer__Remove_cCc()
        {
            Day05 day05 = new Day05();

            string result = day05.ReducePolymer("dabCBAcCcaDA");

            Assert.AreEqual("dabCBAcaDA", result);
        }
Example #28
0
    public void Part2()
    {
        var expected = 12;
        var day      = new Day05();
        var actual   = day.Part2(_input);

        Assert.Equal(expected, actual);
    }
Example #29
0
 public void Day05Part1()
 {
     Assert.IsTrue(Day05.IsNice1("ugknbfddgicrmopn") == true);
     Assert.IsTrue(Day05.IsNice1("aaa") == true);
     Assert.IsTrue(Day05.IsNice1("jchzalrnumimnmhp") == false);
     Assert.IsTrue(Day05.IsNice1("haegwjzuvuyypxyu") == false);
     Assert.IsTrue(Day05.IsNice1("dvszwmarrgswjxmb") == false);
 }
Example #30
0
        public void LocateSeat_WithExampleSeats_LocatesSeat(string seat, int expectedRow, int expectedCol, int expectedId)
        {
            var result = Day05.LocateSeat(seat);

            Assert.Equal(expectedRow, result.row);
            Assert.Equal(expectedCol, result.column);
            Assert.Equal(expectedId, result.id);
        }