Is there any library that allows you to diff files in C++ unit tests? Ideally this would work with Boost Unit tests.
I was thinking of a function along the lines of:
CHECK_FILES_EQUAL('output.txt', 'reference.txt');
Which would then fail the test if the files were equal (possibly showing the line that it failed on).
Thanks
I assume you want something more intelligent that just checking if the files equal byte-by-byte. I would use google-diff-match-patch, a powerful library which can (among other functionality) calculate a diff between two files. A C++ implementation is available, along with other languages. You'll need to handle file IO yourself, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With