boostorg / test

The reference C++ unit testing framework (TDD, xUnit, C++03/11/14/17)
http://boost.org/libs/test
Boost Software License 1.0
182 stars 141 forks source link

Comparing resulting files #307

Open ohhmm opened 3 years ago

ohhmm commented 3 years ago

It would be nice and cozy to have a macro for file result comparision.

A potential body for the file comparision test macro:

std::ifstream ifs1(TEST_SRC_DIR "input/file/path");
std::ifstream ifs2(TEST_SRC_DIR "gold/file/path");

std::istream_iterator<char> b1(ifs1), b2(ifs2), e;

BOOST_CHECK_EQUAL_COLLECTIONS(b1, e, b2, e);
raffienficiaud commented 2 years ago

There is already something close to what you are asking: https://www.boost.org/doc/libs/1_78_0/libs/test/doc/html/boost_test/testing_tools/output_stream_testing.html . We need to polish it a bit and/or document it better.

Would this work for you? What do you think of that feature?