41 #define UUID( A, B, C, D, E0, E1, E2, E3, E4, E5 ) { \ 46 .e = { E0, E1, E2, E3, E4, E5 }, \ 58 const char *file,
unsigned int line ) {
63 DBG (
"uuid_ntoa ( %08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x ) = " 69 okx (
strcmp ( actual, text ) == 0, file, line );
71 #define uuid_ntoa_ok( value, text ) do { \ 72 static const union uuid uuid = { \ 75 uuid_ntoa_okx ( &uuid, text, __FILE__, __LINE__ ); \ 87 const char *file,
unsigned int line ) {
92 DBG (
"uuid_aton ( \"%s\" ) = %s\n", text,
uuid_ntoa ( &actual ) );
93 okx (
memcmp ( &actual,
uuid,
sizeof ( actual ) ) == 0, file, line );
95 #define uuid_aton_ok( text, value ) do { \ 96 static const union uuid uuid = { \ 99 uuid_aton_okx ( text, &uuid, __FILE__, __LINE__ ); \ 110 unsigned int line ) {
116 #define uuid_aton_fail_ok( text ) \ 117 uuid_aton_fail_okx ( text, __FILE__, __LINE__ ) 127 0xc3, 0x80, 0x91, 0xd2, 0xa4, 0x33 ),
128 "18725ca6-d699-4e4d-b501-c38091d2a433" );
130 0xc9, 0x2e, 0xa3, 0x4a ,0xb4, 0x5b ),
131 "1a969b23-c7d5-40fe-b79a-c92ea34ab45b" );
135 UUID ( 0x62b907a8, 0xe1a7, 0x460e, 0x82f7,
136 0x66, 0x7d, 0x84, 0x27, 0x0c, 0x84 ) );
138 UUID ( 0xf5d0349c, 0xef7c, 0x4ad4, 0xb40b,
139 0xfc, 0x2e, 0x52, 0x2a, 0x73, 0x27 ) );
141 UUID ( 0x4edd80ff, 0x7b43, 0x4655, 0x89a0,
142 0x2b, 0x1e, 0x7c, 0xff, 0xa1, 0x96 ) );
static void uuid_aton_okx(const char *text, const union uuid *uuid, const char *file, unsigned int line)
Report a uuid_aton() test result.
uint32_t a
8 hex digits, big-endian
uint16_t c
2 hex digits, big-endian
#define UUID(A, B, C, D, E0, E1, E2, E3, E4, E5)
Define an inline UUID value.
static void uuid_ntoa_okx(const union uuid *uuid, const char *text, const char *file, unsigned int line)
Report a uuid_ntoa() test result.
static void uuid_test_exec(void)
Perform UUID self-tests.
Self-test infrastructure.
const char * name
Test set name.
uint16_t d
2 hex digits, big-endian
#define uuid_aton_fail_ok(text)
static void uuid_aton_fail_okx(const char *text, const char *file, unsigned int line)
Report a uuid_aton() failure test result.
int uuid_aton(const char *string, union uuid *uuid)
Parse UUID.
#define okx(success, file, line)
Report test result.
#define uuid_aton_ok(text, value)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint16_t b
2 hex digits, big-endian
struct uuid::@648 canonical
Canonical form (00000000-0000-0000-0000-000000000000)
struct self_test uuid_test __self_test
UUID self-test.
uint8_t e[6]
12 hex digits, big-endian
const char * uuid_ntoa(const union uuid *uuid)
Convert UUID to printable string.
int strcmp(const char *first, const char *second)
Compare strings.
#define DBG(...)
Print a debugging message.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
#define uuid_ntoa_ok(value, text)