@@ -39,6 +39,8 public: | |||
|
39 | 39 | } |
|
40 | 40 | }; |
|
41 | 41 | |
|
42 | /// Data resolution in local server's files | |
|
43 | const auto LOCALHOST_SERVER_RESOLUTION = 4; | |
|
42 | 44 | /** |
|
43 | 45 | * Implementation of @sa DataValidatorHelper for the local AMDA server |
|
44 | 46 | */ |
@@ -62,6 +64,45 public: | |||
|
62 | 64 | QFAIL(""); |
|
63 | 65 | } |
|
64 | 66 | |
|
67 | auto dataIts = variableDataSeries->xAxisRange(variableState.m_Range.m_TStart, | |
|
68 | variableState.m_Range.m_TEnd); | |
|
69 | ||
|
70 | // Checks that the data are well defined in the range: | |
|
71 | // - there is at least one data | |
|
72 | // - the data are consistent (no data holes) | |
|
73 | if (std::distance(dataIts.first, dataIts.second) == 0) { | |
|
74 | qCInfo(LOG_FuzzingValidators()).noquote() | |
|
75 | << message << "FAIL: the variable has no data"; | |
|
76 | QFAIL(""); | |
|
77 | } | |
|
78 | ||
|
79 | auto firstXAxisData = dataIts.first->x(); | |
|
80 | auto lastXAxisData = (dataIts.second - 1)->x(); | |
|
81 | ||
|
82 | if (std::abs(firstXAxisData - variableState.m_Range.m_TStart) > LOCALHOST_SERVER_RESOLUTION | |
|
83 | || std::abs(lastXAxisData - variableState.m_Range.m_TEnd) | |
|
84 | > LOCALHOST_SERVER_RESOLUTION) { | |
|
85 | qCInfo(LOG_FuzzingValidators()).noquote() | |
|
86 | << message << "FAIL: the data in the defined range are inconsistent (data hole " | |
|
87 | "found at the beginning or the end)"; | |
|
88 | QFAIL(""); | |
|
89 | } | |
|
90 | ||
|
91 | auto dataHoleIt = std::adjacent_find( | |
|
92 | dataIts.first, dataIts.second, [](const auto &it1, const auto &it2) { | |
|
93 | /// @todo: validate resolution | |
|
94 | return std::abs(it1.x() - it2.x()) > 2 * (LOCALHOST_SERVER_RESOLUTION - 1); | |
|
95 | }); | |
|
96 | ||
|
97 | if (dataHoleIt != dataIts.second) { | |
|
98 | qCInfo(LOG_FuzzingValidators()).noquote() | |
|
99 | << message << "FAIL: the data in the defined range are inconsistent (data hole " | |
|
100 | "found between times " | |
|
101 | << toDateString(dataHoleIt->x()) << "and " << toDateString((dataHoleIt + 1)->x()) | |
|
102 | << ")"; | |
|
103 | QFAIL(""); | |
|
104 | } | |
|
105 | ||
|
65 | 106 | } |
|
66 | 107 | }; |
|
67 | 108 |
General Comments 0
You need to be logged in to leave comments.
Login now