FuzzingValidators.h
40 lines
| 1.1 KiB
| text/x-c
|
CLexer
Alexandre Leroux
|
r1193 | #ifndef SCIQLOP_FUZZINGVALIDATORS_H | ||
#define SCIQLOP_FUZZINGVALIDATORS_H | ||||
Alexandre Leroux
|
r1195 | #include <memory> | ||
#include <set> | ||||
Alexandre Leroux
|
r1193 | #include <QLoggingCategory> | ||
Alexandre Leroux
|
r1195 | #include <QMetaType> | ||
Alexandre Leroux
|
r1193 | |||
Q_DECLARE_LOGGING_CATEGORY(LOG_FuzzingValidators) | ||||
class VariableState; | ||||
Alexandre Leroux
|
r1194 | /// Types of validators that can be defined | ||
enum class FuzzingValidatorType { | ||||
DATA, ///< Validates variable's data | ||||
RANGE ///< Validates variable's range | ||||
}; | ||||
Alexandre Leroux
|
r1193 | /** | ||
* Struct that represents a validator. A validator checks if the state of a variable is valid at the | ||||
* moment it is called during a fuzzing test | ||||
*/ | ||||
struct IFuzzingValidator { | ||||
virtual ~IFuzzingValidator() noexcept = default; | ||||
/// Validates the variable's state passed in parameter | ||||
virtual void validate(const VariableState &variableState) const = 0; | ||||
}; | ||||
Alexandre Leroux
|
r1194 | /// Factory of @sa IFuzzingValidator | ||
struct FuzzingValidatorFactory { | ||||
/// Creates a validator according to the type passed in parameter | ||||
static std::unique_ptr<IFuzzingValidator> create(FuzzingValidatorType type); | ||||
}; | ||||
Alexandre Leroux
|
r1195 | using ValidatorsTypes = std::vector<FuzzingValidatorType>; | ||
Q_DECLARE_METATYPE(ValidatorsTypes) | ||||
Alexandre Leroux
|
r1193 | #endif // SCIQLOP_FUZZINGVALIDATORS_H | ||