From a5d2bdc6ede1db0fae397f0129b2906e00a5bd5f Mon Sep 17 00:00:00 2001 From: Luis Ubieda Date: Tue, 8 Jul 2025 14:14:47 -0400 Subject: [PATCH] tests: crc: Add test-case to validate CRC24Q RTCM3 Validating both a frame without CRC (should return calculated CRC), and with CRC (should return 0 as a match). Signed-off-by: Luis Ubieda --- tests/unit/crc/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/unit/crc/main.c b/tests/unit/crc/main.c index f2c2b91fd5b..dab84c00211 100644 --- a/tests/unit/crc/main.c +++ b/tests/unit/crc/main.c @@ -90,6 +90,15 @@ ZTEST(crc, test_crc24_pgp) zassert_equal(crc24_pgp_update(0x00BA353A, test2 + 5, 4), 0x0021CF02); } +ZTEST(crc, test_crc24q_rtcm3) +{ + uint8_t test1[] = {0xD3, 0x00, 0x04, 0x4C, 0xE0, 0x00, 0x80}; + uint8_t test2[] = {0xD3, 0x00, 0x04, 0x4C, 0xE0, 0x00, 0x80, 0xED, 0xED, 0xD6}; + + zassert_equal(crc24q_rtcm3(test1, sizeof(test1)), 0xEDEDD6); + zassert_equal(crc24q_rtcm3(test2, sizeof(test2)), 0x000000); +} + ZTEST(crc, test_crc16) { uint8_t test[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };