コード例 #1
0
        public void Part1()
        {
            var day5   = new Day5();
            var actual = day5.ExecuteToEnd("0 3 0 1 -3", 0, x => ++ x);

            Assert.Equal(5, actual);
        }
コード例 #2
0
        public void Part2()
        {
            var day5   = new Day5();
            var actual = day5.ExecuteToEnd("0 3 0 1 -3", 0, x => (x >= 3 ? --x : ++x));

            Assert.Equal(10, actual);
        }
コード例 #3
0
        public void Part2_Answer()
        {
            var day5   = new Day5();
            var actual = day5.ExecuteToEnd(TEST_INPUT, 0, x => (x >= 3 ? --x : ++x));

            Assert.Equal(26948068, actual);
        }
コード例 #4
0
        private void TestSeatReverser()
        {
            var reverse = Day5.ReverseSeatId(567);

            Assert.Equal(70, reverse.row);
            Assert.Equal(7, reverse.col);
        }
コード例 #5
0
        public void Part1_Answer()
        {
            var day5   = new Day5();
            var actual = day5.ExecuteToEnd(TEST_INPUT, 0, x => ++ x);

            Assert.Equal(355965, actual);
        }
コード例 #6
0
        public void Day5Part1()
        {
            Day5 day5 = new Day5("C:\\advent-of-code\\input-day5.txt");

            string answer = day5.FinalAnswerPart1();

            Assert.Equal("822", answer);
        }
コード例 #7
0
        public void Test1(string firstInput, int thirdParamMode, int secondParamMode, int firstParamMode, int opCode)
        {
            var result = new Day5().GetParameters(firstInput);

            Assert.Equal(opCode, result.opCode);
            Assert.Equal(firstParamMode, result.firstParameterMode);
            Assert.Equal(secondParamMode, result.secondParameterMode);
            Assert.Equal(thirdParamMode, result.thirdParameterMode);
        }
コード例 #8
0
        public void Part1()
        {
            Assert.AreEqual(567, Day5.GetSeatId("BFFFBBFRRR"));
            Assert.AreEqual(119, Day5.GetSeatId("FFFBBBFRRR"));
            Assert.AreEqual(820, Day5.GetSeatId("BBFFBBFRLL"));

            Assert.AreEqual(820, new Day5(TestInput).Part1());
            Assert.AreEqual(915, new Day5(null).Part1());
        }
コード例 #9
0
        public void Day05Part1Test()
        {
            var day5 = new Day5();

            var actual   = day5.Part1();
            var expected = 922;

            Assert.AreEqual(expected, actual);
        }
コード例 #10
0
 public void Problem2()
 {
     Assert.AreEqual(597, Day5.Problem2());
 }
コード例 #11
0
 public void Problem1()
 {
     Assert.AreEqual(801, Day5.Problem1());
 }
コード例 #12
0
 private void TestParser(string seatString, int row, int column, int id)
 {
     Assert.Equal(row, Day5.GetRowFromSeatString(seatString));
     Assert.Equal(column, Day5.GetColumnFromSeatString(seatString));
     Assert.Equal(id, Day5.GetSeatId(row, column));
 }