From 8776f597a80a5ae8c5a7e66fd76a6dc2a2977a37 2017-12-19 14:14:48 From: Alexandre Leroux Date: 2017-12-19 14:14:48 Subject: [PATCH] Defines synchronization groups for fuzzing tests --- diff --git a/plugins/amda/tests/FuzzingDefs.cpp b/plugins/amda/tests/FuzzingDefs.cpp index b55f4ec..958dc29 100644 --- a/plugins/amda/tests/FuzzingDefs.cpp +++ b/plugins/amda/tests/FuzzingDefs.cpp @@ -10,3 +10,28 @@ const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool"); const QString PROVIDER_PROPERTY = QStringLiteral("provider"); const QString OPERATION_DELAY_PROPERTY = QStringLiteral("operationDelay"); const QString VALIDATORS_PROPERTY = QStringLiteral("validators"); + +// //////////// // +// FuzzingState // +// //////////// // + +const SyncGroup &FuzzingState::syncGroup(SyncGroupId id) const +{ + return m_SyncGroupsPool.at(id); +} + +SyncGroup &FuzzingState::syncGroup(SyncGroupId id) +{ + return m_SyncGroupsPool.at(id); +} + +const VariableState &FuzzingState::variableState(VariableId id) const +{ + return m_VariablesPool.at(id); +} + +VariableState &FuzzingState::variableState(VariableId id) +{ + return m_VariablesPool.at(id); +} + diff --git a/plugins/amda/tests/FuzzingDefs.h b/plugins/amda/tests/FuzzingDefs.h index ba8b424..09a82a2 100644 --- a/plugins/amda/tests/FuzzingDefs.h +++ b/plugins/amda/tests/FuzzingDefs.h @@ -4,9 +4,11 @@ #include #include +#include #include #include +#include // /////// // // Aliases // @@ -56,10 +58,41 @@ extern const QString VALIDATORS_PROPERTY; // /////// // class Variable; - struct VariableState { std::shared_ptr m_Variable{nullptr}; SqpRange m_Range{INVALID_RANGE}; }; +using VariableId = int; +using VariablesPool = std::map; + +/** + * Defines a synchronization group for a fuzzing state. A group reports the variables synchronized + * with each other, and the current range of the group (i.e. range of the last synchronized variable + * that has been moved) + */ +struct SyncGroup { + std::set m_Variables{}; + SqpRange m_Range{INVALID_RANGE}; +}; + +using SyncGroupId = QUuid; +using SyncGroupsPool = std::map; + +/** + * Defines a current state during a fuzzing state. It contains all the variables manipulated during + * the test, as well as the synchronization status of these variables. + */ +struct FuzzingState { + const SyncGroup &syncGroup(SyncGroupId id) const; + SyncGroup &syncGroup(SyncGroupId id); + + const VariableState &variableState(VariableId id) const; + VariableState &variableState(VariableId id); + + + VariablesPool m_VariablesPool; + SyncGroupsPool m_SyncGroupsPool; +}; + #endif // SCIQLOP_FUZZINGDEFS_H