1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

tests/cksum: test when the --length argument is 0 or >512

This commit is contained in:
Vardhan Patil 2023-12-30 20:14:30 +05:30
parent aec0cfa6e3
commit e1863ac64e
3 changed files with 28 additions and 0 deletions

View file

@ -262,3 +262,27 @@ fn test_length() {
.succeeds() .succeeds()
.stdout_is_fixture("supported_length.expected"); .stdout_is_fixture("supported_length.expected");
} }
#[test]
fn test_length_greater_than_512() {
new_ucmd!()
.arg("--length=1024")
.arg("--algorithm=blake2b")
.arg("lorem_ipsum.txt")
.arg("alice_in_wonderland.txt")
.fails()
.no_stdout()
.stderr_is_fixture("length_larger_than_512.expected");
}
#[test]
fn test_length_is_zero() {
new_ucmd!()
.arg("--length=0")
.arg("--algorithm=blake2b")
.arg("lorem_ipsum.txt")
.arg("alice_in_wonderland.txt")
.succeeds()
.no_stderr()
.stdout_is_fixture("length_is_zero.expected");
}

View file

@ -0,0 +1,2 @@
BLAKE2b (lorem_ipsum.txt) = 0e97a09189e560c3789c0bff1f020166861ef857d1fbfe4574de1842e3c06cabb9575e4af6309a166158c2b408d3c038c1b49d828b35158142cdc0396d1195c3
BLAKE2b (alice_in_wonderland.txt) = 91b8b0f0868e905ad18b8ac35e4a1dacd289857b19258ab5d1e071761af758b0134ec152d4f011fe1825ca889c80c2e072ca70eb50548c25fc49a98937515af4

View file

@ -0,0 +1,2 @@
cksum: invalid length: 1024
cksum: maximum digest length for BLAKE2b is 512 bits