summaryrefslogtreecommitdiff
path: root/shared/nm-test-utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'shared/nm-test-utils.h')
-rw-r--r--shared/nm-test-utils.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/shared/nm-test-utils.h b/shared/nm-test-utils.h
index 694e84ccd0..6e705dce5c 100644
--- a/shared/nm-test-utils.h
+++ b/shared/nm-test-utils.h
@@ -853,6 +853,18 @@ nmtst_main_loop_run (GMainLoop *loop, int timeout_ms)
return loopx != NULL;
}
+inline static void
+_nmtst_main_loop_quit_on_notify (GObject *object, GParamSpec *pspec, gpointer user_data)
+{
+ GMainLoop *loop = user_data;
+
+ g_assert (G_IS_OBJECT (object));
+ g_assert (loop);
+
+ g_main_loop_quit (loop);
+}
+#define nmtst_main_loop_quit_on_notify ((GCallback) _nmtst_main_loop_quit_on_notify)
+
/*****************************************************************************/
inline static const char *
@@ -1774,6 +1786,34 @@ nmtst_create_connection_from_keyfile (const char *keyfile_str, const char *keyfi
#ifdef __NM_CONNECTION_H__
+#define nmtst_assert_variant_is_of_type(variant, type) \
+ G_STMT_START { \
+ GVariant *_variantx = (variant); \
+ \
+ g_assert (_variantx); \
+ g_assert (g_variant_is_of_type (_variantx, (type))); \
+ } G_STMT_END
+
+#define nmtst_assert_variant_uint32(variant, val) \
+ G_STMT_START { \
+ GVariant *_variant = (variant); \
+ \
+ nmtst_assert_variant_is_of_type (_variant, G_VARIANT_TYPE_UINT32); \
+ g_assert_cmpint (g_variant_get_uint32 (_variant), ==, (val)); \
+ } G_STMT_END
+
+#define nmtst_assert_variant_string(variant, str) \
+ G_STMT_START { \
+ gsize _l; \
+ GVariant *_variant = (variant); \
+ const char *_str = (str); \
+ \
+ nmtst_assert_variant_is_of_type (_variant, G_VARIANT_TYPE_STRING); \
+ g_assert (_str); \
+ g_assert_cmpstr (g_variant_get_string (_variant, &_l), ==, _str); \
+ g_assert_cmpint (_l, ==, strlen (_str)); \
+ } G_STMT_END
+
typedef enum {
NMTST_VARIANT_EDITOR_CONNECTION,
NMTST_VARIANT_EDITOR_SETTING,