@@ -9,3 +9,4 const QString MAX_RANGE_PROPERTY = QStringLiteral("maxRange"); | |||||
9 | const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool"); |
|
9 | const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool"); | |
10 | const QString PROVIDER_PROPERTY = QStringLiteral("provider"); |
|
10 | const QString PROVIDER_PROPERTY = QStringLiteral("provider"); | |
11 | const QString OPERATION_DELAY_PROPERTY = QStringLiteral("operationDelay"); |
|
11 | const QString OPERATION_DELAY_PROPERTY = QStringLiteral("operationDelay"); | |
|
12 | const QString VALIDATORS_PROPERTY = QStringLiteral("validators"); |
@@ -48,6 +48,8 extern const QString PROVIDER_PROPERTY; | |||||
48 | /// Time left for an operation to execute |
|
48 | /// Time left for an operation to execute | |
49 | extern const QString OPERATION_DELAY_PROPERTY; |
|
49 | extern const QString OPERATION_DELAY_PROPERTY; | |
50 |
|
50 | |||
|
51 | /// Validators used to validate an operation | |||
|
52 | extern const QString VALIDATORS_PROPERTY; | |||
51 |
|
53 | |||
52 | // /////// // |
|
54 | // /////// // | |
53 | // Structs // |
|
55 | // Structs // |
@@ -1,7 +1,11 | |||||
1 | #ifndef SCIQLOP_FUZZINGVALIDATORS_H |
|
1 | #ifndef SCIQLOP_FUZZINGVALIDATORS_H | |
2 | #define SCIQLOP_FUZZINGVALIDATORS_H |
|
2 | #define SCIQLOP_FUZZINGVALIDATORS_H | |
3 |
|
3 | |||
|
4 | #include <memory> | |||
|
5 | #include <set> | |||
|
6 | ||||
4 | #include <QLoggingCategory> |
|
7 | #include <QLoggingCategory> | |
|
8 | #include <QMetaType> | |||
5 |
|
9 | |||
6 | Q_DECLARE_LOGGING_CATEGORY(LOG_FuzzingValidators) |
|
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_FuzzingValidators) | |
7 |
|
11 | |||
@@ -30,4 +34,7 struct FuzzingValidatorFactory { | |||||
30 | static std::unique_ptr<IFuzzingValidator> create(FuzzingValidatorType type); |
|
34 | static std::unique_ptr<IFuzzingValidator> create(FuzzingValidatorType type); | |
31 | }; |
|
35 | }; | |
32 |
|
36 | |||
|
37 | using ValidatorsTypes = std::vector<FuzzingValidatorType>; | |||
|
38 | Q_DECLARE_METATYPE(ValidatorsTypes) | |||
|
39 | ||||
33 | #endif // SCIQLOP_FUZZINGVALIDATORS_H |
|
40 | #endif // SCIQLOP_FUZZINGVALIDATORS_H |
@@ -1,6 +1,7 | |||||
1 | #include "FuzzingDefs.h" |
|
1 | #include "FuzzingDefs.h" | |
2 | #include "FuzzingOperations.h" |
|
2 | #include "FuzzingOperations.h" | |
3 | #include "FuzzingUtils.h" |
|
3 | #include "FuzzingUtils.h" | |
|
4 | #include "FuzzingValidators.h" | |||
4 |
|
5 | |||
5 | #include "AmdaProvider.h" |
|
6 | #include "AmdaProvider.h" | |
6 |
|
7 | |||
@@ -34,6 +35,7 using VariablesOperations = std::vector<VariableOperation>; | |||||
34 |
|
35 | |||
35 | using WeightedOperationsPool = std::map<std::shared_ptr<IFuzzingOperation>, Weight>; |
|
36 | using WeightedOperationsPool = std::map<std::shared_ptr<IFuzzingOperation>, Weight>; | |
36 | using VariablesPool = std::map<VariableId, VariableState>; |
|
37 | using VariablesPool = std::map<VariableId, VariableState>; | |
|
38 | using Validators = std::vector<std::shared_ptr<IFuzzingValidator> >; | |||
37 |
|
39 | |||
38 | // ///////// // |
|
40 | // ///////// // | |
39 | // Constants // |
|
41 | // Constants // | |
@@ -54,6 +56,10 const auto CACHE_TOLERANCE_DEFAULT_VALUE = 0.2; | |||||
54 | /// Delay between each operation (in ms) |
|
56 | /// Delay between each operation (in ms) | |
55 | const auto OPERATION_DELAY_DEFAULT_VALUE = 3000; |
|
57 | const auto OPERATION_DELAY_DEFAULT_VALUE = 3000; | |
56 |
|
58 | |||
|
59 | /// Validators for the tests (executed in the order in which they're defined) | |||
|
60 | const auto VALIDATORS_DEFAULT_VALUE = QVariant::fromValue( | |||
|
61 | ValidatorsTypes{{FuzzingValidatorType::RANGE, FuzzingValidatorType::DATA}}); | |||
|
62 | ||||
57 | // /////// // |
|
63 | // /////// // | |
58 | // Methods // |
|
64 | // Methods // | |
59 | // /////// // |
|
65 | // /////// // | |
@@ -98,6 +104,16 WeightedOperationsPool createOperationsPool(const WeightedOperationsTypes &types | |||||
98 | return result; |
|
104 | return result; | |
99 | } |
|
105 | } | |
100 |
|
106 | |||
|
107 | Validators createValidators(const ValidatorsTypes &types) | |||
|
108 | { | |||
|
109 | Validators result{}; | |||
|
110 | ||||
|
111 | std::transform(types.cbegin(), types.cend(), std::inserter(result, result.end()), | |||
|
112 | [](const auto &type) { return FuzzingValidatorFactory::create(type); }); | |||
|
113 | ||||
|
114 | return result; | |||
|
115 | } | |||
|
116 | ||||
101 | /** |
|
117 | /** | |
102 | * Class to run random tests |
|
118 | * Class to run random tests | |
103 | */ |
|
119 | */ | |
@@ -180,6 +196,14 private: | |||||
180 | return result; |
|
196 | return result; | |
181 | } |
|
197 | } | |
182 |
|
198 | |||
|
199 | Validators validators() const | |||
|
200 | { | |||
|
201 | static auto result | |||
|
202 | = createValidators(m_Properties.value(VALIDATORS_PROPERTY, VALIDATORS_DEFAULT_VALUE) | |||
|
203 | .value<ValidatorsTypes>()); | |||
|
204 | return result; | |||
|
205 | } | |||
|
206 | ||||
183 | VariableController &m_VariableController; |
|
207 | VariableController &m_VariableController; | |
184 | Properties m_Properties; |
|
208 | Properties m_Properties; | |
185 | VariablesPool m_VariablesPool; |
|
209 | VariablesPool m_VariablesPool; | |
@@ -265,6 +289,7 int main(int argc, char *argv[]) | |||||
265 | "*.info=false\n" |
|
289 | "*.info=false\n" | |
266 | "*.debug=false\n" |
|
290 | "*.debug=false\n" | |
267 | "FuzzingOperations.info=true\n" |
|
291 | "FuzzingOperations.info=true\n" | |
|
292 | "FuzzingValidators.info=true\n" | |||
268 | "TestAmdaFuzzing.info=true\n"); |
|
293 | "TestAmdaFuzzing.info=true\n"); | |
269 |
|
294 | |||
270 | SqpApplication app{argc, argv}; |
|
295 | SqpApplication app{argc, argv}; |
General Comments 0
You need to be logged in to leave comments.
Login now