mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Fix two bugs. Add property testing.
This commit is contained in:
parent
4f19c0e9ff
commit
ea7a543bfe
7 changed files with 608 additions and 128 deletions
|
@ -45,7 +45,6 @@ fn test_base64() {
|
|||
.arg("--base64")
|
||||
.pipe_in("to>be?")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("dG8+YmU/\n");
|
||||
}
|
||||
|
||||
|
@ -55,7 +54,6 @@ fn test_base64_decode() {
|
|||
.args(&["--base64", "-d"])
|
||||
.pipe_in("dG8+YmU/")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("to>be?");
|
||||
}
|
||||
|
||||
|
@ -65,7 +63,6 @@ fn test_base64url() {
|
|||
.arg("--base64url")
|
||||
.pipe_in("to>be?")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("dG8-YmU_\n");
|
||||
}
|
||||
|
||||
|
@ -75,7 +72,6 @@ fn test_base64url_decode() {
|
|||
.args(&["--base64url", "-d"])
|
||||
.pipe_in("dG8-YmU_")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("to>be?");
|
||||
}
|
||||
|
||||
|
@ -85,7 +81,6 @@ fn test_base32() {
|
|||
.arg("--base32")
|
||||
.pipe_in("nice>base?")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("NZUWGZJ6MJQXGZJ7\n"); // spell-checker:disable-line
|
||||
}
|
||||
|
||||
|
@ -95,7 +90,6 @@ fn test_base32_decode() {
|
|||
.args(&["--base32", "-d"])
|
||||
.pipe_in("NZUWGZJ6MJQXGZJ7") // spell-checker:disable-line
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("nice>base?");
|
||||
}
|
||||
|
||||
|
@ -105,7 +99,6 @@ fn test_base32hex() {
|
|||
.arg("--base32hex")
|
||||
.pipe_in("nice>base?")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("DPKM6P9UC9GN6P9V\n"); // spell-checker:disable-line
|
||||
}
|
||||
|
||||
|
@ -115,7 +108,6 @@ fn test_base32hex_decode() {
|
|||
.args(&["--base32hex", "-d"])
|
||||
.pipe_in("DPKM6P9UC9GN6P9V") // spell-checker:disable-line
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("nice>base?");
|
||||
}
|
||||
|
||||
|
@ -125,7 +117,6 @@ fn test_base16() {
|
|||
.arg("--base16")
|
||||
.pipe_in("Hello, World!")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("48656C6C6F2C20576F726C6421\n");
|
||||
}
|
||||
|
||||
|
@ -135,7 +126,6 @@ fn test_base16_decode() {
|
|||
.args(&["--base16", "-d"])
|
||||
.pipe_in("48656C6C6F2C20576F726C6421")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("Hello, World!");
|
||||
}
|
||||
|
||||
|
@ -145,7 +135,6 @@ fn test_base2msbf() {
|
|||
.arg("--base2msbf")
|
||||
.pipe_in("msbf")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("01101101011100110110001001100110\n");
|
||||
}
|
||||
|
||||
|
@ -155,7 +144,6 @@ fn test_base2msbf_decode() {
|
|||
.args(&["--base2msbf", "-d"])
|
||||
.pipe_in("01101101011100110110001001100110")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("msbf");
|
||||
}
|
||||
|
||||
|
@ -165,7 +153,6 @@ fn test_base2lsbf() {
|
|||
.arg("--base2lsbf")
|
||||
.pipe_in("lsbf")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("00110110110011100100011001100110\n");
|
||||
}
|
||||
|
||||
|
@ -175,7 +162,6 @@ fn test_base2lsbf_decode() {
|
|||
.args(&["--base2lsbf", "-d"])
|
||||
.pipe_in("00110110110011100100011001100110")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("lsbf");
|
||||
}
|
||||
|
||||
|
@ -194,7 +180,6 @@ fn test_choose_last_encoding_z85() {
|
|||
])
|
||||
.pipe_in("Hello, World")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("nm=QNz.92jz/PV8\n");
|
||||
}
|
||||
|
||||
|
@ -213,7 +198,6 @@ fn test_choose_last_encoding_base64() {
|
|||
])
|
||||
.pipe_in("Hello, World!")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("SGVsbG8sIFdvcmxkIQ==\n"); // spell-checker:disable-line
|
||||
}
|
||||
|
||||
|
@ -232,7 +216,6 @@ fn test_choose_last_encoding_base2lsbf() {
|
|||
])
|
||||
.pipe_in("lsbf")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("00110110110011100100011001100110\n");
|
||||
}
|
||||
|
||||
|
@ -253,6 +236,18 @@ fn test_base32_decode_repeated() {
|
|||
])
|
||||
.pipe_in("NZUWGZJ6MJQXGZJ7") // spell-checker:disable-line
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_only("nice>base?");
|
||||
}
|
||||
|
||||
// The restriction that input length has to be divisible by 4 only applies to data being encoded with Z85, not to the
|
||||
// decoding of Z85-encoded data
|
||||
#[test]
|
||||
fn test_z85_length_check() {
|
||||
new_ucmd!()
|
||||
.args(&["--decode", "--z85"])
|
||||
// Input has length 10, not divisible by 4
|
||||
// spell-checker:disable-next-line
|
||||
.pipe_in("f!$Kwh8WxM")
|
||||
.succeeds()
|
||||
.stdout_only("12345678");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue