53 const std::string & string_1,
54 const char * string_1_stringified,
55 const std::string & string_2,
56 const char * string_2_stringified);
69 friend void OPENMS_DLLAPI
73 const std::string & string_1,
74 const char * string_1_stringified,
75 const std::string & string_2,
76 const char * string_2_stringified);
78 friend bool OPENMS_DLLAPI
228 const std::string & filename_2);
240 bool compareLines_(std::string
const & line_str_1, std::string
const & line_str_2);
254 void readNextLine_(std::istream & input_stream, std::string & line_string,
int & line_number)
const;
Fuzzy comparison of strings, tolerates numeric differences.
Definition: FuzzyStringComparator.h:67
double ratio_max_allowed_
Maximum ratio of numbers allowed, see ratio_max_.
Definition: FuzzyStringComparator.h:307
InputLine input_line_2_
Definition: FuzzyStringComparator.h:295
FuzzyStringComparator(const FuzzyStringComparator &rhs)
Copy constructor intentionally not implemented.
int line_num_1_max_
Definition: FuzzyStringComparator.h:300
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:263
int tab_width_
Definition: FuzzyStringComparator.h:355
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:303
int verbose_level_
Definition: FuzzyStringComparator.h:354
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:338
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:298
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:373
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:362
double absdiff_max_allowed_
Maximum absolute difference of numbers allowed, see absdiff_max_.
Definition: FuzzyStringComparator.h:313
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:340
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:310
std::string line_str_2_max_
Definition: FuzzyStringComparator.h:304
double absdiff_max_
Maximum difference of numbers observed so far, see absdiff_max_allowed_.
Definition: FuzzyStringComparator.h:316
const int & getVerboseLevel() const
verbose level
virtual ~FuzzyStringComparator()
Destructor.
StringList whitelist_
Whitelist.
Definition: FuzzyStringComparator.h:368
int first_column_
Definition: FuzzyStringComparator.h:356
int line_num_1_
Definition: FuzzyStringComparator.h:297
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:260
std::map< String, UInt > whitelist_cases_
Occurrences of whitelist entries.
Definition: FuzzyStringComparator.h:370
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:352
std::string input_2_name_
Name of second input e.g., filename.
Definition: FuzzyStringComparator.h:265
InputLine input_line_1_
Definition: FuzzyStringComparator.h:294
bool use_prefix_
use a prefix when reporting
Definition: FuzzyStringComparator.h:365
int line_num_2_max_
Definition: FuzzyStringComparator.h:301
void readNextLine_(std::istream &input_stream, std::string &line_string, int &line_number) const
Internal exception class.
Definition: FuzzyStringComparator.h:84
A more convenient string class.
Definition: String.h:60
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
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:147
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Wrapper for the prefix information computed for the failure report.
Definition: FuzzyStringComparator.h:344
OpenMS::String prefix_whitespaces
Definition: FuzzyStringComparator.h:346
int line_column
Definition: FuzzyStringComparator.h:347
OpenMS::String prefix
Definition: FuzzyStringComparator.h:345
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:320
double number
Definition: FuzzyStringComparator.h:321
bool is_number
Definition: FuzzyStringComparator.h:323
void fillFromInputLine(InputLine &input_line, const std::string &str_line)
bool is_space
Definition: FuzzyStringComparator.h:324
void reset()
reset all elements of the element to default value
unsigned char letter
Definition: FuzzyStringComparator.h:322