diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-04-14 21:12:56 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-04-14 21:12:56 -0400 |
commit | eb42b402487fa04778b62775fa200e35693fe59e (patch) | |
tree | bbbfecaac1bff16667f60073e8bd9383d85fbd4c | |
parent | ecb3f9d1a0ab5e85a84e8cb3ee6e86aab4a6eeeb (diff) | |
download | libc-testsuite-eb42b402487fa04778b62775fa200e35693fe59e.tar.gz |
some new floating point printf tests, including one musl fails
-rw-r--r-- | snprintf.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -66,6 +66,9 @@ static const struct { { "%f", 1.3, "1.300000" }, { "%f", 1.4, "1.400000" }, { "%f", 1.5, "1.500000" }, + { "%.4f", 1.06125, "1.0612" }, + { "%.2f", 1.375, "1.38" }, + { "%.1f", 1.375, "1.4" }, /* correctness in DBL_DIG places */ { "%.15g", 1.23456789012345, "1.23456789012345" }, @@ -77,6 +80,10 @@ static const struct { { "%g", 1234567, "1.23457e+06" }, { "%.7g", 1234567, "1234567" }, { "%.7g", 12345678, "1.234568e+07" }, + { "%.8g", 0.1, "0.1" }, + { "%.9g", 0.1, "0.1" }, + { "%.10g", 0.1, "0.1" }, + { "%.11g", 0.1, "0.1" }, /* pi in double precision, printed to a few extra places */ { "%.15f", M_PI, "3.141592653589793" }, @@ -134,5 +141,7 @@ int test_snprintf(void) TEST_S(b, fp_tests[j].expect, "bad floating point conversion"); } + TEST(i, snprintf(0, 0, "%.4a", 1.0), 11, "%d != %d"); + return err; } |