diff options
author | tege <tege@gmplib.org> | 2007-09-24 17:19:27 +0200 |
---|---|---|
committer | tege <tege@gmplib.org> | 2007-09-24 17:19:27 +0200 |
commit | 7f6e0a4930a18e221ea2d45d621bea82c9c9c34e (patch) | |
tree | 13f6076dca2ab33d5e59b8847b03226cc30a7be5 /tests/mpq | |
parent | 4c893cee7bc42b6f874b4729f7afc767512e8f34 (diff) | |
download | gmp-7f6e0a4930a18e221ea2d45d621bea82c9c9c34e.tar.gz |
Clean up spacing.
Diffstat (limited to 'tests/mpq')
-rw-r--r-- | tests/mpq/t-get_d.c | 46 | ||||
-rw-r--r-- | tests/mpq/t-get_str.c | 8 | ||||
-rw-r--r-- | tests/mpq/t-inp_str.c | 132 | ||||
-rw-r--r-- | tests/mpq/t-set_str.c | 2 |
4 files changed, 94 insertions, 94 deletions
diff --git a/tests/mpq/t-get_d.c b/tests/mpq/t-get_d.c index 8acb99eda..cae4da93b 100644 --- a/tests/mpq/t-get_d.c +++ b/tests/mpq/t-get_d.c @@ -136,7 +136,7 @@ my_ldexp (double d, int e) } else if (e < 0) { - + if (e <= -16) { d /= 65536.0; @@ -225,35 +225,35 @@ check_onebit (void) mpq_set_ui (q, 1L, 1L); if (exp >= 0) - mpq_mul_2exp (q, q, exp); + mpq_mul_2exp (q, q, exp); else - mpq_div_2exp (q, q, -exp); + mpq_div_2exp (q, q, -exp); want = 1.0; for (l = 0; l < exp; l++) - want *= 2.0; + want *= 2.0; for (l = 0; l > exp; l--) - want /= 2.0; + want /= 2.0; for (neg = 0; neg <= 1; neg++) - { - if (neg) - { - mpq_neg (q, q); - want = -want; - } - - got = mpq_get_d (q); - - if (got != want) - { - printf ("mpq_get_d wrong on %s2**%ld\n", neg ? "-" : "", exp); - mpq_trace (" q ", q); - d_trace (" want ", want); - d_trace (" got ", got); - abort(); - } - } + { + if (neg) + { + mpq_neg (q, q); + want = -want; + } + + got = mpq_get_d (q); + + if (got != want) + { + printf ("mpq_get_d wrong on %s2**%ld\n", neg ? "-" : "", exp); + mpq_trace (" q ", q); + d_trace (" want ", want); + d_trace (" got ", got); + abort(); + } + } } mpq_clear (q); } diff --git a/tests/mpq/t-get_str.c b/tests/mpq/t-get_str.c index 96428f7d8..27566e746 100644 --- a/tests/mpq/t-get_str.c +++ b/tests/mpq/t-get_str.c @@ -30,14 +30,14 @@ check_one (mpq_srcptr q, int base, const char *want) { char *str, *ret; size_t str_alloc; - + MPQ_CHECK_FORMAT (q); mp_trace_base = base; str_alloc = mpz_sizeinbase (mpq_numref(q), ABS(base)) + mpz_sizeinbase (mpq_denref(q), ABS(base)) + 3; - + str = mpq_get_str (NULL, base, q); if (strlen(str)+1 > str_alloc) { @@ -57,9 +57,9 @@ check_one (mpq_srcptr q, int base, const char *want) abort (); } (*__gmp_free_func) (str, strlen (str) + 1); - + str = (char *) (*__gmp_allocate_func) (str_alloc); - + ret = mpq_get_str (str, base, q); if (str != ret) { diff --git a/tests/mpq/t-inp_str.c b/tests/mpq/t-inp_str.c index 3fc15de2c..24d9642dc 100644 --- a/tests/mpq/t-inp_str.c +++ b/tests/mpq/t-inp_str.c @@ -86,72 +86,72 @@ check_data (void) for (i = 0; i < numberof (data); i++) { for (post = 0; post <= 2; post++) - { - mpq_set_str_or_abort (want, data[i].want, 0); - MPQ_CHECK_FORMAT (want); - - fp = fopen (FILENAME, "w+"); - ASSERT_ALWAYS (fp != NULL); - fputs (data[i].inp, fp); - for (j = 0; j < post; j++) - putc (' ', fp); - fflush (fp); - ASSERT_ALWAYS (! ferror(fp)); - - rewind (fp); - got_nread = mpq_inp_str (got, fp, data[i].base); - - if (got_nread != 0) - { - ftell_nread = ftell (fp); - if (got_nread != ftell_nread) - { - printf ("mpq_inp_str nread wrong\n"); - printf (" inp \"%s\"\n", data[i].inp); - printf (" base %d\n", data[i].base); - printf (" got_nread %d\n", got_nread); - printf (" ftell_nread %ld\n", ftell_nread); - abort (); - } - } - - if (post == 0 && data[i].want_nread == strlen(data[i].inp)) - { - int c = getc(fp); - if (c != EOF) - { - printf ("mpq_inp_str didn't read to EOF\n"); - printf (" inp \"%s\"\n", data[i].inp); - printf (" base %d\n", data[i].base); - printf (" c '%c' %#x\n", c, c); - abort (); - } - } - - if (got_nread != data[i].want_nread) - { - printf ("mpq_inp_str nread wrong\n"); - printf (" inp \"%s\"\n", data[i].inp); - printf (" base %d\n", data[i].base); - printf (" got_nread %d\n", got_nread); - printf (" want_nread %d\n", data[i].want_nread); - abort (); - } - - MPQ_CHECK_FORMAT (got); - - if (! mpq_equal (got, want)) - { - printf ("mpq_inp_str wrong result\n"); - printf (" inp \"%s\"\n", data[i].inp); - printf (" base %d\n", data[i].base); - mpq_trace (" got ", got); - mpq_trace (" want", want); - abort (); - } - - ASSERT_ALWAYS (fclose (fp) == 0); - } + { + mpq_set_str_or_abort (want, data[i].want, 0); + MPQ_CHECK_FORMAT (want); + + fp = fopen (FILENAME, "w+"); + ASSERT_ALWAYS (fp != NULL); + fputs (data[i].inp, fp); + for (j = 0; j < post; j++) + putc (' ', fp); + fflush (fp); + ASSERT_ALWAYS (! ferror(fp)); + + rewind (fp); + got_nread = mpq_inp_str (got, fp, data[i].base); + + if (got_nread != 0) + { + ftell_nread = ftell (fp); + if (got_nread != ftell_nread) + { + printf ("mpq_inp_str nread wrong\n"); + printf (" inp \"%s\"\n", data[i].inp); + printf (" base %d\n", data[i].base); + printf (" got_nread %d\n", got_nread); + printf (" ftell_nread %ld\n", ftell_nread); + abort (); + } + } + + if (post == 0 && data[i].want_nread == strlen(data[i].inp)) + { + int c = getc(fp); + if (c != EOF) + { + printf ("mpq_inp_str didn't read to EOF\n"); + printf (" inp \"%s\"\n", data[i].inp); + printf (" base %d\n", data[i].base); + printf (" c '%c' %#x\n", c, c); + abort (); + } + } + + if (got_nread != data[i].want_nread) + { + printf ("mpq_inp_str nread wrong\n"); + printf (" inp \"%s\"\n", data[i].inp); + printf (" base %d\n", data[i].base); + printf (" got_nread %d\n", got_nread); + printf (" want_nread %d\n", data[i].want_nread); + abort (); + } + + MPQ_CHECK_FORMAT (got); + + if (! mpq_equal (got, want)) + { + printf ("mpq_inp_str wrong result\n"); + printf (" inp \"%s\"\n", data[i].inp); + printf (" base %d\n", data[i].base); + mpq_trace (" got ", got); + mpq_trace (" want", want); + abort (); + } + + ASSERT_ALWAYS (fclose (fp) == 0); + } } mpq_clear (got); diff --git a/tests/mpq/t-set_str.c b/tests/mpq/t-set_str.c index dd13a9a22..9f95d263b 100644 --- a/tests/mpq/t-set_str.c +++ b/tests/mpq/t-set_str.c @@ -28,7 +28,7 @@ void check_one (mpq_srcptr want, int base, const char *str) { mpq_t got; - + MPQ_CHECK_FORMAT (want); mp_trace_base = base; |