##// END OF EJS Templates
Defines synchronization groups for fuzzing tests
Alexandre Leroux -
r1235:8776f597a80a
parent child
Show More
@@ -10,3 +10,28 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
@@ -4,9 +4,11
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 //
@@ -56,10 +58,41 extern const QString VALIDATORS_PROPERTY;
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