public void Day03Part1_TestSolution() { string[] vectors = DayDataUtilities.ReadLinesFromFile("day03.txt"); Assert.Equal(2, vectors.Length); List <string> cmds0 = new List <string>(vectors[0].Split(',')); List <string> cmds1 = new List <string>(vectors[1].Split(',')); Assert.NotNull(cmds0); Assert.NotNull(cmds1); PathCmdsToPoints pathMaker = new PathCmdsToPoints(); List <Point> path0 = pathMaker.ParsePath(cmds0); List <Point> path1 = pathMaker.ParsePath(cmds1); int actualDist = pathMaker.FindAllInterSections(path0, path1); Assert.Equal(1264, actualDist); }
public void Day03Part1_Examples(string data0, string data1, int expectedDist) { List <string> cmds0 = new List <string>(data0.Split(',')); List <string> cmds1 = new List <string>(data1.Split(',')); Assert.NotNull(cmds0); Assert.NotNull(cmds1); PathCmdsToPoints pathMaker = new PathCmdsToPoints(); List <Point> path0 = pathMaker.ParsePath(cmds0); List <Point> path1 = pathMaker.ParsePath(cmds1); Assert.NotNull(path0); Assert.Equal(cmds0.Count + 1, path0.Count); Assert.NotNull(path1); Assert.Equal(cmds1.Count + 1, path1.Count); int actualDist = pathMaker.FindAllInterSections(path0, path1); Assert.Equal(expectedDist, actualDist); }