public void TestFillUndeterminedFieldsColumnToNo() { var grid = new BimaruGrid(2, 3); grid.FillUndeterminedFieldsColumn(1, BimaruValueConstraint.NO); BimaruValue[,] expectedFieldValues = new BimaruValue[2, 3] { { BimaruValue.UNDETERMINED, BimaruValue.UNDETERMINED, BimaruValue.UNDETERMINED }, { BimaruValue.UNDETERMINED, BimaruValue.UNDETERMINED, BimaruValue.UNDETERMINED } }; grid.AssertEqual(expectedFieldValues); }
public void TestFillUndeterminedFieldsRowToShip() { var grid = new BimaruGrid(2, 3); grid.FillUndeterminedFieldsRow(1, BimaruValueConstraint.SHIP); BimaruValue[,] expectedFieldValues = new BimaruValue[2, 3] { { BimaruValue.UNDETERMINED, BimaruValue.UNDETERMINED, BimaruValue.UNDETERMINED }, { BimaruValue.SHIP_UNDETERMINED, BimaruValue.SHIP_UNDETERMINED, BimaruValue.SHIP_UNDETERMINED } }; grid.AssertEqual(expectedFieldValues); }
public void TestOverwriteWith() { var grid = new BimaruGrid(1, 2); var p0 = new GridPoint(0, 0); var p1 = new GridPoint(0, 1); grid[p0] = BimaruValue.SHIP_SINGLE; grid[p1] = BimaruValue.UNDETERMINED; var overwrittenGrid = new BimaruGrid(2, 3); overwrittenGrid.OverwriteWith(grid); grid.AssertEqual(overwrittenGrid); }
public void TestFillUndeterminedFieldsColumnPreset() { var grid = new BimaruGrid(2, 3); grid[new GridPoint(0, 1)] = BimaruValue.WATER; grid.FillUndeterminedFieldsColumn(1, BimaruValueConstraint.SHIP); BimaruValue[,] expectedFieldValues = new BimaruValue[2, 3] { { BimaruValue.UNDETERMINED, BimaruValue.WATER, BimaruValue.UNDETERMINED }, { BimaruValue.UNDETERMINED, BimaruValue.SHIP_UNDETERMINED, BimaruValue.UNDETERMINED } }; grid.AssertEqual(expectedFieldValues); }
public void TestClone() { var grid = new BimaruGrid(1, 2); var p0 = new GridPoint(0, 0); var p1 = new GridPoint(0, 1); grid[p0] = BimaruValue.SHIP_SINGLE; grid[p1] = BimaruValue.UNDETERMINED; BimaruGrid clonedGrid = (BimaruGrid)grid.Clone(); grid.AssertEqual(clonedGrid); grid[p1] = BimaruValue.SHIP_SINGLE; Assert.AreEqual(BimaruValue.UNDETERMINED, clonedGrid[p1]); }