1 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
2 // (C) Copyright 2004-2007 Jonathan Turkanis
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
6 // See http://www.boost.org/libs/iostreams for documentation.
8 #ifndef BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_OSTREAM_HPP_INCLUDED
9 #define BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_OSTREAM_HPP_INCLUDED
12 #include <boost/iostreams/filtering_stream.hpp>
13 #include <boost/test/test_tools.hpp>
14 #include "detail/sequence.hpp"
15 #include "detail/temp_file.hpp"
16 #include "detail/verification.hpp"
18 void write_output_ostream_test()
21 using namespace boost;
22 using namespace boost::iostreams;
23 using namespace boost::iostreams::test;
30 ofstream dest(test2.name().c_str(), out_mode);
31 filtering_ostream out(dest, 0);
32 write_data_in_chars(out);
35 compare_files(test2.name(), test.name()),
36 "failed writing to filtering_ostream based on an ostream "
37 "in chars with no buffer"
44 ofstream dest(test2.name().c_str(), out_mode);
45 filtering_ostream out(dest, 0);
46 write_data_in_chunks(out);
49 compare_files(test2.name(), test.name()),
50 "failed writing to filtering_ostream based on an ostream "
51 "in chunks with no buffer"
58 ofstream dest(test2.name().c_str(), out_mode);
59 filtering_ostream out(dest);
60 write_data_in_chars(out);
63 compare_files(test2.name(), test.name()),
64 "failed writing to filtering_ostream based on an ostream "
65 "in chars with large buffer"
72 ofstream dest(test2.name().c_str(), out_mode);
73 filtering_ostream out(dest);
74 write_data_in_chunks(out);
77 compare_files(test2.name(), test.name()),
78 "failed writing to filtering_ostream based on an ostream "
79 "in chunks with large buffer"
84 #endif // #ifndef BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_OSTREAM_HPP_INCLUDED