35 #ifndef FILECOMPARISON_HPP_
36 #define FILECOMPARISON_HPP_
38 #include "AbstractFileComparison.hpp"
40 #include <boost/foreach.hpp>
75 FileComparison(std::string fileName1, std::string fileName2,
bool calledCollectively=
true,
bool suppressOutput =
false)
169 bool CompareFiles(
unsigned ignoreFirstFewLines=0,
bool doTsAssert=
true)
179 unsigned failures = 0;
180 unsigned max_display_failures = 10;
184 bool files_empty =
false;
195 while (buffer1.empty() &&
mpFile1->good())
199 while (buffer2.empty() &&
mpFile2->good())
207 bool skip_this_line =
false;
213 if (found1 == 0 && found2 == 0)
215 skip_this_line =
true;
228 bool skip_this_line =
false;
231 size_t found1 = buffer1.find(rText);
232 size_t found2 = buffer2.find(rText);
233 if (found1 != std::string::npos && found2 != std::string::npos)
235 skip_this_line =
true;
245 if (!(buffer1==buffer2) && !files_empty)
250 std::stringstream message;
253 TS_TRACE(message.str());
266 TS_ASSERT_EQUALS(failures, 0u);
277 return (failures==0);
void IgnoreBlankLines(bool ignore=true)
void SkipHeaderLines(unsigned numLinesToSkip)
FileComparison(std::string fileName1, std::string fileName2, bool calledCollectively=true, bool suppressOutput=false)
FileComparison(const FileFinder &rFileName1, const FileFinder &rFileName2, bool calledCollectively=true, bool suppressOutput=false)
std::vector< std::string > mIgnorableContent
void SetIgnoreCommentLines(bool ignore=true)
void SetIgnoreLinesBeginningWith(std::string lineStart)
bool CompareFiles(unsigned ignoreFirstFewLines=0, bool doTsAssert=true)
std::vector< std::string > mCommentLineStarts
void IgnoreLinesContaining(const std::string &rIgnorableText)