[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sat Jan 19 11:12:59 CET 2013
details: /var/hg/gmp/rev/a9330bcaab47
changeset: 15314:a9330bcaab47
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Jan 19 11:12:25 2013 +0100
description:
tests/mpz/t-set_str.c: Check also failing conditions.
details: /var/hg/gmp/rev/40d2d0a50e2a
changeset: 15315:40d2d0a50e2a
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Jan 19 11:12:40 2013 +0100
description:
ChangeLog
diffstat:
ChangeLog | 2 ++
tests/mpz/t-set_str.c | 46 ++++++++++++++++++++++++++++++----------------
2 files changed, 32 insertions(+), 16 deletions(-)
diffs (91 lines):
diff -r d323a6ba92b6 -r 40d2d0a50e2a ChangeLog
--- a/ChangeLog Sat Jan 19 08:01:01 2013 +0100
+++ b/ChangeLog Sat Jan 19 11:12:40 2013 +0100
@@ -8,6 +8,8 @@
* mini-gmp/tests/testutils.c (block_check, tu_free): Mark static.
+ * tests/mpz/t-set_str.c: Check also failing conditions.
+
2013-01-18 Niels Möller <nisse at lysator.liu.se>
* mini-gmp/tests/t-str.c (test_small): New function, exercising
diff -r d323a6ba92b6 -r 40d2d0a50e2a tests/mpz/t-set_str.c
--- a/tests/mpz/t-set_str.c Sat Jan 19 08:01:01 2013 +0100
+++ b/tests/mpz/t-set_str.c Sat Jan 19 11:12:40 2013 +0100
@@ -25,7 +25,7 @@
void
-check_one (mpz_srcptr want, int base, const char *str)
+check_one (mpz_srcptr want, int fail, int base, const char *str)
{
mpz_t got;
@@ -34,7 +34,7 @@
mpz_init (got);
- if (mpz_set_str (got, str, base) != 0)
+ if (mpz_set_str (got, str, base) != fail)
{
printf ("mpz_set_str unexpectedly failed\n");
printf (" base %d\n", base);
@@ -43,7 +43,7 @@
}
MPZ_CHECK_FORMAT (got);
- if (mpz_cmp (got, want) != 0)
+ if (fail == 0 && mpz_cmp (got, want) != 0)
{
printf ("mpz_set_str wrong\n");
printf (" base %d\n", base);
@@ -64,21 +64,35 @@
mpz_init (z);
mpz_set_ui (z, 0L);
- check_one (z, 0, "0 ");
- check_one (z, 0, "0 ");
- check_one (z, 10, "0 ");
- check_one (z, 10, "0 ");
- check_one (z, 10, "0000000 ");
+ check_one (z, 0, 0, "0 ");
+ check_one (z, 0, 0, " 0 0 0 ");
+ check_one (z, 0, 0, " -0B 0 ");
+ check_one (z, 0, 0, " 0X 0 ");
+ check_one (z, 0, 10, "0 ");
+ check_one (z, 0, 10, "-0 ");
+ check_one (z, 0, 10, " 0 000 000 ");
mpz_set_ui (z, 123L);
- check_one (z, 0, "123 ");
- check_one (z, 0, "123 ");
- check_one (z, 10, "123 ");
- check_one (z, 10, "123 ");
- check_one (z, 0, " 123 ");
- check_one (z, 0, " 123 ");
- check_one (z, 10, " 0000123 ");
- check_one (z, 10, " 123 ");
+ check_one (z, 0, 0, "123 ");
+ check_one (z, 0, 0, "123 ");
+ check_one (z, 0, 0, "0173 ");
+ check_one (z, 0, 0, " 0b 1 11 10 11 ");
+ check_one (z, 0, 0, " 0x 7b ");
+ check_one (z, 0, 0, "0x7B");
+ check_one (z, 0, 10, "123 ");
+ check_one (z, 0, 10, "123 ");
+ check_one (z, 0, 0, " 123 ");
+ check_one (z, 0, 0, " 123 ");
+ check_one (z, 0, 10, " 0000123 ");
+ check_one (z, 0, 10, " 123 ");
+ check_one (z,-1, 10, "1%");
+ check_one (z,-1, 0, "3!");
+ check_one (z,-1, 0, "0123456789");
+ check_one (z,-1, 0, "13579BDF");
+ check_one (z,-1, 0, "0b0102");
+ check_one (z,-1, 0, "0x010G");
+ check_one (z,-1, 37,"0x010G");
+ check_one (z,-1, 99,"0x010G");
mpz_clear (z);
}
More information about the gmp-commit
mailing list