tests: add nmtst_gbytes_from_arr(), nmtst_gbytes_from_str() helpers

This commit is contained in:
Thomas Haller 2021-08-26 19:09:12 +02:00
parent 0d9435d5d9
commit a30fd66a85
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -2854,4 +2854,20 @@ nmtst_ip_address_new(int addr_family, const char *str)
/*****************************************************************************/
#define nmtst_gbytes_from_arr(...) \
({ \
const guint8 _arr[] = {__VA_ARGS__}; \
\
g_bytes_new(_arr, sizeof(_arr)); \
})
#define nmtst_gbytes_from_str(str) \
({ \
const char *const _str = (str); \
\
g_bytes_new(_str, strlen(_str)); \
})
/*****************************************************************************/
#endif /* __NM_TEST_UTILS_H__ */