Skip to content

Commit 76c9ec1

Browse files
committed
Move test data from test code to data files
The test_get_sketches_reports unit test makes assertions of the data the function will return given a set of input report files. Previously, the assertion data was defined in the test code. That was a significant amount of data, which added a lot of code to the test that is not of interest to the test code maintainer. This will become much more problematic if additional variants of the test are added in the future to provide coverage for other conditions. The problem is solved by moving the data to a JSON file. The test loads the data from the file when making the assertion.
1 parent c41445b commit 76c9ec1

File tree

8 files changed

+752
-278
lines changed

8 files changed

+752
-278
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"commit_hash": "d8fd302",
3+
"commit_url": "https://example.com/foo",
4+
"boards": [
5+
{
6+
"board": "arduino:avr:leonardo",
7+
"sketches": [
8+
{
9+
"name": "examples/Bar",
10+
"compilation_success": true,
11+
"sizes": [
12+
{
13+
"name": "flash",
14+
"maximum": 28672,
15+
"current": {
16+
"absolute": 3494,
17+
"relative": 12.19
18+
},
19+
"previous": {
20+
"absolute": "N/A",
21+
"relative": "N/A"
22+
},
23+
"delta": {
24+
"absolute": "N/A",
25+
"relative": "N/A"
26+
}
27+
},
28+
{
29+
"name": "RAM for global variables",
30+
"maximum": 2560,
31+
"current": {
32+
"absolute": 153,
33+
"relative": 5.97
34+
},
35+
"previous": {
36+
"absolute": "N/A",
37+
"relative": "N/A"
38+
},
39+
"delta": {
40+
"absolute": "N/A",
41+
"relative": "N/A"
42+
}
43+
}
44+
]
45+
},
46+
{
47+
"name": "examples/Foo",
48+
"compilation_success": true,
49+
"sizes": [
50+
{
51+
"name": "flash",
52+
"maximum": 28672,
53+
"current": {
54+
"absolute": 3462,
55+
"relative": 12.07
56+
},
57+
"previous": {
58+
"absolute": 3474,
59+
"relative": 12.12
60+
},
61+
"delta": {
62+
"absolute": -12,
63+
"relative": -0.05
64+
}
65+
},
66+
{
67+
"name": "RAM for global variables",
68+
"maximum": 2560,
69+
"current": {
70+
"absolute": 149,
71+
"relative": 5.82
72+
},
73+
"previous": {
74+
"absolute": 149,
75+
"relative": 5.82
76+
},
77+
"delta": {
78+
"absolute": 0,
79+
"relative": 0.0
80+
}
81+
}
82+
]
83+
}
84+
],
85+
"sizes": [
86+
{
87+
"name": "flash",
88+
"maximum": 28672,
89+
"delta": {
90+
"absolute": {
91+
"minimum": -12,
92+
"maximum": -12
93+
},
94+
"relative": {
95+
"minimum": -0.05,
96+
"maximum": -0.05
97+
}
98+
}
99+
},
100+
{
101+
"name": "RAM for global variables",
102+
"maximum": 2560,
103+
"delta": {
104+
"absolute": {
105+
"minimum": 0,
106+
"maximum": 0
107+
},
108+
"relative": {
109+
"minimum": 0.0,
110+
"maximum": 0.0
111+
}
112+
}
113+
}
114+
]
115+
}
116+
]
117+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"commit_hash": "d8fd302",
3+
"commit_url": "https://example.com/foo",
4+
"boards": [
5+
{
6+
"board": "arduino:avr:uno",
7+
"sketches": [
8+
{
9+
"name": "examples/Bar",
10+
"compilation_success": true,
11+
"sizes": [
12+
{
13+
"name": "flash",
14+
"maximum": 32256,
15+
"current": {
16+
"absolute": 1460,
17+
"relative": 4.53
18+
},
19+
"previous": {
20+
"absolute": "N/A",
21+
"relative": "N/A"
22+
},
23+
"delta": {
24+
"absolute": "N/A",
25+
"relative": "N/A"
26+
}
27+
},
28+
{
29+
"name": "RAM for global variables",
30+
"maximum": 2048,
31+
"current": {
32+
"absolute": 190,
33+
"relative": 9.28
34+
},
35+
"previous": {
36+
"absolute": "N/A",
37+
"relative": "N/A"
38+
},
39+
"delta": {
40+
"absolute": "N/A",
41+
"relative": "N/A"
42+
}
43+
}
44+
]
45+
},
46+
{
47+
"name": "examples/Foo",
48+
"compilation_success": true,
49+
"sizes": [
50+
{
51+
"name": "flash",
52+
"maximum": 32256,
53+
"current": {
54+
"absolute": 444,
55+
"relative": 1.38
56+
},
57+
"previous": {
58+
"absolute": 1438,
59+
"relative": 4.46
60+
},
61+
"delta": {
62+
"absolute": -994,
63+
"relative": -3.08
64+
}
65+
},
66+
{
67+
"name": "RAM for global variables",
68+
"maximum": 2048,
69+
"current": {
70+
"absolute": 9,
71+
"relative": 0.44
72+
},
73+
"previous": {
74+
"absolute": 184,
75+
"relative": 8.98
76+
},
77+
"delta": {
78+
"absolute": -175,
79+
"relative": -8.54
80+
}
81+
}
82+
]
83+
}
84+
],
85+
"sizes": [
86+
{
87+
"name": "flash",
88+
"maximum": 32256,
89+
"delta": {
90+
"absolute": {
91+
"minimum": -994,
92+
"maximum": -994
93+
},
94+
"relative": {
95+
"minimum": -3.08,
96+
"maximum": -3.08
97+
}
98+
}
99+
},
100+
{
101+
"name": "RAM for global variables",
102+
"maximum": 2048,
103+
"delta": {
104+
"absolute": {
105+
"minimum": -175,
106+
"maximum": -175
107+
},
108+
"relative": {
109+
"minimum": -8.54,
110+
"maximum": -8.54
111+
}
112+
}
113+
}
114+
]
115+
}
116+
]
117+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"commit_hash": "54815a7d1a30fcb0d77d98242b158e7845c0516d",
3+
"commit_url": "https://example.com/foo",
4+
"boards": [
5+
{
6+
"board": "arduino:mbed_portenta:envie_m7",
7+
"sketches": [
8+
{
9+
"name": "examples/Bar",
10+
"compilation_success": true,
11+
"sizes": [
12+
{
13+
"name": "flash",
14+
"maximum": "N/A",
15+
"current": {
16+
"absolute": "N/A",
17+
"relative": "N/A"
18+
}
19+
},
20+
{
21+
"name": "RAM for global variables",
22+
"maximum": "N/A",
23+
"current": {
24+
"absolute": "N/A",
25+
"relative": "N/A"
26+
}
27+
}
28+
]
29+
},
30+
{
31+
"name": "examples/Foo",
32+
"compilation_success": true,
33+
"sizes": [
34+
{
35+
"name": "flash",
36+
"maximum": "N/A",
37+
"current": {
38+
"absolute": "N/A",
39+
"relative": "N/A"
40+
}
41+
},
42+
{
43+
"name": "RAM for global variables",
44+
"maximum": "N/A",
45+
"current": {
46+
"absolute": "N/A",
47+
"relative": "N/A"
48+
}
49+
}
50+
]
51+
}
52+
],
53+
"sizes": [
54+
{
55+
"name": "flash",
56+
"maximum": "N/A"
57+
},
58+
{
59+
"name": "RAM for global variables",
60+
"maximum": "N/A"
61+
}
62+
]
63+
}
64+
]
65+
}

0 commit comments

Comments
 (0)