35#ifndef FILECOMPARISON_HPP_
36#define FILECOMPARISON_HPP_
38#include "AbstractFileComparison.hpp"
40#include <boost/foreach.hpp>
42#include <cxxtest/TestSuite.h>
77 FileComparison(std::string fileName1, std::string fileName2,
bool calledCollectively=
true,
bool suppressOutput =
false)
171 bool CompareFiles(
unsigned ignoreFirstFewLines=0,
bool doTsAssert=
true)
181 unsigned failures = 0;
182 unsigned max_display_failures = 10;
186 bool files_empty =
false;
197 while (buffer1.empty() &&
mpFile1->good())
201 while (buffer2.empty() &&
mpFile2->good())
209 bool skip_this_line =
false;
215 if (found1 == 0 && found2 == 0)
217 skip_this_line =
true;
230 bool skip_this_line =
false;
233 size_t found1 = buffer1.find(rText);
234 size_t found2 = buffer2.find(rText);
235 if (found1 != std::string::npos && found2 != std::string::npos)
237 skip_this_line =
true;
247 if (!(buffer1==buffer2) && !files_empty)
252 std::stringstream message;
255 TS_TRACE(message.str());
268 TS_ASSERT_EQUALS(failures, 0u);
279 return (failures==0);
void SkipHeaderLines(unsigned numLinesToSkip)
void IgnoreBlankLines(bool ignore=true)
void SetIgnoreCommentLines(bool ignore=true)
void SetIgnoreLinesBeginningWith(std::string lineStart)
std::vector< std::string > mCommentLineStarts
std::vector< std::string > mIgnorableContent
FileComparison(const FileFinder &rFileName1, const FileFinder &rFileName2, bool calledCollectively=true, bool suppressOutput=false)
void IgnoreLinesContaining(const std::string &rIgnorableText)
bool CompareFiles(unsigned ignoreFirstFewLines=0, bool doTsAssert=true)
FileComparison(std::string fileName1, std::string fileName2, bool calledCollectively=true, bool suppressOutput=false)