summaryrefslogtreecommitdiff
path: root/examples/cppunittest/TestDecoratorTest.cpp
blob: f90874b8b6973bc07ef501683052daa5c3a6545a (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
#include "ExtensionSuite.h"
#include "TestDecoratorTest.h"
#include <cppunit/TestResult.h>


CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestDecoratorTest,
                                       extensionSuiteName() );


TestDecoratorTest::TestDecoratorTest()
{
}


TestDecoratorTest::~TestDecoratorTest()
{
}


void 
TestDecoratorTest::setUp()
{
  m_test = new MockTestCase( "mocktest" );
  m_decorator = new CPPUNIT_NS::TestDecorator( m_test );
}


void 
TestDecoratorTest::tearDown()
{
  delete m_decorator;
}


void 
TestDecoratorTest::testCountTestCases()
{
  m_test->setExpectedCountTestCasesCall( 1 );
  CPPUNIT_ASSERT_EQUAL( 1, m_decorator->countTestCases() );
  m_test->verify();
}


void 
TestDecoratorTest::testRun()
{
  m_test->setExpectedSetUpCall( 1 );
  m_test->setExpectedRunTestCall( 1 );
  m_test->setExpectedTearDownCall( 1 );
  CPPUNIT_NS::TestResult result;

  m_decorator->run( &result );
  m_test->verify();
}


void 
TestDecoratorTest::testGetName()
{
  CPPUNIT_ASSERT_EQUAL( m_test->getName(), m_decorator->getName() );
}