Salome HOME
- Changed tests to use Python (for portability)
[tools/libbatch.git] / src / Core / Test / SimpleParser.cxx
index ac6a135945c8ade086d5144c1c9e393817419057..e40a56bf8c96035c1e18e1ff4d0a1300a33fa0c8 100644 (file)
@@ -128,9 +128,18 @@ const string & SimpleParser::getValue(const string & key) const throw(ParserExce
   return iter->second;
 }
 
-const string & SimpleParser::getTestValue(const string & bmType, const string & key) const throw(ParserException)
+const string & SimpleParser::getTestValue(const string & bmType, const string & protocolStr,
+                                          const string & key) const throw(ParserException)
 {
-  string fullkey = string("TEST_") + bmType + "_" + key;
+  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);
 }
 
@@ -146,9 +155,18 @@ int SimpleParser::getValueAsInt(const string & key) const throw(ParserException)
   return res;
 }
 
-int SimpleParser::getTestValueAsInt(const string & bmType, const string & key) const throw(ParserException)
+int SimpleParser::getTestValueAsInt(const string & bmType, const string & protocolStr,
+                                    const string & key) const throw(ParserException)
 {
-  string fullkey = string("TEST_") + bmType + "_" + key;
+  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);
 }