diff options
author | Joseph Myers <josmyers@redhat.com> | 2024-09-20 23:24:45 +0000 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2024-10-01 17:41:22 +0200 |
commit | 13f300db1955bca5c2e9a4f90b6da80fcffffe86 (patch) | |
tree | b75f1ee8a318e71d0d13c39d9c5f0ea8e50694b4 | |
parent | Add more tests of strtod end pointer (diff) | |
download | glibc-13f300db1955bca5c2e9a4f90b6da80fcffffe86.tar.gz glibc-13f300db1955bca5c2e9a4f90b6da80fcffffe86.tar.bz2 glibc-13f300db1955bca5c2e9a4f90b6da80fcffffe86.zip |
Add tests of more strtod special casesgentoo/glibc-2.40-4
There is very little test coverage of inputs to strtod-family
functions that don't contain anything that can be parsed as a number
(one test of ".y" in tst-strtod2), and none that I can see of skipping
initial whitespace. Add some tests of these things to tst-strtod2.
Tested for x86_64.
(cherry picked from commit 378039ca578c2ea93095a1e710d96f58c68a3997)
(cherry picked from commit cc256952ecb07789c423dff9712eb7a38f80e963)
-rw-r--r-- | stdlib/tst-strtod2.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/stdlib/tst-strtod2.c b/stdlib/tst-strtod2.c index c84bd792c1..d00bc13323 100644 --- a/stdlib/tst-strtod2.c +++ b/stdlib/tst-strtod2.c @@ -31,6 +31,20 @@ struct test_strto ## FSUF \ { "0x1px", 1.0 ## LSUF, 3 }, \ { "0x1p+x", 1.0 ## LSUF, 3 }, \ { "0x1p-x", 1.0 ## LSUF, 3 }, \ + { "", 0.0 ## LSUF, 0 }, \ + { ".", 0.0 ## LSUF, 0 }, \ + { "-", 0.0 ## LSUF, 0 }, \ + { "-.", 0.0 ## LSUF, 0 }, \ + { ".e", 0.0 ## LSUF, 0 }, \ + { "-.e", 0.0 ## LSUF, 0 }, \ + { " \t", 0.0 ## LSUF, 0 }, \ + { " \t.", 0.0 ## LSUF, 0 }, \ + { " \t-", 0.0 ## LSUF, 0 }, \ + { " \t-.", 0.0 ## LSUF, 0 }, \ + { " \t.e", 0.0 ## LSUF, 0 }, \ + { " \t-.e", 0.0 ## LSUF, 0 }, \ + { " \t\f\r\n\v1", 1.0 ## LSUF, 7 }, \ + { " \t\f\r\n\v-1.5e2", -150.0 ## LSUF, 12 }, \ { "INFx", INFINITY, 3 }, \ { "infx", INFINITY, 3 }, \ { "INFINITx", INFINITY, 3 }, \ |