diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-02-18 19:03:30 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-02-18 19:03:30 +0000 |
commit | ac2ca0229ab39381e9e92e07f929703981f77a90 (patch) | |
tree | 405404c5cfe6d729b4a253cf41a9adb76245e51c /stdio-common/tst-sscanf.c | |
parent | da50f0010773cd88b34ad8b08f88d5ffabe061df (diff) | |
download | glibc-ac2ca0229ab39381e9e92e07f929703981f77a90.tar.gz glibc-ac2ca0229ab39381e9e92e07f929703981f77a90.tar.xz glibc-ac2ca0229ab39381e9e92e07f929703981f77a90.zip |
* stdio-common/vfscanf.c: Fix problems in width accounting.
* stdio-common/tst-sscanf.c (double_tests): New tests. (main): Hook them up.
Diffstat (limited to 'stdio-common/tst-sscanf.c')
-rw-r--r-- | stdio-common/tst-sscanf.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/stdio-common/tst-sscanf.c b/stdio-common/tst-sscanf.c index b76f757c90..a987e87797 100644 --- a/stdio-common/tst-sscanf.c +++ b/stdio-common/tst-sscanf.c @@ -65,7 +65,7 @@ const long int val_long[] = -12345678, 987654321, 123456789, 987654321, 123456789, 987654321 }; -struct int_test +struct test { const CHAR *str; const CHAR *fmt; @@ -99,6 +99,17 @@ struct int_test { L("foo \t %bar1"), L("foo%%bar%d"), 1 } }; +struct test double_tests[] = +{ + { L("-1"), L("%1g"), 0 }, + { L("-.1"), L("%2g"), 0 }, + { L("-inf"), L("%3g"), 0 }, + { L("+0"), L("%1g"), }, + { L("-0x1p0"), L("%2g"), 1 }, + { L("-..1"), L("%g"), 0 }, + { L("-inf"), L("%g"), 1 } +}; + int main (void) { @@ -172,5 +183,19 @@ main (void) } } + for (i = 0; i < sizeof (double_tests) / sizeof (double_tests[0]); ++i) + { + double dummy; + int ret; + + if ((ret = SSCANF (double_tests[i].str, double_tests[i].fmt, + &dummy)) != double_tests[i].retval) + { + printf ("double_tests[%d] returned %d != %d\n", + i, ret, double_tests[i].retval); + result = 1; + } + } + return result; } |