Skip to content

tests: add decompress with large streaming compress data #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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