func TestSolvesThis(t *testing.T) { input := Board{ Set{C(), C(1), C(), C(6), C(), C(7), C(), C(), C(4)}, Set{C(), C(4), C(2), C(), C(), C(), C(), C(), C()}, Set{C(8), C(7), C(), C(3), C(), C(), C(6), C(), C()}, Set{C(), C(8), C(), C(), C(7), C(), C(), C(2), C()}, Set{C(), C(), C(), C(8), C(9), C(3), C(), C(), C()}, Set{C(), C(3), C(), C(), C(6), C(), C(), C(1), C()}, Set{C(), C(), C(8), C(), C(), C(6), C(), C(4), C(5)}, Set{C(), C(), C(), C(), C(), C(), C(1), C(7), C()}, Set{C(4), C(), C(), C(9), C(), C(8), C(), C(6), C()}, } expected := Board{ Set{C(9), C(1), C(3), C(6), C(2), C(7), C(5), C(8), C(4)}, Set{C(6), C(4), C(2), C(5), C(8), C(9), C(7), C(3), C(1)}, Set{C(8), C(7), C(5), C(3), C(4), C(1), C(6), C(9), C(2)}, Set{C(5), C(8), C(9), C(1), C(7), C(4), C(3), C(2), C(6)}, Set{C(2), C(6), C(1), C(8), C(9), C(3), C(4), C(5), C(7)}, Set{C(7), C(3), C(4), C(2), C(6), C(5), C(8), C(1), C(9)}, Set{C(1), C(2), C(8), C(7), C(3), C(6), C(9), C(4), C(5)}, Set{C(3), C(9), C(6), C(4), C(5), C(2), C(1), C(7), C(8)}, Set{C(4), C(5), C(7), C(9), C(1), C(8), C(2), C(6), C(3)}, } output := input.Solve() matchers.AssertThat(t, output, matchers.Equals(expected)) }
func TestRemoves1sFromRestOfSquareWhenASubsetMustContainThem(t *testing.T) { input := []Set{ Set{C(1, 2), C(1, 3), C(1, 4), C(1, 4)}, Set{C(1, 4), C(1, 4), C(2), C(3)}, } intersect := []int{2, 3} expected := []Set{ Set{C(2), C(3), C(1, 4), C(1, 4)}, Set{C(1, 4), C(1, 4), C(2), C(3)}, } output := ConstrainLinearAndSquare(input, intersect) matchers.AssertThat(t, output, matchers.Equals(expected)) }
func DISABLED_TestSolvesExtremePuzzle(t *testing.T) { input := Board{ Set{C(), C(), C(5), C(6), C(), C(), C(), C(), C(7)}, Set{C(), C(6), C(), C(), C(4), C(), C(), C(8), C()}, Set{C(), C(), C(9), C(), C(), C(), C(), C(), C(1)}, Set{C(7), C(), C(), C(), C(), C(), C(1), C(), C()}, Set{C(), C(8), C(), C(), C(1), C(), C(), C(2), C()}, Set{C(), C(), C(2), C(), C(), C(), C(), C(), C(4)}, Set{C(5), C(), C(), C(), C(), C(), C(3), C(), C()}, Set{C(), C(2), C(), C(), C(9), C(), C(), C(6), C()}, Set{C(4), C(), C(), C(), C(), C(7), C(5), C(), C()}, } output := input.Solve() matchers.AssertThat(t, output.IsSolved(), matchers.IsTrue) }