X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=source%2Ftesting%2FTestManager.cpp;fp=source%2Ftesting%2FTestManager.cpp;h=beb0d9398895ee05844e96723ed5285a77671717;hp=b83f8d4ce566b6a2ff08ac0e8325f9145cef521c;hb=4275d46f5d3c3a150ced258ae20c985520f6477a;hpb=f34b8069233e9e09208339bb79d8576c1ff962e1 diff --git a/source/testing/TestManager.cpp b/source/testing/TestManager.cpp index b83f8d4..beb0d93 100644 --- a/source/testing/TestManager.cpp +++ b/source/testing/TestManager.cpp @@ -320,13 +320,33 @@ bool TestManager::clearTestCase(std::string &result, unsigned int id) { a_testPool.erase(it); - auto key1_it = a_key1TestCaseMap.find(it->second->getKey()); - if (key1_it != a_key1TestCaseMap.end()) a_key1TestCaseMap.erase(key1_it); - auto key2_it = a_key2TestCaseMap.find(it->second->getKey()); - if (key2_it != a_key2TestCaseMap.end()) a_key2TestCaseMap.erase(key2_it); - result = "Provided test case has been dropped"; - return true; + bool something_removed = false; + + auto key1_it = a_key1TestCaseMap.find(it->second->getKey1()); + if (key1_it != a_key1TestCaseMap.end()) { + a_key1TestCaseMap.erase(key1_it); + result += " | Removed key1 = "; + result += it->second->getKey1(); + something_removed = true; + } + auto key2_it = a_key2TestCaseMap.find(it->second->getKey2()); + if (key2_it != a_key2TestCaseMap.end()) { + a_key2TestCaseMap.erase(key2_it); + result += " | Removed key2 = "; + result += it->second->getKey2(); + something_removed = true; + } + + if (something_removed) return true; + + result = "Provided test case has been dropped, but key1 = '"; + result += it->second->getKey1(); + result += "' was not found, and also key2 = '"; + result += it->second->getKey2(); + result += "' was not found"; + + return false; } bool TestManager::clearPool(std::string &result) {