1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-08 17:22:10 +03:00

Add --stream-size=# command

This commit is contained in:
Nick Magerko
2019-08-15 23:57:55 -07:00
parent c9072ee674
commit af0c9501d1
4 changed files with 46 additions and 4 deletions

View File

@@ -108,7 +108,6 @@ else
fi
println "\n===> simple tests "
./datagen > tmp
@@ -1020,4 +1019,25 @@ test -f dictionary
rm -f tmp* dictionary
println "\n===> stream-size mode"
./datagen -g11000 > tmp
println "test : basic file compression vs sized streaming compression"
$ZSTD -14 -f tmp -o tmp.zst |& tee file.out
cat tmp | $ZSTD -14 -f -o tmp.zst --stream-size=11000 |& tee stream_sized.out
file_ratio=$(cat file.out | awk '{print $4}' | sed 's/%//g')
stream_sized_ratio=$(cat stream_sized.out | awk '{print $4}' | sed 's/%//g')
rm file.out stream_sized.out
ratio_diff=$(echo $file_ratio - $stream_sized_ratio | bc)
if [ $(echo "(100 * $ratio_diff) > 5" | bc -l) == 1 ]
then
die "greater than 0.05% difference between file and sized-streaming compression"
fi
println "test : incorrect stream size"
cat tmp | $ZSTD -14 -f -o tmp.zst --stream-size=11001 && die "should fail with incorrect stream size"
rm -f tmp*