#ifndef _MATCHERS_TEST_TEST_H #define _MATCHERS_TEST_TEST_H #include #include #include #include #include #include "Matchers.h" #include #include using namespace CppUnit; class MatchersTest : public TestCase { private: BitmapFont *a; Matchers *mat; BitmapFontFile *ff; public: void setUp(){ /* .....................@@. @@@@@@@@@@@@@@@@@@@@@@@@ ........@@....@@........ ........@@....@@........ ........@@....@@........ ........@@....@@........ ..@.....@@....@@....@@.. ..@@@@@@@@@@@@@@@@@@@@@. ..@@....@@....@@....@@.. ..@@....@@....@@....@@.. ..@@....@@....@@....@@.. ..@@....@@....@@....@@.. ..@@....@@....@@....@@.. ..@@....@@....@@....@@.. ..@@@@@@@@@@@@@@@@@@@@.. ..@@....@@....@@....@@.. ........@@....@@........ ........@@....@@........ ........@@....@@........ ........@@....@@........ ........@@....@@........ ........@@....@@.....@@. @@@@@@@@@@@@@@@@@@@@@@@@ ........................ */ a=new BitmapFont(24,24,"000006FFFFFF00C30000C30000C30000C30020C30C3FFFFE30C30C30C30C30C30C30C30C30C30C30C30C3FFFFC30C30C00C30000C30000C30000C30000C30000C306FFFFFF000000"); mat=new Matchers(); ff=new BitmapFontFile("jiskan24.bdf"); } void tearDown(){ delete a; delete mat; delete ff; } void testShow(){ std::cout << *mat << '\n'; } void testMatch(){ std::vector mr=mat->findMatch(*a); std::vector::iterator it; for(it=mr.begin();it!=mr.end();it++) std::cout << *it << '\n'; } void testCover(){ for(int code=0x3021;code<=0x307e;code++){ BitmapFont bf=ff->find(code); std::vector nc=mat->notCovered(bf); if(!nc.empty()){ std::cout << "---------------------------------------\n"; std::cout << bf; std::cout << BitmapFont(bf.getWidth(),bf.getHeight(),nc) ; } } } static Test *suite(){ TestSuite *suiteOfTests = new TestSuite; suiteOfTests->addTest (new TestCaller("testShow", &MatchersTest::testShow)); suiteOfTests->addTest (new TestCaller("testMatch", &MatchersTest::testMatch)); suiteOfTests->addTest (new TestCaller("testCover", &MatchersTest::testCover)); return suiteOfTests; } }; #endif /* _MATCHERS_TEST_TEST_H */