aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2013-12-11 16:50:36 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-12-18 12:09:47 +0100
commit61cfda41f9443071bc84a7bf2b0dfd47951ca0a0 (patch)
tree5e12d1c7cb128718e83349adaa5f3096df49366a
parent0b362ae926a213dd9cad8ac5a335673c7c32549d (diff)
tests/TypesTest: Add macro to compare memory regions
Prints them out in case of failure
-rw-r--r--tests/types/TypesTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp
index ea9fdbe..51aebee 100644
--- a/tests/types/TypesTest.cpp
+++ b/tests/types/TypesTest.cpp
@@ -32,6 +32,16 @@ extern "C" {
#include <osmocom/core/utils.h>
}
+#define OSMO_ASSERT_MEM_EQ(a, b, size) \
+ do { \
+ if (memcmp(a, b, size)) { \
+ printf("Data mismatch:\nGot:\t%s\n", \
+ osmo_hexdump((const uint8_t *)a, size)); \
+ printf("Want:\t%s\n", osmo_hexdump((const uint8_t *)b, size)); \
+ OSMO_ASSERT(false); \
+ } \
+ } while (0)
+
#define OSMO_ASSERT_STR_EQ(a, b) \
do { \
if (strcmp(a, b)) { \