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")); }
public void Part2_WhenCalled_ProducesCorrectSolution(string[] input, int expected) { var solve = new Day02(); int actual = solve.Part2(input); Assert.Equal(expected, actual); }
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); } }
public void FindCommonCharactersTest() { Assert.AreEqual("abcefg", Day02.FindCommonCharacters("abcdefg", "abcXefg")); Assert.AreEqual("cde", Day02.FindCommonCharacters("abcdefg", "XXcdeXX")); }
public void Puzzle2Test() { var commonCharacters = Day02.Puzzle2(inputDay02); Assert.AreEqual("iosnxmfkpabcjpdywvrtahluy", commonCharacters); }
public void Puzzle2ExampleTest() { var commonCharacters = Day02.Puzzle2(InputData.ResourceManager.GetObject("D02_E2").ToString().Replace(",", Environment.NewLine)); Assert.AreEqual("fgij", commonCharacters); }
public void Puzzle1Test() { var checksum = Day02.Puzzle1(inputDay02); Assert.AreEqual(8610, checksum); }
public void Puzzle1ExampleTest() { var checksum = Day02.Puzzle1(InputData.ResourceManager.GetObject("D02_E1").ToString().Replace(",", Environment.NewLine)); Assert.AreEqual(12, checksum); }