aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/tests.cpp')
-rw-r--r--src/tests/tests.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index f922c99a6..b78b7a2e2 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -602,6 +602,20 @@ std::string Text_Based_Test::get_opt_str(const VarMap& vars,
return i->second;
}
+bool Text_Based_Test::get_req_bool(const VarMap& vars, const std::string& key) const
+ {
+ auto i = vars.find(key);
+ if(i == vars.end())
+ throw Test_Error("Test missing variable " + key);
+
+ if(i->second == "true")
+ return true;
+ else if(i->second == "false")
+ return false;
+ else
+ throw Test_Error("Invalid boolean for key '" + key + "' value '" + i->second + "'");
+ }
+
size_t Text_Based_Test::get_req_sz(const VarMap& vars, const std::string& key) const
{
auto i = vars.find(key);