This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/7790
test_gsm0808_enc_dec_cell_id_list_lac(): validate encoded bytes
Change-Id: I81b1ffbe6a5ec566c112492c2cbaf99c018c45bb
---
M tests/gsm0808/gsm0808_test.c
M tests/gsm0808/gsm0808_test.ok
2 files changed, 9 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/90/7790/1
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index 13ae3ce..4e91832 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -750,6 +750,13 @@
msgb_free(msg);
}
+#define EXPECT_ENCODED(hexstr) do { \
+ const char *enc_str = msgb_hexdump(msg); \
+ printf("%s: encoded: %s(rc = %u)\n", __func__, enc_str, rc_enc); \
+ OSMO_ASSERT(strcmp(enc_str, hexstr " ") == 0); \
+ OSMO_ASSERT(rc_enc == msg->len); \
+ } while(0)
+
static void test_gsm0808_enc_dec_cell_id_list_lac()
{
struct gsm0808_cell_id_list2 enc_cil;
@@ -767,7 +774,7 @@
msg = msgb_alloc(1024, "output buffer");
rc_enc = gsm0808_enc_cell_id_list2(msg, &enc_cil);
- OSMO_ASSERT(rc_enc == 9);
+ EXPECT_ENCODED("1a 07 05 56 78 00 00 00 00");
rc_dec = gsm0808_dec_cell_id_list2(&dec_cil, msg->data + 2, msg->len - 2);
OSMO_ASSERT(rc_dec == 7);
@@ -1255,13 +1262,6 @@
printf("------- %s done\n", __func__);
}
-
-#define EXPECT_ENCODED(hexstr) do { \
- const char *enc_str = msgb_hexdump(msg); \
- printf("%s: encoded: %s(rc = %u)\n", __func__, enc_str, rc_enc); \
- OSMO_ASSERT(strcmp(enc_str, hexstr " ") == 0); \
- OSMO_ASSERT(rc_enc == msg->len); \
- } while(0)
static void test_gsm0808_enc_dec_cell_id_lac()
{
diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok
index 1f51aea..6e5e118 100644
--- a/tests/gsm0808/gsm0808_test.ok
+++ b/tests/gsm0808/gsm0808_test.ok
@@ -19,6 +19,7 @@
Testing creating Paging Request
Testing creating DTAP
Testing prepend DTAP
+test_gsm0808_enc_dec_cell_id_list_lac: encoded: 1a 07 05 56 78 00 00 00 00 (rc = 9)
------- test_cell_id_list_add
cell_id_list cgi[0] = {
}
--
To view, visit https://gerrit.osmocom.org/7790
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I81b1ffbe6a5ec566c112492c2cbaf99c018c45bb
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>