xref: /netbsd-src/external/lgpl3/mpfr/dist/tests/tconst_catalan.c (revision 6cd39ddb8550f6fa1bff3fed32053d7f19fd0453)
1 /* Test file for mpfr_const_catalan.
2 
3 Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
4 Contributed by the AriC and Caramel projects, INRIA.
5 
6 This file is part of the GNU MPFR Library.
7 
8 The GNU MPFR Library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 The GNU MPFR Library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with the GNU MPFR Library; see the file COPYING.LESSER.  If not, see
20 http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
21 51 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 */
28 static int
29 my_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 
38 int
39 main (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