File: BoardGameTest.h

package info (click to toggle)
cppunit 1.12.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,040 kB
  • ctags: 3,332
  • sloc: cpp: 18,193; sh: 8,465; ansic: 2,940; makefile: 553; xml: 58; csh: 6
file content (49 lines) | stat: -rw-r--r-- 862 bytes parent folder | download | duplicates (6)
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
#ifndef __BOARDGAMETEST_H__
#define __BOARDGAMETEST_H__

#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/portability/Stream.h>

template<class GAMECLASS> 
class BoardGameTest : public CPPUNIT_NS::TestFixture 
{
  CPPUNIT_TEST_SUITE( BoardGameTest );
  CPPUNIT_TEST( testReset );
  CPPUNIT_TEST( testResetShouldFail );
  CPPUNIT_TEST_SUITE_END();
protected:
  GAMECLASS	*m_game;
  
public:
  BoardGameTest()
  {
  }

  int countTestCases () const
  { 
    return 1; 
  }
  
  void setUp() 
  { 
    this->m_game = new GAMECLASS; 
  }
  
  void tearDown()
  { 
    delete this->m_game; 
  }
  
  void testReset() 
  { 
    CPPUNIT_ASSERT( this->m_game->reset() );
  }

  void testResetShouldFail() 
  { 
    CPPUNIT_NS::stdCOut() << "The following test fails, this is intended:" << "\n";
    CPPUNIT_ASSERT( !this->m_game->reset() );
  }
};

#endif