From a199540869ecf3e7654514621fb3f770dd43ef66 2017-12-19 14:05:11 From: Alexandre Leroux Date: 2017-12-19 14:05:11 Subject: [PATCH] Implements validation of variable's data (2) Checks that data are well-defined --- diff --git a/plugins/amda/tests/FuzzingValidators.cpp b/plugins/amda/tests/FuzzingValidators.cpp index 3b71a0b..9632599 100644 --- a/plugins/amda/tests/FuzzingValidators.cpp +++ b/plugins/amda/tests/FuzzingValidators.cpp @@ -1,4 +1,7 @@ #include "FuzzingValidators.h" +#include "FuzzingDefs.h" + +#include #include #include @@ -43,7 +46,22 @@ class LocalhostServerDataValidatorHelper : public DataValidatorHelper { public: void validate(const VariableState &variableState) const override { - /// @todo: complete + // Don't check data for null variable + if (!variableState.m_Variable || variableState.m_Range == INVALID_RANGE) { + return; + } + + auto message = "Checking variable's data..."; + auto toDateString = [](double value) { return DateUtils::dateTime(value).toString(); }; + + // Checks that data are defined + auto variableDataSeries = variableState.m_Variable->dataSeries(); + if (variableDataSeries == nullptr && variableState.m_Range != INVALID_RANGE) { + qCInfo(LOG_FuzzingValidators()).noquote() + << message << "FAIL: the variable has no data while a range is defined"; + QFAIL(""); + } + } };