Merge branch 'master' into feature/model-animation

* Resolve conflicts
This commit is contained in:
Malin Ejdbo
2021-03-30 16:31:25 +02:00
71 changed files with 2203 additions and 3431 deletions
-15
View File
@@ -140,21 +140,6 @@ namespace openspace::documentation {
const std::string DocumentationEntry::Wildcard = "*";
//std::string concatenate(const std::vector<TestResult::Offense>& offenses) {
// std::string result = "Error in specification (";
// for (const TestResult::Offense& o : offenses) {
// if (o.explanation.empty()) {
// result += fmt::format("{} ({}), ", o.offender, ghoul::to_string(o.reason));
// }
// else {
// result += fmt::format("{} ({}: {}), ", o.offender, ghoul::to_string(o.reason), o.explanation);
// }
// }
// result.pop_back();
// result.back() = ')';
// return result;
//}
SpecificationError::SpecificationError(TestResult res, std::string comp)
: ghoul::RuntimeError("Error in specification", std::move(comp))
, result(std::move(res))
+180 -60
View File
@@ -141,7 +141,9 @@ TestResult IntVerifier::operator()(const ghoul::Dictionary& dict,
{
if (dict.hasValue<int>(key)) {
// We have a key and the value is int, we are done
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
if (dict.hasKey(key)) {
@@ -151,23 +153,39 @@ TestResult IntVerifier::operator()(const ghoul::Dictionary& dict,
double intPart;
bool isInt = modf(value, &intPart) == 0.0;
if (isInt) {
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
return {
false,
{ { key, TestResult::Offense::Reason::WrongType } },
{}
};
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
return res;
}
}
else {
// If we don't have a double value, we cannot have an int value
return { false, {{ key, TestResult::Offense::Reason::WrongType }}, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
return res;
}
}
else {
return { false, {{ key, TestResult::Offense::Reason::MissingKey }}, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::MissingKey;
res.offenses.push_back(o);
return res;
}
}
}
@@ -317,17 +335,26 @@ TestResult Color3Verifier::operator()(const ghoul::Dictionary& dictionary,
glm::dvec3 values = dictionary.value<glm::dvec3>(key);
if (values.x < 0.0 || values.x > 1.0) {
res.success = false;
res.offenses.push_back({ key + ".x", TestResult::Offense::Reason::Verification });
TestResult::Offense o;
o.offender = key + ".x";
o.reason = TestResult::Offense::Reason::Verification;
res.offenses.push_back(o);
}
if (values.y < 0.0 || values.y > 1.0) {
res.success = false;
res.offenses.push_back({ key + ".y", TestResult::Offense::Reason::Verification });
TestResult::Offense o;
o.offender = key + ".y";
o.reason = TestResult::Offense::Reason::Verification;
res.offenses.push_back(o);
}
if (values.z < 0.0 || values.z > 1.0) {
res.success = false;
res.offenses.push_back({ key + ".z", TestResult::Offense::Reason::Verification });
TestResult::Offense o;
o.offender = key + ".z";
o.reason = TestResult::Offense::Reason::Verification;
res.offenses.push_back(o);
}
return res;
@@ -345,27 +372,39 @@ TestResult Color4Verifier::operator()(const ghoul::Dictionary& dictionary,
return res;
}
std::vector<double> values = dictionary.value<std::vector<double>>(key);
if (values[0] < 0.0 || values[0] > 1.0) {
glm::dvec4 values = dictionary.value<glm::dvec4>(key);
if (values.x < 0.0 || values.x > 1.0) {
res.success = false;
res.offenses.push_back({ key + ".x", TestResult::Offense::Reason::Verification });
TestResult::Offense o;
o.offender = key + ".x";
o.reason = TestResult::Offense::Reason::Verification;
res.offenses.push_back(o);
}
if (values[1] < 0.0 || values[1] > 1.0) {
if (values.y < 0.0 || values.y > 1.0) {
res.success = false;
res.offenses.push_back({ key + ".y", TestResult::Offense::Reason::Verification });
TestResult::Offense o;
o.offender = key + ".y";
o.reason = TestResult::Offense::Reason::Verification;
res.offenses.push_back(o);
}
if (values[2] < 0.0 || values[2] > 1.0) {
if (values.z < 0.0 || values.z > 1.0) {
res.success = false;
res.offenses.push_back({ key + ".z", TestResult::Offense::Reason::Verification });
TestResult::Offense o;
o.offender = key + ".z";
o.reason = TestResult::Offense::Reason::Verification;
res.offenses.push_back(o);
}
if (values[3] < 0.0 || values[3] > 1.0) {
if (values.w < 0.0 || values.w > 1.0) {
res.success = false;
res.offenses.push_back({ key + ".a", TestResult::Offense::Reason::Verification });
TestResult::Offense o;
o.offender = key + ".a";
o.reason = TestResult::Offense::Reason::Verification;
res.offenses.push_back(o);
}
return res;
}
@@ -378,7 +417,9 @@ TestResult TemplateVerifier<glm::ivec2>::operator()(const ghoul::Dictionary& dic
const std::string& key) const
{
if (dict.hasValue<glm::ivec2>(key)) {
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
if (dict.hasKey(key)) {
@@ -390,22 +431,38 @@ TestResult TemplateVerifier<glm::ivec2>::operator()(const ghoul::Dictionary& dic
modf(value.y, &intPart.y) == 0.0
};
if (isInt.x && isInt.y) {
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
return {
false,
{{ key, TestResult::Offense::Reason::WrongType }},
{}
};
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
return res;
}
}
else {
return { false, {{ key, TestResult::Offense::Reason::WrongType }}, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
return res;
}
}
else {
return { false, {{ key, TestResult::Offense::Reason::MissingKey }}, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::MissingKey;
res.offenses.push_back(o);
return res;
}
}
}
@@ -415,7 +472,9 @@ TestResult TemplateVerifier<glm::ivec3>::operator()(const ghoul::Dictionary& dic
const std::string& key) const
{
if (dict.hasValue<glm::ivec3>(key)) {
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
if (dict.hasKey(key)) {
@@ -428,22 +487,38 @@ TestResult TemplateVerifier<glm::ivec3>::operator()(const ghoul::Dictionary& dic
modf(value.z, &intPart.z) == 0.0
};
if (isInt.x && isInt.y && isInt.z) {
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
return {
false,
{{ key, TestResult::Offense::Reason::WrongType }},
{}
};
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
return res;
}
}
else {
return { false, {{ key, TestResult::Offense::Reason::WrongType }}, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
return res;
}
}
else {
return { false, {{ key, TestResult::Offense::Reason::MissingKey }}, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::MissingKey;
res.offenses.push_back(o);
return res;
}
}
}
@@ -453,7 +528,9 @@ TestResult TemplateVerifier<glm::ivec4>::operator()(const ghoul::Dictionary& dic
const std::string& key) const
{
if (dict.hasValue<glm::ivec4>(key)) {
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
if (dict.hasKey(key)) {
@@ -467,22 +544,38 @@ TestResult TemplateVerifier<glm::ivec4>::operator()(const ghoul::Dictionary& dic
modf(value.w, &intPart.w) == 0.0
};
if (isInt.x && isInt.y && isInt.z && isInt.w) {
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
return {
false,
{{ key, TestResult::Offense::Reason::WrongType }},
{}
};
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
return res;
}
}
else {
return { false, {{ key, TestResult::Offense::Reason::WrongType }}, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
return res;
}
}
else {
return { false, {{ key, TestResult::Offense::Reason::MissingKey }}, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::MissingKey;
res.offenses.push_back(o);
return res;
}
}
}
@@ -512,11 +605,22 @@ TestResult TableVerifier::operator()(const ghoul::Dictionary& dictionary,
}
else {
if (dictionary.hasKey(key)) {
return { false, { { key, TestResult::Offense::Reason::WrongType } }, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
return res;
}
else {
return { false, { { key, TestResult::Offense::Reason::MissingKey } }, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::MissingKey;
res.offenses.push_back(o);
return res;
}
}
}
@@ -565,11 +669,11 @@ TestResult ReferencingVerifier::operator()(const ghoul::Dictionary& dictionary,
);
if (it == docs.end()) {
res.offenses.push_back({
key,
TestResult::Offense::Reason::UnknownIdentifier
});
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::UnknownIdentifier;
res.offenses.push_back(o);
return res;
}
@@ -629,10 +733,18 @@ TestResult AndVerifier::operator()(const ghoul::Dictionary& dictionary,
);
if (success) {
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
return { false, { { key, TestResult::Offense::Reason::Verification } }, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::Verification;
res.offenses.push_back(o);
return res;
}
}
@@ -698,10 +810,18 @@ TestResult OrVerifier::operator()(const ghoul::Dictionary& dictionary,
);
if (success) {
return { true, {}, {} };
TestResult res;
res.success = true;
return res;
}
else {
return { false, { { key, TestResult::Offense::Reason::Verification } }, {} };
TestResult res;
res.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::Verification;
res.offenses.push_back(o);
return res;
}
}