22 #ifndef otbTestHelper_h
23 #define otbTestHelper_h
28 #include "itkObject.h"
29 #include "itkObjectFactory.h"
33 #include "OTBTestKernelExport.h"
47 class OTBTestKernel_EXPORT
TestHelper :
public itk::Object
84 itkSetMacro(ReportErrors,
bool);
85 itkBooleanMacro(ReportErrors);
86 itkSetMacro(IgnoreLineOrder,
bool);
87 itkBooleanMacro(IgnoreLineOrder);
89 itkSetMacro(EpsilonBoundaryChecking,
double);
90 itkSetMacro(ToleranceRatio,
double);
95 int RegressionTestImage(
int cpt,
const char* testImageFilename,
const char* baselineImageFilename,
const double toleranceDiffPixelImage)
const;
97 int RegressionTestOgrFile(
const char* testOgrFilename,
const char* baselineOgrFilename,
const double toleranceDiffValue)
const;
102 std::vector<std::string> ignoredLines)
const;
105 std::vector<std::string> ignoredLines)
const;
107 int RegressionTestMetaData(
const char* testImageFilename,
const char* baselineImageFilename,
const double toleranceDiffPixelImage)
const;
122 static bool IsTokenEmpty(boost::iterator_range<std::string::const_iterator>& token);
127 bool CompareLines(
const std::string& strfileref,
const std::string& strfiletest,
int& nbdiff, std::ofstream& fluxfilediff,
int& numLine,
128 std::vector<std::string>& listStrDiffLineFileRef, std::vector<std::string>& listStrDiffLineFileTest,
double epsilon)
const;
130 void ogrReportOnLayer(OGRLayer* ref_poLayer,
const char* ref_pszWHERE, OGRGeometry* ref_poSpatialFilter, OGRLayer* test_poLayer,
const char* test_pszWHERE,
131 OGRGeometry* test_poSpatialFilter,
int& nbdiff,
double epsilon)
const;
133 static void DumpOGRFeature(FILE* fileid, OGRFeature* feature,
char** papszOptions =
nullptr);
134 static void DumpOGRGeometry(FILE* fileid, OGRGeometry* geometry,
const char* pszPrefix,
char** papszOptions =
nullptr);
144 void CheckValueTolerance(
const char* Comment,
double ref,
double test,
int& count,
bool report,
double epsilon)
const;
Helper class to perform the baseline comparisons during the tests.
bool isAlphaNum(int i) const
bool CompareLines(const std::string &strfileref, const std::string &strfiletest, int &nbdiff, std::ofstream &fluxfilediff, int &numLine, std::vector< std::string > &listStrDiffLineFileRef, std::vector< std::string > &listStrDiffLineFileTest, double epsilon) const
std::map< std::string, int > RegressionTestBaselines(char *baselineFilename) const
int RegressionTestOgrFile(const char *testOgrFilename, const char *baselineOgrFilename, const double toleranceDiffValue) const
std::vector< std::pair< std::string, std::string > > m_SpecialTokens
bool isPoint(int i) const
EpsilonList::const_iterator EpsilonListIt
void ogrReportOnLayer(OGRLayer *ref_poLayer, const char *ref_pszWHERE, OGRGeometry *ref_poSpatialFilter, OGRLayer *test_poLayer, const char *test_pszWHERE, OGRGeometry *test_poSpatialFilter, int &nbdiff, double epsilon) const
int RegressionTestImage(int cpt, const char *testImageFilename, const char *baselineImageFilename, const double toleranceDiffPixelImage) const
bool isScientificNumeric(const std::string &str) const
static void DumpOGRGeometry(FILE *fileid, OGRGeometry *geometry, const char *pszPrefix, char **papszOptions=nullptr)
bool isNumber(int i) const
int RegressionTestAllMetaData(const StringList &baselineFilenamesMetaData, const StringList &testFilenamesMetaData, const EpsilonList &epsilons)
itk::SmartPointer< const Self > ConstPointer
std::vector< std::string > StringList
int RegressionTestBinaryFile(const char *testBinaryFileName, const char *baselineBinaryFileName) const
int RegressionTestAllBinary(const StringList &baselineFilenamesBinary, const StringList &testFilenamesBinary)
bool isHexaPointerAddress(const std::string &str) const
StringList::const_iterator StringListIt
int RegressionTestAllAscii(const StringList &baselineFilenamesAscii, const StringList &testFilenamesAscii, const EpsilonList &epsilons, const StringList &ignoredLines)
int RegressionTestAllOgr(const StringList &baselineFilenamesOgr, const StringList &testFilenamesOgr, const EpsilonList &epsilons)
bool isNumeric(const std::string &str) const
bool isMinusSign(int i) const
bool isToBeIgnoredForAnyComparison(const std::string &str) const
int RegressionTestAllDiff(const StringList &baselineFilenamesAscii, const StringList &testFilenamesAscii, const EpsilonList &epsilons, const StringList &ignoredLines)
static void DumpOGRFeature(FILE *fileid, OGRFeature *feature, char **papszOptions=nullptr)
bool isHexaNumber(int i) const
void AddWhiteSpace(const std::string &strIn, std::string &strOut) const
static bool IsTokenEmpty(boost::iterator_range< std::string::const_iterator > &token)
int RegressionTestAsciiFile(const char *testAsciiFileName, const char *baselineAsciiFileName, const double epsilon, std::vector< std::string > ignoredLines) const
const unsigned int m_MaxArea
std::vector< double > EpsilonList
void CheckValueTolerance(const char *Comment, double ref, double test, int &count, bool report, double epsilon) const
double m_EpsilonBoundaryChecking
int RegressionTestMetaData(const char *testImageFilename, const char *baselineImageFilename, const double toleranceDiffPixelImage) const
bool IsLineValid(const std::string &str, const StringList &ignoredLines) const
int RegressionTestDiffFile(const char *testAsciiFileName, const char *baselineAsciiFileName, const double epsilon, std::vector< std::string > ignoredLines) const
int RegressionTestAllImages(const StringList &baselineFilenamesImage, const StringList &testFilenamesImage, const EpsilonList &epsilons)
itk::SmartPointer< Self > Pointer
std::string VectorToString(const otb::MetaDataKey::VectorType &vector) const
int TokenizeLine(const std::string &line, StringList &tokens) const
bool isHexaPointerAddress(const std::string &str, vcl_size_t pos, vcl_size_t size) const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.