Skip to content

Commit 7ced341

Browse files
authored
Merge pull request #92 from SpringMT/feature/add-test-for-large-streaming-compress-data
tests: add decompress with large streaming compress data
2 parents 16cb3a3 + 4585327 commit 7ced341

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

spec/zstd-ruby_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ def to_str
9595
expect(Zstd.decompress(simple_compressed).force_encoding('UTF-8').hash).to eq(Zstd.decompress(streaming_compressed).force_encoding('UTF-8').hash)
9696
end
9797

98+
it 'shoud work with large streaming compress data' do
99+
large_strings = Random.bytes(1<<16)
100+
stream = Zstd::StreamingCompress.new
101+
res = stream.compress(large_strings)
102+
res << stream.flush
103+
res << stream.compress(large_strings)
104+
res << stream.compress(large_strings)
105+
res << stream.finish
106+
expect(Zstd.decompress(res)).to eq(large_strings * 3)
107+
end
108+
98109
it 'should raise exception with unsupported object' do
99110
expect { Zstd.decompress(Object.new) }.to raise_error(TypeError)
100111
end

0 commit comments

Comments
 (0)