-
Notifications
You must be signed in to change notification settings - Fork 0
/
GraphSpec.py
68 lines (58 loc) · 1.96 KB
/
GraphSpec.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from Graph import Graph
from PrettyPrint import pretty_print_list
R = [255, 0, 0] # Red
G = [0, 255, 0] # Green
B = [0, 0, 255] # Blue
O = [0, 0, 0]
def should_render_min_value():
name_of_test = "should_render_min_value"
graph = Graph(20, 40)
result = graph.render(20)
pretty_print_list(name_of_test, result)
assert result == [
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, B
], name_of_test
def should_render_scaled_to_middle():
name_of_test = "should_render_scaled_to_middle"
graph = Graph(20, 30)
result = graph.render(25)
pretty_print_list(name_of_test, result)
assert result == [
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, G,
O, O, O, O, O, O, O, G,
O, O, O, O, O, O, O, B,
O, O, O, O, O, O, O, B
], name_of_test
def should_render_multiple_times_and_shifting_old_values_left():
name_of_test = "should_render_multiple_times_and_shifting_old_values_left"
graph = Graph(20, 30)
graph.render(30)
graph.render(25)
result = graph.render(20)
pretty_print_list(name_of_test, result)
assert result == [
O, O, O, O, O, R, O, O,
O, O, O, O, O, R, O, O,
O, O, O, O, O, G, O, O,
O, O, O, O, O, G, O, O,
O, O, O, O, O, G, G, O,
O, O, O, O, O, G, G, O,
O, O, O, O, O, B, B, O,
O, O, O, O, O, B, B, B
], name_of_test
if __name__ == "__main__":
should_render_min_value()
should_render_scaled_to_middle()
should_render_multiple_times_and_shifting_old_values_left()
print("Tests passed")