From e77f38f14a01be7d0e1f2ca055047579ec42ffb7 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 14 May 2014 12:39:12 -0700 Subject: [PATCH] Add a unit test for already-fixed printf -0.0 formatting. This was fixed by the upgrade to upstream head. Bug: 5084292 Change-Id: Ia3bda1c0bbe38f428e22213b8bdbdf1a16caccf2 --- tests/stdio_test.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp index 655ad3f87..2a0549ac6 100644 --- a/tests/stdio_test.cpp +++ b/tests/stdio_test.cpp @@ -400,6 +400,13 @@ TEST(stdio, snprintf_e) { EXPECT_STREQ("1.500000e+00", buf); } +TEST(stdio, snprintf_negative_zero_5084292) { + char buf[BUFSIZ]; + + snprintf(buf, sizeof(buf), "%f", -0.0); + EXPECT_STREQ("-0.000000", buf); +} + TEST(stdio, popen) { FILE* fp = popen("cat /proc/version", "r"); ASSERT_TRUE(fp != NULL);