~ubuntu-branches/ubuntu/vivid/psi/vivid

« back to all changes in this revision

Viewing changes to third-party/cppunit/cppunit/src/cppunit/TestComposite.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <cppunit/TestComposite.h>
 
2
#include <cppunit/TestResult.h>
 
3
 
 
4
 
 
5
CPPUNIT_NS_BEGIN
 
6
 
 
7
 
 
8
TestComposite::TestComposite( const std::string &name )
 
9
    : m_name( name )
 
10
{
 
11
}
 
12
 
 
13
 
 
14
TestComposite::~TestComposite()
 
15
{
 
16
}
 
17
 
 
18
 
 
19
void 
 
20
TestComposite::run( TestResult *result )
 
21
{
 
22
  doStartSuite( result );
 
23
  doRunChildTests( result );
 
24
  doEndSuite( result );
 
25
}
 
26
 
 
27
 
 
28
int 
 
29
TestComposite::countTestCases() const
 
30
{
 
31
  int count = 0;
 
32
  
 
33
  int childCount = getChildTestCount();
 
34
  for ( int index =0; index < childCount; ++index )
 
35
    count += getChildTestAt( index )->countTestCases();
 
36
  
 
37
  return count;
 
38
}
 
39
 
 
40
 
 
41
std::string 
 
42
TestComposite::getName() const
 
43
{
 
44
  return m_name;
 
45
}
 
46
 
 
47
 
 
48
void 
 
49
TestComposite::doStartSuite( TestResult *controller )
 
50
{
 
51
  controller->startSuite( this );
 
52
}
 
53
 
 
54
 
 
55
void 
 
56
TestComposite::doRunChildTests( TestResult *controller )
 
57
{
 
58
  int childCount = getChildTestCount();
 
59
  for ( int index =0; index < childCount; ++index )
 
60
  {
 
61
    if ( controller->shouldStop() )
 
62
      break;
 
63
 
 
64
    getChildTestAt( index )->run( controller );
 
65
  }
 
66
}
 
67
 
 
68
 
 
69
void 
 
70
TestComposite::doEndSuite( TestResult *controller )
 
71
{
 
72
  controller->endSuite( this );
 
73
}
 
74
 
 
75
 
 
76
CPPUNIT_NS_END
 
77