本文整理汇总了C++中TestSuite::getTestCaseList方法的典型用法代码示例。如果您正苦于以下问题:C++ TestSuite::getTestCaseList方法的具体用法?C++ TestSuite::getTestCaseList怎么用?C++ TestSuite::getTestCaseList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestSuite
的用法示例。
在下文中一共展示了TestSuite::getTestCaseList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
threadproc_ret _callconv TestRunner::run(void* pUserData)
{
const ThreadInfo* pInfo = static_cast<const ThreadInfo*>(pUserData);
assert(pInfo);
assert(pInfo->pRunner);
TestRunner* pRunner = pInfo->pRunner;
assert(pRunner->m_testSuiteList);
assert(pRunner->m_nbTestSuites);
RTErrorProtector errorProtector(pRunner->m_pTestListener, pInfo->threadIdx);
TestEvent event;
stats::CodeTimer suiteTimer;
stats::CodeTimer caseTimer;
for (;;)
{
bool bStopRequested = pRunner->m_bStopRequested.load(std::memory_order_relaxed);
if (bStopRequested)
break;
#ifndef EASYTEST_NO_THREADS
size_t idx = pRunner->m_nextTestSuiteIdx.fetch_add(1, std::memory_order_relaxed);
#else //EASYTEST_NO_THREADS is defined
size_t idx = pRunner->m_nextTestSuiteIdx++;
#endif //!EASYTEST_NO_THREADS
if (idx >= pRunner->m_nbTestSuites)
break;
suiteTimer.start();
const TestSuiteRegistrar* pRegistrar = pRunner->m_testSuiteList[idx];
bool bTestSuiteSuccess = false;
TestSuite* pTestSuite = errorProtector.createProtectedTestSuite(pRegistrar);
if (pTestSuite)
{
assert(pRegistrar);
bTestSuiteSuccess = true;
const size_t nbTotalCases = pTestSuite->getTestCaseCount();
size_t nbSuccessCases = 0;
size_t nbFailedCases = 0;
if (pRunner->m_pTestListener)
{
event.type = TestEventType::TESTSUITE_START;
event.testSuiteStart.workerThreadIdx = pInfo->threadIdx;
event.testSuiteStart.testSuiteName = pRegistrar->getTestSuiteName();
event.testSuiteStart.nbTotalCases = nbTotalCases;
pRunner->m_pTestListener->onEvent(event);
}
const TestCaseRegistrar** caseRegListBegin = pTestSuite->getTestCaseList();
const TestCaseRegistrar** caseRegListEnd = caseRegListBegin + nbTotalCases;
for (const TestCaseRegistrar** ppCaseReg = caseRegListBegin; ppCaseReg < caseRegListEnd; ++ppCaseReg)
{
assert(*ppCaseReg);
bStopRequested = pRunner->m_bStopRequested.load(std::memory_order_relaxed);
if (bStopRequested)
{
bTestSuiteSuccess = false;
break;
}
caseTimer.start();
if (pRunner->m_pTestListener)
{
event.type = TestEventType::TESTCASE_START;
event.testCaseStart.testCaseName = (*ppCaseReg)->getTestName();
pRunner->m_pTestListener->onEvent(event);
}
if (errorProtector.executeProtectedTestCase(*ppCaseReg))
{
event.testCaseFinish.bSuccess = true;
nbSuccessCases++;
}
else
{
event.testCaseFinish.bSuccess = false;
nbFailedCases++;
bTestSuiteSuccess = false;
}
caseTimer.stop();
if (pRunner->m_pTestListener)
{
event.type = TestEventType::TESTCASE_FINISH;
event.testCaseFinish.pTimer = &caseTimer;
pRunner->m_pTestListener->onEvent(event);
}
}
errorProtector.deleteProtectedTestSuite();
suiteTimer.stop();
//.........这里部分代码省略.........