Project

General

Profile

Bug #239 ยป ztest.rb

Zlib::Deflate#params test script - drbrain (Eric Hodel), 07/09/2008 08:55 AM

 
require 'zlib'

data = ('a'..'z').to_a.join

d = Zlib::Deflate.new Zlib::NO_COMPRESSION, Zlib::MAX_WBITS,
Zlib::DEF_MEM_LEVEL, Zlib::DEFAULT_STRATEGY

d << data.slice!(0, 10)
d.params Zlib::BEST_COMPRESSION, Zlib::DEFAULT_STRATEGY
d << data

deflated = d.finish

puts "deflated: %p" % deflated

inflated = Zlib::Inflate.inflate deflated

puts "inflated: %p" % inflated

    (1-1/1)