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

numfmt: add suffixes and fix negative numbers

Also refactors the code.
This commit is contained in:
Zheyu Shen 2018-09-04 11:41:01 -04:00
parent 07b01a85f9
commit 1af0484360
2 changed files with 130 additions and 107 deletions

View file

@ -106,3 +106,17 @@ fn test_header_default() {
.run()
.stdout_is("header\n1000\n1100000\n100000000");
}
#[test]
fn test_negative() {
new_ucmd!()
.args(&["--from=si"])
.pipe_in("-1000\n-1.1M\n-0.1G")
.run()
.stdout_is("-1000\n-1100000\n-100000000");
new_ucmd!()
.args(&["--to=iec-i"])
.pipe_in("-1024\n-1153434\n-107374182")
.run()
.stdout_is("-1.0Ki\n-1.1Mi\n-102.4Mi");
}