summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-21 15:38:16 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-25 23:04:38 +0800
commitc459c0491af7a72e5a17a70e3f3bec8a320fc24e (patch)
tree5506637ecc27ed624befe10d0ba07b310e54f00e /tests
parent902e32e051714249a451f535be2cb5394b24eb3c (diff)
[sccp] Parse the error message and add a unit test for it.
Diffstat (limited to 'tests')
-rw-r--r--tests/sccp/sccp_test.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/sccp/sccp_test.c b/tests/sccp/sccp_test.c
index 0c2adc8..31eb47f 100644
--- a/tests/sccp/sccp_test.c
+++ b/tests/sccp/sccp_test.c
@@ -264,6 +264,10 @@ static const u_int8_t it_test[] = {
0x10, 0x01, 0x07,
0x94, 0x01, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00 };
+static const u_int8_t proto_err[] = {
+0x0f, 0x0c, 0x04, 0x00, 0x00,
+};
+
static const struct sccp_parse_header_result parse_result[] = {
{
.msg_type = SCCP_MSG_TYPE_IT,
@@ -287,6 +291,21 @@ static const struct sccp_parse_header_result parse_result[] = {
.input = it_test,
.input_len = sizeof(it_test),
},
+ {
+ .msg_type = SCCP_MSG_TYPE_ERR,
+ .wanted_len = 0,
+ .src_ssn = -1,
+ .dst_ssn = -1,
+ .has_src_ref = 0,
+ .has_dst_ref = 1,
+ .dst_ref = {
+ .octet1 = 0x0c,
+ .octet2 = 0x04,
+ .octet3 = 0x00,
+ },
+ .input = proto_err,
+ .input_len = sizeof(proto_err),
+ },
};
@@ -777,7 +796,7 @@ static void test_sccp_parsing(void)
memset(&result, 0, sizeof(result));
if (sccp_parse_header(msg, &result) != 0) {
- fprintf(stderr, "Failed to parse test: %d\n", current_test);
+ fprintf(stderr, "Failed to sccp parse test: %d\n", current_test);
} else {
if (parse_result[current_test].wanted_len != result.data_len) {
fprintf(stderr, "Unexpected data length.\n");