Skip to content

Commit 204d05f

Browse files
committed
cksum: Remove redundant SHA3 tests (fixes PR uutils#8948 review feedback)
- Remove test_sha3_with_length() - redundant with test_sha3_single_file() - Remove test_sha3_invalid_length() - redundant with test_sha_length_invalid() and test_sha_missing_length() - Remove test_sha3_untagged() - redundant with test_untagged_sha3_single_file() - Keep test_sha3_base64_output() - provides unique coverage for base64 output with SHA3 Addresses code review feedback from @cakebaker (Oct 31) on PR uutils#8948. All 134 tests pass with no regressions.
1 parent fd5840a commit 204d05f

File tree

1 file changed

+0
-77
lines changed

1 file changed

+0
-77
lines changed

tests/by-util/test_cksum.rs

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,70 +2668,6 @@ mod gnu_cksum_c {
26682668
}
26692669
}
26702670

2671-
#[test]
2672-
fn test_sha3_with_length() {
2673-
// Test SHA3-224
2674-
new_ucmd!()
2675-
.arg("-a")
2676-
.arg("sha3")
2677-
.arg("--length")
2678-
.arg("224")
2679-
.arg("lorem_ipsum.txt")
2680-
.succeeds()
2681-
.stdout_contains("SHA3-224 (lorem_ipsum.txt) = ");
2682-
2683-
// Test SHA3-256
2684-
new_ucmd!()
2685-
.arg("-a")
2686-
.arg("sha3")
2687-
.arg("--length")
2688-
.arg("256")
2689-
.arg("lorem_ipsum.txt")
2690-
.succeeds()
2691-
.stdout_contains("SHA3-256 (lorem_ipsum.txt) = ");
2692-
2693-
// Test SHA3-384
2694-
new_ucmd!()
2695-
.arg("-a")
2696-
.arg("sha3")
2697-
.arg("--length")
2698-
.arg("384")
2699-
.arg("lorem_ipsum.txt")
2700-
.succeeds()
2701-
.stdout_contains("SHA3-384 (lorem_ipsum.txt) = ");
2702-
2703-
// Test SHA3-512
2704-
new_ucmd!()
2705-
.arg("-a")
2706-
.arg("sha3")
2707-
.arg("--length")
2708-
.arg("512")
2709-
.arg("lorem_ipsum.txt")
2710-
.succeeds()
2711-
.stdout_contains("SHA3-512 (lorem_ipsum.txt) = ");
2712-
}
2713-
2714-
#[test]
2715-
fn test_sha3_invalid_length() {
2716-
// Test SHA3 with invalid length (not 224, 256, 384, or 512)
2717-
new_ucmd!()
2718-
.arg("-a")
2719-
.arg("sha3")
2720-
.arg("--length")
2721-
.arg("128")
2722-
.arg("lorem_ipsum.txt")
2723-
.fails()
2724-
.stderr_contains("digest length for 'SHA3' must be 224, 256, 384, or 512");
2725-
2726-
// Test SHA3 without length
2727-
new_ucmd!()
2728-
.arg("-a")
2729-
.arg("sha3")
2730-
.arg("lorem_ipsum.txt")
2731-
.fails()
2732-
.stderr_contains("--algorithm=sha3 requires specifying --length 224, 256, 384, or 512");
2733-
}
2734-
27352671
#[test]
27362672
fn test_sha3_base64_output() {
27372673
// Test SHA3 with base64 output format
@@ -2746,19 +2682,6 @@ fn test_sha3_base64_output() {
27462682
.stdout_contains("SHA3-256 (lorem_ipsum.txt) = ");
27472683
}
27482684

2749-
#[test]
2750-
fn test_sha3_untagged() {
2751-
// Test SHA3 with untagged output
2752-
new_ucmd!()
2753-
.arg("--untagged")
2754-
.arg("-a")
2755-
.arg("sha3")
2756-
.arg("--length")
2757-
.arg("256")
2758-
.arg("lorem_ipsum.txt")
2759-
.succeeds();
2760-
}
2761-
27622685
/// The tests in this module check the behavior of cksum when given different
27632686
/// checksum formats and algorithms in the same file, while specifying an
27642687
/// algorithm on CLI or not.

0 commit comments

Comments
 (0)