summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-09-05 23:06:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-09-05 23:06:54 (GMT)
commit46467e91b0c96f368b2ac75569dfab2d3a097ef8 (patch)
tree9028c68c57d3f0a06152823f768484d1d460562b /test
parent5afc64f31b1cb2f3907ad5fa5f1a1629d27fb5c4 (diff)
downloadhdf5-46467e91b0c96f368b2ac75569dfab2d3a097ef8.zip
hdf5-46467e91b0c96f368b2ac75569dfab2d3a097ef8.tar.gz
hdf5-46467e91b0c96f368b2ac75569dfab2d3a097ef8.tar.bz2
[svn-r12649] Description:
Add a CRC algorithm to the library, initially for "small" (<256 byte) metadata blocks. Update checksum tests to verify it's working correctly. Tested: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2) (Will be testing on more platforms after checkin)
Diffstat (limited to 'test')
-rw-r--r--test/tchecksum.c72
1 files changed, 51 insertions, 21 deletions
diff --git a/test/tchecksum.c b/test/tchecksum.c
index 62c0505..ee492f8 100644
--- a/test/tchecksum.c
+++ b/test/tchecksum.c
@@ -51,13 +51,19 @@ test_chksum_size_one(void)
uint32_t chksum; /* Checksum value */
/* Buffer w/real data */
- chksum = H5_fletcher32(buf, sizeof(buf));
- VERIFY(chksum, 0x17001700, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(buf, sizeof(buf));
+ VERIFY(chksum, 0x17001700, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(buf, sizeof(buf));
+ VERIFY(chksum, 0xfa2568b7, "H5_checksum_crc");
/* Buffer w/zero(s) for data */
HDmemset(buf, 0, sizeof(buf));
- chksum = H5_fletcher32(buf, sizeof(buf));
- VERIFY(chksum, 0, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(buf, sizeof(buf));
+ VERIFY(chksum, 0, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(buf, sizeof(buf));
+ VERIFY(chksum, 0xfa60fb57, "H5_checksum_crc");
} /* test_chksum_size_one() */
@@ -73,13 +79,19 @@ test_chksum_size_two(void)
uint32_t chksum; /* Checksum value */
/* Buffer w/real data */
- chksum = H5_fletcher32(buf, sizeof(buf));
- VERIFY(chksum, 0x17bb17bb, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(buf, sizeof(buf));
+ VERIFY(chksum, 0x17bb17bb, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(buf, sizeof(buf));
+ VERIFY(chksum, 0xfc856608, "H5_checksum_crc");
/* Buffer w/zero(s) for data */
HDmemset(buf, 0, sizeof(buf));
- chksum = H5_fletcher32(buf, sizeof(buf));
- VERIFY(chksum, 0, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(buf, sizeof(buf));
+ VERIFY(chksum, 0, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(buf, sizeof(buf));
+ VERIFY(chksum, 0xfc7e9b20, "H5_checksum_crc");
} /* test_chksum_size_two() */
@@ -95,13 +107,19 @@ test_chksum_size_three(void)
uint32_t chksum; /* Checksum value */
/* Buffer w/real data */
- chksum = H5_fletcher32(buf, sizeof(buf));
- VERIFY(chksum, 0x917679bb, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(buf, sizeof(buf));
+ VERIFY(chksum, 0x917679bb, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(buf, sizeof(buf));
+ VERIFY(chksum, 0xfebc5d70, "H5_checksum_crc");
/* Buffer w/zero(s) for data */
HDmemset(buf, 0, sizeof(buf));
- chksum = H5_fletcher32(buf, sizeof(buf));
- VERIFY(chksum, 0, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(buf, sizeof(buf));
+ VERIFY(chksum, 0, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(buf, sizeof(buf));
+ VERIFY(chksum, 0xf9cc4c7a, "H5_checksum_crc");
} /* test_chksum_size_three() */
@@ -117,13 +135,19 @@ test_chksum_size_four(void)
uint32_t chksum; /* Checksum value */
/* Buffer w/real data */
- chksum = H5_fletcher32(buf, sizeof(buf));
- VERIFY(chksum, 0x924f7a94, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(buf, sizeof(buf));
+ VERIFY(chksum, 0x924f7a94, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(buf, sizeof(buf));
+ VERIFY(chksum, 0xff398a46, "H5_checksum_crc");
/* Buffer w/zero(s) for data */
HDmemset(buf, 0, sizeof(buf));
- chksum = H5_fletcher32(buf, sizeof(buf));
- VERIFY(chksum, 0, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(buf, sizeof(buf));
+ VERIFY(chksum, 0, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(buf, sizeof(buf));
+ VERIFY(chksum, 0xff117081, "H5_checksum_crc");
} /* test_chksum_size_four() */
@@ -143,13 +167,19 @@ test_chksum_large(void)
large_buf[u] = u * 3;
/* Buffer w/real data */
- chksum = H5_fletcher32(large_buf, sizeof(large_buf));
- VERIFY(chksum, 0x85b4e2a, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf));
+ VERIFY(chksum, 0x85b4e2a, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(large_buf, sizeof(large_buf));
+ VERIFY(chksum, 0xfbd0f7c0, "H5_checksum_crc");
/* Buffer w/zero(s) for data */
HDmemset(large_buf, 0, sizeof(large_buf));
- chksum = H5_fletcher32(large_buf, sizeof(large_buf));
- VERIFY(chksum, 0, "H5_fletcher32");
+ chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf));
+ VERIFY(chksum, 0, "H5_checksum_fletcher32");
+
+ chksum = H5_checksum_crc(large_buf, sizeof(large_buf));
+ VERIFY(chksum, 0xfac8b4c4, "H5_checksum_crc");
} /* test_chksum_large() */
@@ -162,7 +192,7 @@ void
test_checksum(void)
{
/* Output message about test being performed */
- MESSAGE(5, ("Testing checksum algorithm\n"));
+ MESSAGE(5, ("Testing checksum algorithms\n"));
/* Various checks for fletcher32 checksum algorithm */
test_chksum_size_one(); /* Test buffer w/only 1 byte */