1 2 // Copyright 2019 Peter Dimov. 3 // 4 // Distributed under the Boost Software License, Version 1.0. 5 // 6 // See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt 8 9 #include <boost/iostreams/device/file.hpp> 10 #include <boost/iostreams/filter/gzip.hpp> 11 #include <boost/iostreams/device/back_inserter.hpp> 12 #include <boost/iostreams/copy.hpp> 13 #include <boost/iostreams/compose.hpp> 14 #include <boost/core/lightweight_test.hpp> 15 16 namespace io = boost::iostreams; 17 main()18int main() 19 { 20 io::file_source fs( "test.txt.gz", std::ios_base::binary ); 21 io::gzip_decompressor gz; 22 23 std::string s; 24 io::copy( io::compose( gz, fs ), io::back_inserter( s ) ); 25 26 BOOST_TEST( s == "=== reference output ===" ); 27 28 return boost::report_errors(); 29 } 30