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

printf: fix printf sci notation round up

This commit is contained in:
Nick Donald 2022-02-11 18:49:49 -05:00 committed by Sylvestre Ledru
parent b85cc90586
commit a74ffac19e
2 changed files with 61 additions and 12 deletions

View file

@ -228,6 +228,22 @@ fn sub_num_float() {
.stdout_only("twenty is 20.000000");
}
#[test]
fn sub_num_float_e_round() {
new_ucmd!()
.args(&["%e", "99999999"])
.succeeds()
.stdout_only("1.000000e+08");
}
#[test]
fn sub_num_float_e_no_round() {
new_ucmd!()
.args(&["%e", "99999994"])
.succeeds()
.stdout_only("9.999999e+07");
}
#[test]
fn sub_num_float_round() {
new_ucmd!()
@ -236,6 +252,14 @@ fn sub_num_float_round() {
.stdout_only("two is 2.000000");
}
#[test]
fn sub_num_float_round_nines_dec() {
new_ucmd!()
.args(&["%f", "0.99999999"])
.succeeds()
.stdout_only("1.000000");
}
#[test]
fn sub_num_sci_lower() {
new_ucmd!()