/* Test compilation of tgmath macros.
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com> and
Ulrich Drepper <drepper@redhat.com>, 2001.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef HAVE_MAIN
#undef __NO_MATH_INLINES
#define __NO_MATH_INLINES 1
#include <math.h>
#include <stdio.h>
#include <tgmath.h>
//#define DEBUG
static void compile_test (void);
static void compile_testf (void);
static void compile_testl (void);
float fx;
double dx;
long double lx;
int count_double;
int count_float;
int count_ldouble;
#define NCALLS 115
#define NCALLS_INT 4
int
main (void)
{
int result = 0;
count_float = count_double = count_ldouble = 0;
compile_test ();
if (count_float != 0)
{
puts ("float function called for double test");
result = 1;
}
if (count_ldouble != 0)
{
puts ("long double function called for double test");
result = 1;
}
if (count_double < NCALLS + NCALLS_INT)
{
printf ("double functions not called often enough (%d)\n",
count_double);
result = 1;
}
else if (count_double > NCALLS + NCALLS_INT)
{
printf ("double functions called too often (%d)\n",
count_double);
result = 1;
}
count_float = count_double = count_ldouble = 0;
compile_testf ();
if (count_double != 0)
{
puts ("double function called for float test");
result = 1;
}
if (count_ldouble != 0)
{
puts ("long double function called for float test");
result = 1;
}
if (count_float < NCALLS)
{
printf ("float functions not called often enough (%d)\n", count_float);
result = 1;
}
else if (count_float > NCALLS)
{
printf ("float functions called too often (%d)\n",
count_double);
result = 1;
}
#ifndef NO_LONG_DOUBLE
count_float = count_double = count_ldouble = 0;
compile_testl ();
if (count_float != 0)
{
puts ("float function called for long double test");
result = 1;
}
if (count_double != 0)
{
puts ("double function called for long double test");
result = 1;
}
if (count_ldouble < NCALLS)
{
printf ("long double functions not called often enough (%d)\n",
count_ldouble);
result = 1;
}
else if