aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-11-07 16:33:39 +0100
committerStefan Sperling <ssperling@sysmocom.de>2018-11-15 15:57:59 +0100
commitc5721545c6cd69effcef612a14c01aa4be89adde (patch)
tree97fd63dfe4a622a5a4385517ebbef68ca6a190bb /tests
parent60509688527efdf2a90b2d4241034a9775898940 (diff)
use enums consistently instead of falling back to int
The two existing enums defined in gprs_sndcp_xid.h, for protocol and data compression algorithm numbers respectively, were assigned to 'int' variables when their values were copied to other structures. This prevented the compiler from checking the enum value coverage during switch statements and also tripped up Coverity scans looking for enum value mismatch problems. So instead of copying enums to ints, make use of the enums throughout. Structures which can contain values from both enums now use a union of both, forcing us to be very explicit about which set of values we are dealing with. Change-Id: I3771a5c59f4e6fee24083b3c914965baf192cbd7 Depends: If6f3598cd6da4643ff2214e21c0d21f6eff0eb67 Depends: I8444c1ed052707c76a979fb06cb018ac678defa7 Related: CID#149102
Diffstat (limited to 'tests')
-rw-r--r--tests/sndcp_xid/sndcp_xid_test.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/sndcp_xid/sndcp_xid_test.c b/tests/sndcp_xid/sndcp_xid_test.c
index 5ed695c5..56b97e33 100644
--- a/tests/sndcp_xid/sndcp_xid_test.c
+++ b/tests/sndcp_xid/sndcp_xid_test.c
@@ -106,7 +106,7 @@ static void test_xid_encode_decode(const void *ctx)
/* Setup rfc1144 compression field */
rfc1144_comp_field.p = 1;
rfc1144_comp_field.entity = 0;
- rfc1144_comp_field.algo = RFC_1144;
+ rfc1144_comp_field.algo.pcomp = RFC_1144;
rfc1144_comp_field.comp[RFC1144_PCOMP1] = 1;
rfc1144_comp_field.comp[RFC1144_PCOMP2] = 2;
rfc1144_comp_field.comp_len = RFC1144_PCOMP_NUM;
@@ -126,7 +126,7 @@ static void test_xid_encode_decode(const void *ctx)
/* Setup rfc2507 compression field */
rfc2507_comp_field.p = 1;
rfc2507_comp_field.entity = 1;
- rfc2507_comp_field.algo = RFC_2507;
+ rfc2507_comp_field.algo.pcomp = RFC_2507;
rfc2507_comp_field.comp[RFC2507_PCOMP1] = 3;
rfc2507_comp_field.comp[RFC2507_PCOMP2] = 4;
rfc2507_comp_field.comp[RFC2507_PCOMP3] = 5;
@@ -173,7 +173,7 @@ static void test_xid_encode_decode(const void *ctx)
/* Setup ROHC compression field */
rohc_comp_field.p = 1;
rohc_comp_field.entity = 2;
- rohc_comp_field.algo = ROHC;
+ rohc_comp_field.algo.pcomp = ROHC;
rohc_comp_field.comp[ROHC_PCOMP1] = 8;
rohc_comp_field.comp[ROHC_PCOMP2] = 9;
rohc_comp_field.comp_len = ROHC_PCOMP_NUM;
@@ -191,7 +191,7 @@ static void test_xid_encode_decode(const void *ctx)
/* Setup v42bis compression field */
v42bis_comp_field.p = 1;
v42bis_comp_field.entity = 3;
- v42bis_comp_field.algo = V42BIS;
+ v42bis_comp_field.algo.dcomp = V42BIS;
v42bis_comp_field.comp[V42BIS_DCOMP1] = 10;
v42bis_comp_field.comp_len = V42BIS_DCOMP_NUM;
v42bis_comp_field.v42bis_params = &v42bis_params;
@@ -211,7 +211,7 @@ static void test_xid_encode_decode(const void *ctx)
/* Setup v44 compression field */
v44_comp_field.p = 1;
v44_comp_field.entity = 3;
- v44_comp_field.algo = V44;
+ v44_comp_field.algo.dcomp = V44;
v44_comp_field.comp[V44_DCOMP1] = 10;
v44_comp_field.comp[V44_DCOMP2] = 11;
v44_comp_field.comp_len = V44_DCOMP_NUM;