mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07: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:
@@ -886,6 +886,30 @@ fn float_with_zero_precision_should_pad() {
|
||||
.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]
|
||||
fn precision_check() {
|
||||
new_ucmd!()
|
||||
|
||||
Reference in New Issue
Block a user