public void SnailNumber_ListMagnitude_OK() { var lines = Utils.ReadLinesFromFile("Day18Test5.txt"); SnailNumber snacc = SnailNumber.Builder(lines[0]); for (int i = 1; i < lines.Length; i++) { SnailNumber sn = SnailNumber.Builder(lines[i]); snacc = snacc.Add(sn); snacc.Reduce(); } long actual = snacc.Magnitude(); Assert.Equal(4140, actual); }
public void Day18_Puzzle1_OK() { var lines = Utils.ReadLinesFromFile("Day18.txt"); Assert.Equal(100, lines.Length); SnailNumber snacc = SnailNumber.Builder(lines[0]); for (int i = 1; i < lines.Length; i++) { SnailNumber sn = SnailNumber.Builder(lines[i]); snacc = snacc.Add(sn); snacc.Reduce(); } long actual = snacc.Magnitude(); Assert.Equal(4088, actual); }