Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Jul 17, 2024
1 parent d2cc4f3 commit de1c230
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,16 @@ jobs:
run: |
cat test-in.file.sha1
cat test-out.file.sha1
diff test-in.file.sha1 test-out.file.sha1
diff test-in.file.sha1 test-out.file.sha1
- name: Random tests
run: |
for i in {1..100}; do
file_size=$(( ( RANDOM % 10000000 ) + 1 ))
chunk_size=$(( ( RANDOM % 1000000 ) + 20000 ))
cat-once --file test.file --test-create-ascii-file-size=$file_size
sha1sum test.file > test-in.file.sha1
cargo run --release -- --file test.file --chunk-size $chunk_size > test-out.file
sha1sum test-out.file > test-out.file.sha1
diff test-in.file.sha1 test-out.file.sha1
done
4 changes: 3 additions & 1 deletion src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ pub fn commit_plan(
op.data_chunk.1
);
if !dry_run {
let data_chunk = if op.is_middle && (src_end - src_start + 1 == op.data_chunk.1 - op.data_chunk.0) {
let data_chunk = if op.is_middle
&& (src_end - src_start + 1 == op.data_chunk.1 - op.data_chunk.0)
{
(op.data_chunk.0, op.data_chunk.1 - 1)
} else {
op.data_chunk
Expand Down

0 comments on commit de1c230

Please sign in to comment.