-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
44 lines (31 loc) · 1.54 KB
/
test.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
from model import Board
from solver import solve_board
import unittest
class SolverTestCase(unittest.TestCase):
def _test_from_files(self, in_file_path, out_file_path):
with open(in_file_path) as f:
b_in = Board.from_file(f)
with open(out_file_path) as f:
b_out = Board.from_file(f)
solve_board(b_in)
self.assertEquals(b_in, b_out, "boards don't match (in=%s, out=%s)" % (in_file_path, out_file_path))
def test_easy1(self):
self._test_from_files('test_boards/easy/1.in', 'test_boards/easy/1.out')
def test_easy2(self):
self._test_from_files('test_boards/easy/2.in', 'test_boards/easy/2.out')
def test_easy3(self):
self._test_from_files('test_boards/easy/3.in', 'test_boards/easy/3.out')
def test_easy4(self):
self._test_from_files('test_boards/easy/4.in', 'test_boards/easy/4.out')
def test_hard1(self):
self._test_from_files('test_boards/hard/1.in', 'test_boards/hard/1.out')
def test_hard2(self):
self._test_from_files('test_boards/hard/2.in', 'test_boards/hard/2.out')
def test_harder1(self):
self._test_from_files('test_boards/harder/1.in', 'test_boards/harder/1.out')
def test_harder2(self):
self._test_from_files('test_boards/harder/2.in', 'test_boards/harder/2.out')
def test_hardest1(self):
self._test_from_files('test_boards/hardest/1.in', 'test_boards/hardest/1.out')
def test_hardest2(self):
self._test_from_files('test_boards/hardest/2.in', 'test_boards/hardest/2.out')