mirror of
https://github.com/unittest-cpp/unittest-cpp
synced 2026-09-27 00:28:49 +03:00
moved iteration FIRST/IDLE/ITERATE handling in manager
This commit is contained in:
parent
8b1cb0b1d0
commit
4373207200
3 changed files with 30 additions and 19 deletions
|
|
@ -109,6 +109,24 @@ void ParameterizedManager::endExecute(TestDetails const * const details)
|
|||
}
|
||||
|
||||
|
||||
void ParameterizedManager::updateParameter(ParameterizedTestAbstract* const parameterized)
|
||||
{
|
||||
RegisterThen then = registerParameter(parameterized);
|
||||
if (then == ParameterizedManager::IDLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (then == ParameterizedManager::FIRST)
|
||||
{
|
||||
parameterized->onNewIteration(true);
|
||||
}
|
||||
else if (then == ParameterizedManager::ITERATE)
|
||||
{
|
||||
parameterized->onNewIteration(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ParameterizedManager::RegisterThen ParameterizedManager::registerParameter(ParameterizedTestAbstract* const parameterized)
|
||||
{
|
||||
if (find(_stack.begin(), _stack.end(), parameterized) == _stack.end())
|
||||
|
|
|
|||
|
|
@ -14,25 +14,26 @@ namespace UnitTest
|
|||
class ParameterizedManager
|
||||
{
|
||||
public:
|
||||
enum RegisterThen
|
||||
static ParameterizedManager & getInstance();
|
||||
Test* const getCurrentTest() const;
|
||||
bool isCurrentTest(TestDetails const * const details) const;
|
||||
void beginExecute(TestDetails const * const details);
|
||||
void endExecute(TestDetails const * const details);
|
||||
void updateParameter(ParameterizedTestAbstract* const parameterized);
|
||||
const vector<ParameterizedTestAbstract*> & getStack(TestDetails const * const details) const;
|
||||
|
||||
private:
|
||||
enum RegisterThen //TODO Can remove this ?
|
||||
{
|
||||
FIRST,
|
||||
ITERATE,
|
||||
IDLE
|
||||
};
|
||||
|
||||
static ParameterizedManager & getInstance();
|
||||
Test* const getCurrentTest() const;
|
||||
bool isCurrentTest(TestDetails const * const details) const;
|
||||
void beginExecute(TestDetails const * const details);
|
||||
void endExecute(TestDetails const * const details);
|
||||
RegisterThen registerParameter(ParameterizedTestAbstract* const parameterized);
|
||||
const vector<ParameterizedTestAbstract*> & getStack(TestDetails const * const details) const;
|
||||
|
||||
private:
|
||||
ParameterizedManager();
|
||||
virtual ~ParameterizedManager();
|
||||
TestListNode* const retrieveTest(TestDetails const * const details);
|
||||
RegisterThen registerParameter(ParameterizedTestAbstract* const parameterized);
|
||||
|
||||
TestListNode* _currentTest;
|
||||
TestListNode* _nextTestBackup;
|
||||
|
|
|
|||
|
|
@ -36,15 +36,7 @@ string ParameterizedTestAbstract::getNameCurrent() const
|
|||
|
||||
void ParameterizedTestAbstract::updateIteration()
|
||||
{
|
||||
ParameterizedManager::RegisterThen then = ParameterizedManager::getInstance().registerParameter(this);
|
||||
if (then == ParameterizedManager::FIRST)
|
||||
{
|
||||
onNewIteration(true);
|
||||
}
|
||||
else if (then == ParameterizedManager::ITERATE)
|
||||
{
|
||||
onNewIteration(false);
|
||||
}
|
||||
ParameterizedManager::getInstance().updateParameter(this);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue