summaryrefslogtreecommitdiff
path: root/tests/test-libgmp.c
blob: af8e4d77b82bf9558913c9a3b0de28beafe1ef04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <config.h>

#include <gmp.h>

#include "macros.h"

int
main ()
{
  /* A simple sanity check that 2 + 2 = 4.  */
  static mp_limb_t const twobody[] = { 2 };
  static mpz_t const two = MPZ_ROINIT_N ((mp_limb_t *) twobody, 1);
  ASSERT (mpz_fits_slong_p (two));
  ASSERT (mpz_get_si (two) == 2);

  mpz_t four;
  mpz_init (four);
  mpz_add (four, two, two);
  ASSERT (mpz_fits_slong_p (four));
  ASSERT (mpz_get_si (four) == 4);
  mpz_clear (four);

  return 0;
}

Return to:

Send suggestions and report system problems to the System administrator.