Back to index

glibc  2.9
Defines | Functions | Variables
tst-strtod4.c File Reference
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define NBSP   "\xc2\xa0"
#define NTESTS   (sizeof (tests) / sizeof (tests[0]))
#define TEST_FUNCTION   do_test ()

Functions

static int do_test (void)

Variables

struct {
const char * in
const char * out
double expected
tests []

Define Documentation

#define NBSP   "\xc2\xa0"

Definition at line 6 of file tst-strtod4.c.

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

Definition at line 18 of file tst-strtod4.c.

#define TEST_FUNCTION   do_test ()

Definition at line 55 of file tst-strtod4.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 22 of file tst-strtod4.c.

{
  if (setlocale (LC_ALL, "cs_CZ.UTF-8") == NULL)
    {
      puts ("could not set locale");
      return 1;
    }

  int status = 0;

  for (int i = 0; i < NTESTS; ++i)
    {
      char *ep;
      double r = __strtod_internal (tests[i].in, &ep, 1);

      if (strcmp (ep, tests[i].out) != 0)
       {
         printf ("%d: got rest string \"%s\", expected \"%s\"\n",
                i, ep, tests[i].out);
         status = 1;
       }

      if (r != tests[i].expected)
       {
         printf ("%d: got wrong results %g, expected %g\n",
                i, r, tests[i].expected);
         status = 1;
       }
    }

  return status;
}

Here is the call graph for this function:


Variable Documentation

struct { ... } tests[] [static]