| 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/gzip.hpp> |
|---|
| 9 | #include <boost/iostreams/filter/test.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 boost; |
|---|
| 16 | using namespace boost::iostreams; |
|---|
| 17 | using namespace boost::iostreams::test; |
|---|
| 18 | using boost::unit_test::test_suite; |
|---|
| 19 | |
|---|
| 20 | struct gzip_alloc : std::allocator<char> { }; |
|---|
| 21 | |
|---|
| 22 | void gzip_test() |
|---|
| 23 | { |
|---|
| 24 | text_sequence data; |
|---|
| 25 | BOOST_CHECK( |
|---|
| 26 | test_filter_pair( gzip_compressor(), |
|---|
| 27 | gzip_decompressor(), |
|---|
| 28 | std::string(data.begin(), data.end()) ) |
|---|
| 29 | ); |
|---|
| 30 | BOOST_CHECK( |
|---|
| 31 | test_filter_pair( basic_gzip_compressor<gzip_alloc>(), |
|---|
| 32 | basic_gzip_decompressor<gzip_alloc>(), |
|---|
| 33 | std::string(data.begin(), data.end()) ) |
|---|
| 34 | ); |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | test_suite* init_unit_test_suite(int, char* []) |
|---|
| 38 | { |
|---|
| 39 | test_suite* test = BOOST_TEST_SUITE("gzip test"); |
|---|
| 40 | test->add(BOOST_TEST_CASE(&gzip_test)); |
|---|
| 41 | return test; |
|---|
| 42 | } |
|---|