コード例 #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);
        }
コード例 #2
0
        public void Stars()
        {
            var run = new Day05();

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

            Assert.That(isNice, Is.EqualTo(isNiceExpected));
        }
コード例 #4
0
ファイル: DayTestCases.cs プロジェクト: jjermanis/aoc2020
        public void Day05()
        {
            var d = new Day05();

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

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

            Assert.Equal(355965, day.FirstPart());
            Assert.Equal(26948068, day.SecondPart());
        }
コード例 #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);
    }
コード例 #8
0
ファイル: Day05Test.cs プロジェクト: joscalv/AdventOfCode2020
        public void TestPart2()
        {
            int part2Solution = 636;
            var day5          = new Day05();

            Assert.Equal(part2Solution, actual: day5.ExecutePart2());
        }
コード例 #9
0
ファイル: Day5Test.cs プロジェクト: therealjawss/aoc2020
        public void TestColumns()
        {
            var day    = new Day05();
            var result = day.FindId("FBFBBFFRLR");

            result.Should().Be(357);
        }
コード例 #10
0
ファイル: Test05.cs プロジェクト: htoomik/aoc2017
        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));
        }
コード例 #11
0
        public void Test2()
        {
            var data   = "dabAcCaCBAcCcaDA";
            var result = Day05.Solve2(data);

            Assert.Equal(4, result);
        }
コード例 #12
0
ファイル: Test05.cs プロジェクト: htoomik/aoc2020
        public void Part1(string input, int expected)
        {
            var solver = new Day05();
            var result = solver.GetSeatId(input);

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

            Assert.Equal(expected, actual);
        }
コード例 #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());
        }
コード例 #15
0
ファイル: Day05Test.cs プロジェクト: joscalv/AdventOfCode2020
        public void TestPart1()
        {
            int part1Solution = 947;
            var day5          = new Day05();

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

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

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

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

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

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

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

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

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

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

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

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

            Assert.AreEqual("dabCBAcaDA", result);
        }
コード例 #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);
    }
コード例 #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);
    }
コード例 #24
0
ファイル: Test05.cs プロジェクト: htoomik/aoc2020
        public void Solve2()
        {
            var input  = DataHelper.GetAllRows(5);
            var solver = new Day05();
            var result = solver.Solve2(input);

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

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

            Assert.AreEqual("10", result);
        }
コード例 #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);
 }
コード例 #27
0
        public void ReducePolymer__Remove_cCc()
        {
            Day05 day05 = new Day05();

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

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

        Assert.Equal(expected, actual);
    }
コード例 #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);
 }
コード例 #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);
        }