47 #define DATA(...) { __VA_ARGS__ } 70 #define CRC32_TEST( name, DATA, SEED, CRC32 ) \ 71 static const uint8_t name ## _data[] = DATA; \ 72 static struct crc32_test name = { \ 73 .data = name ## _data, \ 74 .len = sizeof ( name ## _data ), \ 84 #define crc32_ok( test ) do { \ 86 crc32 = crc32_le ( (test)->seed, (test)->data, (test)->len ); \ 87 ok ( crc32 == (test)->crc32 ); \ 93 0x12345678UL, 0x12345678UL );
95 DATA (
'h',
'e',
'l',
'l',
'o',
' ',
'w',
'o',
'r',
'l',
'd' ),
96 0xffffffffUL, 0xf2b5ee7aUL );
98 DATA (
'h',
'e',
'l',
'l',
'o' ),
99 0xffffffffUL, 0xc9ef5979UL );
101 DATA (
' ',
'w',
'o',
'r',
'l',
'd' ),
102 0xc9ef5979UL, 0xf2b5ee7aUL );
#define CRC32_TEST(name, DATA, SEED, CRC32)
Define a CRC32 test.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static void crc32_test_exec(void)
Perform CRC32 self-tests.
Self-test infrastructure.
const char * name
Test set name.
uint32_t crc32
Expected CRC32.
size_t len
Length of test data.
struct self_test crc32_test __self_test
CRC32 self-test.
#define crc32_ok(test)
Report a CRC32 test result.
const void * data
Test data.
#define DATA(...)
Define inline data.