Skip to content

Commit

Permalink
Add test to reproduce issue #20
Browse files Browse the repository at this point in the history
  • Loading branch information
titusz committed Jun 27, 2024
1 parent 09ec9bc commit d3b9f7f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_fastcdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,18 @@ def test_chunk_generator_cy_fat():
stream.seek(c.offset)
data = stream.read(c.length)
assert data == c.data


@pytest.mark.parametrize("chunk_func", [fastcdc_py, fastcdc_cy])
def test_chunk_length_less_than_min_size(chunk_func):
data = os.urandom(20)
chunks = chunk_func(
data,
min_size=1024, # 1 kb
avg_size=4 * 1024, # 4 kb
max_size=16 * 1024, # 16 kb
fat=True,
hf=sha256,
)
chunk = next(chunks)
assert chunk.length == len(data)

0 comments on commit d3b9f7f

Please sign in to comment.