mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-21 20:39:08 -06:00
Submodule ext/ghoul updated: e03f640bee...fbd80eae0f
@@ -36,6 +36,8 @@ namespace ghoul { class Dictionary; }
|
||||
|
||||
namespace openspace::documentation {
|
||||
|
||||
class Verifier;
|
||||
|
||||
BooleanType(Optional);
|
||||
|
||||
/**
|
||||
@@ -52,9 +54,7 @@ struct TestResult {
|
||||
* offense.
|
||||
*/
|
||||
struct Offense {
|
||||
/**
|
||||
* The Reason for the offense
|
||||
*/
|
||||
/// The Reason for the offense
|
||||
enum class Reason {
|
||||
Unknown, ///< Unknown reason
|
||||
MissingKey, ///< The offending key that was requested was not found
|
||||
@@ -78,9 +78,7 @@ struct TestResult {
|
||||
* might be removed in a latter version.
|
||||
*/
|
||||
struct Warning {
|
||||
/**
|
||||
* The reason for the warning
|
||||
*/
|
||||
/// The reason for the warning
|
||||
enum class Reason {
|
||||
Deprecated ///< The value is marked as deprecated and should not used
|
||||
};
|
||||
@@ -124,8 +122,6 @@ struct SpecificationError : public ghoul::RuntimeError {
|
||||
|
||||
void logError(const SpecificationError& error, std::string component = "");
|
||||
|
||||
struct Verifier;
|
||||
|
||||
/**
|
||||
* A DocumentationEntry provides the specification for a single key, which is tested using
|
||||
* the provided Verifier. Each DocumentationEntry can contain a textual documentation that
|
||||
@@ -172,28 +168,28 @@ struct DocumentationEntry {
|
||||
Optional opt, std::string doc = "");
|
||||
|
||||
/**
|
||||
* The constructor for a DocumentationEntry describing a key \p k in a Documentation.
|
||||
* The value for the key (or each value in the case of the
|
||||
* DocumentationEntry::Wildcard) is tested using the verifier \p v, that specifies the
|
||||
* conditions that the \p k%'s value has to fulfill. The textual documentation
|
||||
* \p doc shall describe the usage of the key-value pair and will be printed for human
|
||||
* consumption for example in the DocumentationEngine. Each DocumentationEntry can
|
||||
* further be \p opt.
|
||||
*
|
||||
* \param k The key for which this DocumentationEntry is valid. If this valid is
|
||||
* equal to DocumentationEntry::Wildcard, each entry in the Documentation that
|
||||
* contains this DocumentationEntry will be matched
|
||||
* \param v The Verifier that is used to test the \p key%'s value to determine if it is
|
||||
* a valid value. The DocumentationEntry will take ownership of the passed
|
||||
* object
|
||||
* \param doc The textual documentation that describes the DocumentationEntry in a
|
||||
* human readable format
|
||||
* \param opt Determines whether the Documentation containing this DocumentationEntry
|
||||
* must have a key \p key, or whether it is optional
|
||||
*
|
||||
* \pre \p k must not be empty
|
||||
* \pre \p v must not be nullptr
|
||||
*/
|
||||
* The constructor for a DocumentationEntry describing a key \p k in a Documentation.
|
||||
* The value for the key (or each value in the case of the
|
||||
* DocumentationEntry::Wildcard) is tested using the verifier \p v, that specifies the
|
||||
* conditions that the \p k%'s value has to fulfill. The textual documentation
|
||||
* \p doc shall describe the usage of the key-value pair and will be printed for human
|
||||
* consumption for example in the DocumentationEngine. Each DocumentationEntry can
|
||||
* further be \p opt.
|
||||
*
|
||||
* \param k The key for which this DocumentationEntry is valid. If this valid is
|
||||
* equal to DocumentationEntry::Wildcard, each entry in the Documentation that
|
||||
* contains this DocumentationEntry will be matched
|
||||
* \param v The Verifier that is used to test the \p key%'s value to determine if it
|
||||
* is a valid value. The DocumentationEntry will take ownership of the passed
|
||||
* object
|
||||
* \param doc The textual documentation that describes the DocumentationEntry in a
|
||||
* human readable format
|
||||
* \param opt Determines whether the Documentation containing this DocumentationEntry
|
||||
* must have a key \p key, or whether it is optional
|
||||
*
|
||||
* \pre \p k must not be empty
|
||||
* \pre \p v must not be nullptr
|
||||
*/
|
||||
DocumentationEntry(std::string k, Verifier* v, Optional opt,
|
||||
std::string doc = "");
|
||||
|
||||
@@ -232,43 +228,14 @@ Documentation doc = {
|
||||
* both the wildcard and the specialized entry will be evaluated.
|
||||
*/
|
||||
struct Documentation {
|
||||
using DocumentationEntries = std::vector<documentation::DocumentationEntry>;
|
||||
|
||||
/**
|
||||
* Creates a Documentation with a human-readable name \p n and a list of entries
|
||||
* \p ents.
|
||||
*
|
||||
* \param n The human-readable name of this Documentation
|
||||
* \param i A unique identifier which can be used by applications (or other
|
||||
* Documentation%s to reference this entry
|
||||
* \param ents A list of DocumentationEntry%s that describe the individual keys for
|
||||
* this entrie Documentation
|
||||
*/
|
||||
Documentation(std::string n, std::string i, DocumentationEntries ents = {});
|
||||
|
||||
/**
|
||||
* Creates a Documentation with a human-readable name \p n.
|
||||
*
|
||||
* \param n The human-readable name of this Documentation
|
||||
* \param ents A list of DocumentationEntry%s that describe the individual keys for
|
||||
* this entrie Documentation
|
||||
*/
|
||||
Documentation(std::string n, DocumentationEntries ents = {});
|
||||
|
||||
/**
|
||||
* Creates a Documentation.
|
||||
*
|
||||
* \param entries A list of DocumentationEntry%s that describe the individual keys for
|
||||
* this entrie Documentation
|
||||
*/
|
||||
Documentation(DocumentationEntries ents = {});
|
||||
|
||||
/// The human-readable name of the Documentation
|
||||
std::string name;
|
||||
/// A unique identifier which can be used to reference this Documentation
|
||||
std::string id;
|
||||
/// A general description for the entire documented entity
|
||||
std::string description;
|
||||
/// A list of specifications that are describing this Documentation
|
||||
DocumentationEntries entries;
|
||||
std::vector<documentation::DocumentationEntry> entries;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -287,20 +254,21 @@ TestResult testSpecification(const Documentation& documentation,
|
||||
const ghoul::Dictionary& dictionary);
|
||||
|
||||
/**
|
||||
* This method tests whether a provided ghoul::Dictionary \p dictionary adheres to the
|
||||
* specification \p documentation. If the \p dictionary does not adhere to the
|
||||
* specification a SpecificationError is thrown, and the exception contains the TestResult
|
||||
* that contains more information about the offending keys. If the \p dictionary adheres to
|
||||
* the \p documentation, the method returns normally.
|
||||
*
|
||||
* \param documentation The Documentation that the \p dictionary is tested against
|
||||
* \param dictionary The ghoul::Dictionary that is to be tested against the
|
||||
* \p documentation
|
||||
* \param component The component that is using this method; this argument is passed to the
|
||||
* SpecificationError that is thrown in case of not adhering to the \p documentation
|
||||
*
|
||||
* \throw SpecificationError If the \p dictionary does not adhere to the \p documentation
|
||||
*/
|
||||
* This method tests whether a provided ghoul::Dictionary \p dictionary adheres to the
|
||||
* specification \p documentation. If the \p dictionary does not adhere to the
|
||||
* specification a SpecificationError is thrown, and the exception contains the TestResult
|
||||
* that contains more information about the offending keys. If the \p dictionary adheres
|
||||
* to the \p documentation, the method returns normally.
|
||||
*
|
||||
* \param documentation The Documentation that the \p dictionary is tested against
|
||||
* \param dictionary The ghoul::Dictionary that is to be tested against the
|
||||
* \p documentation
|
||||
* \param component The component that is using this method; this argument is passed to
|
||||
* the SpecificationError that is thrown in case of not adhering to the
|
||||
* \p documentation
|
||||
*
|
||||
* \throw SpecificationError If the \p dictionary does not adhere to the \p documentation
|
||||
*/
|
||||
void testSpecificationAndThrow(const Documentation& documentation,
|
||||
const ghoul::Dictionary& dictionary, std::string component);
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace openspace::documentation {
|
||||
* Verifier. Furthermore, the Verifier::documentation method returns a human-readable
|
||||
* description of the Verifier subclass and what it tests for.
|
||||
*/
|
||||
struct Verifier {
|
||||
class Verifier {
|
||||
public:
|
||||
virtual ~Verifier() = default;
|
||||
|
||||
/**
|
||||
@@ -100,7 +101,8 @@ struct Verifier {
|
||||
* \tparam T The type against which the key's value is tested
|
||||
*/
|
||||
template <typename T>
|
||||
struct TemplateVerifier : public Verifier {
|
||||
class TemplateVerifier : public Verifier {
|
||||
public:
|
||||
using Type = T;
|
||||
|
||||
/**
|
||||
@@ -126,7 +128,8 @@ struct TemplateVerifier : public Verifier {
|
||||
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
|
||||
* `bool`. No implicit conversion is considered in this testing.
|
||||
*/
|
||||
struct BoolVerifier : public TemplateVerifier<bool> {
|
||||
class BoolVerifier : public TemplateVerifier<bool> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -134,7 +137,8 @@ struct BoolVerifier : public TemplateVerifier<bool> {
|
||||
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
|
||||
* `double`. No implicit conversion is considered in this testing.
|
||||
*/
|
||||
struct DoubleVerifier : public TemplateVerifier<double> {
|
||||
class DoubleVerifier : public TemplateVerifier<double> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -143,7 +147,8 @@ struct DoubleVerifier : public TemplateVerifier<double> {
|
||||
* `int`. It will also return `true` if the key's value is of type `double`, but is a
|
||||
* integer value (for example, `0.0`, `12.0`, but not `0.5`).
|
||||
*/
|
||||
struct IntVerifier : public TemplateVerifier<int> {
|
||||
class IntVerifier : public TemplateVerifier<int> {
|
||||
public:
|
||||
TestResult operator()(const ghoul::Dictionary& dict,
|
||||
const std::string& key) const override;
|
||||
|
||||
@@ -154,7 +159,8 @@ struct IntVerifier : public TemplateVerifier<int> {
|
||||
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
|
||||
* `std::string`. No implicit conversion is considered in this testing.
|
||||
*/
|
||||
struct StringVerifier : public TemplateVerifier<std::string> {
|
||||
class StringVerifier : public TemplateVerifier<std::string> {
|
||||
public:
|
||||
StringVerifier(bool mustBeNotEmpty = false);
|
||||
|
||||
TestResult operator()(const ghoul::Dictionary& dictionary,
|
||||
@@ -172,7 +178,8 @@ private:
|
||||
* A Verifier that checks whether a given string is a valid identifier, meaning that is
|
||||
* does not contain any whitespaces or dots
|
||||
*/
|
||||
struct IdentifierVerifier : public StringVerifier {
|
||||
class IdentifierVerifier : public StringVerifier {
|
||||
public:
|
||||
IdentifierVerifier();
|
||||
|
||||
TestResult operator()(const ghoul::Dictionary& dict,
|
||||
@@ -187,7 +194,8 @@ struct IdentifierVerifier : public StringVerifier {
|
||||
* A Verifier that checks whether a given key inside a ghoul::Dictionary is a string and
|
||||
* refers to an existing file on disk.
|
||||
*/
|
||||
struct FileVerifier : public StringVerifier {
|
||||
class FileVerifier : public StringVerifier {
|
||||
public:
|
||||
FileVerifier();
|
||||
|
||||
TestResult operator()(const ghoul::Dictionary& dict,
|
||||
@@ -197,10 +205,11 @@ struct FileVerifier : public StringVerifier {
|
||||
};
|
||||
|
||||
/**
|
||||
* A Verifier that checks whether a given key inside a ghoul::Dictionary is a string and
|
||||
* refers to an existing directory on disk.
|
||||
*/
|
||||
struct DirectoryVerifier : public StringVerifier {
|
||||
* A Verifier that checks whether a given key inside a ghoul::Dictionary is a string and
|
||||
* refers to an existing directory on disk.
|
||||
*/
|
||||
class DirectoryVerifier : public StringVerifier {
|
||||
public:
|
||||
DirectoryVerifier();
|
||||
|
||||
TestResult operator()(const ghoul::Dictionary& dict,
|
||||
@@ -213,7 +222,8 @@ struct DirectoryVerifier : public StringVerifier {
|
||||
* A Verifier that checks whether a given key inside a ghoul::Dictionary is a string and
|
||||
* a valid date time
|
||||
*/
|
||||
struct DateTimeVerifier : public StringVerifier {
|
||||
class DateTimeVerifier : public StringVerifier {
|
||||
public:
|
||||
DateTimeVerifier();
|
||||
|
||||
TestResult operator()(const ghoul::Dictionary& dict,
|
||||
@@ -232,7 +242,8 @@ struct DateTimeVerifier : public StringVerifier {
|
||||
* DocumentationEntry checks for a nested key `a` and this does not comply, this Verifier
|
||||
* will return `Table.a` as an offender.
|
||||
*/
|
||||
struct TableVerifier : public TemplateVerifier<ghoul::Dictionary> {
|
||||
class TableVerifier : public TemplateVerifier<ghoul::Dictionary> {
|
||||
public:
|
||||
/**
|
||||
* This constructor takes a list of DocumentationEntry%s that are used recursively to
|
||||
* check the table (= ghoul::Dictionary) contained in the key's value. Similar to the
|
||||
@@ -270,7 +281,8 @@ struct TableVerifier : public TemplateVerifier<ghoul::Dictionary> {
|
||||
/**
|
||||
* A Verifier that checks whether all values contained in a Table are of type `string`.
|
||||
*/
|
||||
struct StringListVerifier : public TableVerifier {
|
||||
class StringListVerifier : public TableVerifier {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a StringListVerifier.
|
||||
*
|
||||
@@ -284,7 +296,8 @@ struct StringListVerifier : public TableVerifier {
|
||||
/**
|
||||
* A Verifier that checks whether all values contained in a Table are of type `int`.
|
||||
*/
|
||||
struct IntListVerifier : public TableVerifier {
|
||||
class IntListVerifier : public TableVerifier {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a IntListVerifier.
|
||||
*
|
||||
@@ -299,40 +312,37 @@ struct IntListVerifier : public TableVerifier {
|
||||
// Vector verifiers
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This struct is the base class for all Verifier%s that check for `glm` vector types.
|
||||
* The template parameter for the subclasses is the containing type, not the full vector
|
||||
* type. For example to check for `glm::dvec3`, one would create a
|
||||
* `Vector3Verifier<double>`.
|
||||
*/
|
||||
struct VectorVerifier {};
|
||||
|
||||
/// This Verifier checks whether the value is of type `glm::tvec2<T>`
|
||||
template <typename T>
|
||||
struct Vector2Verifier : public TemplateVerifier<glm::tvec2<T>>, public VectorVerifier {
|
||||
class Vector2Verifier : public TemplateVerifier<glm::tvec2<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
/// This Verifier checks whether the value is of type `glm::tvec3<T>`
|
||||
template <typename T>
|
||||
struct Vector3Verifier : public TemplateVerifier<glm::tvec3<T>>, public VectorVerifier {
|
||||
class Vector3Verifier : public TemplateVerifier<glm::tvec3<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
/// This Verifier checks whether the value is of type `glm::tvec4<T>`
|
||||
template <typename T>
|
||||
struct Vector4Verifier : public TemplateVerifier<glm::tvec4<T>>, public VectorVerifier {
|
||||
class Vector4Verifier : public TemplateVerifier<glm::tvec4<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
struct Color3Verifier : public Vector3Verifier<double> {
|
||||
class Color3Verifier : public Vector3Verifier<double> {
|
||||
public:
|
||||
TestResult operator()(const ghoul::Dictionary& dictionary,
|
||||
const std::string& key) const override;
|
||||
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
struct Color4Verifier : public Vector4Verifier<double> {
|
||||
class Color4Verifier : public Vector4Verifier<double> {
|
||||
public:
|
||||
TestResult operator()(const ghoul::Dictionary& dictionary,
|
||||
const std::string& key) const override;
|
||||
|
||||
@@ -344,7 +354,8 @@ struct Color4Verifier : public Vector4Verifier<double> {
|
||||
* type `glm::tvec2<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Vector2ListVerifier : public TableVerifier {
|
||||
class Vector2ListVerifier : public TableVerifier {
|
||||
public:
|
||||
Vector2ListVerifier(std::string elementDocumentation = "")
|
||||
: TableVerifier({
|
||||
{ "*", new Vector2Verifier<T>, Optional::No, std::move(elementDocumentation) }
|
||||
@@ -361,7 +372,8 @@ struct Vector2ListVerifier : public TableVerifier {
|
||||
* type `glm::tvec3<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Vector3ListVerifier : public TableVerifier {
|
||||
class Vector3ListVerifier : public TableVerifier {
|
||||
public:
|
||||
Vector3ListVerifier(std::string elementDocumentation = "")
|
||||
: TableVerifier({
|
||||
{ "*", new Vector3Verifier<T>, Optional::No, std::move(elementDocumentation) }
|
||||
@@ -378,7 +390,8 @@ struct Vector3ListVerifier : public TableVerifier {
|
||||
* type `glm::tvec4<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Vector4ListVerifier : public TableVerifier {
|
||||
class Vector4ListVerifier : public TableVerifier {
|
||||
public:
|
||||
Vector4ListVerifier(std::string elementDocumentation = "")
|
||||
: TableVerifier({
|
||||
{ "*", new Vector4Verifier<T>, Optional::No, std::move(elementDocumentation) }
|
||||
@@ -394,20 +407,12 @@ struct Vector4ListVerifier : public TableVerifier {
|
||||
// Matrix verifiers
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This struct is the base class for all Verifier%s that check for `glm` matrix types.
|
||||
* The template parameter for the subclasses is the containing type, not the full matrix
|
||||
* type. For example to check for `glm::dmat4x3`, one would create a
|
||||
* `Matrix4x3Verifier<double>`.
|
||||
*/
|
||||
struct MatrixVerifier {};
|
||||
|
||||
/**
|
||||
* This Verifier checks whether the value is of type `glm::mat2x2<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Matrix2x2Verifier : public TemplateVerifier<glm::tmat2x2<T>>, public MatrixVerifier
|
||||
{
|
||||
class Matrix2x2Verifier : public TemplateVerifier<glm::tmat2x2<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -415,8 +420,8 @@ struct Matrix2x2Verifier : public TemplateVerifier<glm::tmat2x2<T>>, public Matr
|
||||
* This Verifier checks whether the value is of type `glm::mat2x3<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Matrix2x3Verifier : public TemplateVerifier<glm::tmat2x3<T>>, public MatrixVerifier
|
||||
{
|
||||
class Matrix2x3Verifier : public TemplateVerifier<glm::tmat2x3<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -424,8 +429,8 @@ struct Matrix2x3Verifier : public TemplateVerifier<glm::tmat2x3<T>>, public Matr
|
||||
* This Verifier checks whether the value is of type `glm::mat2x4<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Matrix2x4Verifier : public TemplateVerifier<glm::tmat2x4<T>>, public MatrixVerifier
|
||||
{
|
||||
class Matrix2x4Verifier : public TemplateVerifier<glm::tmat2x4<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -433,8 +438,8 @@ struct Matrix2x4Verifier : public TemplateVerifier<glm::tmat2x4<T>>, public Matr
|
||||
* This Verifier checks whether the value is of type `glm::mat3x2<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Matrix3x2Verifier : public TemplateVerifier<glm::tmat3x2<T>>, public MatrixVerifier
|
||||
{
|
||||
class Matrix3x2Verifier : public TemplateVerifier<glm::tmat3x2<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -442,8 +447,8 @@ struct Matrix3x2Verifier : public TemplateVerifier<glm::tmat3x2<T>>, public Matr
|
||||
* This Verifier checks whether the value is of type `glm::mat3x3<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Matrix3x3Verifier : public TemplateVerifier<glm::tmat3x3<T>>, public MatrixVerifier
|
||||
{
|
||||
class Matrix3x3Verifier : public TemplateVerifier<glm::tmat3x3<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -451,8 +456,8 @@ struct Matrix3x3Verifier : public TemplateVerifier<glm::tmat3x3<T>>, public Matr
|
||||
* This Verifier checks whether the value is of type `glm::mat3x4<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Matrix3x4Verifier : public TemplateVerifier<glm::tmat3x4<T>>, public MatrixVerifier
|
||||
{
|
||||
class Matrix3x4Verifier : public TemplateVerifier<glm::tmat3x4<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -460,8 +465,8 @@ struct Matrix3x4Verifier : public TemplateVerifier<glm::tmat3x4<T>>, public Matr
|
||||
* This Verifier checks whether the value is of type `glm::mat4x2<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Matrix4x2Verifier : public TemplateVerifier<glm::tmat4x2<T>>, public MatrixVerifier
|
||||
{
|
||||
class Matrix4x2Verifier : public TemplateVerifier<glm::tmat4x2<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -469,8 +474,8 @@ struct Matrix4x2Verifier : public TemplateVerifier<glm::tmat4x2<T>>, public Matr
|
||||
* This Verifier checks whether the value is of type `glm::mat4x3<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Matrix4x3Verifier : public TemplateVerifier<glm::tmat4x3<T>>, public MatrixVerifier
|
||||
{
|
||||
class Matrix4x3Verifier : public TemplateVerifier<glm::tmat4x3<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -478,8 +483,8 @@ struct Matrix4x3Verifier : public TemplateVerifier<glm::tmat4x3<T>>, public Matr
|
||||
* This Verifier checks whether the value is of type `glm::mat4x4<T>`
|
||||
*/
|
||||
template <typename T>
|
||||
struct Matrix4x4Verifier : public TemplateVerifier<glm::tmat4x4<T>>, public MatrixVerifier
|
||||
{
|
||||
class Matrix4x4Verifier : public TemplateVerifier<glm::tmat4x4<T>> {
|
||||
public:
|
||||
std::string type() const override;
|
||||
};
|
||||
|
||||
@@ -503,7 +508,8 @@ struct Matrix4x4Verifier : public TemplateVerifier<glm::tmat4x4<T>>, public Matr
|
||||
* reason TestResult::Offense::Verification is returned instead.
|
||||
*/
|
||||
template <typename T, typename Operator>
|
||||
struct OperatorVerifier : public T {
|
||||
class OperatorVerifier : public T {
|
||||
public:
|
||||
/**
|
||||
* Constructor for an OperatorVerifier. As all operators need to compare the incoming
|
||||
* value to a stored value, we require the comparison \p value to be passed in here.
|
||||
@@ -539,18 +545,17 @@ struct OperatorVerifier : public T {
|
||||
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
|
||||
*/
|
||||
template <typename T>
|
||||
struct LessVerifier : public OperatorVerifier<T, std::less<typename T::Type>> {
|
||||
static_assert(!std::is_base_of<BoolVerifier, T>::value, "T cannot be BoolVerifier");
|
||||
static_assert(
|
||||
!std::is_base_of<StringVerifier, T>::value, "T cannot be StringVerifier"
|
||||
);
|
||||
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
|
||||
|
||||
class LessVerifier : public OperatorVerifier<T, std::less<typename T::Type>> {
|
||||
public:
|
||||
using OperatorVerifier<T, std::less<typename T::Type>>::OperatorVerifier;
|
||||
using OperatorVerifier<T, std::less<typename T::Type>>::value;
|
||||
|
||||
std::string documentation() const override;
|
||||
|
||||
using OperatorVerifier<T, std::less<typename T::Type>>::value;
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<BoolVerifier, T>, "T cannot be BoolVerifier");
|
||||
static_assert(!std::is_base_of_v<StringVerifier, T>, "T cannot be StringVerifier");
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -559,19 +564,17 @@ struct LessVerifier : public OperatorVerifier<T, std::less<typename T::Type>> {
|
||||
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
|
||||
*/
|
||||
template <typename T>
|
||||
struct LessEqualVerifier : public OperatorVerifier<T, std::less_equal<typename T::Type>> {
|
||||
static_assert(!std::is_base_of<BoolVerifier, T>::value, "T cannot be BoolVerifier");
|
||||
static_assert(
|
||||
!std::is_base_of<StringVerifier, T>::value,
|
||||
"T cannot be StringVerifier"
|
||||
);
|
||||
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
|
||||
|
||||
class LessEqualVerifier : public OperatorVerifier<T, std::less_equal<typename T::Type>> {
|
||||
public:
|
||||
using OperatorVerifier<T, std::less_equal<typename T::Type>>::OperatorVerifier;
|
||||
using OperatorVerifier<T, std::less_equal<typename T::Type>>::value;
|
||||
|
||||
std::string documentation() const override;
|
||||
|
||||
using OperatorVerifier<T, std::less_equal<typename T::Type>>::value;
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<BoolVerifier, T>, "T cannot be BoolVerifier");
|
||||
static_assert(!std::is_base_of_v<StringVerifier, T>, "T cannot be StringVerifier");
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -580,19 +583,17 @@ struct LessEqualVerifier : public OperatorVerifier<T, std::less_equal<typename T
|
||||
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
|
||||
*/
|
||||
template <typename T>
|
||||
struct GreaterVerifier : public OperatorVerifier<T, std::greater<typename T::Type>> {
|
||||
static_assert(!std::is_base_of<BoolVerifier, T>::value, "T cannot be BoolVerifier");
|
||||
static_assert(
|
||||
!std::is_base_of<StringVerifier, T>::value,
|
||||
"T cannot be StringVerifier"
|
||||
);
|
||||
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
|
||||
|
||||
class GreaterVerifier : public OperatorVerifier<T, std::greater<typename T::Type>> {
|
||||
public:
|
||||
using OperatorVerifier<T, std::greater<typename T::Type>>::OperatorVerifier;
|
||||
using OperatorVerifier<T, std::greater<typename T::Type>>::value;
|
||||
|
||||
std::string documentation() const override;
|
||||
|
||||
using OperatorVerifier<T, std::greater<typename T::Type>>::value;
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<BoolVerifier, T>, "T cannot be BoolVerifier");
|
||||
static_assert(!std::is_base_of_v<StringVerifier, T>, "T cannot be StringVerifier");
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -601,21 +602,19 @@ struct GreaterVerifier : public OperatorVerifier<T, std::greater<typename T::Typ
|
||||
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
|
||||
*/
|
||||
template <typename T>
|
||||
struct GreaterEqualVerifier : public OperatorVerifier<T,
|
||||
class GreaterEqualVerifier : public OperatorVerifier<T,
|
||||
std::greater_equal<typename T::Type>>
|
||||
{
|
||||
static_assert(!std::is_base_of<BoolVerifier, T>::value, "T cannot be BoolVerifier");
|
||||
static_assert(
|
||||
!std::is_base_of<StringVerifier, T>::value,
|
||||
"T cannot be StringVerifier"
|
||||
);
|
||||
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
|
||||
|
||||
public:
|
||||
using OperatorVerifier<T, std::greater_equal<typename T::Type>>::OperatorVerifier;
|
||||
using OperatorVerifier<T, std::greater_equal<typename T::Type>>::value;
|
||||
|
||||
std::string documentation() const override;
|
||||
|
||||
using OperatorVerifier<T, std::greater_equal<typename T::Type>>::value;
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<BoolVerifier, T>, "T cannot be BoolVerifier");
|
||||
static_assert(!std::is_base_of_v<StringVerifier, T>, "T cannot be StringVerifier");
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -624,14 +623,15 @@ struct GreaterEqualVerifier : public OperatorVerifier<T,
|
||||
* TableVerifier.
|
||||
*/
|
||||
template <typename T>
|
||||
struct EqualVerifier : public OperatorVerifier<T, std::equal_to<typename T::Type>> {
|
||||
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
|
||||
|
||||
class EqualVerifier : public OperatorVerifier<T, std::equal_to<typename T::Type>> {
|
||||
public:
|
||||
using OperatorVerifier<T, std::equal_to<typename T::Type>>::OperatorVerifier;
|
||||
using OperatorVerifier<T, std::equal_to<typename T::Type>>::value;
|
||||
|
||||
std::string documentation() const override;
|
||||
|
||||
using OperatorVerifier<T, std::equal_to<typename T::Type>>::value;
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -640,14 +640,15 @@ struct EqualVerifier : public OperatorVerifier<T, std::equal_to<typename T::Type
|
||||
* TableVerifier.
|
||||
*/
|
||||
template <typename T>
|
||||
struct UnequalVerifier : public OperatorVerifier<T, std::not_equal_to<typename T::Type>> {
|
||||
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
|
||||
|
||||
class UnequalVerifier : public OperatorVerifier<T, std::not_equal_to<typename T::Type>> {
|
||||
public:
|
||||
using OperatorVerifier<T, std::not_equal_to<typename T::Type>>::OperatorVerifier;
|
||||
using OperatorVerifier<T, std::not_equal_to<typename T::Type>>::value;
|
||||
|
||||
std::string documentation() const override;
|
||||
|
||||
using OperatorVerifier<T, std::not_equal_to<typename T::Type>>::value;
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
@@ -661,9 +662,8 @@ struct UnequalVerifier : public OperatorVerifier<T, std::not_equal_to<typename T
|
||||
* be a subclass of (or the same as) TableVerifier.
|
||||
*/
|
||||
template <typename T>
|
||||
struct InListVerifier : public T {
|
||||
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
|
||||
|
||||
class InListVerifier : public T {
|
||||
public:
|
||||
/**
|
||||
* Constructs an InListVerifier that checks whether the incoming value is of the
|
||||
* correct type and whether the value is part of the list passed as \p values.
|
||||
@@ -692,6 +692,9 @@ struct InListVerifier : public T {
|
||||
|
||||
/// The list of values against which the incoming value is tested
|
||||
std::vector<typename T::Type> values;
|
||||
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -701,9 +704,8 @@ struct InListVerifier : public T {
|
||||
* be a subclass of (or the same as) TableVerifier.
|
||||
*/
|
||||
template <typename T>
|
||||
struct NotInListVerifier : public T {
|
||||
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
|
||||
|
||||
class NotInListVerifier : public T {
|
||||
public:
|
||||
/**
|
||||
* Constructs a NotInListVerifier that checks whether the incoming value is of the
|
||||
* correct type and whether the value is not part of the list passed as \p values.
|
||||
@@ -731,6 +733,9 @@ struct NotInListVerifier : public T {
|
||||
std::string documentation() const override;
|
||||
|
||||
std::vector<typename T::Type> values;
|
||||
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
@@ -745,20 +750,8 @@ struct NotInListVerifier : public T {
|
||||
* TableVerifier, or VectorVerifier. Both the lower and the higher limit are inclusive).
|
||||
*/
|
||||
template <typename T>
|
||||
struct InRangeVerifier : public T {
|
||||
static_assert(
|
||||
!std::is_base_of<BoolVerifier, T>::value,
|
||||
"T cannot be BoolVerifier"
|
||||
);
|
||||
static_assert(
|
||||
!std::is_base_of<StringVerifier, T>::value,
|
||||
"T cannot be StringVerifier"
|
||||
);
|
||||
static_assert(
|
||||
!std::is_base_of<TableVerifier, T>::value,
|
||||
"T cannot be TableVerifier"
|
||||
);
|
||||
|
||||
class InRangeVerifier : public T {
|
||||
public:
|
||||
/**
|
||||
* Constructs a InRangeVerifier that checks whether the incoming value is of the
|
||||
* correct type and whether the value is greater or equal to \p lower and less or
|
||||
@@ -793,6 +786,11 @@ struct InRangeVerifier : public T {
|
||||
|
||||
typename T::Type lower;
|
||||
typename T::Type upper;
|
||||
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<BoolVerifier, T>, "T cannot be BoolVerifier");
|
||||
static_assert(!std::is_base_of_v<StringVerifier, T>, "T cannot be StringVerifier");
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -803,20 +801,8 @@ struct InRangeVerifier : public T {
|
||||
* TableVerifier, or VectorVerifier. Both the lower and the higher limit are exclusive).
|
||||
*/
|
||||
template <typename T>
|
||||
struct NotInRangeVerifier : public T {
|
||||
static_assert(
|
||||
!std::is_base_of<BoolVerifier, T>::value,
|
||||
"T cannot be BoolVerifier"
|
||||
);
|
||||
static_assert(
|
||||
!std::is_base_of<StringVerifier, T>::value,
|
||||
"T cannot be StringVerifier"
|
||||
);
|
||||
static_assert(
|
||||
!std::is_base_of<TableVerifier, T>::value,
|
||||
"T cannot be TableVerifier"
|
||||
);
|
||||
|
||||
class NotInRangeVerifier : public T {
|
||||
public:
|
||||
/**
|
||||
* Constructs a InRangeVerifier that checks whether the incoming value is of the
|
||||
* correct type and whether the value is less then \p lower and greater than \p upper.
|
||||
@@ -850,6 +836,11 @@ struct NotInRangeVerifier : public T {
|
||||
|
||||
typename T::Type lower;
|
||||
typename T::Type upper;
|
||||
|
||||
private:
|
||||
static_assert(!std::is_base_of_v<BoolVerifier, T>, "T cannot be BoolVerifier");
|
||||
static_assert(!std::is_base_of_v<StringVerifier, T>, "T cannot be StringVerifier");
|
||||
static_assert(!std::is_base_of_v<TableVerifier, T>, "T cannot be TableVerifier");
|
||||
};
|
||||
|
||||
|
||||
@@ -865,7 +856,8 @@ struct NotInRangeVerifier : public T {
|
||||
* the user that the parameter should be a file of a specific type.
|
||||
*/
|
||||
template <typename T>
|
||||
struct AnnotationVerifier : public T {
|
||||
class AnnotationVerifier : public T {
|
||||
public:
|
||||
/**
|
||||
* Constructs an AnnotationVerifier that contains the passed \p annotation which is
|
||||
* passed to the user when a documentation is requested.
|
||||
@@ -883,34 +875,6 @@ struct AnnotationVerifier : public T {
|
||||
std::string annotation;
|
||||
};
|
||||
|
||||
/**
|
||||
* This Verifier is a marker that performs the same testing as the `T` parameter, but
|
||||
* also adds a warning to the test result informing the user of the deprecation.
|
||||
* Furthermore, the documentation will contain the word `(deprecated)` in
|
||||
* addition to the documentation returned by `T`
|
||||
* \tparam T The Verifier that is to be marked deprecated
|
||||
*/
|
||||
template <typename T>
|
||||
struct DeprecatedVerifier : public T {
|
||||
/**
|
||||
* Tests the \p dictionary%s \p key using the Verifier `T` and adds a warning to the
|
||||
* TestResult informing the caller of the deprecation.
|
||||
*
|
||||
* \param dictionary The ghoul::Dictionary whose \p key should be tested
|
||||
* \param key The key inside the \p dictionary that is to be tested
|
||||
* \return A TestResult that contains the results of the testing
|
||||
*/
|
||||
TestResult operator()(const ghoul::Dictionary& dictionary,
|
||||
const std::string& key) const override;
|
||||
|
||||
/**
|
||||
* Returns the documentation as reported by `T` and adds the word
|
||||
* `(deprecated)` to it.
|
||||
* \return The deprecated version of `T`%'s documentation
|
||||
*/
|
||||
std::string documentation() const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* This Verifier can reference and apply other Documentation%s that have been registered
|
||||
* with a DocumentationEngine. The dependency is only resolved when the operator() is
|
||||
@@ -919,7 +883,8 @@ struct DeprecatedVerifier : public T {
|
||||
* If the referenced Documentation exists, the stored Table will be checked against that
|
||||
* Documentation.
|
||||
*/
|
||||
struct ReferencingVerifier : public TableVerifier {
|
||||
class ReferencingVerifier : public TableVerifier {
|
||||
public:
|
||||
/**
|
||||
* Creates a ReferencingVerifier that references a documentation with the provided
|
||||
* identifier \p identifier. The ReferencingVerifier will use the static
|
||||
@@ -958,54 +923,14 @@ struct ReferencingVerifier : public TableVerifier {
|
||||
// Misc verifiers
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This Verifier takes two Verifiers and performs a boolean `and` operation on their
|
||||
* results. In essence, a value only passes this Verifier if it passes both Verifier%s
|
||||
* that are passed in the constructor. Opposed to the `C++` `&&`
|
||||
* operator, the AndVerifier does not perform any short-circut evaluation.
|
||||
*/
|
||||
struct AndVerifier : public Verifier {
|
||||
/**
|
||||
* Constructs an AndVerifier with Verifiers that must be cleared by incoming values in
|
||||
* order to pass this Verifier.
|
||||
*
|
||||
* \param values The list of Verifiers that are to be tested
|
||||
*
|
||||
* \pre values must contain at least two values
|
||||
*/
|
||||
AndVerifier(const std::vector<Verifier*> values);
|
||||
|
||||
/**
|
||||
* Checks whether the \p dictionary contains the \p key and whether this key passes
|
||||
* all Verifier%s that were passed in the constructor. If the value fails at least
|
||||
* one Verifiers, it is only added once to the TestResult::offenses list with a reason
|
||||
* of TestResult::Offense::Reason::Verification.
|
||||
*
|
||||
* \param dictionary The ghoul::Dictionary that is to be tested
|
||||
* \param key The key contained in \p dictionary that is to be tested
|
||||
* \return A TestResult object that contains the test results. If the value fails
|
||||
* any passed Verifiers, TestResult::success is `false` and the
|
||||
* TestResult::offenses list contains \p with a reason of
|
||||
* TestResult::Offense::Reason::Verification. If \p key%'s value passes both
|
||||
* Verifier%s, the result's TestResult::success is `true` and the
|
||||
* TestResult::offenses is empty.
|
||||
*/
|
||||
TestResult operator()(const ghoul::Dictionary& dictionary,
|
||||
const std::string& key) const override;
|
||||
|
||||
std::string type() const override;
|
||||
std::string documentation() const override;
|
||||
|
||||
std::vector<std::shared_ptr<Verifier>> values;
|
||||
};
|
||||
|
||||
/**
|
||||
* This Verifier takes two Verifiers and performs a boolean `or` operation on their
|
||||
* results. In essence, a value only passes this Verifier if it passes either of the two
|
||||
* Verifier%s that are passed in the constructor. Opposed to the `C++` `||` operator, the
|
||||
* OrVerifier does not perform any short-circut evaluation.
|
||||
*/
|
||||
struct OrVerifier : public Verifier {
|
||||
class OrVerifier : public Verifier {
|
||||
public:
|
||||
/**
|
||||
* Constructs an OrVerifier with Verifiers that must be cleared by incoming values in
|
||||
* order to pass this Verifier.
|
||||
@@ -1161,92 +1086,68 @@ using StringAnnotationVerifier = AnnotationVerifier<StringVerifier>;
|
||||
/// `ghoul::Dictionary`
|
||||
using TableAnnotationVerifier = AnnotationVerifier<TableVerifier>;
|
||||
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for `bool`
|
||||
using BoolDeprecatedVerifier = DeprecatedVerifier<BoolVerifier>;
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for `int`
|
||||
using IntDeprecatedVerifier = DeprecatedVerifier<IntVerifier>;
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for `double`
|
||||
using DoubleDeprecatedVerifier = DeprecatedVerifier<DoubleVerifier>;
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for `string`
|
||||
using StringDeprecatedVerifier = DeprecatedVerifier<StringVerifier>;
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for
|
||||
/// `ghoul::Dictionary`
|
||||
using TableDeprecatedVerifier = DeprecatedVerifier<TableVerifier>;
|
||||
|
||||
// Definitions of external templates that are instantiated in the cpp file
|
||||
// This cuts down the compilation times as almost all of the possible template types do
|
||||
// not need to be instantiated multiple times
|
||||
extern template struct Vector2Verifier<int>;
|
||||
extern template struct Vector2Verifier<double>;
|
||||
extern template struct Vector3Verifier<int>;
|
||||
extern template struct Vector3Verifier<double>;
|
||||
extern template struct Vector4Verifier<int>;
|
||||
extern template struct Vector4Verifier<double>;
|
||||
extern template class Vector2Verifier<int>;
|
||||
extern template class Vector2Verifier<double>;
|
||||
extern template class Vector3Verifier<int>;
|
||||
extern template class Vector3Verifier<double>;
|
||||
extern template class Vector4Verifier<int>;
|
||||
extern template class Vector4Verifier<double>;
|
||||
|
||||
extern template struct Matrix2x2Verifier<double>;
|
||||
extern template struct Matrix2x3Verifier<double>;
|
||||
extern template struct Matrix2x4Verifier<double>;
|
||||
extern template struct Matrix3x2Verifier<double>;
|
||||
extern template struct Matrix3x3Verifier<double>;
|
||||
extern template struct Matrix3x4Verifier<double>;
|
||||
extern template struct Matrix4x2Verifier<double>;
|
||||
extern template struct Matrix4x3Verifier<double>;
|
||||
extern template struct Matrix4x4Verifier<double>;
|
||||
extern template class Matrix2x2Verifier<double>;
|
||||
extern template class Matrix2x3Verifier<double>;
|
||||
extern template class Matrix2x4Verifier<double>;
|
||||
extern template class Matrix3x2Verifier<double>;
|
||||
extern template class Matrix3x3Verifier<double>;
|
||||
extern template class Matrix3x4Verifier<double>;
|
||||
extern template class Matrix4x2Verifier<double>;
|
||||
extern template class Matrix4x3Verifier<double>;
|
||||
extern template class Matrix4x4Verifier<double>;
|
||||
|
||||
extern template struct LessVerifier<IntVerifier>;
|
||||
extern template struct LessVerifier<DoubleVerifier>;
|
||||
extern template struct LessEqualVerifier<IntVerifier>;
|
||||
extern template struct LessEqualVerifier<DoubleVerifier>;
|
||||
extern template struct GreaterVerifier<IntVerifier>;
|
||||
extern template struct GreaterVerifier<DoubleVerifier>;
|
||||
extern template struct GreaterEqualVerifier<IntVerifier>;
|
||||
extern template struct GreaterEqualVerifier<DoubleVerifier>;
|
||||
extern template struct EqualVerifier<BoolVerifier>;
|
||||
extern template struct EqualVerifier<IntVerifier>;
|
||||
extern template struct EqualVerifier<DoubleVerifier>;
|
||||
extern template struct EqualVerifier<StringVerifier>;
|
||||
extern template struct UnequalVerifier<BoolVerifier>;
|
||||
extern template struct UnequalVerifier<IntVerifier>;
|
||||
extern template struct UnequalVerifier<DoubleVerifier>;
|
||||
extern template struct UnequalVerifier<StringVerifier>;
|
||||
extern template class LessVerifier<IntVerifier>;
|
||||
extern template class LessVerifier<DoubleVerifier>;
|
||||
extern template class LessEqualVerifier<IntVerifier>;
|
||||
extern template class LessEqualVerifier<DoubleVerifier>;
|
||||
extern template class GreaterVerifier<IntVerifier>;
|
||||
extern template class GreaterVerifier<DoubleVerifier>;
|
||||
extern template class GreaterEqualVerifier<IntVerifier>;
|
||||
extern template class GreaterEqualVerifier<DoubleVerifier>;
|
||||
extern template class EqualVerifier<BoolVerifier>;
|
||||
extern template class EqualVerifier<IntVerifier>;
|
||||
extern template class EqualVerifier<DoubleVerifier>;
|
||||
extern template class EqualVerifier<StringVerifier>;
|
||||
extern template class UnequalVerifier<BoolVerifier>;
|
||||
extern template class UnequalVerifier<IntVerifier>;
|
||||
extern template class UnequalVerifier<DoubleVerifier>;
|
||||
extern template class UnequalVerifier<StringVerifier>;
|
||||
|
||||
extern template struct InListVerifier<BoolVerifier>;
|
||||
extern template struct InListVerifier<IntVerifier>;
|
||||
extern template struct InListVerifier<DoubleVerifier>;
|
||||
extern template struct InListVerifier<StringVerifier>;
|
||||
extern template struct NotInListVerifier<BoolVerifier>;
|
||||
extern template struct NotInListVerifier<IntVerifier>;
|
||||
extern template struct NotInListVerifier<DoubleVerifier>;
|
||||
extern template struct NotInListVerifier<StringVerifier>;
|
||||
extern template class InListVerifier<BoolVerifier>;
|
||||
extern template class InListVerifier<IntVerifier>;
|
||||
extern template class InListVerifier<DoubleVerifier>;
|
||||
extern template class InListVerifier<StringVerifier>;
|
||||
extern template class NotInListVerifier<BoolVerifier>;
|
||||
extern template class NotInListVerifier<IntVerifier>;
|
||||
extern template class NotInListVerifier<DoubleVerifier>;
|
||||
extern template class NotInListVerifier<StringVerifier>;
|
||||
|
||||
extern template struct InRangeVerifier<IntVerifier>;
|
||||
extern template struct InRangeVerifier<DoubleVerifier>;
|
||||
extern template struct NotInRangeVerifier<IntVerifier>;
|
||||
extern template struct NotInRangeVerifier<DoubleVerifier>;
|
||||
extern template class InRangeVerifier<IntVerifier>;
|
||||
extern template class InRangeVerifier<DoubleVerifier>;
|
||||
extern template class NotInRangeVerifier<IntVerifier>;
|
||||
extern template class NotInRangeVerifier<DoubleVerifier>;
|
||||
|
||||
extern template struct AnnotationVerifier<BoolVerifier>;
|
||||
extern template struct AnnotationVerifier<IntVerifier>;
|
||||
extern template struct AnnotationVerifier<DoubleVerifier>;
|
||||
extern template struct AnnotationVerifier<StringVerifier>;
|
||||
extern template struct AnnotationVerifier<TableVerifier>;
|
||||
extern template struct AnnotationVerifier<IntVector2Verifier>;
|
||||
extern template struct AnnotationVerifier<DoubleVector2Verifier>;
|
||||
extern template struct AnnotationVerifier<IntVector3Verifier>;
|
||||
extern template struct AnnotationVerifier<DoubleVector3Verifier>;
|
||||
extern template struct AnnotationVerifier<IntVector4Verifier>;
|
||||
extern template struct AnnotationVerifier<DoubleVector4Verifier>;
|
||||
|
||||
extern template struct DeprecatedVerifier<BoolVerifier>;
|
||||
extern template struct DeprecatedVerifier<IntVerifier>;
|
||||
extern template struct DeprecatedVerifier<DoubleVerifier>;
|
||||
extern template struct DeprecatedVerifier<StringVerifier>;
|
||||
extern template struct DeprecatedVerifier<TableVerifier>;
|
||||
extern template struct DeprecatedVerifier<IntVector2Verifier>;
|
||||
extern template struct DeprecatedVerifier<DoubleVector2Verifier>;
|
||||
extern template struct DeprecatedVerifier<IntVector3Verifier>;
|
||||
extern template struct DeprecatedVerifier<DoubleVector3Verifier>;
|
||||
extern template struct DeprecatedVerifier<IntVector4Verifier>;
|
||||
extern template struct DeprecatedVerifier<DoubleVector4Verifier>;
|
||||
extern template class AnnotationVerifier<BoolVerifier>;
|
||||
extern template class AnnotationVerifier<IntVerifier>;
|
||||
extern template class AnnotationVerifier<DoubleVerifier>;
|
||||
extern template class AnnotationVerifier<StringVerifier>;
|
||||
extern template class AnnotationVerifier<TableVerifier>;
|
||||
extern template class AnnotationVerifier<IntVector2Verifier>;
|
||||
extern template class AnnotationVerifier<DoubleVector2Verifier>;
|
||||
extern template class AnnotationVerifier<IntVector3Verifier>;
|
||||
extern template class AnnotationVerifier<DoubleVector3Verifier>;
|
||||
extern template class AnnotationVerifier<IntVector4Verifier>;
|
||||
extern template class AnnotationVerifier<DoubleVector4Verifier>;
|
||||
|
||||
} // namespace openspace::documentation
|
||||
|
||||
|
||||
@@ -30,384 +30,6 @@
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
|
||||
template <>
|
||||
struct std::less<glm::vec2> {
|
||||
bool operator()(const glm::vec2& a, const glm::vec2& b) const {
|
||||
return a.x < b.x && a.x < b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less<glm::vec3> {
|
||||
bool operator()(const glm::vec3& a, const glm::vec3& b) const {
|
||||
return a.x < b.x && a.x < b.y && a.z < b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less<glm::vec4> {
|
||||
bool operator()(const glm::vec4& a, const glm::vec4& b) const {
|
||||
return a.x < b.x && a.x < b.y && a.z < b.z && a.w < b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less<glm::ivec2> {
|
||||
bool operator()(const glm::ivec2& a, const glm::ivec2& b) const {
|
||||
return a.x < b.x && a.x < b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less<glm::ivec3> {
|
||||
bool operator()(const glm::ivec3& a, const glm::ivec3& b) const {
|
||||
return a.x < b.x && a.x < b.y && a.z < b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less<glm::ivec4> {
|
||||
bool operator()(const glm::ivec4& a, const glm::ivec4& b) const {
|
||||
return a.x < b.x && a.x < b.y && a.z < b.z && a.w < b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less<glm::dvec2> {
|
||||
bool operator()(const glm::dvec2& a, const glm::dvec2& b) const {
|
||||
return a.x < b.x && a.x < b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less<glm::dvec3> {
|
||||
bool operator()(const glm::dvec3& a, const glm::dvec3& b) const {
|
||||
return a.x < b.x && a.x < b.y && a.z < b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less<glm::dvec4> {
|
||||
bool operator()(const glm::dvec4& a, const glm::dvec4& b) const {
|
||||
return a.x < b.x && a.x < b.y && a.z < b.z && a.w < b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less_equal<glm::vec2> {
|
||||
bool operator()(const glm::vec2& a, const glm::vec2& b) const {
|
||||
return a.x <= b.x && a.x <= b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less_equal<glm::vec3> {
|
||||
bool operator()(const glm::vec3& a, const glm::vec3& b) const {
|
||||
return a.x <= b.x && a.x <= b.y && a.z <= b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less_equal<glm::vec4> {
|
||||
bool operator()(const glm::vec4& a, const glm::vec4& b) const {
|
||||
return a.x <= b.x && a.x <= b.y && a.z <= b.z && a.w <= b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less_equal<glm::ivec2> {
|
||||
bool operator()(const glm::ivec2& a, const glm::ivec2& b) const {
|
||||
return a.x <= b.x && a.x <= b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less_equal<glm::ivec3> {
|
||||
bool operator()(const glm::ivec3& a, const glm::ivec3& b) const {
|
||||
return a.x <= b.x && a.x <= b.y && a.z <= b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less_equal<glm::ivec4> {
|
||||
bool operator()(const glm::ivec4& a, const glm::ivec4& b) const {
|
||||
return a.x <= b.x && a.x <= b.y && a.z <= b.z && a.w <= b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less_equal<glm::dvec2> {
|
||||
bool operator()(const glm::dvec2& a, const glm::dvec2& b) const {
|
||||
return a.x <= b.x && a.x <= b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less_equal<glm::dvec3> {
|
||||
bool operator()(const glm::dvec3& a, const glm::dvec3& b) const {
|
||||
return a.x <= b.x && a.x <= b.y && a.z <= b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::less_equal<glm::dvec4> {
|
||||
bool operator()(const glm::dvec4& a, const glm::dvec4& b) const {
|
||||
return a.x <= b.x && a.x <= b.y && a.z <= b.z && a.w <= b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater<glm::vec2> {
|
||||
bool operator()(const glm::vec2& a, const glm::vec2& b) const {
|
||||
return a.x > b.x && a.x > b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater<glm::vec3> {
|
||||
bool operator()(const glm::vec3& a, const glm::vec3& b) const {
|
||||
return a.x > b.x && a.x > b.y && a.z > b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater<glm::vec4> {
|
||||
bool operator()(const glm::vec4& a, const glm::vec4& b) const {
|
||||
return a.x > b.x && a.x > b.y && a.z > b.z && a.w > b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater<glm::ivec2> {
|
||||
bool operator()(const glm::ivec2& a, const glm::ivec2& b) const {
|
||||
return a.x > b.x && a.x > b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater<glm::ivec3> {
|
||||
bool operator()(const glm::ivec3& a, const glm::ivec3& b) const {
|
||||
return a.x > b.x && a.x > b.y && a.z > b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater<glm::ivec4> {
|
||||
bool operator()(const glm::ivec4& a, const glm::ivec4& b) const {
|
||||
return a.x > b.x && a.x > b.y && a.z > b.z && a.w > b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater<glm::dvec2> {
|
||||
bool operator()(const glm::dvec2& a, const glm::dvec2& b) const {
|
||||
return a.x > b.x && a.x > b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater<glm::dvec3> {
|
||||
bool operator()(const glm::dvec3& a, const glm::dvec3& b) const {
|
||||
return a.x > b.x && a.x > b.y && a.z > b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater<glm::dvec4> {
|
||||
bool operator()(const glm::dvec4& a, const glm::dvec4& b) const {
|
||||
return a.x > b.x && a.x > b.y && a.z > b.z && a.w > b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater_equal<glm::vec2> {
|
||||
bool operator()(const glm::vec2& a, const glm::vec2& b) const {
|
||||
return a.x >= b.x && a.x >= b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater_equal<glm::vec3> {
|
||||
bool operator()(const glm::vec3& a, const glm::vec3& b) const {
|
||||
return a.x >= b.x && a.x >= b.y && a.z >= b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater_equal<glm::vec4> {
|
||||
bool operator()(const glm::vec4& a, const glm::vec4& b) const {
|
||||
return a.x >= b.x && a.x >= b.y && a.z >= b.z && a.w >= b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater_equal<glm::ivec2> {
|
||||
bool operator()(const glm::ivec2& a, const glm::ivec2& b) const {
|
||||
return a.x >= b.x && a.x >= b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater_equal<glm::ivec3> {
|
||||
bool operator()(const glm::ivec3& a, const glm::ivec3& b) const {
|
||||
return a.x >= b.x && a.x >= b.y && a.z >= b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater_equal<glm::ivec4> {
|
||||
bool operator()(const glm::ivec4& a, const glm::ivec4& b) const {
|
||||
return a.x >= b.x && a.x >= b.y && a.z >= b.z && a.w >= b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater_equal<glm::dvec2> {
|
||||
bool operator()(const glm::dvec2& a, const glm::dvec2& b) const {
|
||||
return a.x >= b.x && a.x >= b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater_equal<glm::dvec3> {
|
||||
bool operator()(const glm::dvec3& a, const glm::dvec3& b) const {
|
||||
return a.x >= b.x && a.x >= b.y && a.z >= b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::greater_equal<glm::dvec4> {
|
||||
bool operator()(const glm::dvec4& a, const glm::dvec4& b) const {
|
||||
return a.x >= b.x && a.x >= b.y && a.z >= b.z && a.w >= b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::equal_to<glm::vec2> {
|
||||
bool operator()(const glm::vec2& a, const glm::vec2& b) const {
|
||||
return a.x == b.x && a.x == b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::equal_to<glm::vec3> {
|
||||
bool operator()(const glm::vec3& a, const glm::vec3& b) const {
|
||||
return a.x == b.x && a.x == b.y && a.z == b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::equal_to<glm::vec4> {
|
||||
bool operator()(const glm::vec4& a, const glm::vec4& b) const {
|
||||
return a.x == b.x && a.x == b.y && a.z == b.z && a.w == b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::equal_to<glm::ivec2> {
|
||||
bool operator()(const glm::ivec2& a, const glm::ivec2& b) const {
|
||||
return a.x == b.x && a.x == b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::equal_to<glm::ivec3> {
|
||||
bool operator()(const glm::ivec3& a, const glm::ivec3& b) const {
|
||||
return a.x == b.x && a.x == b.y && a.z == b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::equal_to<glm::ivec4> {
|
||||
bool operator()(const glm::ivec4& a, const glm::ivec4& b) const {
|
||||
return a.x == b.x && a.x == b.y && a.z == b.z && a.w == b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::equal_to<glm::dvec2> {
|
||||
bool operator()(const glm::dvec2& a, const glm::dvec2& b) const {
|
||||
return a.x == b.x && a.x == b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::equal_to<glm::dvec3> {
|
||||
bool operator()(const glm::dvec3& a, const glm::dvec3& b) const {
|
||||
return a.x == b.x && a.x == b.y && a.z == b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::equal_to<glm::dvec4> {
|
||||
bool operator()(const glm::dvec4& a, const glm::dvec4& b) const {
|
||||
return a.x == b.x && a.x == b.y && a.z == b.z && a.w == b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::not_equal_to<glm::vec2> {
|
||||
bool operator()(const glm::vec2& a, const glm::vec2& b) const {
|
||||
return a.x != b.x && a.x != b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::not_equal_to<glm::vec3> {
|
||||
bool operator()(const glm::vec3& a, const glm::vec3& b) const {
|
||||
return a.x != b.x && a.x != b.y && a.z != b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::not_equal_to<glm::vec4> {
|
||||
bool operator()(const glm::vec4& a, const glm::vec4& b) const {
|
||||
return a.x != b.x && a.x != b.y && a.z != b.z && a.w != b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::not_equal_to<glm::ivec2> {
|
||||
bool operator()(const glm::ivec2& a, const glm::ivec2& b) const {
|
||||
return a.x != b.x && a.x != b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::not_equal_to<glm::ivec3> {
|
||||
bool operator()(const glm::ivec3& a, const glm::ivec3& b) const {
|
||||
return a.x != b.x && a.x != b.y && a.z != b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::not_equal_to<glm::ivec4> {
|
||||
bool operator()(const glm::ivec4& a, const glm::ivec4& b) const {
|
||||
return a.x != b.x && a.x != b.y && a.z != b.z && a.w != b.w;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::not_equal_to<glm::dvec2> {
|
||||
bool operator()(const glm::dvec2& a, const glm::dvec2& b) const {
|
||||
return a.x != b.x && a.x != b.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::not_equal_to<glm::dvec3> {
|
||||
bool operator()(const glm::dvec3& a, const glm::dvec3& b) const {
|
||||
return a.x != b.x && a.x != b.y && a.z != b.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::not_equal_to<glm::dvec4> {
|
||||
bool operator()(const glm::dvec4& a, const glm::dvec4& b) const {
|
||||
return a.x != b.x && a.x != b.y && a.z != b.z && a.w != b.w;
|
||||
}
|
||||
};
|
||||
|
||||
namespace openspace::documentation {
|
||||
|
||||
template <>
|
||||
@@ -1073,21 +695,4 @@ std::string AnnotationVerifier<T>::documentation() const {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
TestResult DeprecatedVerifier<T>::operator()(const ghoul::Dictionary& dict,
|
||||
const std::string& key) const
|
||||
{
|
||||
TestResult res = T::operator()(dict, key);
|
||||
TestResult::Warning w;
|
||||
w.offender = key;
|
||||
w.reason = TestResult::Warning::Reason::Deprecated;
|
||||
res.warnings.push_back(w);
|
||||
return res;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string DeprecatedVerifier<T>::documentation() const {
|
||||
return T::documentation() + " (deprecated)";
|
||||
}
|
||||
|
||||
} // namespace openspace::documentation
|
||||
|
||||
@@ -104,6 +104,9 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This DashboardItem shows the angle between two scenegraph nodes relative to a
|
||||
// reference node. The angle is calculated in the plane that is defined by the
|
||||
// 'SourceNodeName', 'DestinationNodeName', and the 'ReferenceNodeName'.
|
||||
struct [[codegen::Dictionary(DashboardItemAngle)]] Parameters {
|
||||
enum class [[codegen::map(Type)]] Type {
|
||||
Node,
|
||||
|
||||
@@ -40,6 +40,7 @@ documentation::Documentation LayerManager::Documentation() {
|
||||
return {
|
||||
"LayerManager",
|
||||
"globebrowsing_layermanager",
|
||||
"",
|
||||
{
|
||||
{
|
||||
"*",
|
||||
|
||||
@@ -171,9 +171,9 @@ ServerInterface::ServerInterface(const ghoul::Dictionary& config)
|
||||
readList(DenyAddressesInfo.identifier, _denyAddresses);
|
||||
readList(RequirePasswordAddressesInfo.identifier, _requirePasswordAddresses);
|
||||
|
||||
this->setIdentifier(identifier);
|
||||
this->setGuiName(identifier);
|
||||
this->setDescription("Settings for server interface " + identifier);
|
||||
setIdentifier(identifier);
|
||||
setGuiName(identifier);
|
||||
setDescription("Settings for server interface " + identifier);
|
||||
|
||||
const std::string type = config.value<std::string>(TypeInfo.identifier);
|
||||
if (type == TcpSocketType) {
|
||||
|
||||
@@ -38,6 +38,7 @@ documentation::Documentation RenderableSphereSpout::Documentation() {
|
||||
return {
|
||||
"Renderable Sphere Spout",
|
||||
"spout_sphere_spout",
|
||||
"",
|
||||
{
|
||||
{
|
||||
"Name",
|
||||
|
||||
@@ -90,7 +90,7 @@ void TransferFunctionHandler::initialize() {
|
||||
addProperty(_maxValue);
|
||||
addProperty(_saveTransferFunction);
|
||||
|
||||
this->addTag("TF");
|
||||
addTag("TF");
|
||||
_texture = std::make_shared<ghoul::opengl::Texture>(
|
||||
glm::uvec3(1024, 1, 1),
|
||||
GL_TEXTURE_1D,
|
||||
|
||||
@@ -189,20 +189,6 @@ DocumentationEntry::DocumentationEntry(std::string k, Verifier* v, Optional opt,
|
||||
std::move(doc))
|
||||
{}
|
||||
|
||||
Documentation::Documentation(std::string n, std::string i, DocumentationEntries ents)
|
||||
: name(std::move(n))
|
||||
, id(std::move(i))
|
||||
, entries(std::move(ents))
|
||||
{}
|
||||
|
||||
Documentation::Documentation(std::string n, DocumentationEntries ents)
|
||||
: Documentation(std::move(n), "", std::move(ents))
|
||||
{}
|
||||
|
||||
Documentation::Documentation(DocumentationEntries ents)
|
||||
: Documentation("", "", std::move(ents))
|
||||
{}
|
||||
|
||||
TestResult testSpecification(const Documentation& documentation,
|
||||
const ghoul::Dictionary& dictionary)
|
||||
{
|
||||
|
||||
@@ -77,6 +77,7 @@ nlohmann::json generateJsonDocumentation(const Documentation& d) {
|
||||
|
||||
json["name"] = d.name;
|
||||
json["id"] = d.id;
|
||||
json["description"] = d.description;
|
||||
json["properties"] = nlohmann::json::array();
|
||||
|
||||
for (const DocumentationEntry& p : d.entries) {
|
||||
@@ -110,7 +111,8 @@ nlohmann::json generateJsonDocumentation(const Documentation& d) {
|
||||
}
|
||||
}
|
||||
else if (tv) {
|
||||
nlohmann::json restrictions = generateJsonDocumentation(tv->documentations);
|
||||
Documentation doc = { .entries = tv->documentations };
|
||||
nlohmann::json restrictions = generateJsonDocumentation(doc);
|
||||
// We have a TableVerifier, so we need to recurse
|
||||
entry["restrictions"] = restrictions;
|
||||
}
|
||||
|
||||
@@ -119,21 +119,6 @@ template struct AnnotationVerifier<DoubleVector3Verifier>;
|
||||
template struct AnnotationVerifier<IntVector4Verifier>;
|
||||
template struct AnnotationVerifier<DoubleVector4Verifier>;
|
||||
|
||||
template struct DeprecatedVerifier<BoolVerifier>;
|
||||
template struct DeprecatedVerifier<IntVerifier>;
|
||||
template struct DeprecatedVerifier<DoubleVerifier>;
|
||||
template struct DeprecatedVerifier<StringVerifier>;
|
||||
template struct DeprecatedVerifier<TableVerifier>;
|
||||
//template struct DeprecatedVerifier<BoolVector2Verifier>;
|
||||
template struct DeprecatedVerifier<IntVector2Verifier>;
|
||||
template struct DeprecatedVerifier<DoubleVector2Verifier>;
|
||||
//template struct DeprecatedVerifier<BoolVector3Verifier>;
|
||||
template struct DeprecatedVerifier<IntVector3Verifier>;
|
||||
template struct DeprecatedVerifier<DoubleVector3Verifier>;
|
||||
//template struct DeprecatedVerifier<BoolVector4Verifier>;
|
||||
template struct DeprecatedVerifier<IntVector4Verifier>;
|
||||
template struct DeprecatedVerifier<DoubleVector4Verifier>;
|
||||
|
||||
std::string BoolVerifier::type() const {
|
||||
return "Boolean";
|
||||
}
|
||||
@@ -143,7 +128,7 @@ std::string DoubleVerifier::type() const {
|
||||
}
|
||||
|
||||
TestResult IntVerifier::operator()(const ghoul::Dictionary& dict,
|
||||
const std::string & key) const
|
||||
const std::string& key) const
|
||||
{
|
||||
if (dict.hasValue<int>(key)) {
|
||||
// We have a key and the value is int, we are done
|
||||
@@ -201,8 +186,7 @@ std::string IntVerifier::type() const {
|
||||
}
|
||||
|
||||
StringVerifier::StringVerifier(bool mustBeNotEmpty)
|
||||
: TemplateVerifier<std::string>()
|
||||
, _mustBeNotEmpty(mustBeNotEmpty)
|
||||
: _mustBeNotEmpty(mustBeNotEmpty)
|
||||
{}
|
||||
|
||||
TestResult StringVerifier::operator()(const ghoul::Dictionary& dictionary,
|
||||
@@ -612,16 +596,17 @@ TestResult TableVerifier::operator()(const ghoul::Dictionary& dictionary,
|
||||
{
|
||||
if (dictionary.hasValue<Type>(key)) {
|
||||
ghoul::Dictionary d = dictionary.value<ghoul::Dictionary>(key);
|
||||
TestResult res = testSpecification({documentations}, d);
|
||||
Documentation doc = { .entries = documentations };
|
||||
TestResult res = testSpecification(doc, d);
|
||||
|
||||
// Add the 'key' as a prefix to make the new offender a fully qualified identifer
|
||||
for (TestResult::Offense& s : res.offenses) {
|
||||
s.offender = key + "." + s.offender;
|
||||
s.offender = fmt::format("{}.{}", key, s.offender);
|
||||
}
|
||||
|
||||
// Add the 'key' as a prefix to make the new warning a fully qualified identifer
|
||||
for (TestResult::Warning& w : res.warnings) {
|
||||
w.offender = key + "." + w.offender;
|
||||
w.offender = fmt::format("{}.{}", key, w.offender);
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -700,22 +685,17 @@ TestResult ReferencingVerifier::operator()(const ghoul::Dictionary& dictionary,
|
||||
return res;
|
||||
}
|
||||
|
||||
//ghoul_assert(
|
||||
// it != docs.end(),
|
||||
// "Did not find referencing identifier '" + identifier + "'"
|
||||
//);
|
||||
|
||||
ghoul::Dictionary d = dictionary.value<ghoul::Dictionary>(key);
|
||||
TestResult r = testSpecification(*it, d);
|
||||
|
||||
// Add the 'key' as a prefix to make the offender a fully qualified identifer
|
||||
for (TestResult::Offense& s : r.offenses) {
|
||||
s.offender = key + "." + s.offender;
|
||||
s.offender = fmt::format("{}.{}", key, s.offender);
|
||||
}
|
||||
|
||||
// Add the 'key' as a prefix to make the warning a fully qualified identifer
|
||||
for (TestResult::Warning& w : r.warnings) {
|
||||
w.offender = key + "." + w.offender;
|
||||
w.offender = fmt::format("{}.{}", key, w.offender);
|
||||
}
|
||||
|
||||
return r;
|
||||
@@ -729,86 +709,16 @@ std::string ReferencingVerifier::documentation() const {
|
||||
return "Referencing Documentation: '" + identifier + "'";
|
||||
}
|
||||
|
||||
AndVerifier::AndVerifier(const std::vector<Verifier*> values_) {
|
||||
ghoul_assert(!values_.empty(), "values must not be empty");
|
||||
for (Verifier* v : values_) {
|
||||
this->values.push_back(std::shared_ptr<Verifier>(v));
|
||||
}
|
||||
}
|
||||
|
||||
TestResult AndVerifier::operator()(const ghoul::Dictionary& dictionary,
|
||||
const std::string& key) const
|
||||
{
|
||||
std::vector<TestResult> res(values.size());
|
||||
std::transform(
|
||||
values.cbegin(),
|
||||
values.cend(),
|
||||
res.begin(),
|
||||
[dictionary, key](const std::shared_ptr<Verifier>& v) {
|
||||
return v->operator()(dictionary, key);
|
||||
}
|
||||
);
|
||||
|
||||
const bool success = std::all_of(
|
||||
res.cbegin(),
|
||||
res.cend(),
|
||||
std::mem_fn(&TestResult::success)
|
||||
);
|
||||
|
||||
if (success) {
|
||||
TestResult r;
|
||||
r.success = true;
|
||||
return r;
|
||||
}
|
||||
else {
|
||||
TestResult r;
|
||||
r.success = false;
|
||||
TestResult::Offense o;
|
||||
o.offender = key;
|
||||
o.reason = TestResult::Offense::Reason::Verification;
|
||||
r.offenses.push_back(o);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
std::string AndVerifier::type() const {
|
||||
// Dirty hack to get an "and " inserted before the last element
|
||||
std::vector<std::string> types(values.size() - 1);
|
||||
std::transform(
|
||||
values.cbegin(),
|
||||
values.cend() - 1,
|
||||
types.begin(),
|
||||
std::mem_fn(&Verifier::type)
|
||||
);
|
||||
types.push_back(std::string("and ") + values.back()->type());
|
||||
|
||||
return ghoul::join(types, ", ");
|
||||
}
|
||||
|
||||
std::string AndVerifier::documentation() const {
|
||||
// Dirty hack to get an "and " inserted before the last element
|
||||
std::vector<std::string> documentations(values.size() - 1);
|
||||
std::transform(
|
||||
values.cbegin(),
|
||||
values.cend() - 1,
|
||||
documentations.begin(),
|
||||
std::mem_fn(&Verifier::documentation)
|
||||
);
|
||||
documentations.push_back(std::string("and ") + values.back()->documentation());
|
||||
|
||||
return ghoul::join(documentations, ", ");
|
||||
}
|
||||
|
||||
OrVerifier::OrVerifier(
|
||||
const std::vector<std::variant<Verifier*, std::shared_ptr<Verifier>>> values_)
|
||||
{
|
||||
ghoul_assert(!values_.empty(), "values must not be empty");
|
||||
for (const std::variant<Verifier*, std::shared_ptr<Verifier>>& v : values_) {
|
||||
if (std::holds_alternative<Verifier*>(v)) {
|
||||
this->values.push_back(std::shared_ptr<Verifier>(std::get<Verifier*>(v)));
|
||||
values.push_back(std::shared_ptr<Verifier>(std::get<Verifier*>(v)));
|
||||
}
|
||||
else {
|
||||
this->values.push_back(std::get<std::shared_ptr<Verifier>>(v));
|
||||
values.push_back(std::get<std::shared_ptr<Verifier>>(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -857,7 +767,7 @@ std::string OrVerifier::type() const {
|
||||
types.begin(),
|
||||
std::mem_fn(&Verifier::type)
|
||||
);
|
||||
types.push_back(std::string("or ") + values.back()->type());
|
||||
types.push_back(fmt::format("or {}", values.back()->type()));
|
||||
|
||||
return ghoul::join(types, ", ");
|
||||
}
|
||||
@@ -871,7 +781,7 @@ std::string OrVerifier::documentation() const {
|
||||
documentations.begin(),
|
||||
std::mem_fn(&Verifier::documentation)
|
||||
);
|
||||
documentations.push_back(std::string("or ") + values.back()->documentation());
|
||||
documentations.push_back(fmt::format("or {}", values.back()->documentation()));
|
||||
|
||||
return ghoul::join(documentations, ", ");
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ documentation::Documentation ConvertRecFileVersionTask::documentation() {
|
||||
return {
|
||||
"ConvertRecFileVersionTask",
|
||||
"convert_file_version_task",
|
||||
"",
|
||||
{
|
||||
{
|
||||
"InputFilePath",
|
||||
|
||||
@@ -314,6 +314,7 @@ documentation::Documentation ConvertRecFormatTask::documentation() {
|
||||
return {
|
||||
"ConvertRecFormatTask",
|
||||
"convert_format_task",
|
||||
"",
|
||||
{
|
||||
{
|
||||
"InputFilePath",
|
||||
|
||||
@@ -47,6 +47,7 @@ nlohmann::json generateJsonDocumentation(const Documentation& d) {
|
||||
|
||||
json["name"] = d.name;
|
||||
json["identifier"] = d.id;
|
||||
json["description"] = d.description;
|
||||
json["members"] = nlohmann::json::array();
|
||||
|
||||
for (const DocumentationEntry& p : d.entries) {
|
||||
@@ -80,7 +81,8 @@ nlohmann::json generateJsonDocumentation(const Documentation& d) {
|
||||
}
|
||||
}
|
||||
else if (tv) {
|
||||
nlohmann::json restrictions = generateJsonDocumentation(tv->documentations);
|
||||
Documentation doc = { .entries = tv->documentations };
|
||||
nlohmann::json restrictions = generateJsonDocumentation(doc);
|
||||
// We have a TableVerifier, so we need to recurse
|
||||
entry["restrictions"] = restrictions;
|
||||
}
|
||||
|
||||
Submodule support/coding/codegen updated: abe1b74019...b38743ad76
@@ -277,8 +277,8 @@ TEST_CASE("Documentation: Constructor", "[documentation]") {
|
||||
TEST_CASE("Documentation: Initializer Constructor", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
// Basic Verifiers
|
||||
{"BoolVerifier", new BoolVerifier, Optional::No },
|
||||
{"DoubleVerifier", new DoubleVerifier, Optional::No },
|
||||
@@ -344,8 +344,10 @@ TEST_CASE("Documentation: Initializer Constructor", "[documentation]") {
|
||||
TEST_CASE("Documentation: BoolVerifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Bool", new BoolVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Bool", new BoolVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -376,8 +378,10 @@ TEST_CASE("Documentation: BoolVerifier", "[documentation]") {
|
||||
TEST_CASE("Documentation: DoubleVerifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new DoubleVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Double", new DoubleVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -407,8 +411,10 @@ TEST_CASE("Documentation: DoubleVerifier", "[documentation]") {
|
||||
TEST_CASE("Documentation: IntVerifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new IntVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Int", new IntVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -444,8 +450,10 @@ TEST_CASE("Documentation: StringVerifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{{ "String", new StringVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "String", new StringVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -475,8 +483,10 @@ TEST_CASE("Documentation: IdentifierVerifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc{
|
||||
{{ "Identifier", new IdentifierVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Identifier", new IdentifierVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -538,8 +548,10 @@ TEST_CASE("Documentation: FileVerifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{{ "File", new FileVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "File", new FileVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -577,8 +589,10 @@ TEST_CASE("Documentation: DirectoryVerifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc{
|
||||
{{ "Dir", new DirectoryVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Dir", new DirectoryVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -616,8 +630,10 @@ TEST_CASE("Documentation: DateTimeVerifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc{
|
||||
{{ "DateTime", new DateTimeVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "DateTime", new DateTimeVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -654,8 +670,10 @@ TEST_CASE("Documentation: DateTimeVerifier", "[documentation]") {
|
||||
TEST_CASE("Documentation: TableVerifierType", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Table", new TableVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Table", new TableVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -685,8 +703,10 @@ TEST_CASE("Documentation: StringListVerifierType", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "StringList", new StringListVerifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "StringList", new StringListVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -737,8 +757,10 @@ TEST_CASE("Documentation: IntListVerifierType", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "IntList", new IntListVerifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "IntList", new IntListVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -788,8 +810,8 @@ TEST_CASE("Documentation: MixedVerifiers", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Bool", new BoolVerifier, Optional::No },
|
||||
{ "Double", new DoubleVerifier, Optional::No },
|
||||
{ "Int", new IntVerifier, Optional::No },
|
||||
@@ -839,8 +861,8 @@ TEST_CASE("Documentation: NestedTables", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Outer_Int", new IntVerifier, Optional::No },
|
||||
{ "Outer_Table", new TableVerifier({
|
||||
{ "Inner_Double", new DoubleVerifier, Optional::No },
|
||||
@@ -1018,8 +1040,8 @@ TEST_CASE("Documentation: NestedTables", "[documentation]") {
|
||||
TEST_CASE("Documentation: Optional", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Bool_Force", new BoolVerifier, Optional::No },
|
||||
{ "Bool_Optional", new BoolVerifier, Optional::Yes }
|
||||
}
|
||||
@@ -1066,23 +1088,25 @@ TEST_CASE("Documentation: Optional", "[documentation]") {
|
||||
TEST_CASE("Documentation: Required In Optional", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{
|
||||
"a",
|
||||
new TableVerifier({
|
||||
{
|
||||
"b",
|
||||
new IntVerifier,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
"c",
|
||||
new IntVerifier,
|
||||
Optional::Yes
|
||||
}
|
||||
}),
|
||||
Optional::Yes
|
||||
}}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{
|
||||
"a",
|
||||
new TableVerifier({
|
||||
{
|
||||
"b",
|
||||
new IntVerifier,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
"c",
|
||||
new IntVerifier,
|
||||
Optional::Yes
|
||||
}
|
||||
}),
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1127,8 +1151,10 @@ TEST_CASE("Documentation: Required In Optional", "[documentation]") {
|
||||
TEST_CASE("Documentation: Exhaustive", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new IntVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Int", new IntVerifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1157,11 +1183,14 @@ TEST_CASE("Documentation: Exhaustive", "[documentation]") {
|
||||
TEST_CASE("Documentation: Nested Exhaustive", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Table", new TableVerifier(
|
||||
{ { "a", new IntVerifier, Optional::No } }
|
||||
), Optional::No
|
||||
}}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{
|
||||
"Table",
|
||||
new TableVerifier({ { "a", new IntVerifier, Optional::No } }),
|
||||
Optional::No
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1207,12 +1236,10 @@ TEST_CASE("Documentation: Empty Entries Non Exhaustive", "[documentation]") {
|
||||
TEST_CASE("Documentation: Empty Nested Exhaustive", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{
|
||||
"Table",
|
||||
new TableVerifier(),
|
||||
Optional::No,
|
||||
}}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Table", new TableVerifier(), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1235,8 +1262,10 @@ TEST_CASE("Documentation: Empty Nested Exhaustive", "[documentation]") {
|
||||
TEST_CASE("Documentation: Less Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new IntLessVerifier(5), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Int", new IntLessVerifier(5), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1257,8 +1286,8 @@ TEST_CASE("Documentation: Less Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: Less Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new DoubleLessVerifier(5.0), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Double", new DoubleLessVerifier(5.0), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1279,8 +1308,8 @@ TEST_CASE("Documentation: Less Double", "[documentation]") {
|
||||
TEST_CASE("Documentation: LessEqual Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new IntLessEqualVerifier(5), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int", new IntLessEqualVerifier(5), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1307,8 +1336,8 @@ TEST_CASE("Documentation: LessEqual Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: LessEqual Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new DoubleLessEqualVerifier(5.0), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Double", new DoubleLessEqualVerifier(5.0), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1335,8 +1364,8 @@ TEST_CASE("Documentation: LessEqual Double", "[documentation]") {
|
||||
TEST_CASE("Documentation: Greater Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new IntGreaterVerifier(5), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int", new IntGreaterVerifier(5), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1357,8 +1386,8 @@ TEST_CASE("Documentation: Greater Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: Greater Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new DoubleGreaterVerifier(5.0), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Double", new DoubleGreaterVerifier(5.0), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1379,8 +1408,8 @@ TEST_CASE("Documentation: Greater Double", "[documentation]") {
|
||||
TEST_CASE("Documentation: GreaterEqual Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new IntGreaterEqualVerifier(5), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int", new IntGreaterEqualVerifier(5), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1407,8 +1436,8 @@ TEST_CASE("Documentation: GreaterEqual Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: GreaterEqual Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new DoubleGreaterEqualVerifier(5.0), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Double", new DoubleGreaterEqualVerifier(5.0), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1435,8 +1464,8 @@ TEST_CASE("Documentation: GreaterEqual Double", "[documentation]") {
|
||||
TEST_CASE("Documentation: Equal Bool", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Bool", new BoolEqualVerifier(true), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Bool", new BoolEqualVerifier(true), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1457,8 +1486,8 @@ TEST_CASE("Documentation: Equal Bool", "[documentation]") {
|
||||
TEST_CASE("Documentation: Equal Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new IntEqualVerifier(1), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int", new IntEqualVerifier(1), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1479,8 +1508,8 @@ TEST_CASE("Documentation: Equal Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: Equal Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new DoubleEqualVerifier(1.0), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Double", new DoubleEqualVerifier(1.0), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1502,8 +1531,8 @@ TEST_CASE("Documentation: Equal String", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{{ "String", new StringEqualVerifier("string"s), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "String", new StringEqualVerifier("string"s), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1524,8 +1553,8 @@ TEST_CASE("Documentation: Equal String", "[documentation]") {
|
||||
TEST_CASE("Documentation: Unequal Bool", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Bool", new BoolUnequalVerifier(true), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Bool", new BoolUnequalVerifier(true), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1546,8 +1575,8 @@ TEST_CASE("Documentation: Unequal Bool", "[documentation]") {
|
||||
TEST_CASE("Documentation: Unequal Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new IntUnequalVerifier(1), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int", new IntUnequalVerifier(1), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1568,8 +1597,8 @@ TEST_CASE("Documentation: Unequal Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: Unequal Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new DoubleUnequalVerifier(1.0), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Double", new DoubleUnequalVerifier(1.0), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1591,8 +1620,8 @@ TEST_CASE("Documentation: Unequal String", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{{ "String", new StringUnequalVerifier("string"s), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "String", new StringUnequalVerifier("string"s), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1613,8 +1642,8 @@ TEST_CASE("Documentation: Unequal String", "[documentation]") {
|
||||
TEST_CASE("Documentation: List Bool", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Bool" , new BoolInListVerifier({ true }), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Bool" , new BoolInListVerifier({ true }), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1635,8 +1664,8 @@ TEST_CASE("Documentation: List Bool", "[documentation]") {
|
||||
TEST_CASE("Documentation: List Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int" , new IntInListVerifier({ 0, 1, 2 }), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int" , new IntInListVerifier({ 0, 1, 2 }), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1663,8 +1692,10 @@ TEST_CASE("Documentation: List Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: List Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double" , new DoubleInListVerifier({ 0.0, 1.0, 2.0 }), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Double" , new DoubleInListVerifier({ 0.0, 1.0, 2.0 }), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1692,8 +1723,10 @@ TEST_CASE("Documentation: List String", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{{ "String" , new StringInListVerifier({ "0"s, "1"s, "2"s }), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "String" , new StringInListVerifier({ "0"s, "1"s, "2"s }), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1720,8 +1753,8 @@ TEST_CASE("Documentation: List String", "[documentation]") {
|
||||
TEST_CASE("Documentation: NotList Bool", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Bool" , new BoolNotInListVerifier({ true }), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Bool" , new BoolNotInListVerifier({ true }), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1742,8 +1775,8 @@ TEST_CASE("Documentation: NotList Bool", "[documentation]") {
|
||||
TEST_CASE("Documentation: NotList Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int" , new IntNotInListVerifier({ 0, 1, 2 }), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int" , new IntNotInListVerifier({ 0, 1, 2 }), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1770,8 +1803,10 @@ TEST_CASE("Documentation: NotList Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: NotList Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double" , new DoubleNotInListVerifier({ 0.0, 1.0, 2.0 }), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Double" , new DoubleNotInListVerifier({ 0.0, 1.0, 2.0 }), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1799,8 +1834,10 @@ TEST_CASE("Documentation: NotList String", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{{ "String" , new StringNotInListVerifier({ "0"s, "1"s, "2"s }), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "String" , new StringNotInListVerifier({ "0"s, "1"s, "2"s }), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1827,8 +1864,8 @@ TEST_CASE("Documentation: NotList String", "[documentation]") {
|
||||
TEST_CASE("Documentation: Annotation Bool", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Bool", new BoolAnnotationVerifier("Bool"), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Bool", new BoolAnnotationVerifier("Bool"), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1849,8 +1886,8 @@ TEST_CASE("Documentation: Annotation Bool", "[documentation]") {
|
||||
TEST_CASE("Documentation: Annotation Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new IntAnnotationVerifier("Int"), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int", new IntAnnotationVerifier("Int"), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1871,8 +1908,8 @@ TEST_CASE("Documentation: Annotation Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: Annotation Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new DoubleAnnotationVerifier("Double"), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Double", new DoubleAnnotationVerifier("Double"), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1894,8 +1931,8 @@ TEST_CASE("Documentation: Annotation String", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{{ "String", new StringAnnotationVerifier("String"), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "String", new StringAnnotationVerifier("String"), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1916,8 +1953,8 @@ TEST_CASE("Documentation: Annotation String", "[documentation]") {
|
||||
TEST_CASE("Documentation: Annotation Table", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Table", new TableAnnotationVerifier("Table"), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Table", new TableAnnotationVerifier("Table"), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1938,8 +1975,8 @@ TEST_CASE("Documentation: Annotation Table", "[documentation]") {
|
||||
TEST_CASE("Documentation: InRange Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new InRangeVerifier<IntVerifier>(0, 5), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int", new InRangeVerifier<IntVerifier>(0, 5), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -1972,8 +2009,10 @@ TEST_CASE("Documentation: InRange Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: InRange Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new InRangeVerifier<DoubleVerifier>(0.0, 5.0), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Double", new InRangeVerifier<DoubleVerifier>(0.0, 5.0), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2012,8 +2051,8 @@ TEST_CASE("Documentation: InRange Double", "[documentation]") {
|
||||
TEST_CASE("Documentation: NotInRange Int", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Int", new NotInRangeVerifier<IntVerifier>(0, 5), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { "Int", new NotInRangeVerifier<IntVerifier>(0, 5), Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2056,8 +2095,10 @@ TEST_CASE("Documentation: NotInRange Int", "[documentation]") {
|
||||
TEST_CASE("Documentation: NotInRange Double", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ "Double", new NotInRangeVerifier<DoubleVerifier>(0.0, 5.0), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Double", new NotInRangeVerifier<DoubleVerifier>(0.0, 5.0), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2100,8 +2141,8 @@ TEST_CASE("Documentation: NotInRange Double", "[documentation]") {
|
||||
TEST_CASE("Documentation: Wildcard", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{{ DocumentationEntry::Wildcard, new IntVerifier, Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = { { DocumentationEntry::Wildcard, new IntVerifier, Optional::No } }
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2152,9 +2193,9 @@ TEST_CASE("Documentation: Wildcard", "[documentation]") {
|
||||
TEST_CASE("Documentation: Wildcard Mixed", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{
|
||||
{ DocumentationEntry::Wildcard, new IntVerifier, Optional::No},
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ DocumentationEntry::Wildcard, new IntVerifier, Optional::No },
|
||||
{ "b", new IntGreaterVerifier(5), Optional::No }
|
||||
}
|
||||
};
|
||||
@@ -2221,9 +2262,10 @@ TEST_CASE("Documentation: Wildcard Mixed", "[documentation]") {
|
||||
TEST_CASE("Documentation: Referencing", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation referenced {
|
||||
Documentation referenced = {
|
||||
"Referenced Name",
|
||||
"referenced_id",
|
||||
"",
|
||||
{
|
||||
{ "a", new IntVerifier, Optional::No },
|
||||
{ "b", new DoubleVerifier, Optional::No }
|
||||
@@ -2231,9 +2273,11 @@ TEST_CASE("Documentation: Referencing", "[documentation]") {
|
||||
};
|
||||
DocEng.addDocumentation(referenced);
|
||||
|
||||
Documentation doc {{
|
||||
{ "Table", new ReferencingVerifier("referenced_id"), Optional::No }
|
||||
}};
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "Table", new ReferencingVerifier("referenced_id"), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
{
|
||||
@@ -2268,9 +2312,11 @@ TEST_CASE("Documentation: Referencing", "[documentation]") {
|
||||
CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType);
|
||||
|
||||
|
||||
Documentation wrongDoc {{
|
||||
{ "Table", new ReferencingVerifier("WRONG"), Optional::No }
|
||||
} };
|
||||
Documentation wrongDoc = {
|
||||
.entries = {
|
||||
{ "Table", new ReferencingVerifier("WRONG"), Optional::No }
|
||||
}
|
||||
};
|
||||
ghoul::Dictionary wrongNegative;
|
||||
{
|
||||
ghoul::Dictionary inner;
|
||||
@@ -2287,50 +2333,14 @@ TEST_CASE("Documentation: Referencing", "[documentation]") {
|
||||
);
|
||||
}
|
||||
|
||||
TEST_CASE("Documentation: AndOperator", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{
|
||||
{
|
||||
"a",
|
||||
new AndVerifier({
|
||||
new IntGreaterEqualVerifier(2), new IntLessEqualVerifier(5)
|
||||
}),
|
||||
Optional::No
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
positive.setValue("a", 4.0);
|
||||
TestResult positiveRes = testSpecification(doc, positive);
|
||||
CHECK(positiveRes.success);
|
||||
CHECK(positiveRes.offenses.empty());
|
||||
|
||||
ghoul::Dictionary negative;
|
||||
negative.setValue("a", 0.0);
|
||||
TestResult negativeRes = testSpecification(doc, negative);
|
||||
CHECK_FALSE(negativeRes.success);
|
||||
REQUIRE(negativeRes.offenses.size() == 1);
|
||||
CHECK(negativeRes.offenses[0].offender == "a");
|
||||
CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification);
|
||||
|
||||
ghoul::Dictionary negative2;
|
||||
negative2.setValue("a", 8.0);
|
||||
negativeRes = testSpecification(doc, negative2);
|
||||
CHECK_FALSE(negativeRes.success);
|
||||
REQUIRE(negativeRes.offenses.size() == 1);
|
||||
CHECK(negativeRes.offenses[0].offender == "a");
|
||||
CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification);
|
||||
}
|
||||
|
||||
TEST_CASE("Documentation: OrOperator", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{{ "a", new OrVerifier({ new StringVerifier, new IntVerifier }), Optional::No }}
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new OrVerifier({ new StringVerifier, new IntVerifier }), Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2357,8 +2367,10 @@ TEST_CASE("Documentation: OrOperator", "[documentation]") {
|
||||
TEST_CASE("Documentation: IntVector2Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new IntVector2Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new IntVector2Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2392,8 +2404,10 @@ TEST_CASE("Documentation: IntVector2Verifier", "[documentation]") {
|
||||
TEST_CASE("Documentation: DoubleVector2Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleVector2Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleVector2Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2428,8 +2442,10 @@ TEST_CASE("Documentation: IntVector3Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new IntVector3Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new IntVector3Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2465,8 +2481,10 @@ TEST_CASE("Documentation: DoubleVector3Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleVector3Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleVector3Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2502,8 +2520,10 @@ TEST_CASE("Documentation: IntVector4Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new IntVector4Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new IntVector4Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2540,8 +2560,10 @@ TEST_CASE("Documentation: DoubleVector4Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleVector4Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleVector4Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2578,8 +2600,10 @@ TEST_CASE("Documentation: DoubleMatrix2x2Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleMatrix2x2Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleMatrix2x2Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2615,8 +2639,10 @@ TEST_CASE("Documentation: DoubleMatrix2x3Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleMatrix2x3Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleMatrix2x3Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2652,8 +2678,10 @@ TEST_CASE("Documentation: DoubleMatrix2x4Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleMatrix2x4Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleMatrix2x4Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2689,8 +2717,10 @@ TEST_CASE("Documentation: DoubleMatrix3x2Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleMatrix3x2Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleMatrix3x2Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2726,8 +2756,10 @@ TEST_CASE("Documentation: DoubleMatrix3x3Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleMatrix3x3Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleMatrix3x3Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2763,8 +2795,10 @@ TEST_CASE("Documentation: DoubleMatrix3x4Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleMatrix3x4Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleMatrix3x4Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2800,8 +2834,10 @@ TEST_CASE("Documentation: DoubleMatrix4x2Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleMatrix4x2Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleMatrix4x2Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2837,8 +2873,10 @@ TEST_CASE("Documentation: DoubleMatrix4x3Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleMatrix4x3Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleMatrix4x3Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2874,8 +2912,10 @@ TEST_CASE("Documentation: DoubleMatrix4x4Verifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc {
|
||||
{ { "a", new DoubleMatrix4x4Verifier, Optional::No } }
|
||||
Documentation doc = {
|
||||
.entries = {
|
||||
{ "a", new DoubleMatrix4x4Verifier, Optional::No }
|
||||
}
|
||||
};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
@@ -2907,61 +2947,6 @@ TEST_CASE("Documentation: DoubleMatrix4x4Verifier", "[documentation]") {
|
||||
CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType);
|
||||
}
|
||||
|
||||
TEST_CASE("Documentation: DeprecatedVerifier", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
|
||||
Documentation doc { {
|
||||
{ "bool", new BoolDeprecatedVerifier, Optional::No },
|
||||
{ "int" , new IntDeprecatedVerifier, Optional::No },
|
||||
{ "double", new DoubleDeprecatedVerifier, Optional::No },
|
||||
{ "string" , new StringDeprecatedVerifier, Optional::No },
|
||||
{ "intvec2", new DeprecatedVerifier<IntVector2Verifier>, Optional::No },
|
||||
{ "doublevec2", new DeprecatedVerifier<DoubleVector2Verifier>, Optional::No },
|
||||
{ "intvec3", new DeprecatedVerifier<IntVector3Verifier>, Optional::No },
|
||||
{ "doublevec3", new DeprecatedVerifier<DoubleVector3Verifier>, Optional::No },
|
||||
{ "intvec4", new DeprecatedVerifier<IntVector4Verifier>, Optional::No },
|
||||
{ "doublevec4", new DeprecatedVerifier<DoubleVector4Verifier>, Optional::No }
|
||||
}};
|
||||
|
||||
ghoul::Dictionary positive;
|
||||
positive.setValue("bool", true);
|
||||
positive.setValue("int", 1);
|
||||
positive.setValue("double", 2.0);
|
||||
positive.setValue("string", ""s);
|
||||
positive.setValue("intvec2", glm::ivec2(0));
|
||||
positive.setValue("doublevec2", glm::dvec2(0.0));
|
||||
positive.setValue("intvec3", glm::ivec3(0));
|
||||
positive.setValue("doublevec3", glm::dvec3(0.0));
|
||||
positive.setValue("intvec4", glm::ivec4(0));
|
||||
positive.setValue("doublevec4", glm::dvec4(0.0));
|
||||
TestResult positiveRes = testSpecification(doc, positive);
|
||||
CHECK(positiveRes.success);
|
||||
CHECK(positiveRes.offenses.empty());
|
||||
REQUIRE(positiveRes.warnings.size() == 10);
|
||||
|
||||
CHECK(positiveRes.warnings[0].offender == "bool");
|
||||
CHECK(positiveRes.warnings[0].reason == TestResult::Warning::Reason::Deprecated);
|
||||
CHECK(positiveRes.warnings[1].offender == "double");
|
||||
CHECK(positiveRes.warnings[1].reason == TestResult::Warning::Reason::Deprecated);
|
||||
CHECK(positiveRes.warnings[2].offender == "doublevec2");
|
||||
CHECK(positiveRes.warnings[2].reason == TestResult::Warning::Reason::Deprecated);
|
||||
CHECK(positiveRes.warnings[3].offender == "doublevec3");
|
||||
CHECK(positiveRes.warnings[3].reason == TestResult::Warning::Reason::Deprecated);
|
||||
CHECK(positiveRes.warnings[4].offender == "doublevec4");
|
||||
CHECK(positiveRes.warnings[4].reason == TestResult::Warning::Reason::Deprecated);
|
||||
CHECK(positiveRes.warnings[5].offender == "int");
|
||||
CHECK(positiveRes.warnings[5].reason == TestResult::Warning::Reason::Deprecated);
|
||||
CHECK(positiveRes.warnings[6].offender == "intvec2");
|
||||
CHECK(positiveRes.warnings[6].reason == TestResult::Warning::Reason::Deprecated);
|
||||
CHECK(positiveRes.warnings[7].offender == "intvec3");
|
||||
CHECK(positiveRes.warnings[7].reason == TestResult::Warning::Reason::Deprecated);
|
||||
CHECK(positiveRes.warnings[8].offender == "intvec4");
|
||||
CHECK(positiveRes.warnings[8].reason == TestResult::Warning::Reason::Deprecated);
|
||||
CHECK(positiveRes.warnings[9].offender == "string");
|
||||
CHECK(positiveRes.warnings[9].reason == TestResult::Warning::Reason::Deprecated);
|
||||
}
|
||||
|
||||
TEST_CASE("Documentation: Verifier Type Post Conditions", "[documentation]") {
|
||||
using namespace openspace::documentation;
|
||||
using namespace std::string_literals;
|
||||
@@ -3023,18 +3008,6 @@ TEST_CASE("Documentation: Verifier Type Post Conditions", "[documentation]") {
|
||||
CHECK(AnnotationVerifier<IntVector4Verifier>("A"s).type() != "");
|
||||
CHECK(AnnotationVerifier<DoubleVector4Verifier>("A"s).type() != "");
|
||||
|
||||
CHECK(BoolDeprecatedVerifier().type() != "");
|
||||
CHECK(IntDeprecatedVerifier().type() != "");
|
||||
CHECK(DoubleDeprecatedVerifier().type() != "");
|
||||
CHECK(StringDeprecatedVerifier().type() != "");
|
||||
CHECK(TableDeprecatedVerifier().type() != "");
|
||||
CHECK(DeprecatedVerifier<IntVector2Verifier>().type() != "");
|
||||
CHECK(DeprecatedVerifier<DoubleVector2Verifier>().type() != "");
|
||||
CHECK(DeprecatedVerifier<IntVector3Verifier>().type() != "");
|
||||
CHECK(DeprecatedVerifier<DoubleVector3Verifier>().type() != "");
|
||||
CHECK(DeprecatedVerifier<IntVector4Verifier>().type() != "");
|
||||
CHECK(DeprecatedVerifier<DoubleVector4Verifier>().type() != "");
|
||||
|
||||
CHECK(ReferencingVerifier("identifier"s).type() != "");
|
||||
}
|
||||
|
||||
@@ -3099,17 +3072,5 @@ TEST_CASE("Documentation: Verifier Documentation Post Conditions", "[documentati
|
||||
CHECK(AnnotationVerifier<IntVector4Verifier>("A"s).documentation() != "");
|
||||
CHECK(AnnotationVerifier<DoubleVector4Verifier>("A"s).documentation() != "");
|
||||
|
||||
CHECK(BoolDeprecatedVerifier().documentation() != "");
|
||||
CHECK(IntDeprecatedVerifier().documentation() != "");
|
||||
CHECK(DoubleDeprecatedVerifier().documentation() != "");
|
||||
CHECK(StringDeprecatedVerifier().documentation() != "");
|
||||
CHECK(TableDeprecatedVerifier().documentation() != "");
|
||||
CHECK(DeprecatedVerifier<IntVector2Verifier>().documentation() != "");
|
||||
CHECK(DeprecatedVerifier<DoubleVector2Verifier>().documentation() != "");
|
||||
CHECK(DeprecatedVerifier<IntVector3Verifier>().documentation() != "");
|
||||
CHECK(DeprecatedVerifier<DoubleVector3Verifier>().documentation() != "");
|
||||
CHECK(DeprecatedVerifier<IntVector4Verifier>().documentation() != "");
|
||||
CHECK(DeprecatedVerifier<DoubleVector4Verifier>().documentation() != "");
|
||||
|
||||
CHECK(ReferencingVerifier("identifier"s).documentation() != "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user