summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2013-01-19 07:54:37 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2013-01-19 07:54:37 +0100
commit5d625fc12633a44ee37a040b3670466bbeed8544 (patch)
tree381e8a4b2c3a7c6e6dd2930cebbbcc74eb803eb3
parent5a16ec65170f6aeb3c2c8b683824d46a20f2fef6 (diff)
downloadgmp-5d625fc12633a44ee37a040b3670466bbeed8544.tar.gz
mini-gmp/tests: Get the current free function using mp_get_memory_functions.
-rw-r--r--mini-gmp/tests/t-double.c5
-rw-r--r--mini-gmp/tests/t-str.c29
2 files changed, 21 insertions, 13 deletions
diff --git a/mini-gmp/tests/t-double.c b/mini-gmp/tests/t-double.c
index 36a621845..188bf1327 100644
--- a/mini-gmp/tests/t-double.c
+++ b/mini-gmp/tests/t-double.c
@@ -61,6 +61,9 @@ testmain (int argc, char **argv)
unsigned i;
mpz_t x;
+ void (*freefunc) (void *, size_t);
+ mp_get_memory_functions (NULL, NULL, &freefunc);
+
for (i = 0; values[i].s; i++)
{
char *s;
@@ -75,7 +78,7 @@ testmain (int argc, char **argv)
values[i].d, s, values[i].s);
abort ();
}
- tu_free(s, 0);
+ freefunc(s, 0);
mpz_clear (x);
}
diff --git a/mini-gmp/tests/t-str.c b/mini-gmp/tests/t-str.c
index 9cedb2be5..93f251971 100644
--- a/mini-gmp/tests/t-str.c
+++ b/mini-gmp/tests/t-str.c
@@ -1,6 +1,6 @@
/*
-Copyright 2012, Free Software Foundation, Inc.
+Copyright 2012, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library test suite.
@@ -50,30 +50,32 @@ test_small (void)
{ " 763959", "763959" },
{ "9 81999", "981999" },
{ "10\t7398", "107398" },
- { "9585 44", "958544" },
+ { "-9585 44", "-00958544" },
+ { "-0", "0000" },
+ { " -000 ", "0" },
{ "0704436", "231710" },
{ " 02503517", "689999" },
{ "0 1312143", "365667" },
- { "03 274062", "882738" },
- { "012\t242", "5282" },
+ { "-03 274062", "-882738" },
+ { "012\t242", "005282" },
{ "0b11010111110010001111", "883855" },
{ " 0b11001010010100001", "103585" },
- { "0b101010110011101111", "175343" },
+ { "-0b101010110011101111", "-175343" },
{ "0b 1111111011011100110", "521958" },
{ "0b1 1111110111001000011", "1044035" },
{ " 0x53dfc", "343548" },
- { "0xfa019", "1024025" },
+ { "0xfA019", "1024025" },
{ "0x 642d1", "410321" },
{ "0x5 8067", "360551" },
- { "0xd6be6", "879590" },
+ { "-0xd6Be6", "-879590" },
{ "\t0B1110000100000000011", "460803" },
{ "0B\t1111110010010100101", "517285" },
{ "0B1\t010111101101110100", "359284" },
- { "0B101\t1001101111111001", "367609" },
+ { "-0B101\t1001101111111001", "-367609" },
{ "0B10001001010111110000", "562672" },
- { "0Xe4b7e", "936830" },
- { "0X1e4bf", "124095" },
- { "0Xfdb90", "1039248" },
+ { "0Xe4B7e", "936830" },
+ { "0X1E4bf", "124095" },
+ { "-0Xfdb90", "-1039248" },
{ "0X7fc47", "523335" },
{ "0X8167c", "530044" },
/* Some invalid inputs */
@@ -140,6 +142,9 @@ testmain (int argc, char **argv)
mpz_t a, b;
+ void (*freefunc) (void *, size_t);
+ mp_get_memory_functions (NULL, NULL, &freefunc);
+
test_small ();
mpz_init (a);
@@ -262,7 +267,7 @@ testmain (int argc, char **argv)
}
}
free (ap);
- tu_free (bp, 0);
+ freefunc (bp, 0);
}
}
mpz_clear (a);