MailJDTourDownloadDocsQualityTestsCoverage

Which source lines and branches the tests execute. Lines 91.5 %, branches 75.0 % (minimum 85 % and 72 %). main @ 399ffe3d · 21 October 2026 · pipeline 7238.

GCC Code Coverage Report


Directory: src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 97.3% 36 / 0 / 37
Functions: 100.0% 6 / 0 / 6
Branches: 98.3% 58 / 0 / 59

data/RelationGraphGenerations.cpp
Line Branch Exec Source
1 // Generations of the relationship graph: which edges place people in
2 // generations and the breadth-first generation numbers (declared in
3 // RelationGraphRows.h, split from RelationGraphRows.cpp).
4 #include "RelationGraphRows.h"
5
6 #include "RelationGraphTree.h"
7 #include "RelationVocabulary.h"
8
9 #include <QSet>
10 #include <cmath>
11
12 namespace RelationGraphLayout {
13
14 namespace {
15
16 34196 bool isRelation(const RelationGraph::Edge &edge) {
17
4/4
✓ Branch 4 → 5 taken 8049 times.
✓ Branch 4 → 8 taken 26147 times.
✓ Branch 7 → 8 taken 7349 times.
✓ Branch 7 → 9 taken 700 times.
34196 return edge.kind == QLatin1String("relation") || edge.kind == QLatin1String("inferred");
18 }
19
20 } // namespace
21
22 24669 bool kinStep(const RelationGraph::Edge &edge, int *step) {
23
4/4
✓ Branch 3 → 4 taken 24251 times.
✓ Branch 3 → 7 taken 418 times.
✓ Branch 5 → 6 taken 17277 times.
✓ Branch 5 → 7 taken 6974 times.
24669 return isRelation(edge) && RelationGraph::generationStep(edge.type, step);
24 }
25
26 17079 bool isParentEdge(const RelationGraph::Edge &edge) {
27 17079 int step = 0;
28
8/8
✓ Branch 2 → 3 taken 17079 times.
✓ Branch 3 → 4 taken 11399 times.
✓ Branch 3 → 8 taken 5680 times.
✓ Branch 4 → 5 taken 5303 times.
✓ Branch 4 → 8 taken 6096 times.
✓ Branch 5 → 6 taken 5303 times.
✓ Branch 6 → 7 taken 4245 times.
✓ Branch 6 → 8 taken 1058 times.
34158 return kinStep(edge, &step) && std::abs(step) == 1 && RelationGraph::isDescent(edge.type);
29 }
30
31 9527 bool isPartnerEdge(const RelationGraph::Edge &edge) {
32
1/1
✓ Branch 2 → 3 taken 9527 times.
9527 const QString type = RelationVocabulary::canonical(edge.type);
33
6/6
✓ Branch 4 → 5 taken 9245 times.
✓ Branch 4 → 12 taken 282 times.
✓ Branch 7 → 8 taken 7521 times.
✓ Branch 7 → 11 taken 1724 times.
✓ Branch 10 → 11 taken 24 times.
✓ Branch 10 → 12 taken 7497 times.
19054 return isRelation(edge) && (type == QLatin1String("spouse") || type == QLatin1String("ex-partner"));
34 9527 }
35
36 405 QHash<int, int> generations(const RelationGraph::Graph &graph, const QList<int> &nodes, int root) {
37
1/1
✓ Branch 4 → 5 taken 405 times.
405 const QSet<int> members(nodes.cbegin(), nodes.cend());
38 405 QHash<int, QList<QPair<int, int>>> adjacent; // node → (other, generations the other sits above)
39
2/2
✓ Branch 28 → 7 taken 238594 times.
✓ Branch 28 → 29 taken 405 times.
238999 for (const RelationGraph::Edge &edge : graph.edges) {
40 238594 int step = 0;
41
10/11
✓ Branch 8 → 9 taken 238594 times.
✗ Branch 8 → 15 not taken.
✓ Branch 10 → 11 taken 3214 times.
✓ Branch 10 → 15 taken 235380 times.
✓ Branch 12 → 13 taken 2292 times.
✓ Branch 12 → 15 taken 922 times.
✓ Branch 13 → 14 taken 2292 times.
✓ Branch 14 → 15 taken 56 times.
✓ Branch 14 → 16 taken 2236 times.
✓ Branch 17 → 18 taken 236358 times.
✓ Branch 17 → 19 taken 2236 times.
238594 if (edge.from == edge.to || !members.contains(edge.from) || !members.contains(edge.to) || !kinStep(edge, &step))
42 236358 continue;
43
2/2
✓ Branch 19 → 20 taken 2236 times.
✓ Branch 21 → 22 taken 2236 times.
2236 adjacent[edge.from].append({edge.to, step});
44
2/2
✓ Branch 22 → 23 taken 2236 times.
✓ Branch 24 → 25 taken 2236 times.
2236 adjacent[edge.to].append({edge.from, -step});
45 }
46
1/1
✓ Branch 30 → 31 taken 405 times.
405 QHash<int, int> generation{{root, 0}};
47
1/1
✓ Branch 31 → 32 taken 405 times.
405 QList<int> queue{root};
48
2/2
✓ Branch 53 → 33 taken 1844 times.
✓ Branch 53 → 54 taken 405 times.
2249 for (int head = 0; head < queue.size(); ++head)
49
4/4
✓ Branch 35 → 36 taken 1844 times.
✓ Branch 36 → 37 taken 1844 times.
✓ Branch 49 → 38 taken 4460 times.
✓ Branch 49 → 50 taken 1844 times.
6304 for (const auto &[other, step] : adjacent.value(queue.at(head)))
50
2/2
✓ Branch 42 → 43 taken 1439 times.
✓ Branch 42 → 47 taken 3021 times.
4460 if (!generation.contains(other)) {
51
1/1
✓ Branch 45 → 46 taken 1439 times.
1439 generation.insert(other, generation.value(queue.at(head)) + step);
52
1/1
✓ Branch 46 → 47 taken 1439 times.
1439 queue.append(other);
53 1844 }
54 405 return generation;
55 405 }
56
57 336 QHash<int, int> allGenerations(const RelationGraph::Graph &graph, const QList<int> &nodes) {
58 336 QHash<int, int> all;
59
2/2
✓ Branch 13 → 4 taken 1492 times.
✓ Branch 13 → 14 taken 336 times.
1828 for (int node : nodes)
60
2/2
✓ Branch 6 → 7 taken 338 times.
✓ Branch 6 → 11 taken 1154 times.
1492 if (!all.contains(node))
61
2/2
✓ Branch 7 → 8 taken 338 times.
✓ Branch 8 → 9 taken 338 times.
338 all.insert(generations(graph, nodes, node));
62 336 return all;
63 ✗ }
64
65 } // namespace RelationGraphLayout
66