-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_brute_force.py
50 lines (37 loc) · 1.26 KB
/
test_brute_force.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
from nose import with_setup
from domino import build_matrix
from domino import brute_force
def compute(n):
matrix = build_matrix(n)
total = brute_force(matrix)
return total
def test_domino_with_correct_n_numbers():
""" Compute domino with 7 numbers """
assert compute(7) == 12, "Not ok"
def test_domino_with_0_numbers():
""" Compute domino with 0 numbers """
try:
compute(0)
except Exception as e:
assert isinstance(e, ValueError)
def test_domino_with_1_numbers():
""" Compute domino with 1 numbers """
assert compute(1) == 0, "Not ok"
def test_domino_with_2_numbers():
""" Compute domino with 2 numbers """
assert compute(2) == 1, "Not ok"
def test_domino_with_3_numbers():
""" Compute domino with 3 numbers """
assert compute(3) == 2, "Not ok"
def test_domino_with_4_numbers():
""" Compute domino with 4 numbers """
assert compute(4) == 4, "Not ok"
def test_domino_with_9_numbers():
""" Compute domino with 9 numbers """
assert compute(9) == 20, "Not ok"
def test_domino_with_15_numbers():
""" Compute domino with 15 numbers """
assert compute(15) == 56, "Not ok"
def test_domino_with_42_numbers():
""" Compute domino with 42 numbers """
assert compute(42) == 441, "Not ok"