summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gsm0808/gsm0808_test.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index 21a0c992..8e21b0cb 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -805,6 +805,42 @@ static void test_gsm0808_enc_dec_cell_id_list_single_lac()
msgb_free(msg);
}
+static void test_gsm0808_enc_dec_cell_id_list_multi_lac()
+{
+ struct gsm0808_cell_id_list2 enc_cil;
+ struct gsm0808_cell_id_list2 dec_cil;
+ struct msgb *msg;
+ uint8_t cil_enc_expected[] = { GSM0808_IE_CELL_IDENTIFIER_LIST, 0x0b, 0x05,
+ 0x23, 0x42,
+ 0x24, 0x43,
+ 0x25, 0x44,
+ 0x26, 0x45,
+ 0x27, 0x46
+ };
+ uint8_t rc_enc;
+ int rc_dec;
+
+ memset(&enc_cil, 0, sizeof(enc_cil));
+ enc_cil.id_discr = CELL_IDENT_LAC;
+ enc_cil.id_list[0].lac = 0x2342;
+ enc_cil.id_list[1].lac = 0x2443;
+ enc_cil.id_list[2].lac = 0x2544;
+ enc_cil.id_list[3].lac = 0x2645;
+ enc_cil.id_list[4].lac = 0x2746;
+ enc_cil.id_list_len = 5;
+
+ msg = msgb_alloc(1024, "output buffer");
+ rc_enc = gsm0808_enc_cell_id_list2(msg, &enc_cil);
+ OSMO_ASSERT(rc_enc == sizeof(cil_enc_expected));
+ OSMO_ASSERT(memcmp(cil_enc_expected, msg->data, msg->len) == 0);
+
+ rc_dec = gsm0808_dec_cell_id_list2(&dec_cil, msg->data + 2, msg->len - 2);
+ OSMO_ASSERT(rc_dec == msg->len - 2);
+ OSMO_ASSERT(memcmp(&enc_cil, &dec_cil, sizeof(enc_cil)) == 0);
+
+ msgb_free(msg);
+}
+
static void test_gsm0808_enc_dec_cell_id_list_bss()
{
struct gsm0808_cell_id_list2 enc_cil;
@@ -861,6 +897,7 @@ int main(int argc, char **argv)
test_gsm0808_enc_dec_encrypt_info();
test_gsm0808_enc_dec_cell_id_list_lac();
test_gsm0808_enc_dec_cell_id_list_single_lac();
+ test_gsm0808_enc_dec_cell_id_list_multi_lac();
test_gsm0808_enc_dec_cell_id_list_bss();
printf("Done\n");