##// END OF EJS Templates
Sets the number of sync groups to create for fuzzing tests
Alexandre Leroux -
r1237:d97a694e6326
parent child
Show More
@@ -1,6 +1,7
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_SYNC_GROUPS_PROPERTY = QStringLiteral("nbSyncGroups");
4 const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables");
5 const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables");
5 const QString AVAILABLE_OPERATIONS_PROPERTY = QStringLiteral("availableOperations");
6 const QString AVAILABLE_OPERATIONS_PROPERTY = QStringLiteral("availableOperations");
6 const QString CACHE_TOLERANCE_PROPERTY = QStringLiteral("cacheTolerance");
7 const QString CACHE_TOLERANCE_PROPERTY = QStringLiteral("cacheTolerance");
@@ -26,6 +26,9 using Properties = QVariantHash;
26 /// Max number of operations to generate
26 /// Max number of operations to generate
27 extern const QString NB_MAX_OPERATIONS_PROPERTY;
27 extern const QString NB_MAX_OPERATIONS_PROPERTY;
28
28
29 /// Max number of sync groups to create through operations
30 extern const QString NB_MAX_SYNC_GROUPS_PROPERTY;
31
29 /// Max number of variables to manipulate through operations
32 /// Max number of variables to manipulate through operations
30 extern const QString NB_MAX_VARIABLES_PROPERTY;
33 extern const QString NB_MAX_VARIABLES_PROPERTY;
31
34
@@ -41,6 +41,7 using Validators = std::vector<std::shared_ptr<IFuzzingValidator> >;
41
41
42 // Defaults values used when the associated properties have not been set for the test
42 // Defaults values used when the associated properties have not been set for the test
43 const auto NB_MAX_OPERATIONS_DEFAULT_VALUE = 100;
43 const auto NB_MAX_OPERATIONS_DEFAULT_VALUE = 100;
44 const auto NB_MAX_SYNC_GROUPS_DEFAULT_VALUE = 1;
44 const auto NB_MAX_VARIABLES_DEFAULT_VALUE = 1;
45 const auto NB_MAX_VARIABLES_DEFAULT_VALUE = 1;
45 const auto AVAILABLE_OPERATIONS_DEFAULT_VALUE = QVariant::fromValue(WeightedOperationsTypes{
46 const auto AVAILABLE_OPERATIONS_DEFAULT_VALUE = QVariant::fromValue(WeightedOperationsTypes{
46 {FuzzingOperationType::CREATE, 1.},
47 {FuzzingOperationType::CREATE, 1.},
@@ -148,6 +149,13 public:
148 for (auto variableId = 0; variableId < nbMaxVariables(); ++variableId) {
149 for (auto variableId = 0; variableId < nbMaxVariables(); ++variableId) {
149 m_FuzzingState.m_VariablesPool[variableId] = VariableState{};
150 m_FuzzingState.m_VariablesPool[variableId] = VariableState{};
150 }
151 }
152
153 // Inits sync groups and registers them into the variable controller
154 for (auto i = 0; i < nbMaxSyncGroups(); ++i) {
155 auto syncGroupId = SyncGroupId::createUuid();
156 variableController.onAddSynchronizationGroupId(syncGroupId);
157 m_FuzzingState.m_SyncGroupsPool[syncGroupId] = SyncGroup{};
158 }
151 }
159 }
152
160
153 void execute()
161 void execute()
@@ -197,6 +205,14 private:
197 return result;
205 return result;
198 }
206 }
199
207
208 int nbMaxSyncGroups() const
209 {
210 static auto result
211 = m_Properties.value(NB_MAX_SYNC_GROUPS_PROPERTY, NB_MAX_SYNC_GROUPS_DEFAULT_VALUE)
212 .toInt();
213 return result;
214 }
215
200 int nbMaxVariables() const
216 int nbMaxVariables() const
201 {
217 {
202 static auto result
218 static auto result
General Comments 0
You need to be logged in to leave comments. Login now