[subset] try to get more info from bot where g_assert_cmpmem fails

This commit is contained in:
Rod Sheeter 2018-02-16 11:11:20 -08:00
parent 0bb2d7ac12
commit c7a633f957
2 changed files with 13 additions and 10 deletions

View File

@ -112,13 +112,11 @@ hb_subset_test_check (hb_face_t *expected,
hb_face_t *actual,
hb_tag_t table)
{
hb_blob_t *glyf_expected_blob = hb_face_reference_table (expected, table);
hb_blob_t *glyf_actual_blob = hb_face_reference_table (actual, table);
unsigned int expected_length, actual_length;
g_assert_cmpmem(hb_blob_get_data (glyf_expected_blob, &expected_length), expected_length,
hb_blob_get_data (glyf_actual_blob, &actual_length), actual_length);
hb_blob_destroy (glyf_actual_blob);
hb_blob_destroy (glyf_expected_blob);
hb_blob_t *expected_blob = hb_face_reference_table (expected, table);
hb_blob_t *actual_blob = hb_face_reference_table (actual, table);
hb_test_assert_blob_eq(expected_blob, actual_blob);
hb_blob_destroy (expected_blob);
hb_blob_destroy (actual_blob);
}

View File

@ -161,9 +161,14 @@ typedef void (*hb_test_fixture_func_t) (void);
#define g_test_fail() g_error("Test failed")
#endif
#ifndef g_assert_cmpmem
#define g_assert_cmpmem(m1, l1, m2, l2) g_assert_true (l1 == l2 && memcmp (m1, m2, l1) == 0)
#endif
static inline void hb_test_assert_blob_eq(hb_blob_t *expected_blob, hb_blob_t *actual_blob)
{
unsigned int expected_length, actual_length;
const char *raw_expected = hb_blob_get_data (expected_blob, &expected_length);
const char *raw_actual = hb_blob_get_data (actual_blob, &actual_length);
g_assert_cmpint(expected_length, ==, actual_length);
g_assert_cmpint(0, ==, memcmp(raw_expected, raw_actual, expected_length));
}
static inline void