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
changes/99/26899/2
Philipp Maier 1 year ago committed by laforge
parent fd410172bf
commit fb58a448b1
  1. 46
      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);

Loading…
Cancel
Save