mirror of
https://github.com/unittest-cpp/unittest-cpp
synced 2026-09-27 08:33:45 +03:00
46 lines
923 B
C++
46 lines
923 B
C++
#include "ParameterizedManager.h"
|
|
|
|
#include "Test.h"
|
|
|
|
using namespace std;
|
|
using namespace UnitTest;
|
|
|
|
|
|
ParameterizedManager::ParameterizedManager()
|
|
{
|
|
}
|
|
|
|
|
|
ParameterizedManager::~ParameterizedManager()
|
|
{
|
|
}
|
|
|
|
|
|
ParameterizedManager & ParameterizedManager::getInstance()
|
|
{
|
|
static ParameterizedManager stored;
|
|
return stored;
|
|
}
|
|
|
|
|
|
TestListNode* const ParameterizedManager::retrieveTest(TestDetails const * const details)
|
|
{
|
|
//TODO This workaround is too far complicated, why not simply add pointer to current test in class CurrentTest ?
|
|
Details2Test::iterator it = _tests.find(details);
|
|
|
|
if (it != _tests.end())
|
|
{
|
|
return it->second;
|
|
}
|
|
|
|
for (TestListNode* iNode = Test::GetTestList().GetHead(); iNode != nullptr; iNode = iNode->m_next)
|
|
{
|
|
if (&iNode->m_test->m_details == details)
|
|
{
|
|
_tests[details] = iNode;
|
|
return iNode;
|
|
}
|
|
}
|
|
|
|
throw runtime_error(string("Impossible to retrieve test ") + details->testName);
|
|
}
|