aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-12-10 03:53:28 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-12-10 13:22:46 +0100
commitc21cfaa023686c0c4ff041199ed6a04e48f79d15 (patch)
tree2ffbf5e5d29723238b26aa8a173db967b294e72f /tests
parent03ba4f485bdbf79b9efce862940fd871e7b3dc72 (diff)
isup: Start parsing the ISUP messages
Introduce a ISUP debug category, parse the reset circuit message, add a test case for this easy parsing.
Diffstat (limited to 'tests')
-rw-r--r--tests/isup/Makefile.am6
-rw-r--r--tests/isup/isup_parse_test.c15
2 files changed, 19 insertions, 2 deletions
diff --git a/tests/isup/Makefile.am b/tests/isup/Makefile.am
index 4c51d25..d8ba492 100644
--- a/tests/isup/Makefile.am
+++ b/tests/isup/Makefile.am
@@ -1,4 +1,6 @@
-INCLUDES = $(all_includes) -I$(top_srcdir)/include -Wall
+INCLUDES = $(all_includes) -I$(top_srcdir)/include
+AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS)
noinst_PROGRAMS = isup_parse_test
-isup_parse_test_SOURCES = isup_parse_test.c
+isup_parse_test_SOURCES = isup_parse_test.c $(top_srcdir)/src/isup.c
+isup_parse_test_LDADD = $(LIBOSMOCORE_LIBS)
diff --git a/tests/isup/isup_parse_test.c b/tests/isup/isup_parse_test.c
index 8f99cdb..721e9ce 100644
--- a/tests/isup/isup_parse_test.c
+++ b/tests/isup/isup_parse_test.c
@@ -41,8 +41,23 @@ static void test_cic_parsing()
ASSERT(hdr->msg_type, ISUP_MSG_GRS);
}
+static void test_grs_parsing()
+{
+ static const uint8_t isup_grs[] = {3, 0, 23, 1, 1, 28};
+ struct isup_msg_hdr *hdr;
+ int range;
+
+ hdr = (struct isup_msg_hdr *) isup_grs;
+ range = isup_parse_grs(&hdr->data[0], 3);
+
+ ASSERT(range, 28);
+}
+
int main(int argc, char **argv)
{
test_cic_parsing();
+ test_grs_parsing();
+
+ printf("All tests passed.\n");
return 0;
}