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_INPUT_FILTER_HPP_INCLUDED
9 #define BOOST_IOSTREAMS_TEST_READ_INPUT_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 read_input_filter_test()
23 using namespace boost;
24 using namespace boost::iostreams;
25 using namespace boost::iostreams::test;
31 filtering_istream first;
32 first.push(toupper_filter());
33 first.push(file_source(test.name()));
34 ifstream second(upper.name().c_str());
36 compare_streams_in_chars(first, second),
37 "failed reading from a filtering_istream in chars with an "
43 filtering_istream first;
44 first.push(toupper_filter());
45 first.push(file_source(test.name()));
46 ifstream second(upper.name().c_str());
48 compare_streams_in_chunks(first, second),
49 "failed reading from a filtering_istream in chunks with an "
55 filtering_istream first;
56 first.push(toupper_multichar_filter(), 0);
57 first.push(file_source(test.name()));
58 ifstream second(upper.name().c_str());
60 compare_streams_in_chars(first, second),
61 "failed reading from a filtering_istream in chars with a "
62 "multichar input filter with no buffer"
67 filtering_istream first;
68 first.push(toupper_multichar_filter(), 0);
69 first.push(file_source(test.name()));
70 ifstream second(upper.name().c_str());
72 compare_streams_in_chunks(first, second),
73 "failed reading from a filtering_istream in chunks with a "
74 "multichar input filter with no buffer"
80 filtering_istream first;
81 first.push(toupper_multichar_filter());
82 first.push(file_source(src.name()));
83 ifstream second(upper.name().c_str());
85 compare_streams_in_chars(first, second),
86 "failed reading from a filtering_istream in chars with a "
87 "multichar input filter"
93 filtering_istream first;
94 first.push(toupper_multichar_filter());
95 first.push(file_source(src.name()));
96 ifstream second(upper.name().c_str());
98 compare_streams_in_chunks(first, second),
99 "failed reading from a filtering_istream in chunks with a "
100 "multichar input filter"
105 #endif // #ifndef BOOST_IOSTREAMS_TEST_READ_INPUT_FILTER_HPP_INCLUDED