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_READ_BIDIRECTIONAL_FILTER_HPP_INCLUDED
9 #define BOOST_IOSTREAMS_TEST_READ_BIDIRECTIONAL_FILTER_HPP_INCLUDED
12 #include <boost/iostreams/combine.hpp>
13 #include <boost/iostreams/device/file.hpp>
14 #include <boost/iostreams/filtering_stream.hpp>
15 #include <boost/test/test_tools.hpp>
16 #include "detail/filters.hpp"
17 #include "detail/sequence.hpp"
18 #include "detail/temp_file.hpp"
19 #include "detail/verification.hpp"
21 void read_bidirectional_filter_test()
24 using namespace boost;
25 using namespace boost::iostreams;
26 using namespace boost::iostreams::test;
32 // temp_file dest; // Dummy.
33 // filtering_stream<bidirectional> first;
34 // first.push(combine(toupper_filter(), tolower_filter()));
36 // combine(file_source(src.name()), file_sink(dest.name()))
38 // ifstream second(upper.name().c_str());
39 // BOOST_CHECK_MESSAGE(
40 // compare_streams_in_chars(first, second),
41 // "failed reading from filtering_stream<bidirectional> in chars with an "
48 temp_file dest; // Dummy.
49 filtering_stream<bidirectional> first;
50 first.push(combine(toupper_filter(), tolower_filter()));
52 combine(file_source(src.name()), file_sink(dest.name()))
54 ifstream second(upper.name().c_str());
56 compare_streams_in_chunks(first, second),
57 "failed reading from filtering_stream<bidirectional> in chunks with an "
64 // temp_file dest; // Dummy.
65 // filtering_stream<bidirectional> first(
66 // combine(toupper_multichar_filter(), tolower_filter()), 0
69 // combine(file_source(src.name()), file_sink(dest.name()))
71 // ifstream second(upper.name().c_str());
72 // BOOST_CHECK_MESSAGE(
73 // compare_streams_in_chars(first, second),
74 // "failed reading from filtering_stream<bidirectional> in chars with "
75 // "a multichar input filter with no buffer"
81 // temp_file dest; // Dummy.
82 // filtering_stream<bidirectional> first(
83 // combine(toupper_multichar_filter(), tolower_filter()), 0
86 // combine(file_source(src.name()), file_sink(dest.name()))
88 // ifstream second(upper.name().c_str());
89 // BOOST_CHECK_MESSAGE(
90 // compare_streams_in_chunks(first, second),
91 // "failed reading from filtering_stream<bidirectional> in chunks "
92 // "with a multichar input filter with no buffer"
98 // temp_file dest; // Dummy.
99 // filtering_stream<bidirectional> first(
100 // combine(toupper_multichar_filter(), tolower_filter())
103 // combine(file_source(src.name()), file_sink(dest.name()))
105 // ifstream second(upper.name().c_str());
106 // BOOST_CHECK_MESSAGE(
107 // compare_streams_in_chars(first, second),
108 // "failed reading from filtering_stream<bidirectional> in chars with a "
109 // "multichar input filter"
115 // temp_file dest; // Dummy.
116 // filtering_stream<bidirectional> first(
117 // combine(toupper_multichar_filter(), tolower_filter())
120 // combine(file_source(src.name()), file_sink(dest.name()))
122 // ifstream second(upper.name().c_str());
123 // BOOST_CHECK_MESSAGE(
124 // compare_streams_in_chunks(first, second),
125 // "failed reading from filtering_stream<bidirectional> in chunks "
126 // "with a multichar input filter"
131 #endif // #ifndef BOOST_IOSTREAMS_TEST_READ_BIDIRECTIONAL_FILTER_HPP_INCLUDED