Skip to content
Snippets Groups Projects
Commit cea0b31e authored by rds's avatar rds
Browse files

more tests

parent 18a12966
No related branches found
No related tags found
No related merge requests found
......@@ -137,11 +137,12 @@ libcheckZMap_la_DEPENDENCIES = $(noinst_LTLIBRARIES) $(libcheckZMap_la_LIBADD)
libcheckZMap_la_SOURCES =
libcheckZMap_la_LDFLAGS = -all-static
libcheckZMap_la_LIBADD = \
libpfetch/tests/libcheckPFetch.la \
zmapFeature/tests/libcheckZMapFeature.la \
zmapFeature/tests/libcheckZMapFeature_P.la \
zmapFeature/tests/libcheckZMapStyle.la \
zmapFeature/tests/libcheckZMapStyle_P.la \
libpfetch/tests/libcheckPFetch.la \
zmapUtils/tests/libcheckZMapUtilsConfig.la \
$(NULL)
TESTS = check_zmap
......@@ -156,8 +157,9 @@ check_zmap_DEPENDENCIES = $(check_LTLIBRARIES)
check_zmap_LINK = $(zmap_LINK)
check_zmap_LDADD = @CHECK_LIBS@ -lcheckZMap $(zmap_LDADD)
check_zmap_CFLAGS = @CHECK_CFLAGS@ $(INCLUDE_COMMON) \
-I$(top_srcdir)/zmapFeature \
-I$(top_srcdir)/libpfetch \
-I$(top_srcdir)/zmapFeature \
-I$(top_srcdir)/zmapUtils \
-DCHECK_ZMAP_LOG_TO_FILE \
-DCHECK_ZMAP_LOG=\"$(check_zmap_LOG_FILE)\" \
$(NULL)
......
......@@ -394,6 +394,7 @@ zmapServer/das/Makefile
zmapServer/file/Makefile
zmapThreads/Makefile
zmapUtils/Makefile
zmapUtils/tests/Makefile
zmapView/Makefile
zmapWindow/Makefile
zmapXML/Makefile
......
......@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Apr 1 11:28 2009 (rds)
* Last edited: Apr 3 14:32 2009 (rds)
* Created: Mon Mar 30 15:38:23 2009 (rds)
* CVS info: $Id: check_zmapmain.c,v 1.1 2009-04-01 11:56:49 rds Exp $
* CVS info: $Id: check_zmapmain.c,v 1.2 2009-04-03 15:44:00 rds Exp $
*-------------------------------------------------------------------
*/
......@@ -51,6 +51,7 @@ static ZMapCheckSuiteCreateFunc zmap_suite_funcs_G[] = {
zMapCheckStyleSuite,
zMapCheckFeatureSuite,
zMapCheckPfetchSuite,
zMapCheckConfigLoader,
NULL
};
......@@ -150,6 +151,7 @@ int main(int argc, char *argv[])
SRunner *zmap_runner = NULL;
ZMapCheckSuiteCreateFunc *all_suites_ptr;
int failed_test_count = 0;
int test_timeout = ZMAP_DEFAULT_TIMEOUT;
printf("~~~~~~~~~~~~~~~~~~~~~\n");
printf("| ZMap Test Harness |\n");
......@@ -164,6 +166,12 @@ int main(int argc, char *argv[])
{
Suite *suite;
/*
* I was going to pass the timeout through, but realised
* that export CK_DEFAULT_TIMEOUT=0 is better.
* if((suite = (all_suites_ptr[0])(test_timeout)))
*/
if((suite = (all_suites_ptr[0])()))
srunner_add_suite(zmap_runner, suite);
......
......@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Mar 31 10:49 2009 (rds)
* Last edited: Apr 3 12:02 2009 (rds)
* Created: Mon Mar 30 20:30:25 2009 (rds)
* CVS info: $Id: zmapSuites.h,v 1.1 2009-04-01 11:56:49 rds Exp $
* CVS info: $Id: zmapSuites.h,v 1.2 2009-04-03 15:44:00 rds Exp $
*-------------------------------------------------------------------
*/
......@@ -47,6 +47,7 @@
#include <tests/check_zmapFeature.h>
#include <tests/check_zmapStyle.h>
#include <tests/check_libpfetch.h>
#include <tests/check_zmapConfigLoader.h>
#endif /* ZMAP_SUITES_H */
......
include $(top_srcdir)/Makefile.common
SUBDIRS = . tests
noinst_LTLIBRARIES = libZMapUtils.la
libZMapUtils_la_SOURCES = zmapUtilsConfig.c \
......
Makefile
Makefile.in
include $(top_srcdir)/Makefile.common
check_LTLIBRARIES = \
libcheckZMapUtilsConfig.la \
$(NULL)
libcheckZMapUtilsConfig_la_location = $(top_srcdir)/share/ZMap
libcheckZMapUtilsConfig_la_filename = ZMap
libcheckZMapUtilsConfig_la_SOURCES = check_zmapConfigLoader.c check_zmapConfigLoader.h
libcheckZMapUtilsConfig_la_LIBADD =
libcheckZMapUtilsConfig_la_CFLAGS = $(INCLUDE_COMMON) @CHECK_CFLAGS@ \
-DCONFIG_DIR=\"$(libcheckZMapUtilsConfig_la_location)\" \
-DCONFIG_FILE=\"$(libcheckZMapUtilsConfig_la_filename)\" \
$(NULL)
/* File: check_zmapConfigLoader.c
* Author: Roy Storey (rds@sanger.ac.uk)
* Copyright (c) 2009: Genome Research Ltd.
*-------------------------------------------------------------------
* ZMap 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see the on-line version at http://www.gnu.org/copyleft/gpl.txt
*-------------------------------------------------------------------
* This file is part of the ZMap genome database package
* originally written by:
*
* Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk,
* Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk
*
* Description:
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Apr 3 16:30 2009 (rds)
* Created: Fri Apr 3 10:47:20 2009 (rds)
* CVS info: $Id: check_zmapConfigLoader.c,v 1.1 2009-04-03 15:45:58 rds Exp $
*-------------------------------------------------------------------
*/
#include <check_zmapConfigLoader.h>
START_TEST(check_zMapConfigIniContextProvide)
{
ZMapConfigIniContext context = NULL;
context = zMapConfigIniContextProvide();
if(!context)
{
fail("Failed getting context");
}
return ;
}
END_TEST
START_TEST(check_zMapConfigIniContextGetSources)
{
ZMapConfigIniContext context = NULL;
GList *sources = NULL;
context = zMapConfigIniContextProvide();
sources = zMapConfigIniContextGetSources(context);
if(!sources)
{
fail("No sources found");
}
if(g_list_length(sources) != 2)
{
fail("Expected 2 sources");
}
return ;
}
END_TEST
START_TEST(check_zMapConfigIniContextGetString)
{
ZMapConfigIniContext context = NULL;
char *value = NULL;
context = zMapConfigIniContextProvide();
if(!zMapConfigIniContextGetString(context,
ZMAPSTANZA_APP_CONFIG, ZMAPSTANZA_APP_CONFIG,
ZMAPSTANZA_APP_SEQUENCE, &value))
{
fail("Unable to find key '" ZMAPSTANZA_APP_SEQUENCE "' in stanza '" ZMAPSTANZA_APP_CONFIG "'");
}
return ;
}
END_TEST
static void setup_config(void)
{
if(!zMapConfigDirCreate(CONFIG_DIR, CONFIG_FILE))
{
g_print("Using directory '" CONFIG_DIR "' and file '" CONFIG_FILE "'.\n");
fail("Attempt to set config dir and file failed");
}
return ;
}
static void destroy_config(void)
{
return ;
}
Suite *zMapCheckConfigLoader(void)
{
Suite *suite = NULL;
TCase *test_case = NULL;
suite = suite_create(ZMAP_CHECK_CONFIG_SUITE_NAME);
test_case = tcase_create(ZMAP_CHECK_CONFIG_SUITE_NAME " Tests");
tcase_add_unchecked_fixture(test_case, setup_config, destroy_config);
tcase_add_test(test_case, check_zMapConfigIniContextProvide);
tcase_add_test(test_case, check_zMapConfigIniContextGetSources);
tcase_add_test(test_case, check_zMapConfigIniContextGetString);
suite_add_tcase(suite, test_case);
return suite;
}
/* File: check_zmapConfigLoader.h
* Author: Roy Storey (rds@sanger.ac.uk)
* Copyright (c) 2009: Genome Research Ltd.
*-------------------------------------------------------------------
* ZMap 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see the on-line version at http://www.gnu.org/copyleft/gpl.txt
*-------------------------------------------------------------------
* This file is part of the ZMap genome database package
* originally written by:
*
* Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk,
* Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk
*
* Description:
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Apr 3 14:34 2009 (rds)
* Created: Fri Apr 3 10:53:42 2009 (rds)
* CVS info: $Id: check_zmapConfigLoader.h,v 1.1 2009-04-03 15:45:58 rds Exp $
*-------------------------------------------------------------------
*/
#ifndef CHECK_ZMAP_CONFIG_LOADER_H
#define CHECK_ZMAP_CONFIG_LOADER_H
#include <glib.h>
#include <check.h>
#include <ZMap/zmapConfigDir.h>
#include <ZMap/zmapConfigLoader.h>
#define ZMAP_CHECK_CONFIG_SUITE_NAME "Config Loader Suite"
#ifndef CONFIG_DIR
#define CONFIG_DIR "share/ZMap"
#endif /* CONFIG_DIR */
#ifndef CONFIG_FILE
#define CONFIG_FILE "ZMap"
#endif /* CONFIG_FILE */
Suite *zMapCheckConfigLoader(void);
#endif /* CHECK_ZMAP_CONFIG_LOADER_H */
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment