27 const std::string & string_1,
28 const char * string_1_stringified,
29 const std::string & string_2,
30 const char * string_2_stringified);
43 friend void OPENMS_DLLAPI
47 const std::string & string_1,
48 const char * string_1_stringified,
49 const std::string & string_2,
50 const char * string_2_stringified);
52 friend bool OPENMS_DLLAPI
202 const std::string & filename_2);
214 bool compareLines_(std::string
const & line_str_1, std::string
const & line_str_2);
228 void readNextLine_(std::istream & input_stream, std::string & line_string,
int & line_number)
const;
Fuzzy comparison of strings, tolerates numeric differences.
Definition: FuzzyStringComparator.h:41
double ratio_max_allowed_
Maximum ratio of numbers allowed, see ratio_max_.
Definition: FuzzyStringComparator.h:281
InputLine input_line_2_
Definition: FuzzyStringComparator.h:269
FuzzyStringComparator(const FuzzyStringComparator &rhs)
Copy constructor intentionally not implemented.
int line_num_1_max_
Definition: FuzzyStringComparator.h:274
bool openInputFileStream_(const std::string &filename, std::ifstream &input_stream) const
opens and checks an input file stream std::ifstream
void reportSuccess_() const
Report good news.
void setFirstColumn(const int rhs)
set first column (for column numbers)
void setWhitelist(const StringList &rhs)
White list. If both lines contain the same element from this list, they are skipped over.
void setAcceptableRelative(const double rhs)
Acceptable relative error (a number >= 1.0)
std::string input_1_name_
Name of first input e.g., filename.
Definition: FuzzyStringComparator.h:237
int tab_width_
Definition: FuzzyStringComparator.h:329
void setTabWidth(const int rhs)
set tab width (for column numbers)
void writeWhitelistCases_(const std::string &prefix) const
Write info about hits in the whitelist.
void setMatchedWhitelist(const std::vector< std::pair< std::string, std::string > > &rhs)
Matched white list. If file 1 contains element 1 and file 2 contains element 2, they are skipped over...
const StringList & getWhitelist() const
White list. If both lines contain the same element from this list, they are skipped over.
std::string line_str_1_max_
Definition: FuzzyStringComparator.h:277
int verbose_level_
Definition: FuzzyStringComparator.h:328
const int & getFirstColumn() const
get first column (for column numbers)
StreamElement_ element_1_
Stores information about characters, numbers, and white spaces loaded from the first input stream.
Definition: FuzzyStringComparator.h:312
bool compareFiles(const std::string &filename_1, const std::string &filename_2)
Simple diff-like application to compare two input files. Numeric differences are tolerated up to a ce...
int line_num_2_
Definition: FuzzyStringComparator.h:272
bool compareStrings(std::string const &lhs, std::string const &rhs)
Compare two strings.
const int & getTabWidth() const
get tab width (for column numbers)
std::vector< std::pair< std::string, std::string > > matched_whitelist_
Alternative Whitelist.
Definition: FuzzyStringComparator.h:347
FuzzyStringComparator()
Constructor.
void setLogDestination(std::ostream &rhs)
Log output is written to this destination.
StringList & getWhitelist()
White list. If both lines contain the same element from this list, they are skipped over.
void reportFailure_(char const *const message) const
void setVerboseLevel(const int rhs)
verbose level
const std::vector< std::pair< std::string, std::string > > & getMatchedWhitelist() const
Matched white list. If file 1 contains element 1 and file 2 contains element 2, they are skipped over...
bool is_status_success_
Has comparison been successful so far? Note: this flag is changed in reportFailure_();.
Definition: FuzzyStringComparator.h:336
double absdiff_max_allowed_
Maximum absolute difference of numbers allowed, see absdiff_max_.
Definition: FuzzyStringComparator.h:287
const double & getAcceptableAbsolute() const
Acceptable absolute difference (a number >= 0.0)
StreamElement_ element_2_
Stores information about characters, numbers, and white spaces loaded from the second input stream.
Definition: FuzzyStringComparator.h:314
FuzzyStringComparator & operator=(const FuzzyStringComparator &rhs)
Assignment operator intentionally not implemented.
double ratio_max_
Maximum ratio of numbers observed so far, see ratio_max_allowed_.
Definition: FuzzyStringComparator.h:284
std::string line_str_2_max_
Definition: FuzzyStringComparator.h:278
double absdiff_max_
Maximum difference of numbers observed so far, see absdiff_max_allowed_.
Definition: FuzzyStringComparator.h:290
const int & getVerboseLevel() const
verbose level
virtual ~FuzzyStringComparator()
Destructor.
StringList whitelist_
Whitelist.
Definition: FuzzyStringComparator.h:342
int first_column_
Definition: FuzzyStringComparator.h:330
int line_num_1_
Definition: FuzzyStringComparator.h:271
bool compareLines_(std::string const &line_str_1, std::string const &line_str_2)
Compare two lines of input.
std::ostream & getLogDestination() const
Log output is written to this destination.
std::ostream * log_dest_
Log and results output goes here.
Definition: FuzzyStringComparator.h:234
std::map< String, UInt > whitelist_cases_
Occurrences of whitelist entries.
Definition: FuzzyStringComparator.h:344
void setAcceptableAbsolute(const double rhs)
Acceptable absolute difference (a number >= 0.0)
const double & getAcceptableRelative() const
Acceptable relative error (a number >= 1.0)
bool compareStreams(std::istream &input_1, std::istream &input_2)
Compare two streams of input.
bool is_absdiff_small_
Definition: FuzzyStringComparator.h:326
std::string input_2_name_
Name of second input e.g., filename.
Definition: FuzzyStringComparator.h:239
InputLine input_line_1_
Definition: FuzzyStringComparator.h:268
bool use_prefix_
use a prefix when reporting
Definition: FuzzyStringComparator.h:339
int line_num_2_max_
Definition: FuzzyStringComparator.h:275
void readNextLine_(std::istream &input_stream, std::string &line_string, int &line_number) const
Internal exception class.
Definition: FuzzyStringComparator.h:58
A more convenient string class.
Definition: String.h:34
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
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.
bool isFileSimilar(const std::string &filename_1, const std::string &filename_2)
Compare files using absdiff_max_allowed and ratio_max_allowed.
static String prefix(const String &this_s, size_t length)
Definition: StringUtilsSimple.h:122
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Wrapper for the prefix information computed for the failure report.
Definition: FuzzyStringComparator.h:318
OpenMS::String prefix_whitespaces
Definition: FuzzyStringComparator.h:320
int line_column
Definition: FuzzyStringComparator.h:321
OpenMS::String prefix
Definition: FuzzyStringComparator.h:319
PrefixInfo_(const InputLine &input_line, const int tab_width_, const int first_column_)
Stores information about characters, numbers, and white spaces loaded from the InputStream.
Definition: FuzzyStringComparator.h:294
double number
Definition: FuzzyStringComparator.h:295
bool is_number
Definition: FuzzyStringComparator.h:297
void fillFromInputLine(InputLine &input_line, const std::string &str_line)
bool is_space
Definition: FuzzyStringComparator.h:298
void reset()
reset all elements of the element to default value
unsigned char letter
Definition: FuzzyStringComparator.h:296