1/* tbuildopt.c -- test file for mpfr_buildopt_tls_p and
2   mpfr_buildopt_decimal_p.
3
4Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
5Contributed by the Arenaire and Cacao projects, INRIA.
6
7The GNU MPFR Library is free software; you can redistribute it and/or modify
8it under the terms of the GNU Lesser General Public License as published by
9the Free Software Foundation; either version 3 of the License, or (at your
10option) any later version.
11
12The GNU MPFR Library is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15License for more details.
16
17You should have received a copy of the GNU Lesser General Public License
18along with the GNU MPFR Library; see the file COPYING.LESSER.  If not, see
19http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
2051 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
21
22#include <stdlib.h>
23#include "mpfr-test.h"
24
25static void
26check_tls_p (void)
27{
28#ifdef MPFR_USE_THREAD_SAFE
29  if (!mpfr_buildopt_tls_p())
30    {
31      printf ("Error: mpfr_buildopt_tls_p should return true\n");
32      exit (1);
33    }
34#else
35  if (mpfr_buildopt_tls_p())
36    {
37      printf ("Error: mpfr_buildopt_tls_p should return false\n");
38      exit (1);
39    }
40#endif
41}
42
43static void
44check_decimal_p (void)
45{
46#ifdef MPFR_WANT_DECIMAL_FLOATS
47  if (!mpfr_buildopt_decimal_p())
48    {
49      printf ("Error: mpfr_buildopt_decimal_p should return true\n");
50      exit (1);
51    }
52#else
53  if (mpfr_buildopt_decimal_p())
54    {
55      printf ("Error: mpfr_buildopt_decimal_p should return false\n");
56      exit (1);
57    }
58#endif
59}
60
61int
62main (void)
63{
64  check_tls_p();
65  check_decimal_p();
66
67  return 0;
68}
69