]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add tests for options with G, GB and GiB suffixes 4609/head
authorIntegral <integral@member.fsf.org>
Fri, 6 Mar 2026 08:50:05 +0000 (16:50 +0800)
committerIntegral <integral@member.fsf.org>
Tue, 10 Mar 2026 02:16:53 +0000 (10:16 +0800)
tests/cli-tests/basic/memlimit.sh
tests/cli-tests/basic/memlimit.sh.stderr.exact
tests/cli-tests/basic/memlimit.sh.stdout.exact
tests/playTests.sh

index 88d734d0d9d55599e89ab5a1620fe47c80f1afd8..ec7f93a106bd55210d9715cc3effce7d265cf51c 100755 (executable)
@@ -35,6 +35,30 @@ rm file.zst
 println "+ zstd --memory=1MiB file"
 zstd -q --memory=1MiB file && die "Should allow numeric parameter with expected suffix"
 rm file.zst
+println "+ zstd --memory=1G file"
+zstd -q --memory=1G file && die "Should allow numeric parameter with expected suffix"
+rm file.zst
+println "+ zstd --memory=1GB file"
+zstd -q --memory=1GB file && die "Should allow numeric parameter with expected suffix"
+rm file.zst
+println "+ zstd --memory=1GiB file"
+zstd -q --memory=1GiB file && die "Should allow numeric parameter with expected suffix"
+rm file.zst
+println "+ zstd --memory=3G file"
+zstd -q --memory=3G file && die "Should allow numeric parameter with expected suffix"
+rm file.zst
+println "+ zstd --memory=3GB file"
+zstd -q --memory=3GB file && die "Should allow numeric parameter with expected suffix"
+rm file.zst
+println "+ zstd --memory=3GiB file"
+zstd -q --memory=3GiB file && die "Should allow numeric parameter with expected suffix"
+rm file.zst
+println "+ zstd --memory=4G file"
+zstd --memory=4G file && die "Should not allow out-of-bound numeric parameter"
+println "+ zstd --memory=4GB file"
+zstd --memory=4GB file && die "Should not allow out-of-bound numeric parameter"
+println "+ zstd --memory=4GiB file"
+zstd --memory=4GiB file && die "Should not allow out-of-bound numeric parameter"
 
 rm file
 exit 0
index 3785b0f92f31f92dd3ea589de73ff65cfc7ece65..28784a1e629627a43d97f74769fe3fed55bf7b7d 100644 (file)
@@ -1,9 +1,9 @@
-error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed 
-error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed 
-error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed 
-error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed 
-error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed 
-error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed 
+error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed 
+error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed 
+error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed 
+error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed 
+error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed 
+error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed 
 Should allow numeric parameter without suffix
 Should allow numeric parameter with expected suffix
 Should allow numeric parameter with expected suffix
@@ -11,3 +11,12 @@ Should allow numeric parameter with expected suffix
 Should allow numeric parameter with expected suffix
 Should allow numeric parameter with expected suffix
 Should allow numeric parameter with expected suffix
+Should allow numeric parameter with expected suffix
+Should allow numeric parameter with expected suffix
+Should allow numeric parameter with expected suffix
+Should allow numeric parameter with expected suffix
+Should allow numeric parameter with expected suffix
+Should allow numeric parameter with expected suffix
+error: numeric value overflows 32-bit unsigned int 
+error: numeric value overflows 32-bit unsigned int 
+error: numeric value overflows 32-bit unsigned int 
index 1821648e4065a5306b91811b97e494edb20bc543..a1a5520e74b3c161e314e0c735319a2cbfeba82e 100644 (file)
 + zstd --memory=1M file
 + zstd --memory=1MB file
 + zstd --memory=1MiB file
++ zstd --memory=1G file
++ zstd --memory=1GB file
++ zstd --memory=1GiB file
++ zstd --memory=3G file
++ zstd --memory=3GB file
++ zstd --memory=3GiB file
++ zstd --memory=4G file
++ zstd --memory=4GB file
++ zstd --memory=4GiB file
index d3ce39846ce2053fdb91d08aa5865873565c07af..d8ea0c3dad39b43e6081b14efa6d340282428e83 100755 (executable)
@@ -1075,13 +1075,19 @@ cat tmp | zstd -14 -f --size-hint=11050 | zstd -t  # slightly too high
 cat tmp | zstd -14 -f --size-hint=10950 | zstd -t  # slightly too low
 cat tmp | zstd -14 -f --size-hint=22000 | zstd -t  # considerably too high
 cat tmp | zstd -14 -f --size-hint=5500  | zstd -t  # considerably too low
-println "test : allows and interprets K,KB,KiB,M,MB and MiB suffix"
+println "test : allows and interprets K,KB,KiB,M,MB,MiB,G,GB and GiB suffix"
 cat tmp | zstd -14 -f --size-hint=11K | zstd -t
 cat tmp | zstd -14 -f --size-hint=11KB | zstd -t
 cat tmp | zstd -14 -f --size-hint=11KiB | zstd -t
 cat tmp | zstd -14 -f --size-hint=1M  | zstd -t
 cat tmp | zstd -14 -f --size-hint=1MB  | zstd -t
 cat tmp | zstd -14 -f --size-hint=1MiB  | zstd -t
+cat tmp | zstd -14 -f --size-hint=1G  | zstd -t
+cat tmp | zstd -14 -f --size-hint=1GB  | zstd -t
+cat tmp | zstd -14 -f --size-hint=1GiB  | zstd -t
+cat tmp | zstd -14 -f --size-hint=3G  | zstd -t
+cat tmp | zstd -14 -f --size-hint=3GB  | zstd -t
+cat tmp | zstd -14 -f --size-hint=3GiB  | zstd -t
 
 
 println "\n===>  dictionary tests "
@@ -1684,6 +1690,8 @@ roundTripTest -g1M -P50 "1 --single-thread --long=29" " --memory=512MB"
 roundTripTest -g1M -P50 "1 --single-thread --long=29 --zstd=wlog=28" " --memory=256MB"
 roundTripTest -g1M -P50 "1 --single-thread --long=29" " --long=28 --memory=512MB"
 roundTripTest -g1M -P50 "1 --single-thread --long=29" " --zstd=wlog=28 --memory=512MB"
+roundTripTest -g1M -P50 "1 --single-thread --long=30" " --memory=1GB"
+roundTripTest -g1M -P50 "1 --single-thread --long=30" " --zstd=wlog=29 --memory=1GB"
 
 
 if [ "$ZSTD_LIB_EXCLUDE_COMPRESSORS_DFAST_AND_UP" -ne "1" ]; then