Back to index

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

Go to the source code of this file.

Classes

struct  test

Defines

#define TEST_FUNCTION   do_test ()

Functions

static int do_test (void)

Variables

struct test tests []

Class Documentation

struct test

Definition at line 27 of file runptests.c.

Class Members
int end
const CHAR * fmt
size_t offset
int options
const char * reg
double result
int retval
int start
const char * str
const CHAR * str

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 43 of file tst-strtod2.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 21 of file tst-strtod2.c.

{
  int status = 0;
  for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
    {
      char *ep;
      double r = strtod (tests[i].str, &ep);
      if (r != tests[i].result)
       {
         printf ("test %zu r = %g, expect %g\n", i, r, tests[i].result);
         status = 1;
       }
      if (ep != tests[i].str + tests[i].offset)
       {
         printf ("test %zu strtod parsed %tu characters, expected %zu\n",
                i, ep - tests[i].str, tests[i].offset);
         status = 1;
       }
    }
  return status;
}

Here is the call graph for this function:


Variable Documentation

struct test tests[]