lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-asn1-tcap/+/42745?usp=email )
Change subject: tests: add decode tests for TCAP End tests ......................................................................
tests: add decode tests for TCAP End tests
Change-Id: I5679c4a873176d73e973f5cfccff796fe6dbd941 --- M tests/parse/tcap_parse_test.c 1 file changed, 17 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-asn1-tcap refs/changes/45/42745/1
diff --git a/tests/parse/tcap_parse_test.c b/tests/parse/tcap_parse_test.c index a927b39..fe1e409 100644 --- a/tests/parse/tcap_parse_test.c +++ b/tests/parse/tcap_parse_test.c @@ -29,6 +29,19 @@
static const unsigned char pkt_begin[] = {0x62, 0x06, 0x48, 0x04, 0x00, 0x01, 0x02, 0x03};
+/* a TCAP End with DialoguePortion */ +/* without application tag 11 & 12 */ +static const unsigned char pkt_end_dialog_wo11_wo12[] = { 0x64, 0x06, 0x49, 0x04, 0x7f, 0xc2, 0x92, 0x3a}; + +/* with application tag 11 (dialog) and 12 (component) */ +static const unsigned char pkt_end_dialog_w11_w12[] = {0x64, 0x3c, 0x49, 0x4, 0x7f, 0xc2, 0x92, 0x3a, 0x6b, 0x2a, 0x28, 0x28, 0x6, 0x7, 0x0, 0x11, 0x86, 0x5, 0x1, 0x1, 0x1, 0xa0, 0x1d, 0x61, 0x1b, 0x80, 0x2, 0x7, 0x80, 0xa1, 0x9, 0x6, 0x7, 0x4, 0x0, 0x0, 0x1, 0x0, 0xe, 0x3, 0xa2, 0x3, 0x2, 0x1, 0x0, 0xa3, 0x5, 0xa1, 0x3, 0x2, 0x1, 0x0, 0x6c, 0x8, 0xa3, 0x6, 0x2, 0x1, 0x8a, 0x2, 0x1, 0x1}; + +/* with application tag 11 (dialog) but not 12 (component) */ +static const unsigned char pkt_end_dialog_w11_wo12[] = { 0x64, 0x10, 0x49, 0x04, 0x7f, 0xc2, 0x92, 0x3a, 0x6c, 0x08, 0xa3, 0x06, 0x02, 0x01, 0x8a, 0x02, 0x01, 0x01 }; + +/* with application tag 12 (dialog) but not 11 (component) */ +static const unsigned char pkt_end_dialog_wo11_w12[] = { 0x64 , 0x10 , 0x49 , 0x04 , 0x7f , 0xc2 , 0x92 , 0x3a , 0x6c , 0x08 , 0xa3 , 0x06 , 0x02 , 0x01 , 0x8a , 0x02 , 0x01 , 0x01 }; + struct testvector { const char *name; const unsigned char *vector; @@ -36,6 +49,10 @@ }; static struct testvector testvectors[] = { { .name = "Begin", .vector = pkt_begin, .vector_len = sizeof(pkt_begin) }, + { .name = "End", .vector = pkt_end_dialog_wo11_wo12, .vector_len = sizeof(pkt_end_dialog_wo11_wo12) }, + { .name = "End with Dialog & Component", .vector = pkt_end_dialog_w11_w12, .vector_len = sizeof(pkt_end_dialog_w11_w12) }, + { .name = "End with Component", .vector = pkt_end_dialog_w11_wo12, .vector_len = sizeof(pkt_end_dialog_w11_wo12) }, + { .name = "End with Dialog", .vector = pkt_end_dialog_wo11_w12, .vector_len = sizeof(pkt_end_dialog_wo11_w12) }, };
static int encode_tests(void)