aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2022-01-13 10:26:39 +0100
committerlaforge <laforge@osmocom.org>2022-01-13 17:20:30 +0000
commitfb58a448b1582dc5180509a8b23cf9a41431828a (patch)
tree8770ea80404c6e4166996410402766940be5b50d
parentfd410172bfba4812e10aa1b62f8b332450dde785 (diff)
test-ranap: put message gen tests into function
This unit test generats a lot of ranap messages for test, but the code for that is in the main() function. Lets seperate this test code into its own function like we do it in all other unit tests. Change-Id: I7021e48b051afb6f13fdd54843d4cd92a499de2a
-rw-r--r--src/tests/test-ranap.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/tests/test-ranap.c b/src/tests/test-ranap.c
index b3ea4cb..73987f6 100644
--- a/src/tests/test-ranap.c
+++ b/src/tests/test-ranap.c
@@ -77,7 +77,7 @@ static void test_aper_causemisc(uint32_t inp, uint8_t exp_enc)
ASN_STRUCT_FREE(asn_DEF_RANAP_Cause, c_dec);
}
-int main(int argc, char **argv)
+static void test_ranap_messages(void)
{
uint8_t nas_buf[] = { 0xaa, 0xbb, 0xcc };
struct msgb *msg;
@@ -91,26 +91,6 @@ int main(int argc, char **argv)
uint8_t ck[16] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
int i;
- asn1_xer_print = 1;
-
- //asn_debug = 1;
-
- test_common_init();
- ranap_set_log_area(DRANAP);
-
- test_aper_int(1);
- test_aper_int(2);
- test_aper_int(3);
- test_aper_int(255);
- test_aper_int(256);
- test_aper_int(257);
- test_aper_int(64000);
- test_aper_int(0xffff);
- test_aper_int(0xffff+1);
- test_aper_int(0xffff+2);
- test_aper_int(16000000);
- test_aper_causemisc(RANAP_CauseMisc_unspecified_failure, 0x42);
-
for (i = 0; i < 1; i++) {
printf("\n==> DIRECT TRANSFER\n");
msg = ranap_new_msg_dt(0, nas_buf, sizeof(nas_buf));
@@ -191,6 +171,30 @@ int main(int argc, char **argv)
printf("%s\n", msgb_hexdump(msg));
msgb_free(msg);
}
+}
+
+int main(int argc, char **argv)
+{
+ asn1_xer_print = 1;
+
+ //asn_debug = 1;
+
+ test_common_init();
+ ranap_set_log_area(DRANAP);
+
+ test_aper_int(1);
+ test_aper_int(2);
+ test_aper_int(3);
+ test_aper_int(255);
+ test_aper_int(256);
+ test_aper_int(257);
+ test_aper_int(64000);
+ test_aper_int(0xffff);
+ test_aper_int(0xffff+1);
+ test_aper_int(0xffff+2);
+ test_aper_int(16000000);
+ test_aper_causemisc(RANAP_CauseMisc_unspecified_failure, 0x42);
+ test_ranap_messages();
printf("report\n");
talloc_report(talloc_asn1_ctx, stdout);