##// END OF EJS Templates
Defines operations pool...
Alexandre Leroux -
r1204:e9fc95127967
parent child
Show More
@@ -2,3 +2,4
2 2
3 3 const QString NB_MAX_OPERATIONS_PROPERTY = QStringLiteral("component");
4 4 const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables");
5 const QString AVAILABLE_OPERATIONS_PROPERTY = QStringLiteral("availableOperations");
@@ -18,4 +18,7 extern const QString NB_MAX_OPERATIONS_PROPERTY;
18 18 /// Max number of variables to manipulate through operations
19 19 extern const QString NB_MAX_VARIABLES_PROPERTY;
20 20
21 /// Set of operations available for the test
22 extern const QString AVAILABLE_OPERATIONS_PROPERTY;
23
21 24 #endif // SCIQLOP_FUZZINGDEFS_H
@@ -31,6 +31,18 using VariablesPool = std::map<VariableId, std::shared_ptr<Variable> >;
31 31 // Defaults values used when the associated properties have not been set for the test
32 32 const auto NB_MAX_OPERATIONS_DEFAULT_VALUE = 100;
33 33 const auto NB_MAX_VARIABLES_DEFAULT_VALUE = 1;
34 const auto AVAILABLE_OPERATIONS_DEFAULT_VALUE
35 = QVariant::fromValue(OperationsTypes{FuzzingOperationType::CREATE});
36 OperationsPool createOperationsPool(const OperationsTypes &types)
37 {
38 OperationsPool result{};
39
40 std::transform(types.cbegin(), types.cend(), std::inserter(result, result.end()),
41 [](const auto &type) { return FuzzingOperationFactory::create(type); });
42
43 return result;
44 }
45
34 46 /**
35 47 * Class to run random tests
36 48 */
@@ -72,6 +84,14 private:
72 84 return result;
73 85 }
74 86
87 OperationsPool operationsPool() const
88 {
89 static auto result = createOperationsPool(
90 m_Properties.value(AVAILABLE_OPERATIONS_PROPERTY, AVAILABLE_OPERATIONS_DEFAULT_VALUE)
91 .value<OperationsTypes>());
92 return result;
93 }
94
75 95 VariableController &m_VariableController;
76 96 Properties m_Properties;
77 97 VariablesPool m_VariablesPool;
General Comments 0
You need to be logged in to leave comments. Login now