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_FILTER_HPP_INCLUDED
9 #define BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_FILTER_HPP_INCLUDED
12 #include <boost/iostreams/device/file.hpp>
13 #include <boost/iostreams/filtering_stream.hpp>
14 #include <boost/test/test_tools.hpp>
15 #include "detail/filters.hpp"
16 #include "detail/sequence.hpp"
17 #include "detail/temp_file.hpp"
18 #include "detail/verification.hpp"
20 void write_output_filter_test()
23 using namespace boost;
24 using namespace boost::iostreams;
25 using namespace boost::iostreams::test;
31 filtering_ostream out;
32 out.push(tolower_filter());
33 out.push(file_sink(dest.name(), out_mode));
34 write_data_in_chars(out);
37 compare_files(dest.name(), lower.name()),
38 "failed writing to a filtering_ostream in chars with an "
45 filtering_ostream out;
46 out.push(tolower_filter());
47 out.push(file_sink(dest.name(), out_mode));
48 write_data_in_chunks(out);
51 compare_files(dest.name(), lower.name()),
52 "failed writing to a filtering_ostream in chunks with an "
59 filtering_ostream out;
60 out.push(tolower_multichar_filter(), 0);
61 out.push(file_sink(dest.name(), out_mode));
62 write_data_in_chars(out);
65 compare_files(dest.name(), lower.name()),
66 "failed writing to a filtering_ostream in chars with a "
67 "multichar output filter with no buffer"
73 filtering_ostream out;
74 out.push(tolower_multichar_filter(), 0);
75 out.push(file_sink(dest.name(), out_mode));
76 write_data_in_chunks(out);
79 compare_files(dest.name(), lower.name()),
80 "failed writing to a filtering_ostream in chunks with a "
81 "multichar output filter with no buffer"
87 filtering_ostream out;
88 out.push(tolower_multichar_filter());
89 out.push(file_sink(dest.name(), out_mode));
90 write_data_in_chars(out);
93 compare_files(dest.name(), lower.name()),
94 "failed writing to a filtering_ostream in chars with a "
95 "multichar output filter"
101 filtering_ostream out;
102 out.push(tolower_multichar_filter());
103 out.push(file_sink(dest.name(), out_mode));
104 write_data_in_chunks(out);
107 compare_files(dest.name(), lower.name()),
108 "failed writing to a filtering_ostream in chunks with a "
109 "multichar output filter"
114 #endif // #ifndef BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_FILTER_HPP_INCLUDED