summaryrefslogtreecommitdiffstats
blob: ff71b52c136c1ccb0b54f39538b57052f1c7a651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <cppunit/TestSuite.h>
#include <cppunit/extensions/TestFixtureFactory.h>
#include <cppunit/extensions/TestNamer.h>
#include <cppunit/extensions/TestSuiteBuilderContext.h>


CPPUNIT_NS_BEGIN

TestSuiteBuilderContextBase::TestSuiteBuilderContextBase( 
                                 TestSuite &suite,
                                 const TestNamer &namer,
                                 TestFixtureFactory &factory )
  : m_suite( suite )
  , m_namer( namer )
  , m_factory( factory )
{
}


TestSuiteBuilderContextBase::~TestSuiteBuilderContextBase()
{
}


void 
TestSuiteBuilderContextBase::addTest( Test *test )
{
  m_suite.addTest( test );
}


std::string 
TestSuiteBuilderContextBase::getFixtureName() const
{
  return m_namer.getFixtureName();
}


std::string 
TestSuiteBuilderContextBase::getTestNameFor( 
                                 const std::string &testMethodName ) const
{
  return m_namer.getTestNameFor( testMethodName );
}


TestFixture *
TestSuiteBuilderContextBase::makeTestFixture() const
{
  return m_factory.makeFixture();
}


void 
TestSuiteBuilderContextBase::addProperty( const std::string &key, 
                                          const std::string &value )
{
  Properties::iterator it = m_properties.begin();
  for ( ; it != m_properties.end(); ++it )
  {
    if ( (*it).first == key )
    {
      (*it).second = value;
      return;
    }
  }

  Property property( key, value );
  m_properties.push_back( property );
}

const std::string 
TestSuiteBuilderContextBase::getStringProperty( const std::string &key ) const
{
  Properties::const_iterator it = m_properties.begin();
  for ( ; it != m_properties.end(); ++it )
  {
    if ( (*it).first == key )
      return (*it).second;
  }
  return "";
}


CPPUNIT_NS_END