Blame src/cppunit/TestComposite.cpp

Packit 8c9aa0
#include <cppunit/TestComposite.h>
Packit 8c9aa0
#include <cppunit/TestResult.h>
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
CPPUNIT_NS_BEGIN
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
TestComposite::TestComposite( const std::string &name )
Packit 8c9aa0
    : m_name( name )
Packit 8c9aa0
{
Packit 8c9aa0
}
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
TestComposite::~TestComposite()
Packit 8c9aa0
{
Packit 8c9aa0
}
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
void 
Packit 8c9aa0
TestComposite::run( TestResult *result )
Packit 8c9aa0
{
Packit 8c9aa0
  doStartSuite( result );
Packit 8c9aa0
  doRunChildTests( result );
Packit 8c9aa0
  doEndSuite( result );
Packit 8c9aa0
}
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
int 
Packit 8c9aa0
TestComposite::countTestCases() const
Packit 8c9aa0
{
Packit 8c9aa0
  int count = 0;
Packit 8c9aa0
  
Packit 8c9aa0
  int childCount = getChildTestCount();
Packit 8c9aa0
  for ( int index =0; index < childCount; ++index )
Packit 8c9aa0
    count += getChildTestAt( index )->countTestCases();
Packit 8c9aa0
  
Packit 8c9aa0
  return count;
Packit 8c9aa0
}
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
std::string 
Packit 8c9aa0
TestComposite::getName() const
Packit 8c9aa0
{
Packit 8c9aa0
  return m_name;
Packit 8c9aa0
}
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
void 
Packit 8c9aa0
TestComposite::doStartSuite( TestResult *controller )
Packit 8c9aa0
{
Packit 8c9aa0
  controller->startSuite( this );
Packit 8c9aa0
}
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
void 
Packit 8c9aa0
TestComposite::doRunChildTests( TestResult *controller )
Packit 8c9aa0
{
Packit 8c9aa0
  int childCount = getChildTestCount();
Packit 8c9aa0
  for ( int index =0; index < childCount; ++index )
Packit 8c9aa0
  {
Packit 8c9aa0
    if ( controller->shouldStop() )
Packit 8c9aa0
      break;
Packit 8c9aa0
Packit 8c9aa0
    getChildTestAt( index )->run( controller );
Packit 8c9aa0
  }
Packit 8c9aa0
}
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
void 
Packit 8c9aa0
TestComposite::doEndSuite( TestResult *controller )
Packit 8c9aa0
{
Packit 8c9aa0
  controller->endSuite( this );
Packit 8c9aa0
}
Packit 8c9aa0
Packit 8c9aa0
Packit 8c9aa0
CPPUNIT_NS_END
Packit 8c9aa0