Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void CanSolvePositionCharsPasswordRule(string[] passwords, int expected)
        {
            var day2   = new Day2();
            var result = day2.Solve <PositionCharsPasswordRule>(passwords);

            Assert.Equal(expected, result);
        }
Ejemplo n.º 3
0
        public void CalculatesTotalAreaCorrectly(string input, int expected)
        {
            var day2   = new Day2();
            var actual = day2.TotalArea(input);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
        public void CalculateTotalRibbon(string input, int expected)
        {
            var day2   = new Day2();
            var actual = day2.TotalRibbon(input);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 11
0
        public Day2Test()
        {
            var dataHandler = new DataHandler();

            this.day = new Day2(dataHandler)
            {
                pathToData = @"../../../Data/day2.txt"
            };
            this.day.ReadData();
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 13
0
 public void TestDay2Part2(string[] input, string answer)
 {
     Day2.
     Part2(input).
     ShouldBeEquivalentTo(answer);
 }
Ejemplo n.º 14
0
        public void Part2RealPuzzle()
        {
            var result = Day2.Solve(GetPuzzleInput(), Day2.Part2LineLogic);

            Assert.Equal(250, result);
        }
Ejemplo n.º 15
0
        public void Part2LineTests(string input, int expected)
        {
            var result = Day2.Part2LineLogic(input);

            Assert.Equal(expected, result);
        }
Ejemplo n.º 16
0
        public void Part1RealPuzzle()
        {
            var result = Day2.Solve(GetPuzzleInput(), Day2.Part1LineLogic);

            Assert.Equal(47136, result);
        }