|
12 | 12 | #include "../../../lib/crc/crc32c_sw.c"
|
13 | 13 | #include "../../../lib/crc/crc7_sw.c"
|
14 | 14 | #include "../../../lib/crc/crc24_sw.c"
|
| 15 | +#include "../../../lib/crc/crc4_sw.c" |
15 | 16 | #include "../../../lib/crc/crc32k_4_2_sw.c"
|
16 | 17 |
|
17 | 18 | ZTEST(crc, test_crc32_k_4_2)
|
@@ -195,6 +196,25 @@ ZTEST(crc, test_crc16_itu_t)
|
195 | 196 |
|
196 | 197 | }
|
197 | 198 |
|
| 199 | +ZTEST(crc, test_crc4) |
| 200 | +{ |
| 201 | + uint8_t test1[] = {'A'}; |
| 202 | + uint8_t test2[] = {'Z', 'e', 'p', 'h', 'y', 'r'}; |
| 203 | + |
| 204 | + zassert_equal(crc4(test1, sizeof(test1), 0x3, 0x0, true), 0x2); |
| 205 | + zassert_equal(crc4(test2, sizeof(test2), 0x3, 0x0, true), 0x0); |
| 206 | + zassert_equal(crc4(test1, sizeof(test1), 0x3, 0x0, false), 0x4); |
| 207 | + zassert_equal(crc4(test2, sizeof(test2), 0x3, 0x0, false), 0xE); |
| 208 | +} |
| 209 | + |
| 210 | +ZTEST(crc, test_crc4_ti) |
| 211 | +{ |
| 212 | + uint8_t test1[] = {'Z', 'e', 'p'}; |
| 213 | + |
| 214 | + zassert_equal(crc4_ti(0x0, test1, sizeof(test1)), 0xF); |
| 215 | + zassert_equal(crc4_ti(0x5, test1, sizeof(test1)), 0xB); |
| 216 | +} |
| 217 | + |
198 | 218 | ZTEST(crc, test_crc8_ccitt)
|
199 | 219 | {
|
200 | 220 | uint8_t test0[] = { 0 };
|
|
0 commit comments