1 | // (C) Copyright Jonathan Turkanis 2004 |
---|
2 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
---|
3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) |
---|
4 | |
---|
5 | // See http://www.boost.org/libs/iostreams for documentation. |
---|
6 | |
---|
7 | #ifndef BOOST_IOSTREAMS_TEST_READ_INPUT_SEQUENCE_HPP_INCLUDED |
---|
8 | #define BOOST_IOSTREAMS_TEST_READ_INPUT_SEQUENCE_HPP_INCLUDED |
---|
9 | |
---|
10 | #include <fstream> |
---|
11 | #include <boost/iostreams/filtering_stream.hpp> |
---|
12 | #include <boost/range/iterator_range.hpp> |
---|
13 | #include <boost/test/test_tools.hpp> |
---|
14 | #include "detail/sequence.hpp" |
---|
15 | #include "detail/temp_file.hpp" |
---|
16 | #include "detail/verification.hpp" |
---|
17 | |
---|
18 | void read_input_sequence_test() |
---|
19 | { |
---|
20 | using namespace std; |
---|
21 | using namespace boost; |
---|
22 | using namespace boost::iostreams; |
---|
23 | using namespace boost::iostreams::test; |
---|
24 | |
---|
25 | test_file file; |
---|
26 | test_sequence<> seq; |
---|
27 | |
---|
28 | { |
---|
29 | filtering_stream<input> first(make_iterator_range(seq), 0); |
---|
30 | ifstream second(file.name().c_str()); |
---|
31 | BOOST_CHECK_MESSAGE( |
---|
32 | compare_streams_in_chars(first, second), |
---|
33 | "failed reading from range_adapter " |
---|
34 | "in chars with no buffer" |
---|
35 | ); |
---|
36 | } |
---|
37 | |
---|
38 | { |
---|
39 | filtering_stream<input> first(make_iterator_range(seq), 0); |
---|
40 | ifstream second(file.name().c_str()); |
---|
41 | BOOST_CHECK_MESSAGE( |
---|
42 | compare_streams_in_chunks(first, second), |
---|
43 | "failed reading from range_adapter " |
---|
44 | "in chars with no buffer" |
---|
45 | ); |
---|
46 | } |
---|
47 | |
---|
48 | { |
---|
49 | filtering_stream<input> first(make_iterator_range(seq)); |
---|
50 | ifstream second(file.name().c_str()); |
---|
51 | BOOST_CHECK_MESSAGE( |
---|
52 | compare_streams_in_chars(first, second), |
---|
53 | "failed reading from range_adapter " |
---|
54 | "in chars with large buffer" |
---|
55 | ); |
---|
56 | } |
---|
57 | |
---|
58 | { |
---|
59 | filtering_stream<input> first(make_iterator_range(seq)); |
---|
60 | ifstream second(file.name().c_str()); |
---|
61 | BOOST_CHECK_MESSAGE( |
---|
62 | compare_streams_in_chunks(first, second), |
---|
63 | "failed reading from range_adapter " |
---|
64 | "in chars with large buffer" |
---|
65 | ); |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | #endif // #ifndef BOOST_IOSTREAMS_TEST_READ_INPUT_SEQUENCE_HPP_INCLUDED |
---|