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_SEQUENCE_HPP_INCLUDED
9 #define BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_SEQUENCE_HPP_INCLUDED
13 #include <boost/iostreams/filtering_stream.hpp>
14 #include <boost/range/iterator_range.hpp>
15 #include <boost/test/test_tools.hpp>
16 #include "detail/sequence.hpp"
17 #include "detail/temp_file.hpp"
18 #include "detail/verification.hpp"
20 void write_output_sequence_test()
23 using namespace boost;
24 using namespace boost::iostreams;
25 using namespace boost::iostreams::test;
30 vector<char> first(data_reps * data_length(), '?');
31 filtering_ostream out(make_iterator_range(first), 0);
32 write_data_in_chars(out);
33 ifstream second(test.name().c_str());
35 compare_container_and_stream(first, second),
36 "failed writing to filtering_ostream based on a sequence "
37 "in chars with no buffer"
42 vector<char> first(data_reps * data_length(), '?');
43 filtering_ostream out(make_iterator_range(first), 0);
44 write_data_in_chunks(out);
45 ifstream second(test.name().c_str());
47 compare_container_and_stream(first, second),
48 "failed writing to filtering_ostream based on a sequence "
49 "in chunks with no buffer"
54 vector<char> first(data_reps * data_length(), '?');
55 filtering_ostream out(make_iterator_range(first));
56 write_data_in_chars(out);
57 ifstream second(test.name().c_str());
59 compare_container_and_stream(first, second),
60 "failed writing to filtering_ostream based on a sequence "
61 "in chars with large buffer"
66 vector<char> first(data_reps * data_length(), '?');
67 filtering_ostream out(make_iterator_range(first));
68 write_data_in_chunks(out);
69 ifstream second(test.name().c_str());
71 compare_container_and_stream(first, second),
72 "failed writing to filtering_ostream based on a sequence "
73 "in chunks with large buffer"
78 #endif // #ifndef BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_SEQUENCE_HPP_INCLUDED