Esempio n. 1
0
 def test_eliminate(self):
     loc0 = (0,1)
     eliminate = sudoku.read_sudoku("./data/eliminateTest.txt")    #read the eliminate result
     problem = sudoku.read_sudoku("./data/data1.txt")  #read the puzzle
     problemSets = sudoku.convertToSets(problem)
     listOfLocation = sudoku.getRowLocations(loc0[0]) + sudoku.getColumnLocations(loc0[1]) \
                         + sudoku.getBoxLocations(loc0) 
     self.assertEqual(12, sudoku.eliminate(problemSets, loc0, listOfLocation))
     self.assertEqual(eliminate, problemSets)
Esempio n. 2
0
def testGetRowLocations():
    lst = [(5, 0), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (5, 7),
           (5, 8)]
    assert sudoku.getRowLocations(5) == lst
Esempio n. 3
0
def test_row_locations(row_locs, row, row2):
    assert getRowLocations(row) == row_locs[row2]
Esempio n. 4
0
 def test_getRowLocations(self):
     row0 = [(0, 0), (0, 1), (0, 2), (0, 3), 
             (0, 4), (0, 5), (0, 6), (0, 7), (0, 8)]
     self.assertEqual(row0, sudoku.getRowLocations(0))