diff options
Diffstat (limited to 'test/crc.c')
-rw-r--r-- | test/crc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/crc.c b/test/crc.c index 3521bce4a9..3f24c1a7e4 100644 --- a/test/crc.c +++ b/test/crc.c @@ -8,6 +8,7 @@ #include "common.h" #include "console.h" #include "crc.h" +#include "crc8.h" #include "test_util.h" #include "util.h" @@ -63,6 +64,18 @@ static int test_kat0(void) return EC_SUCCESS; } +static int test_cros_crc8(void) +{ + uint8_t buffer[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 8 }; + + int crc = cros_crc8(buffer, 10); + + /* Verifies polynomial values of 0x07 representing x^8 + x^2 + x + 1 */ + TEST_EQ(crc, 170, "%d"); + + return EC_SUCCESS; +} + void run_test(int argc, char **argv) { test_reset(); @@ -70,6 +83,7 @@ void run_test(int argc, char **argv) RUN_TEST(test_static_version); RUN_TEST(test_8); RUN_TEST(test_kat0); + RUN_TEST(test_cros_crc8); test_print_result(); } |