#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(){ |
cout << *pat1 << '\n'; |
std::cout << *pat1 << '\n'; |
vector<pixel> ps=pat1->getPixels(10,10); |
std::vector<pixel> ps=pat1->getPixels(10,10); |
vector<pixel>::iterator it; |
std::vector<pixel>::iterator it; |
for(it=ps.begin();it!=ps.end();it++){ |
for(it=ps.begin();it!=ps.end();it++){ |
cout << '(' << it->first << ',' << it->second << ')'; |
std::cout << '(' << it->first << ',' << it->second << ')'; |
} |
} |
cout << '\n'; |
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(){ |