summaryrefslogtreecommitdiffhomepage
path: root/digital/ucoolib/ucoolib/utils/test
diff options
context:
space:
mode:
authorNicolas Schodet2013-05-01 12:08:01 +0200
committerNicolas Schodet2013-05-01 12:51:45 +0200
commit69d243f0b5f6be4d0df1310ae5752b46dfddb955 (patch)
tree2c7ca729d92af6ee9def996a52972cc1542be2af /digital/ucoolib/ucoolib/utils/test
parent3e8898eb008be3fa11a6d312102d27f3daf55a77 (diff)
digital/ucoolib/ucoolib/utils/crc: add CRC32
Diffstat (limited to 'digital/ucoolib/ucoolib/utils/test')
-rw-r--r--digital/ucoolib/ucoolib/utils/test/test_crc.cc11
1 files changed, 10 insertions, 1 deletions
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 <cstring>
+
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;
}