G_STRFUNC, #a "[" #na"] " #cmp " " #b "[" #nb "]", \
__p1, __n1, #cmp, __p2, __n2); } while (0)
+#define egg_assert_cmpbytes(a, cmp, b, nb) \
+ do { gpointer __p1 = (gpointer)(a); gconstpointer __p2 = (b); gsize __n2 = (nb); \
+ if (egg_bytes_get_size (__p1) cmp __n2 && memcmp (egg_bytes_get_data (__p1), __p2, __n2) cmp 0) ; else \
+ egg_assertion_message_cmpmem (G_LOG_DOMAIN, __FILE__, __LINE__, \
+ G_STRFUNC, #a " " #cmp " " #b, \
+ egg_bytes_get_data (__p1), egg_bytes_get_size(__p1), #cmp, __p2, __n2); } while (0)
+
void egg_assertion_message_cmpmem (const char *domain, const char *file,
int line, const char *func,
const char *expr, gconstpointer arg1,
data = egg_asn1x_encode (asn, NULL);
g_assert (data != NULL);
- egg_assert_equal_bytes (data, SEQ_ENCODING, XL (SEQ_ENCODING));
+ egg_assert_cmpbytes (data, ==, SEQ_ENCODING, XL (SEQ_ENCODING));
check = egg_asn1x_get_element_raw (node);
g_assert (check);
- egg_assert_equal_bytes (check, SFARNSWORTH, XL (SFARNSWORTH));
+ egg_assert_cmpbytes (check, ==, SFARNSWORTH, XL (SFARNSWORTH));
egg_bytes_unref (data);
egg_bytes_unref (check);
data = egg_asn1x_encode (asn, NULL);
g_assert (data != NULL);
- egg_assert_equal_bytes (data, SEQ_ENCODING, XL (SEQ_ENCODING));
+ egg_assert_cmpbytes (data, ==, SEQ_ENCODING, XL (SEQ_ENCODING));
check = egg_asn1x_get_element_raw (node);
g_assert (check);
- egg_assert_equal_bytes (check, SFARNSWORTH, XL (SFARNSWORTH));
+ egg_assert_cmpbytes (check, ==, SFARNSWORTH, XL (SFARNSWORTH));
egg_bytes_unref (data);
egg_bytes_unref (check);
}
g_assert (data != NULL);
- egg_assert_equal_bytes (data, encoding, n_encoding);
+ egg_assert_cmpbytes (data, ==, encoding, n_encoding);
check = egg_asn1x_get_element_raw (node);
g_assert (check != NULL);
- egg_assert_equal_bytes (check, SFARNSWORTH, XL (SFARNSWORTH));
+ egg_assert_cmpbytes (check, ==, SFARNSWORTH, XL (SFARNSWORTH));
egg_bytes_unref (data);
egg_bytes_unref (check);
data = egg_asn1x_encode (asn, NULL);
g_assert (data != NULL);
- egg_assert_equal_bytes (data, SEQOF_TWO, XL (SEQOF_TWO));
+ egg_assert_cmpbytes (data, ==, SEQOF_TWO, XL (SEQOF_TWO));
egg_bytes_unref (data);
egg_asn1x_destroy (asn);
g_assert_not_reached ();
}
- egg_assert_equal_bytes (data, SETOF_THREE, XL (SETOF_THREE));
+ egg_assert_cmpbytes (data, ==, SETOF_THREE, XL (SETOF_THREE));
egg_bytes_unref (data);
egg_asn1x_destroy (asn);
g_assert_not_reached ();
}
- egg_assert_equal_bytes (data, SETOF_NONE, XL (SETOF_NONE));
+ egg_assert_cmpbytes (data, ==, SETOF_NONE, XL (SETOF_NONE));
egg_bytes_unref (data);
egg_asn1x_destroy (asn);
data = egg_asn1x_encode (asn, NULL);
g_assert (data != NULL);
- egg_assert_equal_bytes (data, ENUM_THREE, XL (ENUM_THREE));
+ egg_assert_cmpbytes (data, ==, ENUM_THREE, XL (ENUM_THREE));
egg_bytes_unref (data);
egg_asn1x_destroy (asn);
data = egg_asn1x_get_raw_value (egg_asn1x_node (asn, "data", NULL));
g_assert (data != NULL);
- egg_assert_equal_bytes (data, "SOME DATA", 9);
+ egg_assert_cmpbytes (data, ==, "SOME DATA", 9);
egg_bytes_unref (data);
egg_asn1x_destroy (asn);