#include <NumericFileComparison.hpp>
Public Member Functions | |
NumericFileComparison (std::string fileName1, std::string fileName2) | |
~NumericFileComparison () | |
bool | CompareFiles (double absTol=DBL_EPSILON, unsigned ignoreFirstFewLines=0, double relTol=DBL_EPSILON) |
Private Attributes | |
std::string | mFilename1 |
std::string | mFilename2 |
std::ifstream * | mpFile1 |
std::ifstream * | mpFile2 |
Compare files of numbers to see if they match to within a given tolerance.
Definition at line 43 of file NumericFileComparison.hpp.
NumericFileComparison::NumericFileComparison | ( | std::string | fileName1, | |
std::string | fileName2 | |||
) | [inline] |
Specify two files to compare, and open them for reading. Actual comparison is done by calling CompareFiles.
fileName1 | first file | |
fileName2 | second file |
Definition at line 62 of file NumericFileComparison.hpp.
NumericFileComparison::~NumericFileComparison | ( | ) | [inline] |
Close the files being compared.
Definition at line 93 of file NumericFileComparison.hpp.
bool NumericFileComparison::CompareFiles | ( | double | absTol = DBL_EPSILON , |
|
unsigned | ignoreFirstFewLines = 0 , |
|||
double | relTol = DBL_EPSILON | |||
) | [inline] |
Compare the files under both relative and absolute tolerances. The comparison only fails if neither tolerance holds. The default settings effectively require numbers to match exactly.
absTol | absolute tolerance on difference between numbers | |
ignoreFirstFewLines | how many lines to ignore from the comparison | |
relTol | relative tolerance on difference between numbers |
Definition at line 116 of file NumericFileComparison.hpp.
References mFilename1, mFilename2, mpFile1, mpFile2, and CompareDoubles::WithinAnyTolerance().
std::string NumericFileComparison::mFilename1 [private] |
First filename
Definition at line 47 of file NumericFileComparison.hpp.
Referenced by CompareFiles().
std::string NumericFileComparison::mFilename2 [private] |
Second filename
Definition at line 48 of file NumericFileComparison.hpp.
Referenced by CompareFiles().
std::ifstream* NumericFileComparison::mpFile1 [private] |
First file
Definition at line 50 of file NumericFileComparison.hpp.
Referenced by CompareFiles(), NumericFileComparison(), and ~NumericFileComparison().
std::ifstream* NumericFileComparison::mpFile2 [private] |
Second file
Definition at line 51 of file NumericFileComparison.hpp.
Referenced by CompareFiles(), NumericFileComparison(), and ~NumericFileComparison().