-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrectangles_count_test.py
More file actions
72 lines (60 loc) · 1.7 KB
/
rectangles_count_test.py
File metadata and controls
72 lines (60 loc) · 1.7 KB
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
import unittest
from rectangles import count
class WordTest(unittest.TestCase):
# unit tests
def test_zero_area_1(self):
assert 0 == count()
def test_zero_area_2(self):
lines = ""
assert 0 == count(lines)
def test_empty_area(self):
lines = " "
assert 0 == count(lines)
def test_one_rectangle(self):
lines = ["+-+",
"| |",
"+-+",
]
assert 1 == count(lines)
def test_two_rectangles_no_shared_parts(self):
lines = [" +-+",
" | |",
"+-+-+",
"| | ",
"+-+ "
]
assert 2 == count(lines)
def test_five_rectangles_three_regions(self):
lines = [" +-+",
" | |",
"+-+-+",
"| | |",
"+-+-+"
]
assert 5 == count(lines)
def test_incomplete_rectangles(self):
lines = [" +-+",
" |",
"+-+-+",
"| | -",
"+-+-+"
]
assert 1 == count(lines)
def test_complicated(self):
lines = ["+------+----+",
"| | |",
"+---+--+ |",
"| | |",
"+---+-------+"
]
assert 3 == count(lines)
def test_not_so_complicated(self):
lines = ["+------+----+",
"| | |",
"+------+ |",
"| | |",
"+---+-------+"
]
assert 2 == count(lines)
if __name__ == '__main__':
unittest.main()