-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_SudokuBoard.py
95 lines (77 loc) · 1.7 KB
/
test_SudokuBoard.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
from SudokuBoard import SudokuBoard
# '''534678912.
# 672195348.
# 198342567.
# 859761423.
# 426853791.
# 712924856.
# 961537284.
# 287419635.
# 345286179.
# '''
def test_validate_pass():
board = SudokuBoard([
'534678912.',
'672195348.',
'1983425 7.',
'859761423.',
'42 853791.',
'713924 56.',
'961537284.',
'287419635.',
'345286179.']
, True)
board.validate()
def test_get_solutions_1solved_solved():
board = SudokuBoard([
'534678912.',
'672195348.',
'1983425 7.',
'859761423.',
'42 853791.',
'713924 56.',
'961537284.',
'287419635.',
'345286179.']
, True)
solutions = board.get_solutions()
assert len(solutions) == 1
assert solutions.pop().backing_board[2][7] == 6
def test_has_duplicate_in_rows():
pass
def test_has_duplicate_in_cols():
assert SudokuBoard([
'534678912.',
'672195348.',
'198342567.',
'859761423.',
'426853791.',
'713924 86.',
'961537284.',
'287419635.',
'345286179.'], True).has_duplicate_in_cols()
def test_has_duplicate_in_box():
assert False
def test_get_boxes_numbers_lists():
assert False
def test_sudoku_board_str():
assert '''534|678|912|
672|195|348|
198|342|5 7|
859|761|423|
42 |853|791|
713|924| 56|
961|537|284|
287|419|635|
345|286|179|
''' == SudokuBoard([
'534678912.',
'672195348.',
'1983425 7.',
'859761423.',
'42 853791.',
'713924 56.',
'961537284.',
'287419635.',
'345286179.']
, True).__str__()