Skip to content

Commit

Permalink
tests: add decompress with large streaming compress data
Browse files Browse the repository at this point in the history
  • Loading branch information
SpringMT committed May 24, 2024
1 parent 16cb3a3 commit 4585327
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/zstd-ruby_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ def to_str
expect(Zstd.decompress(simple_compressed).force_encoding('UTF-8').hash).to eq(Zstd.decompress(streaming_compressed).force_encoding('UTF-8').hash)
end

it 'shoud work with large streaming compress data' do
large_strings = Random.bytes(1<<16)
stream = Zstd::StreamingCompress.new
res = stream.compress(large_strings)
res << stream.flush
res << stream.compress(large_strings)
res << stream.compress(large_strings)
res << stream.finish
expect(Zstd.decompress(res)).to eq(large_strings * 3)
end

it 'should raise exception with unsupported object' do
expect { Zstd.decompress(Object.new) }.to raise_error(TypeError)
end
Expand Down

0 comments on commit 4585327

Please sign in to comment.