summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2002-05-09 02:12:21 +0200
committerKevin Ryde <user42@zip.com.au>2002-05-09 02:12:21 +0200
commitee57e2a7cc5cad62ec666d383cec5c69a7ea85ca (patch)
tree0074df5b6f6ead60cd464f6ae9141ec0e54b3cc4
parent60ef39553f40c5e343c55c02ae890214c272514f (diff)
downloadgmp-ee57e2a7cc5cad62ec666d383cec5c69a7ea85ca.tar.gz
* tests/mpz/t-import.c, tests/mpz/t-export.c: More test data.
-rw-r--r--tests/mpz/t-export.c9
-rw-r--r--tests/mpz/t-import.c16
2 files changed, 22 insertions, 3 deletions
diff --git a/tests/mpz/t-export.c b/tests/mpz/t-export.c
index 7592c1994..d212db03e 100644
--- a/tests/mpz/t-export.c
+++ b/tests/mpz/t-export.c
@@ -94,6 +94,15 @@ check_data (void)
{ 0x0C,0xC0,0x0B,0xB0,0x0A,0xA0,0x09,0x90,
0x08,0x80,0x07,0x70,0x06,0x60,0x05,0x50,
0x04,0x40,0x03,0x30,0x02,0x20,0x01,0x10 } },
+
+ { "0x155555555555555555555555", 3,1, 4,1, 1,
+ { 0x55,0x55,0x55,0x55, 0x2A,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55 } },
+ { "0x155555555555555555555555", 3,-1, 4,1, 1,
+ { 0x55,0x55,0x55,0x55, 0x2A,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55 } },
+ { "0x155555555555555555555555", 3,1, 4,-1, 1,
+ { 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0x2A, 0x55,0x55,0x55,0x55 } },
+ { "0x155555555555555555555555", 3,-1, 4,-1, 1,
+ { 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0x2A, 0x55,0x55,0x55,0x55 } },
};
char buf[sizeof(data[0].src) + sizeof (mp_limb_t) + 128];
diff --git a/tests/mpz/t-import.c b/tests/mpz/t-import.c
index 2713b32f1..fc4f52636 100644
--- a/tests/mpz/t-import.c
+++ b/tests/mpz/t-import.c
@@ -39,7 +39,6 @@ check_data (void)
char src[64];
} data[] = {
- { "0x123456789ABC", 3,1, 2,1, 0, { 0x12,0x34, 0x56,0x78, 0x9A,0xBC } },
{ "0", 0,1, 1,1, 0 },
{ "0", 1,1, 0,1, 0 },
@@ -94,6 +93,15 @@ check_data (void)
{ 0x0C,0xC0,0x0B,0xB0,0x0A,0xA0,0x09,0x90,
0x08,0x80,0x07,0x70,0x06,0x60,0x05,0x50,
0x04,0x40,0x03,0x30,0x02,0x20,0x01,0x10 } },
+
+ { "0x155555555555555555555555", 3,1, 4,1, 1,
+ { 0xD5,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0xD5,0x55,0x55,0x55 } },
+ { "0x155555555555555555555555", 3,-1, 4,1, 1,
+ { 0xD5,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0xD5,0x55,0x55,0x55 } },
+ { "0x155555555555555555555555", 3,1, 4,-1, 1,
+ { 0x55,0x55,0x55,0xD5, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0xD5 } },
+ { "0x155555555555555555555555", 3,-1, 4,-1, 1,
+ { 0x55,0x55,0x55,0xD5, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0xD5 } },
};
char buf[sizeof(data[0].src) + sizeof (mp_limb_t)];
@@ -113,6 +121,7 @@ check_data (void)
src = buf + align;
memcpy (src, data[i].src, data[i].count * data[i].size);
+ mpz_set_ui (got, 0L);
mpz_import (got, data[i].count, data[i].order,
data[i].size, data[i].endian, data[i].nail, src);
@@ -120,9 +129,10 @@ check_data (void)
if (mpz_cmp (got, want) != 0)
{
printf ("wrong at data[%d]\n", i);
- printf (" count=%u order=%d size=%u endian=%d nail=%u\n",
+ printf (" count=%u order=%d size=%u endian=%d nail=%u align=%u\n",
data[i].count, data[i].order,
- data[i].size, data[i].endian, data[i].nail);
+ data[i].size, data[i].endian, data[i].nail,
+ align);
mpz_trace (" got ", got);
mpz_trace (" want", want);
abort ();