1 /*
2 Copyright (C) 2011 Fredrik Johansson
3
4 This file is part of FLINT.
5
6 FLINT is free software: you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License (LGPL) as published
8 by the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version. See <https://www.gnu.org/licenses/>.
10 */
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <gmp.h>
15 #include "flint.h"
16 #include "fmpz.h"
17 #include "ulong_extras.h"
18
19 int
main(void)20 main(void)
21 {
22 slong i;
23 ulong n, k;
24 fmpz_t x, y;
25 mpz_t z;
26 FLINT_TEST_INIT(state);
27
28 flint_printf("bin_uiui....");
29 fflush(stdout);
30
31
32
33 for (i = 0; i < 1000 * flint_test_multiplier(); i++)
34 {
35 fmpz_init(x);
36 fmpz_init(y);
37 mpz_init(z);
38
39 n = n_randint(state, 1000);
40 k = n_randint(state, 1000);
41
42 fmpz_bin_uiui(x, n, k);
43 flint_mpz_bin_uiui(z, n, k);
44 fmpz_set_mpz(y, z);
45
46 if (!fmpz_equal(x, y))
47 {
48 flint_printf("FAIL: n,k = %wu,%wu\n", n, k);
49 abort();
50 }
51
52 fmpz_clear(x);
53 fmpz_clear(y);
54 mpz_clear(z);
55 }
56
57
58
59 FLINT_TEST_CLEANUP(state);
60 flint_printf("PASS\n");
61 return 0;
62 }
63