]> Savannah Git Hosting - gnulib.git/commitdiff
strtod, strtold tests: Avoid test failure on AIX 7.2.
authorBruno Haible <bruno@clisp.org>
Thu, 12 Dec 2019 23:19:56 +0000 (00:19 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 12 Dec 2019 23:21:07 +0000 (00:21 +0100)
* tests/test-strtod1.c (main): Allow implementations in which ',' and
'.' both are radix characters.
* tests/test-strtold1.c (main): Likewise.

ChangeLog
tests/test-strtod1.c
tests/test-strtold1.c

index aa25cfde09f701c71d361a7d3420544defcf92ef..b0c7543e53de1ba3d84965a3cff80dd94482a6c6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-12-12  Bruno Haible  <bruno@clisp.org>
+
+       strtod, strtold tests: Avoid test failure on AIX 7.2.
+       * tests/test-strtod1.c (main): Allow implementations in which ',' and
+       '.' both are radix characters.
+       * tests/test-strtold1.c (main): Likewise.
+
 2019-12-12  Paul Eggert  <eggert@cs.ucla.edu>
 
        dfa: prefer ptrdiff_t for API, too
index 75200ccfea2ca44547b6eed0a2203a9847249ad0..26b96beaa01013c005bfed902defac5b158c578b 100644 (file)
@@ -68,8 +68,10 @@ main (int argc, char *argv[])
     double result;
     errno = 0;
     result = strtod (input, &ptr);
-    ASSERT (result == 1.0);
-    ASSERT (ptr == input + 1);
+    /* On AIX 7.2, in the French locale, '.' is recognized as an alternate
+       radix character.  */
+    ASSERT ((ptr == input + 1 && result == 1.0)
+            || (ptr == input + 3 && result == 1.5));
     ASSERT (errno == 0);
   }
   {
@@ -78,8 +80,10 @@ main (int argc, char *argv[])
     double result;
     errno = 0;
     result = strtod (input, &ptr);
-    ASSERT (result == 123.0);
-    ASSERT (ptr == input + 3);
+    /* On AIX 7.2, in the French locale, '.' is recognized as an alternate
+       radix character.  */
+    ASSERT ((ptr == input + 3 && result == 123.0)
+            || (ptr == input + 7 && result > 123.45 && result < 123.46));
     ASSERT (errno == 0);
   }
   {
index 3a2f533b3587750259f4ed5ac5797ba03557ccb1..e58174b062dd276cefd98b1ddee80b0cd497b518 100644 (file)
@@ -68,8 +68,10 @@ main (int argc, char *argv[])
     long double result;
     errno = 0;
     result = strtold (input, &ptr);
-    ASSERT (result == 1.0L);
-    ASSERT (ptr == input + 1);
+    /* On AIX 7.2, in the French locale, '.' is recognized as an alternate
+       radix character.  */
+    ASSERT ((ptr == input + 1 && result == 1.0L)
+            || (ptr == input + 3 && result == 1.5L));
     ASSERT (errno == 0);
   }
   {
@@ -78,8 +80,10 @@ main (int argc, char *argv[])
     long double result;
     errno = 0;
     result = strtold (input, &ptr);
-    ASSERT (result == 123.0L);
-    ASSERT (ptr == input + 3);
+    /* On AIX 7.2, in the French locale, '.' is recognized as an alternate
+       radix character.  */
+    ASSERT ((ptr == input + 3 && result == 123.0L)
+            || (ptr == input + 7 && result > 123.45L && result < 123.46L));
     ASSERT (errno == 0);
   }
   {