public void TestBiodiversity(string input, int expectedOutput) { var inputWithoutNewLines = new string(input.Where(c => c == '#' || c == '.').ToArray()); var grid = new Solver.ErisGrid(inputWithoutNewLines, false); Assert.AreEqual(expectedOutput, grid.GetBiodiversity()); }
public void TestUpdate(string input, string expectedState) { var inputWithoutNewLines = new string(input.Where(c => c == '#' || c == '.').ToArray()); var expectedWithoutNewLines = new string(expectedState.Where(c => c == '#' || c == '.').ToArray()); var expectedGrid = new Solver.ErisGrid(expectedWithoutNewLines, false); var inputGrid = new Solver.ErisGrid(inputWithoutNewLines, false); inputGrid.Step(); inputGrid.GetPrintableState().ToList().ForEach(s => System.Diagnostics.Trace.WriteLine(s)); Assert.AreEqual(expectedGrid.GetBiodiversity(), inputGrid.GetBiodiversity()); }