mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
test: printf: Add nan, inf, negative zero
Add a few end-to-end tests for printf of unusual floats (nan, infinity, negative zero).
This commit is contained in:
parent
b7dcaa34da
commit
92a291b71d
1 changed files with 24 additions and 0 deletions
|
@ -886,6 +886,30 @@ fn float_with_zero_precision_should_pad() {
|
||||||
.stdout_only("-01");
|
.stdout_only("-01");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn float_non_finite() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&[
|
||||||
|
"%f %f %F %f %f %F",
|
||||||
|
"nan",
|
||||||
|
"-nan",
|
||||||
|
"nan",
|
||||||
|
"inf",
|
||||||
|
"-inf",
|
||||||
|
"inf",
|
||||||
|
])
|
||||||
|
.succeeds()
|
||||||
|
.stdout_only("nan -nan NAN inf -inf INF");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn float_zero_neg_zero() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["%f %f", "0.0", "-0.0"])
|
||||||
|
.succeeds()
|
||||||
|
.stdout_only("0.000000 -0.000000");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn precision_check() {
|
fn precision_check() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue