Back to index

glibc  2.9
Defines | Functions | Variables
bug-strtod2.c File Reference
#include <locale.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "../test-skeleton.c"

Go to the source code of this file.


#define ntests   (sizeof (tests) / sizeof (tests[0]))
#define TEST_FUNCTION   do_test ()


static int do_test (void)


static const char * tests []

Define Documentation

#define ntests   (sizeof (tests) / sizeof (tests[0]))

Definition at line 11 of file bug-strtod2.c.

#define TEST_FUNCTION   do_test ()

Definition at line 45 of file bug-strtod2.c.

Function Documentation

static int do_test ( void  ) [static]

Definition at line 14 of file bug-strtod2.c.

  /* The Turkish locale is notorious because tolower() maps 'I' to the
     dotless lowercase 'i' and toupper() maps 'i' to an 'I' with a dot
     above.  */
  if (setlocale (LC_ALL, "tr_TR.UTF-8") == NULL)
      puts ("cannot set locale");
      return 0;

  int res = 0;
  for (int i = 0; i < ntests; ++i)
      char *endp;
      double d = strtod (tests[i], &endp);
      if (*endp != '\0')
         printf ("did not consume all of '%s'\n", tests[i]);
         res = 1;
      if (!isinf (d))
         printf ("'%s' does not pass isinf\n", tests[i]);
         res = 1;

  return res;

Here is the call graph for this function:

Variable Documentation

const char* tests[] [static]
Initial value:
    "inf", "Inf", "iNf", "inF", "INf", "iNF", "INF", "InF",
    "infinity", "Infinity", "InfInity", "INFINITY"

Definition at line 6 of file bug-strtod2.c.