diff options
Diffstat (limited to 'tests/msgfile')
-rw-r--r-- | tests/msgfile/Makefile.am | 5 | ||||
-rw-r--r-- | tests/msgfile/msgconfig.cfg | 1 | ||||
-rw-r--r-- | tests/msgfile/msgfile_test.c | 50 |
3 files changed, 56 insertions, 0 deletions
diff --git a/tests/msgfile/Makefile.am b/tests/msgfile/Makefile.am new file mode 100644 index 00000000..c9f4bec2 --- /dev/null +++ b/tests/msgfile/Makefile.am @@ -0,0 +1,5 @@ +INCLUDES = $(all_includes) -I$(top_srcdir)/include +noinst_PROGRAMS = msgfile_test + +msgfile_test_SOURCES = msgfile_test.c +msgfile_test_LDADD = $(top_builddir)/src/libosmocore.la diff --git a/tests/msgfile/msgconfig.cfg b/tests/msgfile/msgconfig.cfg new file mode 100644 index 00000000..dfaad299 --- /dev/null +++ b/tests/msgfile/msgconfig.cfg @@ -0,0 +1 @@ +*:*::Hello Welt diff --git a/tests/msgfile/msgfile_test.c b/tests/msgfile/msgfile_test.c new file mode 100644 index 00000000..a82ac516 --- /dev/null +++ b/tests/msgfile/msgfile_test.c @@ -0,0 +1,50 @@ +/* + * (C) 2010 by Holger Hans Peter Freyther + * (C) 2010 by On-Waves + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include <osmocore/msgfile.h> + +#include <stdio.h> + +static void dump_entries(struct msg_entries *entries) +{ + struct msg_entry *entry; + + if (!entries) { + fprintf(stderr, "Failed to parse the file\n"); + return; + } + + llist_for_each_entry(entry, &entries->entry, list) { + printf("Entry '%s:%s:%s:%s'\n", + entry->mcc, entry->mnc, entry->option, entry->text); + } +} + +int main(int argc, char **argv) +{ + struct msg_entries *entries; + + /* todo use msgfile_test.c.in and replace the path */ + entries = msg_entry_parse(NULL, "msgconfig.cfg"); + dump_entries(entries); + + return 0; +} |