##// END OF EJS Templates
Some fixes...
Alexandre Leroux -
r1223:767abfa514f1
parent child
Show More
@@ -18,8 +18,8 struct SqpRange {
18 static SqpRange fromDateTime(const QDate &startDate, const QTime &startTime,
18 static SqpRange fromDateTime(const QDate &startDate, const QTime &startTime,
19 const QDate &endDate, const QTime &endTime)
19 const QDate &endDate, const QTime &endTime)
20 {
20 {
21 return {DateUtils::secondsSinceEpoch(QDateTime{startDate, startTime}),
21 return {DateUtils::secondsSinceEpoch(QDateTime{startDate, startTime, Qt::UTC}),
22 DateUtils::secondsSinceEpoch(QDateTime{endDate, endTime})};
22 DateUtils::secondsSinceEpoch(QDateTime{endDate, endTime, Qt::UTC})};
23 }
23 }
24
24
25 /// Start time (UTC)
25 /// Start time (UTC)
@@ -3,6 +3,7
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 INITIAL_RANGE_PROPERTY = QStringLiteral("initialRange");
6 const QString MAX_RANGE_PROPERTY = QStringLiteral("maxRange");
7 const QString MAX_RANGE_PROPERTY = QStringLiteral("maxRange");
7 const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool");
8 const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool");
8 const QString PROVIDER_PROPERTY = QStringLiteral("provider");
9 const QString PROVIDER_PROPERTY = QStringLiteral("provider");
@@ -30,6 +30,10 extern const QString NB_MAX_VARIABLES_PROPERTY;
30 /// Set of operations available for the test
30 /// Set of operations available for the test
31 extern const QString AVAILABLE_OPERATIONS_PROPERTY;
31 extern const QString AVAILABLE_OPERATIONS_PROPERTY;
32
32
33
34 /// Range with which the timecontroller is initialized
35 extern const QString INITIAL_RANGE_PROPERTY;
36
33 /// Max range that an operation can reach
37 /// Max range that an operation can reach
34 extern const QString MAX_RANGE_PROPERTY;
38 extern const QString MAX_RANGE_PROPERTY;
35
39
@@ -34,11 +34,14 struct CreateOperation : public IFuzzingOperation {
34 = properties.value(PROVIDER_PROPERTY).value<std::shared_ptr<IDataProvider> >();
34 = properties.value(PROVIDER_PROPERTY).value<std::shared_ptr<IDataProvider> >();
35
35
36 auto variableName = QString{"Var_%1"}.arg(QUuid::createUuid().toString());
36 auto variableName = QString{"Var_%1"}.arg(QUuid::createUuid().toString());
37 qCInfo(LOG_FuzzingOperations())
37 qCInfo(LOG_FuzzingOperations()).noquote()
38 << "Creating variable" << variableName << "(metadata:" << variableMetadata << ")";
38 << "Creating variable" << variableName << "(metadata:" << variableMetadata << ")";
39
39
40 auto newVariable
40 auto newVariable
41 = variableController.createVariable(variableName, variableMetadata, variableProvider);
41 = variableController.createVariable(variableName, variableMetadata, variableProvider);
42
43 // Updates variable's state
44 variableState.m_Range = properties.value(INITIAL_RANGE_PROPERTY).value<SqpRange>();
42 std::swap(variableState.m_Variable, newVariable);
45 std::swap(variableState.m_Variable, newVariable);
43 }
46 }
44 };
47 };
@@ -105,7 +108,7 struct MoveOperation : public IFuzzingOperation {
105 // Moves variable to its new range
108 // Moves variable to its new range
106 auto newVariableRange = SqpRange{m_RangeStartMoveFun(variableRange.m_TStart, delta),
109 auto newVariableRange = SqpRange{m_RangeStartMoveFun(variableRange.m_TStart, delta),
107 m_RangeEndMoveFun(variableRange.m_TEnd, delta)};
110 m_RangeEndMoveFun(variableRange.m_TEnd, delta)};
108 qCInfo(LOG_FuzzingOperations())
111 qCInfo(LOG_FuzzingOperations()).noquote()
109 << "Performing" << m_Label << "on" << variable->name() << "(from" << variableRange
112 << "Performing" << m_Label << "on" << variable->name() << "(from" << variableRange
110 << "to" << newVariableRange << ")...";
113 << "to" << newVariableRange << ")...";
111 variableController.onRequestDataLoading({variable}, newVariableRange, false);
114 variableController.onRequestDataLoading({variable}, newVariableRange, false);
@@ -113,8 +113,8 public:
113
113
114 void execute()
114 void execute()
115 {
115 {
116 qCInfo(LOG_TestAmdaFuzzing()) << "Running" << nbMaxOperations() << "operations on"
116 qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Running" << nbMaxOperations() << "operations on"
117 << nbMaxVariables() << "variable(s)...";
117 << nbMaxVariables() << "variable(s)...";
118
118
119 auto canExecute = true;
119 auto canExecute = true;
120 for (auto i = 0; i < nbMaxOperations() && canExecute; ++i) {
120 for (auto i = 0; i < nbMaxOperations() && canExecute; ++i) {
@@ -139,12 +139,12 public:
139
139
140 }
140 }
141 else {
141 else {
142 qCInfo(LOG_TestAmdaFuzzing())
142 qCInfo(LOG_TestAmdaFuzzing()).noquote()
143 << "No more operations are available, the execution of the test will stop...";
143 << "No more operations are available, the execution of the test will stop...";
144 }
144 }
145 }
145 }
146
146
147 qCInfo(LOG_TestAmdaFuzzing()) << "Execution of the test completed.";
147 qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Execution of the test completed.";
148 }
148 }
149
149
150 private:
150 private:
@@ -242,8 +242,9 void TestAmdaFuzzing::testFuzzing()
242
242
243 // Sets initial range on time controller
243 // Sets initial range on time controller
244 SqpRange initialRange{initialRangeStart, initialRangeEnd};
244 SqpRange initialRange{initialRangeStart, initialRangeEnd};
245 qCInfo(LOG_TestAmdaFuzzing()) << "Setting initial range to" << initialRange << "...";
245 qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Setting initial range to" << initialRange << "...";
246 timeController.onTimeToUpdate(initialRange);
246 timeController.onTimeToUpdate(initialRange);
247 properties.insert(INITIAL_RANGE_PROPERTY, QVariant::fromValue(initialRange));
247
248
248 FuzzingTest test{variableController, properties};
249 FuzzingTest test{variableController, properties};
249 test.execute();
250 test.execute();
General Comments 0
You need to be logged in to leave comments. Login now