]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/iostreams/test/zlib_test.cpp
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.
9 #include <boost/iostreams/filter/test.hpp>
10 #include <boost/iostreams/filter/zlib.hpp>
11 #include <boost/iostreams/filtering_stream.hpp>
12 #include <boost/test/test_tools.hpp>
13 #include <boost/test/unit_test.hpp>
14 #include "detail/sequence.hpp"
15 #include "detail/verification.hpp"
18 using namespace boost
;
19 using namespace boost::iostreams
;
20 using namespace boost::iostreams::test
;
21 using boost::unit_test::test_suite
;
23 template<class T
> struct basic_test_alloc
: std::allocator
<T
>
29 basic_test_alloc( basic_test_alloc
const& /*other*/ )
34 basic_test_alloc( basic_test_alloc
<U
> const & /*other*/ )
38 template<class U
> struct rebind
40 typedef basic_test_alloc
<U
> other
;
44 typedef basic_test_alloc
<char> zlib_alloc
;
50 test_filter_pair( zlib_compressor(),
52 std::string(data
.begin(), data
.end()) )
55 test_filter_pair( basic_zlib_compressor
<zlib_alloc
>(),
56 basic_zlib_decompressor
<zlib_alloc
>(),
57 std::string(data
.begin(), data
.end()) )
60 test_filter_pair( zlib_compressor(),
65 filtering_istream strm
;
66 strm
.push( zlib_compressor() );
67 strm
.push( null_source() );
70 filtering_istream strm
;
71 strm
.push( zlib_decompressor() );
72 strm
.push( null_source() );
76 test_suite
* init_unit_test_suite(int, char* [])
78 test_suite
* test
= BOOST_TEST_SUITE("zlib test");
79 test
->add(BOOST_TEST_CASE(&zlib_test
));