1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 19:56:17 +00:00

Merge pull request #3028 from jfinkels/dd-multipliers

dd: add support for 'b' and 'x' multipliers in numeric arguments
This commit is contained in:
Sylvestre Ledru 2022-02-06 22:03:54 +01:00 committed by GitHub
commit 1f7c08d87b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 128 additions and 18 deletions

View file

@ -1,4 +1,4 @@
// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, availible, behaviour, bmax, bremain, btotal, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, outfile, parseargs, rlen, rmax, rposition, rremain, rsofar, rstat, sigusr, sigval, wlen, wstat abcdefghijklm
// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, availible, behaviour, bmax, bremain, btotal, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, outfile, parseargs, rlen, rmax, rposition, rremain, rsofar, rstat, sigusr, sigval, wlen, wstat abcdefghijklm abcdefghi
use crate::common::util::*;
@ -178,6 +178,26 @@ fn test_stdin_stdout_count_w_multiplier() {
.success();
}
#[test]
fn test_b_multiplier() {
// "2b" means 2 * 512, which is 1024.
new_ucmd!()
.args(&["bs=2b", "count=1"])
.pipe_in("a".repeat(1025))
.succeeds()
.stdout_is("a".repeat(1024));
}
#[test]
fn test_x_multiplier() {
// "2x3" means 2 * 3, which is 6.
new_ucmd!()
.args(&["bs=2x3", "count=1"])
.pipe_in("abcdefghi")
.succeeds()
.stdout_is("abcdef");
}
#[test]
fn test_final_stats_noxfer() {
new_ucmd!()