llvm::DiffFilesWithTolerance

Compare two files, allowing absolute and relative floating-point tolerance.

Synopsis

Declared in <llvm/Support/FileUtilities.h>

int
DiffFilesWithTolerance(
    StringRef FileA,
    StringRef FileB,
    double AbsTol,
    double RelTol,
    std::string* Error = nullptr);

Description

Returns 0 if the files match, 1 if they are different, and 2 if there is a file error. Absolute and relative FP error may be specified; if they differ by more than those tolerances, the files are considered different. If Error is non-null, it is set to an error message when an error occurs or the files differ.

Return Value

0 if the files match, 1 if they differ, and 2 on file error.

Parameters

NameDescription
FileAPath of the first file to compare.
FileBPath of the second file to compare.
AbsTolAbsolute floating-point difference allowed between values.
RelTolRelative floating-point difference allowed between values.
ErrorOptional string filled with an error or difference message.