Module: wine Branch: master Commit: 3fc33a4282b04a06b08bc158be439841f9d3d9f6 URL: https://source.winehq.org/git/wine.git/?a=commit;h=3fc33a4282b04a06b08bc158b...
Author: Daniel Lehman dlehman25@gmail.com Date: Thu Jul 16 13:10:45 2020 +0200
ucrtbase/tests: Check errno in strtod tests.
Signed-off-by: Daniel Lehman dlehman25@gmail.com Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ucrtbase/tests/string.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/ucrtbase/tests/string.c b/dlls/ucrtbase/tests/string.c index f85f9abf73..5857a02773 100644 --- a/dlls/ucrtbase/tests/string.c +++ b/dlls/ucrtbase/tests/string.c @@ -77,12 +77,18 @@ static BOOL local_isnan(double d) return d != d; }
-#define test_strtod_str(string, value, length) _test_strtod_str(__LINE__, string, value, length) -static void _test_strtod_str(int line, const char* string, double value, int length) +#define test_strtod_str_errno(string, value, length, err) _test_strtod_str(__LINE__, string, value, length, err) +#define test_strtod_str(string, value, length) _test_strtod_str(__LINE__, string, value, length, 0) +static void _test_strtod_str(int line, const char* string, double value, int length, int err) { char *end; double d; + errno = 0xdeadbeef; d = strtod(string, &end); + if(!err) + ok_(__FILE__, line)(errno == 0xdeadbeef, "errno = %d\n", errno); + else + ok_(__FILE__, line)(errno == err, "errno = %d\n", errno); if (local_isnan(value)) ok_(__FILE__, line)(local_isnan(d), "d = %.16le ("%s")\n", d, string); else @@ -102,6 +108,8 @@ static void test_strtod(void) test_strtod_str("infini", INFINITY, 3); test_strtod_str("input", 0, 0); test_strtod_str("-input", 0, 0); + test_strtod_str_errno("1.7976931348623159e+308", INFINITY, 23, ERANGE); + test_strtod_str_errno("-1.7976931348623159e+308", -INFINITY, 24, ERANGE);
test_strtod_str("NAN", NAN, 3); test_strtod_str("nan", NAN, 3); @@ -137,6 +145,7 @@ static void test_strtod(void)
test_strtod_str("4.0621786324484881721115322e-53", 4.0621786324484881721115322e-53, 31); test_strtod_str("1.8905590910042396899370942", 1.8905590910042396899370942, 27); + test_strtod_str("1.7976931348623158e+308", 1.7976931348623158e+308, 23); test_strtod_str("2.2250738585072014e-308", 2.2250738585072014e-308, 23); test_strtod_str("4.9406564584124654e-324", 4.9406564584124654e-324, 23); }