mirror of
https://github.com/unittest-cpp/unittest-cpp
synced 2026-09-27 00:28:49 +03:00
58 lines
909 B
C++
58 lines
909 B
C++
#include "SuitePredicate.h"
|
|
|
|
using namespace std;
|
|
using namespace UnitTest;
|
|
|
|
|
|
SuitePredicate::SuitePredicate()
|
|
{
|
|
}
|
|
|
|
|
|
SuitePredicate::~SuitePredicate()
|
|
{
|
|
}
|
|
|
|
|
|
void SuitePredicate::addSuite(const string & suiteName)
|
|
{
|
|
_suiteNames.push_back(suiteName);
|
|
}
|
|
|
|
|
|
void SuitePredicate::addTest(const string & testName)
|
|
{
|
|
_testNames.push_back(testName);
|
|
}
|
|
|
|
|
|
bool SuitePredicate::operator()(Test const * const test) const
|
|
{
|
|
return (mustExecuteSuite(test) || mustExecuteTest(test));
|
|
}
|
|
|
|
|
|
bool SuitePredicate::mustExecuteSuite(Test const * const test) const
|
|
{
|
|
for (size_t i = 0; i < _suiteNames.size(); i++)
|
|
{
|
|
if (_suiteNames[i] == test->m_details.suiteName)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
bool SuitePredicate::mustExecuteTest(Test const * const test) const
|
|
{
|
|
for (size_t i = 0; i < _testNames.size(); i++)
|
|
{
|
|
if (_testNames[i] == test->m_details.testName)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|