Skip to content

Commit

Permalink
test scope fix/sudoku test formatting
Browse files Browse the repository at this point in the history
This commit fixes a bug in test scopes related to
solveInit.

Also fixes documentation placement in sudoku_test
  • Loading branch information
wsc1 committed Dec 3, 2018
1 parent 2671b84 commit b0d0306
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
5 changes: 3 additions & 2 deletions internal/xo/s.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,9 @@ func (s *S) cleanupSolve() {
drvd := s.Driver.Derive(s.x)
if drvd.TargetLevel < s.endTestLevel {
trail.Back(s.endTestLevel)
s.x = CNull
//break
trail.Assign(drvd.Unit, drvd.P)
s.x = trail.Prop()
continue
}
trail.Back(drvd.TargetLevel)
trail.Assign(drvd.Unit, drvd.P)
Expand Down
19 changes: 10 additions & 9 deletions sudoku_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@ func Example_sudoku() {
}
}
fmt.Printf("\n")
// Output: 5 2 9 1 3 6 7 4 8
// 4 3 1 7 8 5 2 9 6
// 8 7 6 4 9 2 1 3 5
// 1 6 3 2 4 8 5 7 9
// 2 4 5 9 1 7 8 6 3
// 7 9 8 5 6 3 4 1 2
// 6 5 4 3 2 1 9 8 7
// 3 1 2 8 7 9 6 5 4
// 9 8 7 6 5 4 3 2 1

}
// Output: 5 2 9 1 3 6 7 4 8
// 4 3 1 7 8 5 2 9 6
// 8 7 6 4 9 2 1 3 5
// 1 6 3 2 4 8 5 7 9
// 2 4 5 9 1 7 8 6 3
// 7 9 8 5 6 3 4 1 2
// 6 5 4 3 2 1 9 8 7
// 3 1 2 8 7 9 6 5 4
// 9 8 7 6 5 4 3 2 1
}

0 comments on commit b0d0306

Please sign in to comment.