1 #ifndef __BOARDGAMETEST_H__
2 #define __BOARDGAMETEST_H__
3 
4 #include <cppunit/extensions/HelperMacros.h>
5 #include <cppunit/portability/Stream.h>
6 
7 template<class GAMECLASS>
8 class BoardGameTest : public CPPUNIT_NS::TestFixture
9 {
10   CPPUNIT_TEST_SUITE( BoardGameTest );
11   CPPUNIT_TEST( testReset );
12   CPPUNIT_TEST( testResetShouldFail );
13   CPPUNIT_TEST_SUITE_END();
14 protected:
15   GAMECLASS	*m_game;
16 
17 public:
BoardGameTest()18   BoardGameTest()
19   {
20   }
21 
countTestCases()22   int countTestCases () const
23   {
24     return 1;
25   }
26 
setUp()27   void setUp()
28   {
29     this->m_game = new GAMECLASS;
30   }
31 
tearDown()32   void tearDown()
33   {
34     delete this->m_game;
35   }
36 
testReset()37   void testReset()
38   {
39     CPPUNIT_ASSERT( this->m_game->reset() );
40   }
41 
testResetShouldFail()42   void testResetShouldFail()
43   {
44     CPPUNIT_NS::stdCOut() << "The following test fails, this is intended:" << "\n";
45     CPPUNIT_ASSERT( !this->m_game->reset() );
46   }
47 };
48 
49 #endif
50