func Test_puzzleSetUp(t *testing.T) { input := board.Basic() newBoard := puzzle.New(input) b, _, _ := newBoard.Display() if b != board.Basic() { fmt.Println(b) t.Error("should equal: ", board.Basic()) } }
func Test_slowSolve(t *testing.T) { input := board.Basic() newBoard := puzzle.New(input) newBoard.Solve() b, _, _ := newBoard.Display() if b != board.Solved() { fmt.Println(b) t.Error("should equal solved board: ", board.Solved()) } }
func main() { i := board.Basic() sudoku := puzzle.New(i) sudoku.Grade() err := sudoku.SlowSolve() board, status, dif := sudoku.Display() if !err { fmt.Println(board, status, dif) } }
func Benchmark_slowSolveBasic(b *testing.B) { e := puzzle.New(board.Basic()) m := puzzle.New(board.Medium()) h := puzzle.New(board.Hard()) for n := 0; n < b.N; n++ { e.SlowSolve() m.SlowSolve() h.SlowSolve() } }
func Test_validate(t *testing.T) { input := board.Basic() // import standard input newBoard := puzzle.New(input) newBoard.Solve() v := newBoard.Validate() if !v { fmt.Println(v) t.Error("should equal true") } // import unsolvable input input = board.Broken() newBoard.FillPuzzle(input) newBoard.Solve() v = newBoard.Validate() if v { fmt.Println(v) t.Error("should equal false") } }