]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/iostreams/test/zlib_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / 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.)
5
6 // See http://www.boost.org/libs/iostreams for documentation.
7
8 #include <string>
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"
16
17 using namespace std;
18 using namespace boost;
19 using namespace boost::iostreams;
20 using namespace boost::iostreams::test;
21 using boost::unit_test::test_suite;
22
23 struct zlib_alloc : std::allocator<char> { };
24
25 void zlib_test()
26 {
27 text_sequence data;
28 BOOST_CHECK(
29 test_filter_pair( zlib_compressor(),
30 zlib_decompressor(),
31 std::string(data.begin(), data.end()) )
32 );
33 BOOST_CHECK(
34 test_filter_pair( basic_zlib_compressor<zlib_alloc>(),
35 basic_zlib_decompressor<zlib_alloc>(),
36 std::string(data.begin(), data.end()) )
37 );
38 BOOST_CHECK(
39 test_filter_pair( zlib_compressor(),
40 zlib_decompressor(),
41 std::string() )
42 );
43 {
44 filtering_istream strm;
45 strm.push( zlib_compressor() );
46 strm.push( null_source() );
47 }
48 {
49 filtering_istream strm;
50 strm.push( zlib_decompressor() );
51 strm.push( null_source() );
52 }
53 }
54
55 test_suite* init_unit_test_suite(int, char* [])
56 {
57 test_suite* test = BOOST_TEST_SUITE("zlib test");
58 test->add(BOOST_TEST_CASE(&zlib_test));
59 return test;
60 }