From 69d243f0b5f6be4d0df1310ae5752b46dfddb955 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 1 May 2013 12:08:01 +0200 Subject: digital/ucoolib/ucoolib/utils/crc: add CRC32 --- digital/ucoolib/ucoolib/utils/test/test_crc.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'digital/ucoolib/ucoolib/utils/test') diff --git a/digital/ucoolib/ucoolib/utils/test/test_crc.cc b/digital/ucoolib/ucoolib/utils/test/test_crc.cc index 19d6ca8e..77c4c1ac 100644 --- a/digital/ucoolib/ucoolib/utils/test/test_crc.cc +++ b/digital/ucoolib/ucoolib/utils/test/test_crc.cc @@ -25,16 +25,25 @@ #include "ucoolib/arch/arch.hh" #include "ucoolib/base/test/test.hh" +#include + int main (int argc, const char **argv) { ucoo::arch_init (argc, argv); ucoo::TestSuite tsuite ("crc"); { - ucoo::Test test (tsuite, "test vector"); + ucoo::Test test (tsuite, "crc8 test vector"); static const uint8_t test_vector[] = { 0x02, 0x1c, 0xb8, 0x01, 0, 0, 0, 0xa2 }; if (ucoo::crc8_compute (test_vector, lengthof (test_vector)) != 0) test.fail (); } + { + ucoo::Test test (tsuite, "crc32 test vector"); + const char *check_str = "123456789"; + if (ucoo::crc32_compute ((const uint8_t *) check_str, + std::strlen (check_str)) != 0xCBF43926) + test.fail (); + } return tsuite.report () ? 0 : 1; } -- cgit v1.2.3