1/* Test file for mpfr_const_catalan.
2
3Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4Contributed by the Arenaire and Cacao projects, INRIA.
5
6This file is part of the GNU MPFR Library.
7
8The GNU MPFR Library is free software; you can redistribute it and/or modify
9it under the terms of the GNU Lesser General Public License as published by
10the Free Software Foundation; either version 3 of the License, or (at your
11option) any later version.
12
13The GNU MPFR Library is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16License for more details.
17
18You should have received a copy of the GNU Lesser General Public License
19along with the GNU MPFR Library; see the file COPYING.LESSER.  If not, see
20http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
2151 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
22
23#include <stdio.h>
24#include <stdlib.h>
25#include "mpfr-test.h"
26
27/* Wrapper for tgeneric */
28static int
29my_const_catalan (mpfr_ptr x, mpfr_srcptr y, mpfr_rnd_t r)
30{
31  return mpfr_const_catalan (x, r);
32}
33
34#define RAND_FUNCTION(x) mpfr_set_ui(x,0,MPFR_RNDN)
35#define TEST_FUNCTION my_const_catalan
36#include "tgeneric.c"
37
38int
39main (int argc, char *argv[])
40{
41  mpfr_t x;
42
43  tests_start_mpfr ();
44
45  mpfr_init2 (x, 32);
46  (mpfr_const_catalan) (x, MPFR_RNDN);
47  mpfr_mul_2exp (x, x, 32, MPFR_RNDN);
48  if (mpfr_cmp_ui (x, 3934042271UL))
49    {
50      printf ("Error in const_catalan for prec=32\n");
51      exit (1);
52    }
53  mpfr_clear (x);
54
55  test_generic (2, 200, 1);
56
57  tests_end_mpfr ();
58  return 0;
59}
60