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