[29] | 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 | #include <string> |
---|
| 8 | #include <boost/iostreams/filter/test.hpp> |
---|
| 9 | #include <boost/iostreams/filter/zlib.hpp> |
---|
| 10 | #include <boost/test/test_tools.hpp> |
---|
| 11 | #include <boost/test/unit_test.hpp> |
---|
| 12 | #include "detail/sequence.hpp" |
---|
| 13 | #include "detail/verification.hpp" |
---|
| 14 | |
---|
| 15 | using namespace std; |
---|
| 16 | using namespace boost; |
---|
| 17 | using namespace boost::iostreams; |
---|
| 18 | using namespace boost::iostreams::test; |
---|
| 19 | using boost::unit_test::test_suite; |
---|
| 20 | |
---|
| 21 | struct zlib_alloc : std::allocator<char> { }; |
---|
| 22 | |
---|
| 23 | void zlib_test() |
---|
| 24 | { |
---|
| 25 | text_sequence data; |
---|
| 26 | BOOST_CHECK( |
---|
| 27 | test_filter_pair( zlib_compressor(), |
---|
| 28 | zlib_decompressor(), |
---|
| 29 | std::string(data.begin(), data.end()) ) |
---|
| 30 | ); |
---|
| 31 | BOOST_CHECK( |
---|
| 32 | test_filter_pair( basic_zlib_compressor<zlib_alloc>(), |
---|
| 33 | basic_zlib_decompressor<zlib_alloc>(), |
---|
| 34 | std::string(data.begin(), data.end()) ) |
---|
| 35 | ); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | test_suite* init_unit_test_suite(int, char* []) |
---|
| 39 | { |
---|
| 40 | test_suite* test = BOOST_TEST_SUITE("zlib test"); |
---|
| 41 | test->add(BOOST_TEST_CASE(&zlib_test)); |
---|
| 42 | return test; |
---|
| 43 | } |
---|