Пример #1
0
 public void FindNumDifferentCharactersTest()
 {
     Assert.AreEqual(0, Day02.FindNumDifferentCharacters("abcdef", "abcdef"));
     Assert.AreEqual(1, Day02.FindNumDifferentCharacters("abcdef", "Xbcdef"));
     Assert.AreEqual(1, Day02.FindNumDifferentCharacters("abcdef", "abcdeX"));
     Assert.AreEqual(2, Day02.FindNumDifferentCharacters("abcdef", "abcdXX"));
 }
Пример #2
0
        public void Part2_WhenCalled_ProducesCorrectSolution(string[] input, int expected)
        {
            var solve = new Day02();

            int actual = solve.Part2(input);

            Assert.Equal(expected, actual);
        }
Пример #3
0
        public void FindDoublesAndTriplesTest()
        {
            var boxIDs = Common.ParseStringArray(InputData.ResourceManager.GetObject("D02_E1").ToString().Replace(",", Environment.NewLine));

            Assert.AreEqual(7, boxIDs.Length);
            var expectedDoubles = new int[] { 0, 1, 1, 0, 1, 1, 0 };
            var expectedTriples = new int[] { 0, 1, 0, 1, 0, 0, 1 };

            int doubles, triples;

            for (int i = 0; i < 7; i++)
            {
                Day02.FindDoublesAndTriples(boxIDs[i], out doubles, out triples);
                Assert.AreEqual(expectedDoubles[i], doubles);
                Assert.AreEqual(expectedTriples[i], triples);
            }
        }
Пример #4
0
 public void FindCommonCharactersTest()
 {
     Assert.AreEqual("abcefg", Day02.FindCommonCharacters("abcdefg", "abcXefg"));
     Assert.AreEqual("cde", Day02.FindCommonCharacters("abcdefg", "XXcdeXX"));
 }
Пример #5
0
        public void Puzzle2Test()
        {
            var commonCharacters = Day02.Puzzle2(inputDay02);

            Assert.AreEqual("iosnxmfkpabcjpdywvrtahluy", commonCharacters);
        }
Пример #6
0
        public void Puzzle2ExampleTest()
        {
            var commonCharacters = Day02.Puzzle2(InputData.ResourceManager.GetObject("D02_E2").ToString().Replace(",", Environment.NewLine));

            Assert.AreEqual("fgij", commonCharacters);
        }
Пример #7
0
        public void Puzzle1Test()
        {
            var checksum = Day02.Puzzle1(inputDay02);

            Assert.AreEqual(8610, checksum);
        }
Пример #8
0
        public void Puzzle1ExampleTest()
        {
            var checksum = Day02.Puzzle1(InputData.ResourceManager.GetObject("D02_E1").ToString().Replace(",", Environment.NewLine));

            Assert.AreEqual(12, checksum);
        }