dexter has uploaded this change for review.
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
---
M src/tests/test-ranap.c
1 file changed, 25 insertions(+), 21 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/99/26899/1
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 @@
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 @@
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 @@
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);
To view, visit change 26899. To unsubscribe, or for help writing mail filters, visit settings.