xref: /netbsd-src/external/lgpl3/mpfr/dist/tests/tconst_catalan.c (revision 4d342c046e3288fb5a1edcd33cfec48c41c80664)
1 /* Test file for mpfr_const_catalan.
2 
3 Copyright 2005-2018 Free Software Foundation, Inc.
4 Contributed by the AriC and Caramba 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 "mpfr-test.h"
24 
25 /* Wrapper for tgeneric */
26 static int
27 my_const_catalan (mpfr_ptr x, mpfr_srcptr y, mpfr_rnd_t r)
28 {
29   return mpfr_const_catalan (x, r);
30 }
31 
32 #define RAND_FUNCTION(x) mpfr_set_ui(x,0,MPFR_RNDN)
33 #define TEST_FUNCTION my_const_catalan
34 #include "tgeneric.c"
35 
36 int
37 main (int argc, char *argv[])
38 {
39   mpfr_t x;
40 
41   tests_start_mpfr ();
42 
43   mpfr_init2 (x, 32);
44   (mpfr_const_catalan) (x, MPFR_RNDN);
45   mpfr_mul_2exp (x, x, 32, MPFR_RNDN);
46   if (mpfr_cmp_ui (x, 3934042271UL))
47     {
48       printf ("Error in const_catalan for prec=32\n");
49       exit (1);
50     }
51   mpfr_clear (x);
52 
53   test_generic (MPFR_PREC_MIN, 200, 1);
54 
55   tests_end_mpfr ();
56   return 0;
57 }
58