public void FillingPartOfALineThatHasStateOutsideThatPartWithStateAndFlagFillsTheSectionWithThatStateAndFlagAndReturnsFalse() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); l[0].State = Cell.CellState.Blank; Assert.IsTrue(l.Fill(1, 2, Cell.CellState.Filled, 42)); var expectedStates = new Cell.CellState[5] { Cell.CellState.Blank, Cell.CellState.Filled, Cell.CellState.Filled, Cell.CellState.Unknown, Cell.CellState.Unknown }; var expectedFlags = new int[5] { 0, 42, 42, 0, 0 }; for (int i = 0; i < 5; i++) { Assert.AreEqual(expectedStates[i], l[i].State); Assert.AreEqual(expectedFlags[i], l[i].Flag); } }
public void IsValidReturnsTrueWhenHintMatchesContents_Hint0_Contents0() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); l.Fill(Cell.CellState.Blank); Assert.AreEqual(true, l.IsValid()); }
public void DistinctGroupsReturnsOneWithAllFilled() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); l.Fill(Cell.CellState.Filled); Assert.AreEqual(1, l.DistinctGroups()); }
public void DistinctGroupsReturnsZeroWithAllBlank() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); l.Fill(Cell.CellState.Blank); Assert.AreEqual(0, l.DistinctGroups()); }
public void IsValidReturnsFalseWhenHintsExistButAllBlank() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); l.Fill(Cell.CellState.Blank); l.Hints.AddRange(new int[] { 1 }); Assert.AreEqual(false, l.IsValid()); }
public void DistinctGroupsReturnsActualNumberOfGroupsWithTwoGroupsOfTwo() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); l.Fill(Cell.CellState.Filled); l[2].State = Cell.CellState.Blank; Assert.AreEqual(2, l.DistinctGroups()); }
public void IsValidReturnsTrueWhenPossibleSolutionsExist() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); l.Fill(0, 3, Cell.CellState.Blank); l[4].State = Cell.CellState.Blank; l.Hints.AddRange(new int[] { 1 }); Assert.AreEqual(true, l.IsValid()); }
public void IsValidReturnsFalseWhenNoPossibleSolutionsExist() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); l.Fill(0, 3, Cell.CellState.Filled); l[4].State = Cell.CellState.Filled; l.Hints.AddRange(new int[] { 3 }); Assert.AreEqual(false, l.IsValid()); }
public void IsValidReturnsFalseWhenGroupIsTooLarge_Hint3_Contents4_right() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); l[0].State = Cell.CellState.Blank; l.Fill(1, 4, Cell.CellState.Filled); l.Hints.AddRange(new int[] { 3 }); Assert.AreEqual(false, l.IsValid()); }
public void FillingALineWithStateFillsTheEntireLineWithThatStateAndReturnsTrue() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); Assert.IsTrue(l.Fill(Cell.CellState.Filled)); for (int i = 0; i < 5; i++) { Assert.AreEqual(Cell.CellState.Filled, l[i].State); } }
public void FillingPartOfALineWithStateFillsTheSectionWithThatStateAndReturnsTrue() { Nonogram n = new Nonogram(5, 1); CellLine l = n.Row(0); Assert.IsTrue(l.Fill(1, 2, Cell.CellState.Filled)); var expectedStates = new Cell.CellState[5] { Cell.CellState.Unknown, Cell.CellState.Filled, Cell.CellState.Filled, Cell.CellState.Unknown, Cell.CellState.Unknown }; for (int i = 0; i < 5; i++) { Assert.AreEqual(expectedStates[i], l[i].State); } }