Skip to content

Commit

Permalink
Merge pull request #92 from SpringMT/feature/add-test-for-large-strea…
Browse files Browse the repository at this point in the history
…ming-compress-data

tests: add decompress with large streaming compress data
  • Loading branch information
SpringMT authored May 24, 2024
2 parents 16cb3a3 + 4585327 commit 7ced341
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 7ced341

Please sign in to comment.