Add Range checks to unit tests

This commit is contained in:
Alexander Bock
2016-09-14 09:27:34 +02:00
parent 45d034ad2a
commit a4fa9c0788
2 changed files with 14 additions and 1 deletions

View File

@@ -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 = "");

View File

@@ -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")},