diff options
author | Thomas Haller <thaller@redhat.com> | 2021-08-26 19:09:12 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-08-26 23:05:24 +0200 |
commit | a30fd66a85dcb9f2137c945201e0376c345478ad (patch) | |
tree | 76b26d904f7630f767981fbc574f34b2451b4aaf /src | |
parent | 0d9435d5d99c147a500e20666b73c70300f0dcb7 (diff) | |
download | NetworkManager-a30fd66a85dcb9f2137c945201e0376c345478ad.tar.gz |
tests: add nmtst_gbytes_from_arr(), nmtst_gbytes_from_str() helpers
Diffstat (limited to 'src')
-rw-r--r-- | src/libnm-glib-aux/nm-test-utils.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libnm-glib-aux/nm-test-utils.h b/src/libnm-glib-aux/nm-test-utils.h index b759151508..7b19cf12d8 100644 --- a/src/libnm-glib-aux/nm-test-utils.h +++ b/src/libnm-glib-aux/nm-test-utils.h @@ -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__ */ |