1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

seq: Add tests for default float formats

Add tests for some of the default float formats (%f, %g, %E), mostly
to check that the default precision is correctly set to 6 digits.
This commit is contained in:
Nicolas Boichat 2025-03-03 15:07:38 +01:00 committed by Dorian Péron
parent bfa8bf72c7
commit 1782de8999

View file

@ -708,6 +708,30 @@ fn test_format_option() {
.stdout_only("0.00\n0.10\n0.20\n0.30\n0.40\n0.50\n");
}
#[test]
fn test_format_option_default_precision() {
new_ucmd!()
.args(&["-f", "%f", "0", "0.7", "2"])
.succeeds()
.stdout_only("0.000000\n0.700000\n1.400000\n");
}
#[test]
fn test_format_option_default_precision_short() {
new_ucmd!()
.args(&["-f", "%g", "0", "0.987654321", "2"])
.succeeds()
.stdout_only("0\n0.987654\n1.97531\n");
}
#[test]
fn test_format_option_default_precision_scientific() {
new_ucmd!()
.args(&["-f", "%E", "0", "0.7", "2"])
.succeeds()
.stdout_only("0.000000E+00\n7.000000E-01\n1.400000E+00\n");
}
#[test]
#[ignore = "Need issue #2660 to be fixed"]
fn test_auto_precision() {