2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
require 'zlib'
|
|
|
|
|
|
|
|
describe "Zlib::Deflate#params" do
|
2017-06-29 10:35:37 -04:00
|
|
|
it "changes the deflate parameters" do
|
|
|
|
data = 'abcdefghijklm'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2017-06-29 10:35:37 -04:00
|
|
|
d = Zlib::Deflate.new Zlib::NO_COMPRESSION, Zlib::MAX_WBITS,
|
|
|
|
Zlib::DEF_MEM_LEVEL, Zlib::DEFAULT_STRATEGY
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2017-06-29 10:35:37 -04:00
|
|
|
d << data.slice!(0..10)
|
|
|
|
d.params Zlib::BEST_COMPRESSION, Zlib::DEFAULT_STRATEGY
|
|
|
|
d << data
|
2017-05-07 08:04:49 -04:00
|
|
|
|
2017-06-29 10:35:37 -04:00
|
|
|
Zlib::Inflate.inflate(d.finish).should == 'abcdefghijklm'
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
end
|