diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/crc.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/crc.c b/test/crc.c index 9943a7ac0c..cd0ad0f1cc 100644 --- a/test/crc.c +++ b/test/crc.c @@ -83,6 +83,21 @@ static int test_cros_crc8(void) return EC_SUCCESS; } +static int test_crc16(void) +{ + uint8_t buffer[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 8 }; + + int crc = cros_crc16(buffer, 10, 0); + + /* + * Verifies polynomial values of 0x1021 representing X^16 + X^15 + X^2 + + * 1 + */ + TEST_EQ(crc, 60681, "%d"); + + return EC_SUCCESS; +} + void run_test(int argc, const char **argv) { test_reset(); @@ -91,6 +106,7 @@ void run_test(int argc, const char **argv) RUN_TEST(test_8); RUN_TEST(test_kat0); RUN_TEST(test_cros_crc8); + RUN_TEST(test_crc16); test_print_result(); } |