3 Copyright 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/. */
29 #define SGN(x) ((x)<0 ? -1 : (x) != 0)
42 { "0", 0, ULONG_MAX, 0 },
45 { "1", 0, ULONG_MAX, 1 },
48 { "-1", 0, ULONG_MAX, -1 },
52 { "122", 123, 1, -1 },
54 { "-123", 123, 1, -1 },
55 { "-124", 123, 1, -1 },
56 { "-122", 123, 1, -1 },
58 { "123", -123, 1, 1 },
59 { "124", -123, 1, 1 },
60 { "122", -123, 1, 1 },
62 { "-123", -123, 1, 0 },
63 { "-124", -123, 1, -1 },
64 { "-122", -123, 1, 1 },
77 for (i = 0; i < numberof (data); i++)
79 mpq_set_str_or_abort (q, data[i].q, 0);
82 got = mpq_cmp_si (q, data[i].n, data[i].d);
83 if (SGN(got) != data[i].want)
85 printf ("mpq_cmp_si wrong\n");
88 printf (" n=%ld\n", data[i].n);
89 printf (" d=%lu\n", data[i].d);
90 printf (" got=%d\n", got);
91 printf (" want=%d\n", data[i].want);
97 got = mpq_cmp_si (q, 0L, data[i].d);
98 if (SGN(got) != data[i].want)
100 printf ("mpq_cmp_si wrong\n");
110 main (int argc, char **argv)