-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest.py
46 lines (34 loc) · 1.08 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
45
46
#coding=utf-8
__author__ = 'ding'
import unittest
import screen
screen.W, screen.H = 3, 3
from main import is_valid, is_around_valid
class TestValid(unittest.TestCase):
def setUp(self):
self.matrix = [
[1, 2, 3],
['*', 0, '*'],
[' ', '*', 1]
]
def test_is_valid(self):
assert is_valid(self.matrix, 0, 1) == True
assert is_valid(self.matrix, 0, 2) == False
assert is_valid(self.matrix, 2, 2) == False
def test_is_around_valid(self):
print 'test_is_around_valid'
assert is_around_valid(self.matrix, 1, 0) == True
assert is_around_valid(self.matrix, 0, 1) == False
assert is_around_valid(self.matrix, 2, 1) == False
class TestSearch(unittest.TestCase):
def setUp(self):
self.matrix = [
[1, 2, 1],
['*', 0, '*'],
[' ', '*', 1]
]
def test_is_valid(self):
assert is_valid(self.matrix, 0, 1) == True
assert is_valid(self.matrix, 2, 2) == False
if __name__ == '__main__':
unittest.main()