add g_assert_equal_variants
Submitted by Guillaume Desmottes
Link to original bug (#769928)
Description
I end up writing this macro which could be a nice addition to the g_assert_* collection. If you think as well let me know and I'll provide a proper patch.
#define g_assert_equal_variants(v1, v2)
G_STMT_START
{
GVariant *__v1 = (v1), *__v2 = (v2);
if (!g_variant_equal (__v1, __v2))
{
gchar *__s1, *__s2, *__msg;
__s1 = g_variant_print (__v1, TRUE);
__s2 = g_variant_print (__v2, TRUE);
__msg = g_strdup_printf (#v1 " %s does not equal " #v2 " %s", __s1, __s2);
g_assertion_message (G_LOG_DOMAIN, FILE, LINE, G_STRFUNC, __msg);
g_free (__s1);
g_free (__s2);
g_free (__msg);
}
}
G_STMT_END