From dea696576a063d982518746c1db37c1c16d0f3e5 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 10 Sep 2009 12:50:55 +0200 Subject: [PATCH] Get rid of useless tests. --- src/.gitignore | 2 - src/Makefile.am | 9 +-- src/test_config.c | 148 ------------------------------------------------ src/test_record.c | 163 ----------------------------------------------------- 4 files changed, 1 insertion(+), 321 deletions(-) delete mode 100644 src/test_config.c delete mode 100644 src/test_record.c diff --git a/src/.gitignore b/src/.gitignore index 8f3ca0a..b810359 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -10,7 +10,5 @@ config.h.in *.a *~ stamp-h1 -test_config -test_record test_sel_thread test_normalize diff --git a/src/Makefile.am b/src/Makefile.am index 2b3ab51..d07d994 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,8 +2,7 @@ sbin_PROGRAMS = pazpar2 -check_PROGRAMS = test_config \ - test_record \ +check_PROGRAMS = \ test_sel_thread \ test_normalize @@ -32,12 +31,6 @@ libpazpar2_a_SOURCES = pazpar2_config.c pazpar2_config.h eventl.c eventl.h \ pazpar2_SOURCES = pazpar2.c pazpar2_LDADD = libpazpar2.a $(YAZLIB) -test_config_SOURCES = test_config.c -test_config_LDADD = libpazpar2.a $(YAZLIB) - -test_record_SOURCES = test_record.c -test_record_LDADD = libpazpar2.a $(YAZLIB) - test_sel_thread_SOURCES = test_sel_thread.c test_sel_thread_LDADD = libpazpar2.a $(YAZLIB) diff --git a/src/test_config.c b/src/test_config.c deleted file mode 100644 index 21b3e5d..0000000 --- a/src/test_config.c +++ /dev/null @@ -1,148 +0,0 @@ -/* This file is part of Pazpar2. - Copyright (C) 2006-2009 Index Data - -Pazpar2 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, or (at your option) any later -version. - -Pazpar2 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 - -*/ - -#if HAVE_CONFIG_H -#include -#endif - -#define USE_TIMING 0 -#if USE_TIMING -#include -#endif - -#include - -#include "pazpar2_config.h" - - - -void test_conf_service(int argc, char **argv) -{ - struct conf_service *service = 0; - service = conf_service_create(0, 4, 3, 0); - - YAZ_CHECK(service); - - // expected metadata failures - YAZ_CHECK(!conf_service_add_metadata(0, 0, "service_needed", - Metadata_type_generic, - Metadata_merge_unique, - Metadata_setting_no, - 1, 1, 1, 0, - Metadata_mergekey_no)); - - YAZ_CHECK(!conf_service_add_metadata(service, -1, "out_of_bounds", - Metadata_type_generic, - Metadata_merge_unique, - Metadata_setting_no, - 1, 1, 1, 0, - Metadata_mergekey_no)); - - YAZ_CHECK(!conf_service_add_metadata(service, 4, "out_of_bounds", - Metadata_type_generic, - Metadata_merge_unique, - Metadata_setting_no, - 1, 1, 1, 0, - Metadata_mergekey_no)); - - YAZ_CHECK(!conf_service_add_metadata(service, 0, 0, //missing name - Metadata_type_generic, - Metadata_merge_unique, - Metadata_setting_no, - 1, 1, 1, 0, - Metadata_mergekey_no)); - - // expected metadata sucesses - YAZ_CHECK(conf_service_add_metadata(service, 0, "title", - Metadata_type_generic, - Metadata_merge_unique, - Metadata_setting_no, - 1, 1, 1, 0, - Metadata_mergekey_no)); - - YAZ_CHECK(conf_service_add_metadata(service, 1, "author", - Metadata_type_generic, - Metadata_merge_longest, - Metadata_setting_no, - 1, 1, 1, 0, - Metadata_mergekey_no)); - - YAZ_CHECK(conf_service_add_metadata(service, 2, "isbn", - Metadata_type_number, - Metadata_merge_no, - Metadata_setting_no, - 1, 1, 1, 0, - Metadata_mergekey_no)); - - YAZ_CHECK(conf_service_add_metadata(service, 3, "year", - Metadata_type_year, - Metadata_merge_range, - Metadata_setting_no, - 1, 1, 1, 0, - Metadata_mergekey_no)); - - - // expected sortkey failures - YAZ_CHECK(!conf_service_add_sortkey(service, -1, "out_of_bounds", - Metadata_sortkey_skiparticle)); - - YAZ_CHECK(!conf_service_add_sortkey(service, -1, "out_of_bounds", - Metadata_sortkey_string)); - - YAZ_CHECK(!conf_service_add_sortkey(service, 3, "out_of_bounds", - Metadata_sortkey_relevance)); - - YAZ_CHECK(!conf_service_add_sortkey(service, 0, 0, //missing name - Metadata_sortkey_relevance)); - - - // expected sortkey sucess - YAZ_CHECK(conf_service_add_sortkey(service, 0, "relevance", - Metadata_sortkey_relevance)); - - YAZ_CHECK(conf_service_add_sortkey(service, 1, "title", - Metadata_sortkey_string)); - - YAZ_CHECK(conf_service_add_sortkey(service, 2, "year", - Metadata_sortkey_numeric)); -} - - -int main(int argc, char **argv) -{ - YAZ_CHECK_INIT(argc, argv); - YAZ_CHECK_LOG(); - - test_conf_service(argc, argv); - - YAZ_CHECK_TERM; -} - - - - -/* - * Local variables: - * c-basic-offset: 4 - * c-file-style: "Stroustrup" - * indent-tabs-mode: nil - * End: - * vim: shiftwidth=4 tabstop=8 expandtab - */ - diff --git a/src/test_record.c b/src/test_record.c deleted file mode 100644 index f9014f7..0000000 --- a/src/test_record.c +++ /dev/null @@ -1,163 +0,0 @@ -/* This file is part of Pazpar2. - Copyright (C) 2006-2009 Index Data - -Pazpar2 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, or (at your option) any later -version. - -Pazpar2 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 - -*/ - -#if HAVE_CONFIG_H -#include -#endif - -#define USE_TIMING 0 -#if USE_TIMING -#include -#endif - -#include - -#include "pazpar2_config.h" -#include "record.h" - -void test_record(int argc, char **argv) -{ - NMEM nmem = nmem_create(); - - struct conf_service *service = 0; - struct record *record = 0; - - struct client *client = 0; - char * bla = "blabla"; - union data_types data_text; - union data_types data_num; - struct record_metadata * tmp_md = 0; - - data_text.text.disp = bla; - data_text.text.sort = bla; - - data_num.number.min = 2; - data_num.number.max = 5; - - - service = conf_service_create(0, 4, 3, 0); - YAZ_CHECK(service); - - YAZ_CHECK(conf_service_add_metadata( - service, 0, "title", - Metadata_type_generic, Metadata_merge_unique, - Metadata_setting_no, 1, 1, 1, 0, - Metadata_mergekey_no - )); - - YAZ_CHECK(conf_service_add_metadata( - service, 1, "author", - Metadata_type_generic, Metadata_merge_longest, - Metadata_setting_no,1, 1, 1, 0, - Metadata_mergekey_no)); - - YAZ_CHECK(conf_service_add_metadata( - service, 2, "isbn", - Metadata_type_number, Metadata_merge_no, - Metadata_setting_no, 1, 1, 1, 0, - Metadata_mergekey_no)); - - YAZ_CHECK(conf_service_add_metadata( - service, 3, "year", - Metadata_type_year, Metadata_merge_range, - Metadata_setting_no, 1, 1, 1, 0, - Metadata_mergekey_no)); - - YAZ_CHECK(conf_service_add_sortkey( - service, 0, "relevance", - Metadata_sortkey_relevance)); - - YAZ_CHECK(conf_service_add_sortkey( - service, 1, "title", - Metadata_sortkey_string)); - - YAZ_CHECK(conf_service_add_sortkey( - service, 2, "year", - Metadata_sortkey_numeric)); - - - - - // testing record things - record = record_create(nmem, 4, 3, client, 1); - YAZ_CHECK(record); - - tmp_md = record_metadata_insert(nmem, &(record->metadata[0]), data_text); - YAZ_CHECK(tmp_md); - YAZ_CHECK(0 == record->metadata[0]->next); - - tmp_md = record_metadata_insert(nmem, &(record->metadata[0]->next), - data_text); - YAZ_CHECK(tmp_md); - YAZ_CHECK(record->metadata[0]->next); - - YAZ_CHECK(record_add_metadata_field_id(nmem, record, 3, data_num)); - YAZ_CHECK(0 == record->metadata[3]->next); - YAZ_CHECK(record_add_metadata_field_id(nmem, record, 3, data_num)); - YAZ_CHECK(record->metadata[3]->next); - - YAZ_CHECK(record_add_metadata(nmem, record, service, "author", data_text)); - YAZ_CHECK(0 == record->metadata[1]->next); - YAZ_CHECK(record_add_metadata(nmem, record, service, "author", data_text)); - YAZ_CHECK(record->metadata[1]->next); - - - YAZ_CHECK(0 == record->sortkeys[0]); - YAZ_CHECK(record_assign_sortkey_field_id(nmem, record, 0, data_text)); - YAZ_CHECK(record->sortkeys[0]); - YAZ_CHECK(0 == record->sortkeys[1]); - YAZ_CHECK(record_assign_sortkey_field_id(nmem, record, 1, data_text)); - YAZ_CHECK(record->sortkeys[1]); - YAZ_CHECK(0 == record->sortkeys[2]); - YAZ_CHECK(record_assign_sortkey_field_id(nmem, record, 2, data_num)); - YAZ_CHECK(record->sortkeys[2]); - - - YAZ_CHECK(record_assign_sortkey(nmem, record, service, "relevance", data_text)); - YAZ_CHECK(record_assign_sortkey(nmem, record, service, "title", data_text)); - YAZ_CHECK(record_assign_sortkey(nmem, record, service, "year", data_num)); - - - nmem_destroy(nmem); - - //YAZ_CHECK(0 == 0); - //YAZ_CHECK_EQ(0, 1); -} - - -int main(int argc, char **argv) -{ - YAZ_CHECK_INIT(argc, argv); - YAZ_CHECK_LOG(); - - test_record(argc, argv); - - YAZ_CHECK_TERM; -} - - -/* - * Local variables: - * c-basic-offset: 4 - * c-file-style: "Stroustrup" - * indent-tabs-mode: nil - * End: - * vim: shiftwidth=4 tabstop=8 expandtab - */ - -- 1.7.10.4