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_ISTREAM_HPP_INCLUDED |
---|
8 | #define BOOST_IOSTREAMS_TEST_READ_INPUT_ISTREAM_HPP_INCLUDED |
---|
9 | |
---|
10 | #include <fstream> |
---|
11 | #include <boost/iostreams/filtering_stream.hpp> |
---|
12 | #include <boost/test/test_tools.hpp> |
---|
13 | #include "detail/temp_file.hpp" |
---|
14 | #include "detail/verification.hpp" |
---|
15 | |
---|
16 | void read_input_istream_test() |
---|
17 | { |
---|
18 | using namespace std; |
---|
19 | using namespace boost; |
---|
20 | using namespace boost::iostreams; |
---|
21 | using namespace boost::iostreams::test; |
---|
22 | |
---|
23 | test_file test; |
---|
24 | test_file test2; |
---|
25 | |
---|
26 | { |
---|
27 | test_file test2; |
---|
28 | ifstream src(test2.name().c_str()); |
---|
29 | filtering_istream first(src, 0); |
---|
30 | ifstream second(test.name().c_str()); |
---|
31 | BOOST_CHECK_MESSAGE( |
---|
32 | compare_streams_in_chars(first, second), |
---|
33 | "failed reading from filtering_istream based on an istream" |
---|
34 | "in chars with no buffer" |
---|
35 | ); |
---|
36 | } |
---|
37 | |
---|
38 | { |
---|
39 | test_file test2; |
---|
40 | ifstream src(test2.name().c_str()); |
---|
41 | filtering_istream first(src, 0); |
---|
42 | ifstream second(test.name().c_str()); |
---|
43 | BOOST_CHECK_MESSAGE( |
---|
44 | compare_streams_in_chunks(first, second), |
---|
45 | "failed reading from filtering_istream based on an istream" |
---|
46 | "in chunks with no buffer" |
---|
47 | ); |
---|
48 | } |
---|
49 | |
---|
50 | { |
---|
51 | test_file test2; |
---|
52 | ifstream src(test2.name().c_str()); |
---|
53 | filtering_istream first(src); |
---|
54 | ifstream second(test.name().c_str()); |
---|
55 | BOOST_CHECK_MESSAGE( |
---|
56 | compare_streams_in_chars(first, second), |
---|
57 | "failed reading from filtering_istream based on an istream" |
---|
58 | "in chars with large buffer" |
---|
59 | ); |
---|
60 | } |
---|
61 | |
---|
62 | { |
---|
63 | test_file test2; |
---|
64 | ifstream src(test2.name().c_str()); |
---|
65 | filtering_istream first(src); |
---|
66 | ifstream second(test.name().c_str()); |
---|
67 | BOOST_CHECK_MESSAGE( |
---|
68 | compare_streams_in_chunks(first, second), |
---|
69 | "failed reading from filtering_istream based on an istream" |
---|
70 | "in chunks with large buffer" |
---|
71 | ); |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | #endif // #ifndef BOOST_IOSTREAMS_TEST_READ_INPUT_ISTREAM_HPP_INCLUDED |
---|