3 #include <boost/filesystem.hpp> 4 #include <boost/test/unit_test.hpp> 10 BOOST_TEST_MESSAGE(
"Using path=<" << path.string() <<
">\n");
12 std::vector<std::string> lines{
13 "This is a sample file",
"with more than one line",
14 "yet entirely too short",
18 boost::iostreams::filtering_ostream out;
20 for (
auto const& line : lines) {
21 BOOST_TEST_MESSAGE(
"Writing: " << line);
27 boost::iostreams::filtering_istream in;
29 for (
auto const& expected : lines) {
31 std::getline(in, got);
32 BOOST_CHECK_EQUAL(expected, got);
36 boost::filesystem::remove(path);
44 boost::filesystem::path tmp = boost::filesystem::temp_directory_path();
45 tmp /= boost::filesystem::unique_path(
"%%%%-%%%%-%%%%.dat");
55 boost::filesystem::path tmp = boost::filesystem::temp_directory_path();
56 tmp /= boost::filesystem::unique_path(
"%%%%-%%%%-%%%%.gz");
65 boost::iostreams::filtering_ostream out;
67 out <<
"test message, please ignore\n";
void check_read_write(boost::filesystem::path const &path)
Implement the common part of the tests.
void open_output_file(boost::iostreams::filtering_ostream &out, std::string const &filename)
Open a file for writing.
void open_input_file(boost::iostreams::filtering_istream &in, std::string const &filename)
Open a file for reading.
BOOST_AUTO_TEST_CASE(fileio_basic)