From a4fa9c0788d284ca4bfc29338598dd6cf1b21386 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 14 Sep 2016 09:27:34 +0200 Subject: [PATCH] Add Range checks to unit tests --- include/openspace/util/documentation.h | 1 - tests/test_documentation.inl | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/openspace/util/documentation.h b/include/openspace/util/documentation.h index d3470dfdc6..8ad21d5d30 100644 --- a/include/openspace/util/documentation.h +++ b/include/openspace/util/documentation.h @@ -55,7 +55,6 @@ struct Verifier { virtual std::string documentation() const = 0; }; - struct DocumentationEntry { DocumentationEntry(std::string key, Verifier* t, Optional optional = Optional::No, std::string doc = ""); diff --git a/tests/test_documentation.inl b/tests/test_documentation.inl index 4d002cbdba..2ba54e6918 100644 --- a/tests/test_documentation.inl +++ b/tests/test_documentation.inl @@ -78,6 +78,13 @@ TEST_F(DocumentationTest, Constructor) { doc.emplace_back("NotInListInt", new IntNotInListVerifier({ 0, 1 })); doc.emplace_back("NotInListString", new StringNotInListVerifier({ "", "a" })); + // Range Verifiers + doc.emplace_back("InListDouble", new DoubleInRangeVerifier({ 0.0, 1.0 })); + doc.emplace_back("InListInt", new IntInRangeVerifier({ 0, 1 })); + + doc.emplace_back("NotInListDouble", new DoubleNotInRangeVerifier({ 0.0, 1.0 })); + doc.emplace_back("NotInListInt", new IntNotInRangeVerifier({ 0, 1 })); + // Misc Verifiers doc.emplace_back("AnnotationBool", new BoolAnnotationVerifier("Bool")); doc.emplace_back("AnnotationDouble", new DoubleAnnotationVerifier("Double")); @@ -131,6 +138,13 @@ TEST_F(DocumentationTest, InitializerConstructor) { {"NotInListInt", new IntNotInListVerifier({ 0, 1 })}, {"NotInListString", new StringNotInListVerifier({ "", "a" })}, + // Range Verifiers + {"InRangeDouble", new DoubleInRangeVerifier{{0.0, 1.0}}, + {"InRangeInt", new IntInRangeVerifier{{0, 1}}, + + {"InRangeDouble", new DoubleNotInRangeVerifier{{ 0.0, 1.0 }}, + {"InRangeInt", new IntNotInRangeVerifier{{ 0, 1 }}, + // Misc Verifiers {"AnnotationBool", new BoolAnnotationVerifier("Bool")}, {"AnnotationDouble", new DoubleAnnotationVerifier("Double")},