mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
fix(seq): handle 0e... scientific notation without padding (#6934)
* fix(seq): handle 0e... scientific notation without padding - Updated the parse_exponent_no_decimal function to treat 0e... as zero. - Added test cases to verify correct behavior for 0e15 and -w 0e15. Fix: #6926 * fix(seq): improved parse for accurate BigDecimal handling * apply missing cargo fmt formatting adjustments
This commit is contained in:
parent
f7c38a3079
commit
367cc19d45
2 changed files with 48 additions and 2 deletions
|
@ -842,3 +842,31 @@ fn test_invalid_format() {
|
|||
.no_stdout()
|
||||
.stderr_contains("format '%g%g' has too many % directives");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_scientific_zero() {
|
||||
new_ucmd!()
|
||||
.args(&["0e15", "1"])
|
||||
.succeeds()
|
||||
.stdout_only("0\n1\n");
|
||||
new_ucmd!()
|
||||
.args(&["0.0e15", "1"])
|
||||
.succeeds()
|
||||
.stdout_only("0\n1\n");
|
||||
new_ucmd!()
|
||||
.args(&["0", "1"])
|
||||
.succeeds()
|
||||
.stdout_only("0\n1\n");
|
||||
new_ucmd!()
|
||||
.args(&["-w", "0e15", "1"])
|
||||
.succeeds()
|
||||
.stdout_only("0000000000000000\n0000000000000001\n");
|
||||
new_ucmd!()
|
||||
.args(&["-w", "0.0e15", "1"])
|
||||
.succeeds()
|
||||
.stdout_only("0000000000000000\n0000000000000001\n");
|
||||
new_ucmd!()
|
||||
.args(&["-w", "0", "1"])
|
||||
.succeeds()
|
||||
.stdout_only("0\n1\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue