From 71f05eec1b0d5f070f9800c28f08882bcdbd879e Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Mon, 22 Jul 2019 20:21:46 +0100 Subject: [PATCH] test-utils: Add some missing test assertions etc. tests/test-library uses g_assert_nonnull(), which isn't available in SteamRT 1 'scout'. While I'm here, add all the other assertion wrappers from GLib 2.58 that aren't available in 2.32 (except for the rather niche g_assert_cmpfloat_with_epsilon()), along with g_test_skip(). Signed-off-by: Simon McVittie <smcv@collabora.com> --- tests/test-utils.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test-utils.h b/tests/test-utils.h index 0e526a7d2..e963a2549 100644 --- a/tests/test-utils.h +++ b/tests/test-utils.h @@ -30,6 +30,8 @@ * for use with older GLib versions. */ +#include <glib.h> + #ifndef g_assert_true #define g_assert_true(x) g_assert ((x)) #endif @@ -42,6 +44,23 @@ #define g_assert_cmpint(a, op, b) g_assert ((a) op (b)) #endif +#ifndef g_assert_cmpmem +#define g_assert_cmpmem(m1, l1, m2, l2) \ + g_assert (l1 == l2 && memcmp (m1, m2, l1) == 0) +#endif + #ifndef g_assert_cmpstr #define g_assert_cmpstr(a, op, b) g_assert (g_strcmp0 ((a), (b)) op 0) #endif + +#ifndef g_assert_nonnull +#define g_assert_nonnull(x) g_assert ((x) != NULL) +#endif + +#ifndef g_assert_null +#define g_assert_null(x) g_assert ((x) == NULL) +#endif + +#if !GLIB_CHECK_VERSION(2, 38, 0) +#define g_test_skip(msg) g_test_message ("SKIP: %s", msg) +#endif -- GitLab