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_SEEK_HPP_INCLUDED |
---|
8 | #define BOOST_IOSTREAMS_TEST_SEEK_HPP_INCLUDED |
---|
9 | |
---|
10 | #include <string> |
---|
11 | #include <boost/iostreams/filtering_stream.hpp> |
---|
12 | #include <boost/range/iterator_range.hpp> |
---|
13 | #include <boost/test/test_tools.hpp> |
---|
14 | #include "detail/verification.hpp" |
---|
15 | |
---|
16 | void seek_test() |
---|
17 | { |
---|
18 | using namespace std; |
---|
19 | using namespace boost; |
---|
20 | using namespace boost::iostreams; |
---|
21 | using namespace boost::iostreams::test; |
---|
22 | |
---|
23 | { |
---|
24 | string test(data_reps * data_length(), '\0'); |
---|
25 | filtering_stream<seekable> io(make_iterator_range(test)); |
---|
26 | BOOST_CHECK_MESSAGE( |
---|
27 | test_seekable_in_chars(io), |
---|
28 | "failed seeking within a filtering_stream<seekable>, in chars" |
---|
29 | ); |
---|
30 | } |
---|
31 | |
---|
32 | { |
---|
33 | string test(data_reps * data_length(), '\0'); |
---|
34 | filtering_stream<seekable> io(make_iterator_range(test)); |
---|
35 | BOOST_CHECK_MESSAGE( |
---|
36 | test_seekable_in_chunks(io), |
---|
37 | "failed seeking within a filtering_stream<seekable>, in chunks" |
---|
38 | ); |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | #endif // #ifndef BOOST_IOSTREAMS_TEST_SEEK_HPP_INCLUDED |
---|