##// END OF EJS Templates
Defines synchronization groups for fuzzing tests
Alexandre Leroux -
r1235:8776f597a80a
parent child
Show More
@@ -1,12 +1,37
1 1 #include "FuzzingDefs.h"
2 2
3 3 const QString NB_MAX_OPERATIONS_PROPERTY = QStringLiteral("component");
4 4 const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables");
5 5 const QString AVAILABLE_OPERATIONS_PROPERTY = QStringLiteral("availableOperations");
6 6 const QString CACHE_TOLERANCE_PROPERTY = QStringLiteral("cacheTolerance");
7 7 const QString INITIAL_RANGE_PROPERTY = QStringLiteral("initialRange");
8 8 const QString MAX_RANGE_PROPERTY = QStringLiteral("maxRange");
9 9 const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool");
10 10 const QString PROVIDER_PROPERTY = QStringLiteral("provider");
11 11 const QString OPERATION_DELAY_PROPERTY = QStringLiteral("operationDelay");
12 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 1 #ifndef SCIQLOP_FUZZINGDEFS_H
2 2 #define SCIQLOP_FUZZINGDEFS_H
3 3
4 4 #include <Data/SqpRange.h>
5 5
6 6 #include <QString>
7 #include <QUuid>
7 8 #include <QVariantHash>
8 9
9 10 #include <memory>
11 #include <set>
10 12
11 13 // /////// //
12 14 // Aliases //
13 15 // /////// //
14 16
15 17 using MetadataPool = std::vector<QVariantHash>;
16 18 Q_DECLARE_METATYPE(MetadataPool)
17 19
18 20 using Properties = QVariantHash;
19 21
20 22 // ///////// //
21 23 // Constants //
22 24 // ///////// //
23 25
24 26 /// Max number of operations to generate
25 27 extern const QString NB_MAX_OPERATIONS_PROPERTY;
26 28
27 29 /// Max number of variables to manipulate through operations
28 30 extern const QString NB_MAX_VARIABLES_PROPERTY;
29 31
30 32 /// Set of operations available for the test
31 33 extern const QString AVAILABLE_OPERATIONS_PROPERTY;
32 34
33 35 /// Tolerance used for variable's cache (in ratio)
34 36 extern const QString CACHE_TOLERANCE_PROPERTY;
35 37
36 38 /// Range with which the timecontroller is initialized
37 39 extern const QString INITIAL_RANGE_PROPERTY;
38 40
39 41 /// Max range that an operation can reach
40 42 extern const QString MAX_RANGE_PROPERTY;
41 43
42 44 /// Set of metadata that can be associated to a variable
43 45 extern const QString METADATA_POOL_PROPERTY;
44 46
45 47 /// Provider used to retrieve data
46 48 extern const QString PROVIDER_PROPERTY;
47 49
48 50 /// Time left for an operation to execute
49 51 extern const QString OPERATION_DELAY_PROPERTY;
50 52
51 53 /// Validators used to validate an operation
52 54 extern const QString VALIDATORS_PROPERTY;
53 55
54 56 // /////// //
55 57 // Structs //
56 58 // /////// //
57 59
58 60 class Variable;
59
60 61 struct VariableState {
61 62 std::shared_ptr<Variable> m_Variable{nullptr};
62 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 98 #endif // SCIQLOP_FUZZINGDEFS_H
General Comments 0
You need to be logged in to leave comments. Login now