VLR tests: add logging macro with explicit value description

To avoid leaking structure details into test we sometimes have to
separate value description from actual value. Introduce new macro which
makes that possible and convert old one into trivial wrapper around it.

Change-Id: Ic462297edac4c55689f93cc45771c8b5e2aed864
This commit is contained in:
Max 2018-12-17 17:09:17 +01:00
parent 964da93c69
commit bb53a3f64a
1 changed files with 5 additions and 3 deletions

View File

@ -182,11 +182,13 @@ void thwart_rx_non_initial_requests();
OSMO_ASSERT(accepted == expect_accepted); \
} while (false)
#define VERBOSE_ASSERT(val, expect_op, fmt) \
#define VAL_ASSERT(desc, val, expect_op, fmt) \
do { \
log(#val " == " fmt, (val)); \
log(desc " == " fmt, (val)); \
OSMO_ASSERT((val) expect_op); \
} while (0);
} while (0)
#define VERBOSE_ASSERT(val, expect_op, fmt) VAL_ASSERT(#val, val, expect_op, fmt)
#define EXPECT_CONN_COUNT(N) VERBOSE_ASSERT(llist_count(&net->ran_conns), == N, "%d")