From c7a633f95710fcf2fe9151b41feba7db4b1bab0e Mon Sep 17 00:00:00 2001 From: Rod Sheeter Date: Fri, 16 Feb 2018 11:11:20 -0800 Subject: [PATCH] [subset] try to get more info from bot where g_assert_cmpmem fails --- test/api/hb-subset-test.h | 12 +++++------- test/api/hb-test.h | 11 ++++++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/test/api/hb-subset-test.h b/test/api/hb-subset-test.h index 96d5c05a6..12d402d33 100644 --- a/test/api/hb-subset-test.h +++ b/test/api/hb-subset-test.h @@ -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); } diff --git a/test/api/hb-test.h b/test/api/hb-test.h index f6f107e28..48ccc3b28 100644 --- a/test/api/hb-test.h +++ b/test/api/hb-test.h @@ -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