diff options
author | Joseph Myers <josmyers@redhat.com> | 2024-09-20 23:24:45 +0000 |
---|---|---|
committer | Arjun Shankar <arjun@redhat.com> | 2024-09-27 17:25:43 +0200 |
commit | fcdf98f38c16ea5c7296b20db2e9f60e9e6ed39e (patch) | |
tree | 2489111e2786dbdd9bc567eb311954a01e724bc3 | |
parent | 3edc0f22a620fdda6eda69cfd47d96142132943f (diff) | |
download | glibc-fcdf98f38c16ea5c7296b20db2e9f60e9e6ed39e.tar.gz glibc-fcdf98f38c16ea5c7296b20db2e9f60e9e6ed39e.tar.xz glibc-fcdf98f38c16ea5c7296b20db2e9f60e9e6ed39e.zip |
Add tests of more strtod special cases
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)
-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 }, \ |