Skip to content

Commit

Permalink
add tests inspired from #2927
Browse files Browse the repository at this point in the history
centered around -T# and --fast=# arguments
  • Loading branch information
Cyan4973 committed Mar 12, 2024
1 parent a4db145 commit 74e856a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/playTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,51 @@ if [ "$isWindows" = false ] && [ "$UNAME" != "AIX" ]; then
fi
fi

println "\n===> multiple_thread test "

datagen > tmp
println "test : single-thread "
zstd --fast --single-thread tmp -o tmpMT0
println "test : one worker thread (default)"
zstd --fast -T1 tmp -o tmpMT1
println "test : two worker threads "
zstd --fast -T2 tmp -o tmpMT2
println "test : 16-thread "
zstd --fast -T16 tmp -o tmpMT3
println "test : 127-thread "
zstd --fast -T127 tmp -o tmpMT4
println "test : 128-thread "
zstd --fast -T128 tmp -o tmpMT5
println "test : max allowed numeric value is 4294967295 "
zstd --fast -4294967295 tmp -o tmpMT6
println "test : numeric value overflows 32-bit unsigned int "
zstd --fast -4294967296 tmp -o tmptest9 && die "max allowed numeric value is 4294967295"

datagen > tmp
println "test : basic compression "
zstd -f tmp # trivial compression case, creates tmp.zst
println "test : basic decompression"
zstd -d -f -T1 tmp.zst
println "note : decompression does not support -T mode, but execution support"
rm -rf tmpMT*

println "\n===> --fast_argument test "
datagen > tmp
println "test : basic compression "
zstd -f tmp # trivial compression case, creates tmp.zst
println "test: --fast=1"
zstd --fast=1 -f tmp
println "test: --fast=99"
zstd --fast=99 -f tmp
println "test: Invalid value -- negative number"
zstd --fast=-1 -f tmp && die "error: Invalid value -- negative number"
println "test: Invalid value -- zero"
zstd --fast=0 -f tmp && die "error: Invalid value -- 0 number"
println "test: max allowed numeric argument of --fast is 4294967295"
zstd --fast=4294967295 -f tmp
println "test: numeric value overflows 32-bit unsigned int "
zstd --fast=4294967296 -f tmp && die "max allowed argument of --fast is 4294967295"

println "\n===> --exclude-compressed flag"
rm -rf precompressedFilterTestDir
mkdir -p precompressedFilterTestDir
Expand Down

0 comments on commit 74e856a

Please sign in to comment.