FuzzingDefs.h
98 lines
| 2.5 KiB
| text/x-c
|
CLexer
|
r1200 | #ifndef SCIQLOP_FUZZINGDEFS_H | ||
#define SCIQLOP_FUZZINGDEFS_H | ||||
|
r1220 | #include <Data/SqpRange.h> | ||
|
r1201 | #include <QString> | ||
|
r1235 | #include <QUuid> | ||
|
r1207 | #include <QVariantHash> | ||
|
r1220 | #include <memory> | ||
|
r1235 | #include <set> | ||
|
r1220 | |||
|
r1200 | // /////// // | ||
// Aliases // | ||||
// /////// // | ||||
|
r1207 | using MetadataPool = std::vector<QVariantHash>; | ||
Q_DECLARE_METATYPE(MetadataPool) | ||||
|
r1200 | using Properties = QVariantHash; | ||
|
r1201 | // ///////// // | ||
// Constants // | ||||
// ///////// // | ||||
/// Max number of operations to generate | ||||
extern const QString NB_MAX_OPERATIONS_PROPERTY; | ||||
/// Max number of variables to manipulate through operations | ||||
extern const QString NB_MAX_VARIABLES_PROPERTY; | ||||
|
r1204 | /// Set of operations available for the test | ||
extern const QString AVAILABLE_OPERATIONS_PROPERTY; | ||||
|
r1224 | /// Tolerance used for variable's cache (in ratio) | ||
extern const QString CACHE_TOLERANCE_PROPERTY; | ||||
|
r1223 | |||
/// Range with which the timecontroller is initialized | ||||
extern const QString INITIAL_RANGE_PROPERTY; | ||||
|
r1209 | /// Max range that an operation can reach | ||
extern const QString MAX_RANGE_PROPERTY; | ||||
|
r1207 | /// Set of metadata that can be associated to a variable | ||
extern const QString METADATA_POOL_PROPERTY; | ||||
/// Provider used to retrieve data | ||||
extern const QString PROVIDER_PROPERTY; | ||||
|
r1219 | /// Time left for an operation to execute | ||
extern const QString OPERATION_DELAY_PROPERTY; | ||||
|
r1228 | /// Validators used to validate an operation | ||
extern const QString VALIDATORS_PROPERTY; | ||||
|
r1220 | |||
// /////// // | ||||
// Structs // | ||||
// /////// // | ||||
class Variable; | ||||
struct VariableState { | ||||
std::shared_ptr<Variable> m_Variable{nullptr}; | ||||
SqpRange m_Range{INVALID_RANGE}; | ||||
}; | ||||
|
r1235 | using VariableId = int; | ||
using VariablesPool = std::map<VariableId, VariableState>; | ||||
/** | ||||
* 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<VariableId> m_Variables{}; | ||||
SqpRange m_Range{INVALID_RANGE}; | ||||
}; | ||||
using SyncGroupId = QUuid; | ||||
using SyncGroupsPool = std::map<SyncGroupId, SyncGroup>; | ||||
/** | ||||
* 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; | ||||
}; | ||||
|
r1200 | #endif // SCIQLOP_FUZZINGDEFS_H | ||