35 #ifndef OPENMS_CONCEPT_FUZZYSTRINGCOMPARATOR_H 36 #define OPENMS_CONCEPT_FUZZYSTRINGCOMPARATOR_H 45 #ifdef OPENMS_HAS_STREAM_EXTRACTION_BUG 46 #include <boost/lexical_cast.hpp> 47 #endif // OPENMS_HAS_STREAM_EXTRACTION_BUG 57 const std::string & string_1,
58 const char * string_1_stringified,
59 const std::string & string_2,
60 const char * string_2_stringified);
73 friend void OPENMS_DLLAPI
77 const std::string & string_1,
78 const char * string_1_stringified,
79 const std::string & string_2,
80 const char * string_2_stringified);
82 friend bool OPENMS_DLLAPI
112 const double & getAcceptableRelative()
const;
115 void setAcceptableRelative(
const double rhs);
118 const double & getAcceptableAbsolute()
const;
121 void setAcceptableAbsolute(
const double rhs);
133 void setMatchedWhitelist(
const std::vector< std::pair<std::string, std::string> >& rhs);
136 const std::vector< std::pair<std::string, std::string> >& getMatchedWhitelist()
const;
146 const int & getVerboseLevel()
const;
156 void setVerboseLevel(
const int rhs);
161 const int & getTabWidth()
const;
166 void setTabWidth(
const int rhs);
171 const int & getFirstColumn()
const;
176 void setFirstColumn(
const int rhs);
184 std::ostream & getLogDestination()
const;
196 void setLogDestination(std::ostream & rhs);
205 bool compareStrings(std::string
const & lhs, std::string
const & rhs);
215 bool compareStreams(std::istream & input_1, std::istream & input_2);
231 bool compareFiles(
const std::string & filename_1,
232 const std::string & filename_2);
244 bool compareLines_(std::string
const & line_str_1, std::string
const & line_str_2);
247 void reportSuccess_()
const;
251 void reportFailure_(
char const *
const message)
const;
254 void writeWhitelistCases_(
const std::string & prefix)
const;
258 void readNextLine_(std::istream & input_stream, std::string & line_string,
int & line_number)
const;
261 bool openInputFileStream_(
const std::string & filename, std::ifstream & input_stream)
const;
280 void setToString(
const std::string & s);
283 void updatePosition();
286 void seekGToSavedPosition();
334 #ifdef OPENMS_HAS_STREAM_EXTRACTION_BUG 344 bool readdigits(
InputLine & input_line, std::string & target_buffer,
char & c_buffer);
353 bool tryExtractDouble(
InputLine & input_line,
double & target);
355 void fillFromInputLine(
InputLine & input_line);
400 #endif //OPENMS_CONCEPT_FUZZYSTRINGCOMPARATOR_H StreamElement_ element_2_
Stores information about characters, numbers, and white spaces loaded from the second input stream...
Definition: FuzzyStringComparator.h:362
int verbose_level_
Definition: FuzzyStringComparator.h:376
void testStringSimilar(const char *file, int line, const std::string &string_1, const char *string_1_stringified, const std::string &string_2, const char *string_2_stringified)
Compare strings using absdiff_max_allowed and ratio_max_allowed.
A more convenient string class.
Definition: String.h:57
Internal exception class.
Definition: FuzzyStringComparator.h:87
double ratio_max_allowed_
Maximum ratio of numbers allowed, see ratio_max_.
Definition: FuzzyStringComparator.h:311
Stores information about characters, numbers, and white spaces loaded from the InputStream.
Definition: FuzzyStringComparator.h:323
double absdiff_max_
Maximum difference of numbers observed so far, see absdiff_max_allowed_.
Definition: FuzzyStringComparator.h:320
int line_column
Definition: FuzzyStringComparator.h:369
double absdiff_max_allowed_
Maximum absolute difference of numbers allowed, see absdiff_max_.
Definition: FuzzyStringComparator.h:317
OpenMS::String prefix
Definition: FuzzyStringComparator.h:367
bool use_prefix_
use a prefix when reporting
Definition: FuzzyStringComparator.h:387
std::ostream * log_dest_
Log and results output goes here.
Definition: FuzzyStringComparator.h:264
void setWhitelist(const char *const, const int line, const std::string &whitelist)
set the whitelist_
std::vector< std::pair< std::string, std::string > > matched_whitelist_
Alternative Whitelist.
Definition: FuzzyStringComparator.h:395
unsigned char letter
Definition: FuzzyStringComparator.h:326
bool is_space
Definition: FuzzyStringComparator.h:328
Fuzzy comparison of strings, tolerates numeric differences.
Definition: FuzzyStringComparator.h:70
std::string line_str_2_max_
Definition: FuzzyStringComparator.h:308
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
int line_num_2_
Definition: FuzzyStringComparator.h:302
std::map< String, UInt > whitelist_cases_
Occurences of whitelist entries.
Definition: FuzzyStringComparator.h:392
bool is_number
Definition: FuzzyStringComparator.h:327
OpenMS::String prefix_whitespaces
Definition: FuzzyStringComparator.h:368
double number
Definition: FuzzyStringComparator.h:325
int first_column_
Definition: FuzzyStringComparator.h:378
int tab_width_
Definition: FuzzyStringComparator.h:377
double ratio_max_
Maximum ratio of numbers observed so far, see ratio_max_allowed_.
Definition: FuzzyStringComparator.h:314
int line_num_1_
Definition: FuzzyStringComparator.h:301
StreamElement_ element_1_
Stores information about characters, numbers, and white spaces loaded from the first input stream...
Definition: FuzzyStringComparator.h:360
StringList whitelist_
Whitelist.
Definition: FuzzyStringComparator.h:390
InputLine input_line_2_
Definition: FuzzyStringComparator.h:299
bool is_status_success_
Has comparison been successful so far? Note: this flag is changed in reportFailure_();.
Definition: FuzzyStringComparator.h:384
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:74
std::string input_2_name_
Name of second input e.g., filename.
Definition: FuzzyStringComparator.h:269
int line_num_1_max_
Definition: FuzzyStringComparator.h:304
std::string line_str_1_max_
Definition: FuzzyStringComparator.h:307
bool isFileSimilar(const std::string &filename_1, const std::string &filename_2)
Compare files using absdiff_max_allowed and ratio_max_allowed.
bool is_absdiff_small_
Definition: FuzzyStringComparator.h:374
Wrapper for the prefix information computed for the failure report.
Definition: FuzzyStringComparator.h:365
int line_num_2_max_
Definition: FuzzyStringComparator.h:305
InputLine input_line_1_
Definition: FuzzyStringComparator.h:298
std::string input_1_name_
Name of first input e.g., filename.
Definition: FuzzyStringComparator.h:267