Corrade::TestSuite::Compare::StringToFile class

Pseudo-type for comparing string to file contents.

Prints the length of both files (if they are different) and prints the value and position of the first different character in both files. Filename is expected to be in UTF-8. Example usage:

CORRADE_COMPARE_AS("actual file contents", "expected.txt",
    TestSuite::Compare::StringToFile);

See Comparing with pseudo-types for more information.

Saving files for failed comparisons

The comparator supports the --save-diagnostic option — if the comparison fails, it saves actual file contents to given directory with a filename matching the expected file. You can use it to perform a manual data comparison with an external tool or for example to quickly update expected test data — point the option to the directory with expected test files and let the test overwrite them with actual results. The StringToFile variant supports the same.