aboutsummaryrefslogtreecommitdiffstats
path: root/tests/subchan_demux/subchan_demux_test.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-10-11 08:25:36 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-10-12 16:23:31 +0200
commitbc5dcb11a714c3e73982299f421790b3da93e584 (patch)
tree9fc1bb946e6643383bde9eddbb2d60f4ca44bc83 /tests/subchan_demux/subchan_demux_test.c
parentf684976724b04324f2634755bc0f2904c67d91c9 (diff)
tests: Add a test stub for the subchan_demux tests
Tobias has worked on CSD support and Dieter has helped with a CSD trau fix. This is a stub that should allow to easily write a test case for the syncing issue observed by Tobias. Run the tests: $ make check In case of failure: $ vi tests/testsuite.dir/1/testsuite.log Add the actual content: $ edit tests/subchan_demux/subchan_demux_test.c Update the test result: $ ./tests/subchan_demux/subchan_demux_test > tests/subchan_demux/subchan_demux_test.ok
Diffstat (limited to 'tests/subchan_demux/subchan_demux_test.c')
-rw-r--r--tests/subchan_demux/subchan_demux_test.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/subchan_demux/subchan_demux_test.c b/tests/subchan_demux/subchan_demux_test.c
new file mode 100644
index 0000000..75c5901
--- /dev/null
+++ b/tests/subchan_demux/subchan_demux_test.c
@@ -0,0 +1,57 @@
+/* Subchan Demux syncing test */
+
+/* (C) 2012 by Holger Hans Peter Freyther
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <osmocom/abis/subchan_demux.h>
+#include <osmocom/core/utils.h>
+
+#include <stdio.h>
+#include <string.h>
+
+static int data_cb(struct subch_demux *demux, int ch, uint8_t *data, int len, void *p)
+{
+ printf("DATA_CB Channel(%d): %s\n",
+ ch, osmo_hexdump(data, len));
+ return 0;
+}
+
+static void test_csd(void)
+{
+ struct subch_demux demux;
+ memset(&demux, 0, sizeof(demux));
+ subch_demux_init(&demux);
+
+ demux.out_cb = data_cb;
+
+ /* Push data into the demuxer and see what happens. */
+ printf("Testing the csd sync.\n");
+
+}
+
+int main(int argc, char **argv)
+{
+ printf("Testing the subchannel demux.\n");
+
+ /* run the tests */
+ test_csd();
+
+ printf("No crashes.\n");
+ return 0;
+}