public void AllCombinations_TestCombinations(int testCaseId, int[] blackSequences, int rowLength, string[] expectedResults) { var s = new PossibilitiesPossibilitiesSquareGroup(blackSequences, rowLength); var results = s.AllCombinations(); Assert.That(results.HasExactBitSets(expectedResults), Is.True); }
public void FilterCombinations_WithEmptyFilterLists_ReturnsAllCombinations() { var s = new PossibilitiesPossibilitiesSquareGroup(new[] { 1 }, 2); var allCombinations = s.AllCombinations(); var filteredCombinations = s.FilterCombinations(new PartiallyCompleteGroup(new BitGroup(31), new BitGroup(31))); Assert.That(allCombinations.HasExactBitSets(filteredCombinations)); }
public void AllCombinations_ForSingleBlackSequenceInRowOfLength2_ReturnsTwoCombinationsWithTheBlackSequenceInOppositeLocations() { var s = new PossibilitiesPossibilitiesSquareGroup(new[] { 1 }, 2); var results = s.AllCombinations(); Assert.That(results.Count, Is.EqualTo(2)); Assert.That(results.HasExactBitSets("10", "01"), Is.True); }
public void AllCombinations_ForSingleBlackSequenceInRowOfLength1_ReturnsSingleBlackSquare() { var s = new PossibilitiesPossibilitiesSquareGroup(new[] { 1 }, 1); var results = s.AllCombinations(); Assert.That(results.Count, Is.EqualTo(1)); Assert.That(results.First(), Is.EqualTo(new BitGroup(1, "1"))); }
public void AllCombinations_PerformanceTestForLongRow() { var s = new PossibilitiesPossibilitiesSquareGroup(new[] { 1, 1, 1, 1, 1, 1, 1, 1 }, 31); var t = new Stopwatch(); t.Start(); var results = s.AllCombinations(); t.Stop(); Assert.That(t.ElapsedMilliseconds, Is.LessThan(2000)); }
[TestCase(6, new[] { 1, 1 }, 5, "00100", "10000", new[] { "00101" })] // zeroth cell is 0 and 2nd cell is 1 public void FilterCombinations(int testCaseId, int[] inputSequences, int listLength, string blackKnownSquares, string whiteKnownSquares, string[] expectedBitSets) { var s = new PossibilitiesPossibilitiesSquareGroup(inputSequences, listLength); var filteredCombinations = s.FilterCombinations(new PartiallyCompleteGroup(new BitGroup(31, blackKnownSquares), new BitGroup(31, whiteKnownSquares))); Assert.That(filteredCombinations.HasExactBitSets(expectedBitSets), Is.True); }
public void SolveSquares() { var s = new PossibilitiesPossibilitiesSquareGroup(new[] { 1 }, 2); var result = s.SolveSquares(new PartiallyCompleteGroup(new BitGroup(31, "10"), new BitGroup(31, "00"))); Assert.That(result.AnyNewlySolvedSquares, Is.True); }