Revision: 1.1 - (view) (download) (as text)
1 : | ktanaka | 1.1 | #ifndef _PAT_MAT_TEST_H |
2 : | #define _PAT_MAT_TEST_H | ||
3 : | #include <cppunit/TestCase.h> | ||
4 : | #include <cppunit/TestCaller.h> | ||
5 : | #include <cppunit/TestSuite.h> | ||
6 : | #include <cppunit/TestResult.h> | ||
7 : | #include <cppunit/TextTestRunner.h> | ||
8 : | #include "PatMatch.h" | ||
9 : | |||
10 : | using namespace CppUnit; | ||
11 : | |||
12 : | class PatMatchTest : public TestCase { | ||
13 : | private: | ||
14 : | BitmapFont *a; | ||
15 : | PatMatch *pat1,*pat2; | ||
16 : | public: | ||
17 : | void setUp(){ | ||
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 : | a=new BitmapFont(24,24,"000006FFFFFF00C30000C30000C30000C30020C30C3FFFFE30C30C30C30C30C30C30C30C30C30C30C30C3FFFFC30C30C00C30000C30000C30000C30000C30000C306FFFFFF000000"); | ||
46 : | pat1=new PatMatch(3,3, | ||
47 : | "..." | ||
48 : | ".@@" | ||
49 : | "...",Assumption()); | ||
50 : | pat2=new PatMatch(4,3, | ||
51 : | "...." | ||
52 : | "@@@@" | ||
53 : | ".@@.",Assumption()); | ||
54 : | } | ||
55 : | void tearDown(){ | ||
56 : | delete a; delete pat1; delete pat2; | ||
57 : | } | ||
58 : | void testShow(){ | ||
59 : | } | ||
60 : | void testMatch(){ | ||
61 : | CPPUNIT_ASSERT( pat1->isMatch(*a,-1,0) == true ); | ||
62 : | CPPUNIT_ASSERT( pat1->isMatch(*a,0,0) == false ); | ||
63 : | CPPUNIT_ASSERT( pat2->isMatch(*a,7,0) == true ); | ||
64 : | CPPUNIT_ASSERT( pat2->isMatch(*a,7,6) == false ); | ||
65 : | |||
66 : | } | ||
67 : | static Test *suite(){ | ||
68 : | TestSuite *suiteOfTests = new TestSuite; | ||
69 : | suiteOfTests->addTest (new TestCaller<PatMatchTest>("testShow", &PatMatchTest::testShow)); | ||
70 : | suiteOfTests->addTest (new TestCaller<PatMatchTest>("testMatch", &PatMatchTest::testMatch)); | ||
71 : | return suiteOfTests; | ||
72 : | } | ||
73 : | }; | ||
74 : | |||
75 : | |||
76 : | #endif /* _PAT_MAT_TEST_H */ |
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |