@@ -20,12 +20,31 | |||
|
20 | 20 | |
|
21 | 21 | Q_LOGGING_CATEGORY(LOG_TestAmdaFuzzing, "TestAmdaFuzzing") |
|
22 | 22 | |
|
23 | /** | |
|
24 | * Macro used to generate a getter for a property in @sa FuzzingTest. The macro generates a static | |
|
25 | * attribute that is initialized by searching in properties the property and use a default value if | |
|
26 | * it's not present. Macro arguments are: | |
|
27 | * - GETTER_NAME : name of the getter | |
|
28 | * - PROPERTY_NAME: used to generate constants for property's name ({PROPERTY_NAME}_PROPERTY) and | |
|
29 | * default value ({PROPERTY_NAME}_DEFAULT_VALUE) | |
|
30 | * - TYPE : return type of the getter | |
|
31 | */ | |
|
32 | // clang-format off | |
|
33 | #define DECLARE_PROPERTY_GETTER(GETTER_NAME, PROPERTY_NAME, TYPE) \ | |
|
34 | TYPE GETTER_NAME() const \ | |
|
35 | { \ | |
|
36 | static auto result = m_Properties.value(PROPERTY_NAME##_PROPERTY, PROPERTY_NAME##_DEFAULT_VALUE).value<TYPE>(); \ | |
|
37 | return result; \ | |
|
38 | } \ | |
|
39 | // clang-format on | |
|
40 | ||
|
23 | 41 | namespace { |
|
24 | 42 | |
|
25 | 43 | // /////// // |
|
26 | 44 | // Aliases // |
|
27 | 45 | // /////// // |
|
28 | 46 | |
|
47 | using IntPair = std::pair<int, int>; | |
|
29 | 48 | using Weight = double; |
|
30 | 49 | using Weights = std::vector<Weight>; |
|
31 | 50 | |
@@ -224,37 +243,6 public: | |||
|
224 | 243 | } |
|
225 | 244 | |
|
226 | 245 | private: |
|
227 | int nbMaxOperations() const | |
|
228 | { | |
|
229 | static auto result | |
|
230 | = m_Properties.value(NB_MAX_OPERATIONS_PROPERTY, NB_MAX_OPERATIONS_DEFAULT_VALUE) | |
|
231 | .toInt(); | |
|
232 | return result; | |
|
233 | } | |
|
234 | ||
|
235 | int nbMaxSyncGroups() const | |
|
236 | { | |
|
237 | static auto result | |
|
238 | = m_Properties.value(NB_MAX_SYNC_GROUPS_PROPERTY, NB_MAX_SYNC_GROUPS_DEFAULT_VALUE) | |
|
239 | .toInt(); | |
|
240 | return result; | |
|
241 | } | |
|
242 | ||
|
243 | int nbMaxVariables() const | |
|
244 | { | |
|
245 | static auto result | |
|
246 | = m_Properties.value(NB_MAX_VARIABLES_PROPERTY, NB_MAX_VARIABLES_DEFAULT_VALUE).toInt(); | |
|
247 | return result; | |
|
248 | } | |
|
249 | ||
|
250 | std::pair<int, int> operationDelays() const | |
|
251 | { | |
|
252 | static auto result | |
|
253 | = m_Properties | |
|
254 | .value(OPERATION_DELAY_BOUNDS_PROPERTY, OPERATION_DELAY_BOUNDS_DEFAULT_VALUE) | |
|
255 | .value<std::pair<int, int> >(); | |
|
256 | return result; | |
|
257 | } | |
|
258 | 246 | |
|
259 | 247 | WeightedOperationsPool operationsPool() const |
|
260 | 248 | { |
@@ -272,14 +260,12 private: | |||
|
272 | 260 | return result; |
|
273 | 261 | } |
|
274 | 262 | |
|
275 | std::pair<int, int> validationFrequencies() const | |
|
276 | { | |
|
277 | static auto result = m_Properties | |
|
278 | .value(VALIDATION_FREQUENCY_BOUNDS_PROPERTY, | |
|
279 | VALIDATION_FREQUENCY_BOUNDS_DEFAULT_VALUE) | |
|
280 | .value<std::pair<int, int> >(); | |
|
281 | return result; | |
|
282 | } | |
|
263 | DECLARE_PROPERTY_GETTER(nbMaxOperations, NB_MAX_OPERATIONS, int) | |
|
264 | DECLARE_PROPERTY_GETTER(nbMaxSyncGroups, NB_MAX_SYNC_GROUPS, int) | |
|
265 | DECLARE_PROPERTY_GETTER(nbMaxVariables, NB_MAX_VARIABLES, int) | |
|
266 | DECLARE_PROPERTY_GETTER(operationDelays, OPERATION_DELAY_BOUNDS, IntPair) | |
|
267 | DECLARE_PROPERTY_GETTER(validationFrequencies, VALIDATION_FREQUENCY_BOUNDS, IntPair) | |
|
268 | DECLARE_PROPERTY_GETTER(acquisitionTimeout, ACQUISITION_TIMEOUT, int) | |
|
283 | 269 | |
|
284 | 270 | VariableController &m_VariableController; |
|
285 | 271 | Properties m_Properties; |
General Comments 0
You need to be logged in to leave comments.
Login now