1 /* Test mpz_odd_p and mpz_even_p.
3 Copyright 2000, 2001 Free Software Foundation, Inc.
5 This file is part of the GNU MP Library.
7 The GNU MP Library is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
12 The GNU MP Library is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
17 You should have received a copy of the GNU Lesser General Public License
18 along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
44 { "0x1000000000000000000000000000000000000000000000000000", 0, 1 },
45 { "0x1000000000000000000000000000000000000000000000000001", 1, 0 },
46 { "0x1000000000000000000000000000000000000000000000000002", 0, 1 },
47 { "0x1000000000000000000000000000000000000000000000000003", 1, 0 },
49 { "-0x1000000000000000000000000000000000000000000000000004", 0, 1 },
50 { "-0x1000000000000000000000000000000000000000000000000003", 1, 0 },
51 { "-0x1000000000000000000000000000000000000000000000000002", 0, 1 },
52 { "-0x1000000000000000000000000000000000000000000000000001", 1, 0 },
59 for (i = 0; i < numberof (data); i++)
61 mpz_set_str_or_abort (n, data[i].n, 0);
63 if ((mpz_odd_p (n) != 0) != data[i].odd)
65 printf ("mpz_odd_p wrong on data[%d]\n", i);
69 if ((mpz_even_p (n) != 0) != data[i].even)
71 printf ("mpz_even_p wrong on data[%d]\n", i);