Add unit testing tool for GSM 07.10 multiplexer

This commit is contained in:
Marcel Holtmann 2009-09-05 07:46:50 +02:00
parent 5847975b89
commit 6dae50d8e5
3 changed files with 65 additions and 2 deletions

1
.gitignore vendored
View File

@ -34,3 +34,4 @@ unit/test-common
unit/test-util
unit/test-sms
unit/test-simutil
unit/test-mux

View File

@ -184,7 +184,8 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GTHREAD_CFLAGS@ \
-DPLUGINDIR=\""$(build_plugindir)"\"
INCLUDES = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/src \
-I$(srcdir)/gdbus -I$(srcdir)/gisi -I$(srcdir)/gatchat
-I$(srcdir)/gdbus -I$(srcdir)/gisi \
-I$(srcdir)/gatmux -I$(srcdir)/gatchat
doc_files = doc/overview.txt \
doc/manager-api.txt doc/modem-api.txt doc/network-api.txt \
@ -212,7 +213,7 @@ dist_man_MANS = doc/ofonod.8
unit_objects =
noinst_PROGRAMS = unit/test-common unit/test-util \
unit/test-sms unit/test-simutil
unit/test-sms unit/test-simutil unit/test-mux
unit_test_common_SOURCES = unit/test-common.c src/common.c
unit_test_common_LDADD = @GLIB_LIBS@
@ -231,6 +232,10 @@ unit_test_simutil_SOURCES = unit/test-simutil.c src/util.c \
unit_test_simutil_LDADD = @GLIB_LIBS@
unit_objects += $(unit_test_simutil_OBJECTS)
unit_test_mux_SOURCES = unit/test-mux.c gatmux/gsm0710_p.h gatmux/gsm0710.c
unit_test_mux_LDADD = @GLIB_LIBS@
unit_objects += $(unit_test_mux_OBJECTS)
DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles

57
unit/test-mux.c Normal file
View File

@ -0,0 +1,57 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2009 Intel Corporation. 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 version 2 as
* published by the Free Software Foundation.
*
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
#include <glib/gprintf.h>
#include "gsm0710_p.h"
static void debug_message(struct gsm0710_context *ctx, const char *msg)
{
g_print("debug: %s\n", msg);
}
static void test_setup(void)
{
struct gsm0710_context ctx;
gsm0710_initialize(&ctx);
ctx.fd = -1;
ctx.debug_message = debug_message;
gsm0710_startup(&ctx, 0);
gsm0710_shutdown(&ctx);
}
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
g_test_add_func("/testmux/Setup", test_setup);
return g_test_run();
}