#include <cppunit/TestResult.h> |
#include <cppunit/TestResult.h> |
#include <cppunit/TextTestRunner.h> |
#include <cppunit/TextTestRunner.h> |
#include "PatMatch.h" |
#include "PatMatch.h" |
|
#include <vector> |
|
#include <iostream> |
|
|
using namespace CppUnit; |
using namespace CppUnit; |
|
|
delete a; delete pat1; delete pat2; |
delete a; delete pat1; delete pat2; |
} |
} |
void testShow(){ |
void testShow(){ |
|
std::cout << *pat1 << '\n'; |
|
std::vector<pixel> ps=pat1->getPixels(10,10); |
|
std::vector<pixel>::iterator it; |
|
for(it=ps.begin();it!=ps.end();it++){ |
|
std::cout << '(' << it->first << ',' << it->second << ')'; |
|
} |
|
std::cout << '\n'; |
} |
} |
void testMatch(){ |
void testMatch(){ |
CPPUNIT_ASSERT( pat1->isMatch(*a,-1,0) == true ); |
CPPUNIT_ASSERT( pat1->matchPenalty(*a,-1,0) >=0); |
CPPUNIT_ASSERT( pat1->isMatch(*a,0,0) == false ); |
CPPUNIT_ASSERT( pat1->matchPenalty(*a,0,0) <0); |
CPPUNIT_ASSERT( pat2->isMatch(*a,7,0) == true ); |
CPPUNIT_ASSERT( pat2->matchPenalty(*a,7,0) >=0); |
CPPUNIT_ASSERT( pat2->isMatch(*a,7,6) == false ); |
CPPUNIT_ASSERT( pat2->matchPenalty(*a,7,6) <0); |
|
|
} |
} |
static Test *suite(){ |
static Test *suite(){ |