From 19742408cf3d83bb67e4b8c2fc3b0cbbee7bee59 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 21 Dec 2018 10:18:28 +0100 Subject: GSUP: add end marker to enum osmo_gsup_iei Simplify gsup_test.c by defining an end marker in gsup.h. No need to manually update the last element every time anymore. The C standard guarantees, that the end marker will have the last value plus one: "Each subsequent enumerator with no = defines its enumeration constant as the value of the constant expression obtained by adding 1 to the value of the previous enumeration constant." (From C99: 6.7.2.2 Enumeration specifiers) Change-Id: I2aab7245e209f0ebd2f33a83d4d181dd3339cb17 --- tests/gsup/gsup_test.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c index b3a8c772..079a7031 100644 --- a/tests/gsup/gsup_test.c +++ b/tests/gsup/gsup_test.c @@ -401,11 +401,7 @@ static void test_gsup_messages_dec_enc(void) osmo_hexdump(t->data + j, ie_end - j)); OSMO_ASSERT(j <= ie_end - 2); - /** - * FIXME: share the maximal IE value somehow - * in order to avoid manual updating of this - */ - OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_SM_ALERT_RSN_IE); + OSMO_ASSERT(t->data[j+0] < _OSMO_GSUP_IEI_END_MARKER); OSMO_ASSERT(t->data[j+1] <= ie_end - j - 2); ie_end = j; -- cgit v1.2.3