X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fcrc%2Ftest%2Fapi.c;fp=ccan%2Fcrc%2Ftest%2Fapi.c;h=5e85e35bde9aa516d4e1c01ef9f4003fd2b13455;hb=2a9b3284774fe371bb39787d2c19127d7691ff59;hp=c357a2cd6a252d332cd4eb1e0d552307c4fff227;hpb=cd13fd53487ba6f10b78ab1ffd625cb3da7ab22a;p=ccan diff --git a/ccan/crc/test/api.c b/ccan/crc/test/api.c index c357a2cd..5e85e35b 100644 --- a/ccan/crc/test/api.c +++ b/ccan/crc/test/api.c @@ -238,12 +238,24 @@ static void test_crc32(uint32_t (*crc)(uint32_t, const void *, size_t), ok1(memcmp(crc_table(), table_expect, 1024) == 0); } +static void test_crc64(void) +{ + /* according to http://swissknife.sourceforge.net/CRC64.html */ + ok1(crc64_iso(0, "IHATEMATH", strlen("IHATEMATH")) + == 0xE3DCADD69B01ADD1ULL); + + /* according to the CRC64 poly, http://sf.net/projects/jcrcgen */ + ok1(crc64_iso(0, "123456789", strlen("123456789")) + == 0x46A5A9388A5BEFFEULL); +} + int main(int argc, char *argv[]) { - plan_tests(517 * 2); + plan_tests(517 * 2 + 2); test_crc32(crc32c, crc32c_table, crcc_zero_expect, crcc_expect, crc32c_tab); test_crc32(crc32_ieee, crc32_ieee_table, crc_ieee_zero_expect, crc_ieee_expect, crc32_ieee_tab); + test_crc64(); return exit_status(); }