Mantid
Loading...
Searching...
No Matches
FileComparisonHelper.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2017 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include <iosfwd>
10#include <iterator>
11#include <string>
12
27using streamCharIter = std::istreambuf_iterator<char>;
28
31bool areIteratorsEqual(streamCharIter refStream, streamCharIter testStream,
32 streamCharIter refStreamEnd = streamCharIter(), streamCharIter testStreamEnd = streamCharIter());
33
36bool areFilesEqual(const std::string &referenceFileFullPath, const std::string &outFileFullPath);
37
40bool areFileStreamsEqual(std::ifstream &referenceFileStream, std::ifstream &fileToCheck);
41
44bool isEqualToReferenceFile(const std::string &referenceFileName, const std::string &outFileFullPath);
45} // Namespace FileComparisonHelper
bool areFileStreamsEqual(std::ifstream &referenceFileStream, std::ifstream &fileToCheck)
Checks if two file streams are equal in content and length.
bool isEqualToReferenceFile(const std::string &referenceFileName, const std::string &outFileFullPath)
Attempts to find a reference file with the given name using Mantid then compares content and length o...
std::istreambuf_iterator< char > streamCharIter
FileComparisonHelper provides several helper functions to compare files or file-streams within unit t...
bool areIteratorsEqual(streamCharIter refStream, streamCharIter testStream, streamCharIter refStreamEnd=streamCharIter(), streamCharIter testStreamEnd=streamCharIter())
Compares the length and content of std::streams iterators and returns if they are equal.
bool areFilesEqual(const std::string &referenceFileFullPath, const std::string &outFileFullPath)
Checks if two files are equal in content and length at the specified path.