Пример #1
0
        public void ParsesExampleString(string input, Tuple <int, int, int> expected)
        {
            var day2   = new Day2();
            var actual = day2.ParseStringToTuple(input);

            Assert.Equal(expected, actual);
        }
Пример #2
0
        public void CanSolvePositionCharsPasswordRule(string[] passwords, int expected)
        {
            var day2   = new Day2();
            var result = day2.Solve <PositionCharsPasswordRule>(passwords);

            Assert.Equal(expected, result);
        }
Пример #3
0
        public void CalculatesTotalAreaCorrectly(string input, int expected)
        {
            var day2   = new Day2();
            var actual = day2.TotalArea(input);

            Assert.Equal(expected, actual);
        }
Пример #4
0
        public void CalculateRibbon(int x, int y, int z, int expected)
        {
            var day2   = new Day2();
            var actual = day2.CalculateRibbonLength(new Tuple <int, int, int>(x, y, z));

            Assert.Equal(expected, actual);
        }
Пример #5
0
        public void CalculatesCorrectSizeForSinglePresent(int x, int y, int z, int expected)
        {
            var day2   = new Day2();
            var actual = day2.CalculateArea(new Tuple <int, int, int>(x, y, z));

            Assert.Equal(expected, actual);
        }
Пример #6
0
        public void CalculateTotalRibbon(string input, int expected)
        {
            var day2   = new Day2();
            var actual = day2.TotalRibbon(input);

            Assert.Equal(expected, actual);
        }
Пример #7
0
        public void Part2FullTest()
        {
            var input  = new[] { "5 9 2 8", "9 4 7 3", "3 8 6 5" };
            var result = Day2.Solve(input, Day2.Part2LineLogic);

            Assert.Equal(9, result);
        }
Пример #8
0
        public void Part1FullTest()
        {
            var input  = new[] { "5 1 9 5", "7 5 3", "2 4 6 8" };
            var result = Day2.Solve(input, Day2.Part1LineLogic);

            Assert.Equal(18, result);
        }
Пример #9
0
        public void CalculatesRealTotalAreaCorrectly()
        {
            const int TotalArea = 1588178;

            var day2   = new Day2();
            var actual = day2.TotalArea(LoadFromResource.Load("AdventOfCode.Tests.TestData.Day2.txt"));

            Assert.Equal(TotalArea, actual);
        }
Пример #10
0
        public void ActualTotalRibbon()
        {
            const int TotalRibbon = 3783758;

            var day2   = new Day2();
            var actual = day2.TotalRibbon(LoadFromResource.Load("AdventOfCode.Tests.TestData.Day2.txt"));

            Assert.Equal(TotalRibbon, actual);
        }
Пример #11
0
        public Day2Test()
        {
            var dataHandler = new DataHandler();

            this.day = new Day2(dataHandler)
            {
                pathToData = @"../../../Data/day2.txt"
            };
            this.day.ReadData();
        }
Пример #12
0
        public void TestPartB()
        {
            string[] passwordAndPolicyStrings = new string[] {
                "1-3 a: abcde",
                "1-3 b: cdefg",
                "2-9 c: ccccccccc"
            };
            var  data           = new StringData(passwordAndPolicyStrings);
            int  expectedOutput = 1;
            Day2 day2           = new Day2(data);

            var actualOutut = day2.Puzzle2Solution();


            Assert.AreEqual(expectedOutput, actualOutut);
        }
Пример #13
0
 public void TestDay2Part2(string[] input, string answer)
 {
     Day2.
     Part2(input).
     ShouldBeEquivalentTo(answer);
 }
Пример #14
0
        public void Part2RealPuzzle()
        {
            var result = Day2.Solve(GetPuzzleInput(), Day2.Part2LineLogic);

            Assert.Equal(250, result);
        }
Пример #15
0
        public void Part2LineTests(string input, int expected)
        {
            var result = Day2.Part2LineLogic(input);

            Assert.Equal(expected, result);
        }
Пример #16
0
        public void Part1RealPuzzle()
        {
            var result = Day2.Solve(GetPuzzleInput(), Day2.Part1LineLogic);

            Assert.Equal(47136, result);
        }