Skip to content

Commit 4ac1481

Browse files
committed
Add tests for --memory option with G, GB and GiB suffix
1 parent 16a4fc5 commit 4ac1481

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

tests/cli-tests/basic/memlimit.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ rm file.zst
3535
println "+ zstd --memory=1MiB file"
3636
zstd -q --memory=1MiB file && die "Should allow numeric parameter with expected suffix"
3737
rm file.zst
38+
println "+ zstd --memory=1G file"
39+
zstd -q --memory=1G file && die "Should allow numeric parameter with expected suffix"
40+
rm file.zst
41+
println "+ zstd --memory=1GB file"
42+
zstd -q --memory=1GB file && die "Should allow numeric parameter with expected suffix"
43+
rm file.zst
44+
println "+ zstd --memory=1GiB file"
45+
zstd -q --memory=1GiB file && die "Should allow numeric parameter with expected suffix"
46+
rm file.zst
3847

3948
rm file
4049
exit 0
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed
2-
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed
3-
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed
4-
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed
5-
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed
6-
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed
1+
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed
2+
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed
3+
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed
4+
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed
5+
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed
6+
error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB, G, GB, GiB are allowed
77
Should allow numeric parameter without suffix
88
Should allow numeric parameter with expected suffix
99
Should allow numeric parameter with expected suffix
1010
Should allow numeric parameter with expected suffix
1111
Should allow numeric parameter with expected suffix
1212
Should allow numeric parameter with expected suffix
1313
Should allow numeric parameter with expected suffix
14+
Should allow numeric parameter with expected suffix
15+
Should allow numeric parameter with expected suffix
16+
Should allow numeric parameter with expected suffix

tests/cli-tests/basic/memlimit.sh.stdout.exact

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111
+ zstd --memory=1M file
1212
+ zstd --memory=1MB file
1313
+ zstd --memory=1MiB file
14+
+ zstd --memory=1G file
15+
+ zstd --memory=1GB file
16+
+ zstd --memory=1GiB file

tests/playTests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,6 +1684,8 @@ roundTripTest -g1M -P50 "1 --single-thread --long=29" " --memory=512MB"
16841684
roundTripTest -g1M -P50 "1 --single-thread --long=29 --zstd=wlog=28" " --memory=256MB"
16851685
roundTripTest -g1M -P50 "1 --single-thread --long=29" " --long=28 --memory=512MB"
16861686
roundTripTest -g1M -P50 "1 --single-thread --long=29" " --zstd=wlog=28 --memory=512MB"
1687+
roundTripTest -g1M -P50 "1 --single-thread --long=30" " --memory=1GB"
1688+
roundTripTest -g1M -P50 "1 --single-thread --long=30" " --zstd=wlog=29 --memory=1GB"
16871689

16881690

16891691
if [ "$ZSTD_LIB_EXCLUDE_COMPRESSORS_DFAST_AND_UP" -ne "1" ]; then

0 commit comments

Comments
 (0)