@@ -14,6 +14,14 | |||||
14 | * @brief The SqpRange struct holds the information of time parameters |
|
14 | * @brief The SqpRange struct holds the information of time parameters | |
15 | */ |
|
15 | */ | |
16 | struct SqpRange { |
|
16 | struct SqpRange { | |
|
17 | /// Creates SqpRange from dates and times | |||
|
18 | static SqpRange fromDateTime(const QDate &startDate, const QTime &startTime, | |||
|
19 | const QDate &endDate, const QTime &endTime) | |||
|
20 | { | |||
|
21 | return {DateUtils::secondsSinceEpoch(QDateTime{startDate, startTime}), | |||
|
22 | DateUtils::secondsSinceEpoch(QDateTime{endDate, endTime})}; | |||
|
23 | } | |||
|
24 | ||||
17 | /// Start time (UTC) |
|
25 | /// Start time (UTC) | |
18 | double m_TStart; |
|
26 | double m_TStart; | |
19 | /// End time (UTC) |
|
27 | /// End time (UTC) |
@@ -3,5 +3,6 | |||||
3 | const QString NB_MAX_OPERATIONS_PROPERTY = QStringLiteral("component"); |
|
3 | const QString NB_MAX_OPERATIONS_PROPERTY = QStringLiteral("component"); | |
4 | const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables"); |
|
4 | const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables"); | |
5 | const QString AVAILABLE_OPERATIONS_PROPERTY = QStringLiteral("availableOperations"); |
|
5 | const QString AVAILABLE_OPERATIONS_PROPERTY = QStringLiteral("availableOperations"); | |
|
6 | const QString MAX_RANGE_PROPERTY = QStringLiteral("maxRange"); | |||
6 | const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool"); |
|
7 | const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool"); | |
7 | const QString PROVIDER_PROPERTY = QStringLiteral("provider"); |
|
8 | const QString PROVIDER_PROPERTY = QStringLiteral("provider"); |
@@ -26,6 +26,9 extern const QString NB_MAX_VARIABLES_PROPERTY; | |||||
26 | /// Set of operations available for the test |
|
26 | /// Set of operations available for the test | |
27 | extern const QString AVAILABLE_OPERATIONS_PROPERTY; |
|
27 | extern const QString AVAILABLE_OPERATIONS_PROPERTY; | |
28 |
|
28 | |||
|
29 | /// Max range that an operation can reach | |||
|
30 | extern const QString MAX_RANGE_PROPERTY; | |||
|
31 | ||||
29 | /// Set of metadata that can be associated to a variable |
|
32 | /// Set of metadata that can be associated to a variable | |
30 | extern const QString METADATA_POOL_PROPERTY; |
|
33 | extern const QString METADATA_POOL_PROPERTY; | |
31 |
|
34 |
@@ -38,6 +38,7 const auto NB_MAX_OPERATIONS_DEFAULT_VALUE = 100; | |||||
38 | const auto NB_MAX_VARIABLES_DEFAULT_VALUE = 1; |
|
38 | const auto NB_MAX_VARIABLES_DEFAULT_VALUE = 1; | |
39 | const auto AVAILABLE_OPERATIONS_DEFAULT_VALUE |
|
39 | const auto AVAILABLE_OPERATIONS_DEFAULT_VALUE | |
40 | = QVariant::fromValue(OperationsTypes{FuzzingOperationType::CREATE}); |
|
40 | = QVariant::fromValue(OperationsTypes{FuzzingOperationType::CREATE}); | |
|
41 | ||||
41 | // /////// // |
|
42 | // /////// // | |
42 | // Methods // |
|
43 | // Methods // | |
43 | // /////// // |
|
44 | // /////// // | |
@@ -186,6 +187,25 void TestAmdaFuzzing::testFuzzing() | |||||
186 | auto &variableController = sqpApp->variableController(); |
|
187 | auto &variableController = sqpApp->variableController(); | |
187 | auto &timeController = sqpApp->timeController(); |
|
188 | auto &timeController = sqpApp->timeController(); | |
188 |
|
189 | |||
|
190 | // Generates random initial range (bounded to max range) | |||
|
191 | auto maxRange = properties.value(MAX_RANGE_PROPERTY, QVariant::fromValue(INVALID_RANGE)) | |||
|
192 | .value<SqpRange>(); | |||
|
193 | ||||
|
194 | QVERIFY(maxRange != INVALID_RANGE); | |||
|
195 | ||||
|
196 | auto initialRangeStart | |||
|
197 | = RandomGenerator::instance().generateDouble(maxRange.m_TStart, maxRange.m_TEnd); | |||
|
198 | auto initialRangeEnd | |||
|
199 | = RandomGenerator::instance().generateDouble(maxRange.m_TStart, maxRange.m_TEnd); | |||
|
200 | if (initialRangeStart > initialRangeEnd) { | |||
|
201 | std::swap(initialRangeStart, initialRangeEnd); | |||
|
202 | } | |||
|
203 | ||||
|
204 | // Sets initial range on time controller | |||
|
205 | SqpRange initialRange{initialRangeStart, initialRangeEnd}; | |||
|
206 | qCInfo(LOG_TestAmdaFuzzing()) << "Setting initial range to" << initialRange << "..."; | |||
|
207 | timeController.onTimeToUpdate(initialRange); | |||
|
208 | ||||
189 | FuzzingTest test{variableController, properties}; |
|
209 | FuzzingTest test{variableController, properties}; | |
190 | test.execute(); |
|
210 | test.execute(); | |
191 | } |
|
211 | } |
General Comments 0
You need to be logged in to leave comments.
Login now