Salome HOME
- Changed tests to use Python (for portability)
[tools/libbatch.git] / src / Core / Test / SimpleParser.cxx
index f20eb275bcc7ca2ddde39e556ec229d72549fb56..e40a56bf8c96035c1e18e1ff4d0a1300a33fa0c8 100644 (file)
@@ -128,6 +128,21 @@ const string & SimpleParser::getValue(const string & key) const throw(ParserExce
   return iter->second;
 }
 
+const string & SimpleParser::getTestValue(const string & bmType, const string & protocolStr,
+                                          const string & key) const throw(ParserException)
+{
+  string fullkey = string("TEST_") + bmType + "_" + protocolStr + "_" + key;
+  try {
+    return getValue(fullkey);
+  } catch (const ParserException &) {}
+  fullkey = string("TEST_") + bmType + "_" + key;
+  try {
+    return getValue(fullkey);
+  } catch (const ParserException &) {}
+  fullkey = string("TEST_") + key;
+  return getValue(fullkey);
+}
+
 int SimpleParser::getValueAsInt(const string & key) const throw(ParserException)
 {
   const string & valueStr = getValue(key);
@@ -140,6 +155,21 @@ int SimpleParser::getValueAsInt(const string & key) const throw(ParserException)
   return res;
 }
 
+int SimpleParser::getTestValueAsInt(const string & bmType, const string & protocolStr,
+                                    const string & key) const throw(ParserException)
+{
+  string fullkey = string("TEST_") + bmType + "_" + protocolStr + "_" + key;
+  try {
+    return getValueAsInt(fullkey);
+  } catch (const ParserException &) {}
+  fullkey = string("TEST_") + bmType + "_" + key;
+  try {
+    return getValueAsInt(fullkey);
+  } catch (const ParserException &) {}
+  fullkey = string("TEST_") + key;
+  return getValueAsInt(fullkey);
+}
+
 ostream & operator <<(ostream & os, const SimpleParser & parser) throw()
 {
   if (parser._configmap.empty()) {