##// END OF EJS Templates
Defines synchronization groups for fuzzing tests
Alexandre Leroux -
r1235:8776f597a80a
parent child
Show More
@@ -1,12 +1,37
1 #include "FuzzingDefs.h"
1 #include "FuzzingDefs.h"
2
2
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 CACHE_TOLERANCE_PROPERTY = QStringLiteral("cacheTolerance");
6 const QString CACHE_TOLERANCE_PROPERTY = QStringLiteral("cacheTolerance");
7 const QString INITIAL_RANGE_PROPERTY = QStringLiteral("initialRange");
7 const QString INITIAL_RANGE_PROPERTY = QStringLiteral("initialRange");
8 const QString MAX_RANGE_PROPERTY = QStringLiteral("maxRange");
8 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");
12 const QString VALIDATORS_PROPERTY = QStringLiteral("validators");
13
14 // //////////// //
15 // FuzzingState //
16 // //////////// //
17
18 const SyncGroup &FuzzingState::syncGroup(SyncGroupId id) const
19 {
20 return m_SyncGroupsPool.at(id);
21 }
22
23 SyncGroup &FuzzingState::syncGroup(SyncGroupId id)
24 {
25 return m_SyncGroupsPool.at(id);
26 }
27
28 const VariableState &FuzzingState::variableState(VariableId id) const
29 {
30 return m_VariablesPool.at(id);
31 }
32
33 VariableState &FuzzingState::variableState(VariableId id)
34 {
35 return m_VariablesPool.at(id);
36 }
37
@@ -1,65 +1,98
1 #ifndef SCIQLOP_FUZZINGDEFS_H
1 #ifndef SCIQLOP_FUZZINGDEFS_H
2 #define SCIQLOP_FUZZINGDEFS_H
2 #define SCIQLOP_FUZZINGDEFS_H
3
3
4 #include <Data/SqpRange.h>
4 #include <Data/SqpRange.h>
5
5
6 #include <QString>
6 #include <QString>
7 #include <QUuid>
7 #include <QVariantHash>
8 #include <QVariantHash>
8
9
9 #include <memory>
10 #include <memory>
11 #include <set>
10
12
11 // /////// //
13 // /////// //
12 // Aliases //
14 // Aliases //
13 // /////// //
15 // /////// //
14
16
15 using MetadataPool = std::vector<QVariantHash>;
17 using MetadataPool = std::vector<QVariantHash>;
16 Q_DECLARE_METATYPE(MetadataPool)
18 Q_DECLARE_METATYPE(MetadataPool)
17
19
18 using Properties = QVariantHash;
20 using Properties = QVariantHash;
19
21
20 // ///////// //
22 // ///////// //
21 // Constants //
23 // Constants //
22 // ///////// //
24 // ///////// //
23
25
24 /// Max number of operations to generate
26 /// Max number of operations to generate
25 extern const QString NB_MAX_OPERATIONS_PROPERTY;
27 extern const QString NB_MAX_OPERATIONS_PROPERTY;
26
28
27 /// Max number of variables to manipulate through operations
29 /// Max number of variables to manipulate through operations
28 extern const QString NB_MAX_VARIABLES_PROPERTY;
30 extern const QString NB_MAX_VARIABLES_PROPERTY;
29
31
30 /// Set of operations available for the test
32 /// Set of operations available for the test
31 extern const QString AVAILABLE_OPERATIONS_PROPERTY;
33 extern const QString AVAILABLE_OPERATIONS_PROPERTY;
32
34
33 /// Tolerance used for variable's cache (in ratio)
35 /// Tolerance used for variable's cache (in ratio)
34 extern const QString CACHE_TOLERANCE_PROPERTY;
36 extern const QString CACHE_TOLERANCE_PROPERTY;
35
37
36 /// Range with which the timecontroller is initialized
38 /// Range with which the timecontroller is initialized
37 extern const QString INITIAL_RANGE_PROPERTY;
39 extern const QString INITIAL_RANGE_PROPERTY;
38
40
39 /// Max range that an operation can reach
41 /// Max range that an operation can reach
40 extern const QString MAX_RANGE_PROPERTY;
42 extern const QString MAX_RANGE_PROPERTY;
41
43
42 /// Set of metadata that can be associated to a variable
44 /// Set of metadata that can be associated to a variable
43 extern const QString METADATA_POOL_PROPERTY;
45 extern const QString METADATA_POOL_PROPERTY;
44
46
45 /// Provider used to retrieve data
47 /// Provider used to retrieve data
46 extern const QString PROVIDER_PROPERTY;
48 extern const QString PROVIDER_PROPERTY;
47
49
48 /// Time left for an operation to execute
50 /// Time left for an operation to execute
49 extern const QString OPERATION_DELAY_PROPERTY;
51 extern const QString OPERATION_DELAY_PROPERTY;
50
52
51 /// Validators used to validate an operation
53 /// Validators used to validate an operation
52 extern const QString VALIDATORS_PROPERTY;
54 extern const QString VALIDATORS_PROPERTY;
53
55
54 // /////// //
56 // /////// //
55 // Structs //
57 // Structs //
56 // /////// //
58 // /////// //
57
59
58 class Variable;
60 class Variable;
59
60 struct VariableState {
61 struct VariableState {
61 std::shared_ptr<Variable> m_Variable{nullptr};
62 std::shared_ptr<Variable> m_Variable{nullptr};
62 SqpRange m_Range{INVALID_RANGE};
63 SqpRange m_Range{INVALID_RANGE};
63 };
64 };
64
65
66 using VariableId = int;
67 using VariablesPool = std::map<VariableId, VariableState>;
68
69 /**
70 * Defines a synchronization group for a fuzzing state. A group reports the variables synchronized
71 * with each other, and the current range of the group (i.e. range of the last synchronized variable
72 * that has been moved)
73 */
74 struct SyncGroup {
75 std::set<VariableId> m_Variables{};
76 SqpRange m_Range{INVALID_RANGE};
77 };
78
79 using SyncGroupId = QUuid;
80 using SyncGroupsPool = std::map<SyncGroupId, SyncGroup>;
81
82 /**
83 * Defines a current state during a fuzzing state. It contains all the variables manipulated during
84 * the test, as well as the synchronization status of these variables.
85 */
86 struct FuzzingState {
87 const SyncGroup &syncGroup(SyncGroupId id) const;
88 SyncGroup &syncGroup(SyncGroupId id);
89
90 const VariableState &variableState(VariableId id) const;
91 VariableState &variableState(VariableId id);
92
93
94 VariablesPool m_VariablesPool;
95 SyncGroupsPool m_SyncGroupsPool;
96 };
97
65 #endif // SCIQLOP_FUZZINGDEFS_H
98 #endif // SCIQLOP_FUZZINGDEFS_H
General Comments 0
You need to be logged in to leave comments. Login now