From: Adam Dickmeiss Date: Fri, 1 May 2009 08:50:13 +0000 (+0200) Subject: Remove redundant tests test_{relevance,reclists}. X-Git-Tag: v1.1.0~31 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=ccd1d68bf6d9ec4b5b6ba295f41cc789776193eb;p=pazpar2-moved-to-github.git Remove redundant tests test_{relevance,reclists}. --- diff --git a/src/.gitignore b/src/.gitignore index 2beb68d..d7ce180 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -14,7 +14,5 @@ stamp-h1 test_config test_icu_I18N test_record -test_reclists -test_relevance test_sel_thread test_normalize diff --git a/src/Makefile.am b/src/Makefile.am index d027124..81dbe02 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,8 +4,6 @@ sbin_PROGRAMS = pazpar2 check_PROGRAMS = test_config \ test_record \ - test_reclists \ - test_relevance \ test_sel_thread \ test_normalize @@ -40,12 +38,6 @@ test_config_LDADD = libpazpar2.a $(YAZLIB) test_record_SOURCES = test_record.c test_record_LDADD = libpazpar2.a $(YAZLIB) -test_reclists_SOURCES = test_reclists.c -test_reclists_LDADD = libpazpar2.a $(YAZLIB) - -test_relevance_SOURCES = test_relevance.c -test_relevance_LDADD = libpazpar2.a $(YAZLIB) - test_sel_thread_SOURCES = test_sel_thread.c test_sel_thread_LDADD = libpazpar2.a $(YAZLIB) diff --git a/src/test_reclists.c b/src/test_reclists.c deleted file mode 100644 index 859a88b..0000000 --- a/src/test_reclists.c +++ /dev/null @@ -1,103 +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" -#include "reclists.h" - - -#if 0 - -void test_reclist_sortparms(int argc, char **argv) -{ - NMEM nmem = nmem_create(); - - struct conf_service *service = 0; - service = conf_service_create(nmem, 1, 2); - - conf_service_add_metadata(nmem, service, 0, "title", - Metadata_type_generic, Metadata_merge_unique, - 1, 1, 1, 0); - - conf_service_add_sortkey(nmem, service, 0, "relevance", - Metadata_sortkey_relevance); - - conf_service_add_sortkey(nmem, service, 1, "title", - Metadata_sortkey_string); - - - // initializing of sort parameters is controlled by service descriptions - struct reclist_sortparms *sort_parms = 0; - - // sorting ascending according to relevance, then title - YAZ_CHECK(0 == sort_parms); - YAZ_CHECK(reclist_sortparms_insert(nmem, &sort_parms, service, "title", 1)); - YAZ_CHECK(sort_parms); - - YAZ_CHECK(0 == sort_parms->next); - YAZ_CHECK(reclist_sortparms_insert(nmem, &sort_parms, service, - "relevance", 1)); - YAZ_CHECK(sort_parms->next); - - - nmem_destroy(nmem); - - //YAZ_CHECK(0 == 0); - //YAZ_CHECK_EQ(0, 1); -} - - -#endif - -int main(int argc, char **argv) -{ - YAZ_CHECK_INIT(argc, argv); - YAZ_CHECK_LOG(); - - - //test_reclist_sortparms(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_relevance.c b/src/test_relevance.c deleted file mode 100644 index 7de25c3..0000000 --- a/src/test_relevance.c +++ /dev/null @@ -1,225 +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 "relevance.h" -#include "record.h" -#include "reclists.h" - -#if 0 - -void test_relevance_7bit(int argc, char **argv) -{ - NMEM nmem = nmem_create(); - - struct conf_service *service = 0; - service = conf_service_create(nmem, 1, 1); - - conf_service_add_metadata(nmem, service, 0, "title", - Metadata_type_generic, Metadata_merge_unique, - 1, 1, 1, 0); - - conf_service_add_sortkey(nmem, service, 0, "title", - Metadata_sortkey_string); - - //conf_service_add_sortkey(nmem, service, 1, "relevance", - // Metadata_sortkey_relevance); - - - - - // setting up records - - // why on earth do we have a client dangeling from the record ?? - // record->client = client; - - union data_types data_ape = {"ape"}; - union data_types data_bee = {"bee"}; - union data_types data_fish = {"fish"}; - union data_types data_zebra = {"zebra"}; - - - //union data_types data_year; - //data_num.number.min = 2005; - //data_num.number.max = 2007; - - int no_recs = 4; - - const char *mk_ape_fish = "ape fish"; - struct record *rec_ape_fish = 0; - rec_ape_fish - = record_create(nmem, service->num_metadata, service->num_sortkeys); - record_add_metadata(nmem, rec_ape_fish, service, "title", data_ape); - //record_assign_sortkey(nmem, rec_ape_fish, service, "relevance", data_ape); - record_assign_sortkey(nmem, rec_ape_fish, service, "title", data_ape); - record_add_metadata(nmem, rec_ape_fish, service, "title", data_fish); - YAZ_CHECK(rec_ape_fish); - - const char *mk_bee_fish = "bee fish"; - struct record *rec_bee_fish = 0; - rec_bee_fish - = record_create(nmem, service->num_metadata, service->num_sortkeys); - record_add_metadata(nmem, rec_bee_fish, service, "title", data_bee); - //record_assign_sortkey(nmem, rec_bee_fish, service, "relevance", data_bee); - record_assign_sortkey(nmem, rec_bee_fish, service, "title", data_bee); - record_add_metadata(nmem, rec_bee_fish, service, "title", data_fish); - YAZ_CHECK(rec_bee_fish); - - const char *mk_fish_bee = "fish bee"; - struct record *rec_fish_bee = 0; - rec_fish_bee - = record_create(nmem, service->num_metadata, service->num_sortkeys); - record_add_metadata(nmem, rec_fish_bee, service, "title", data_fish); - //record_assign_sortkey(nmem, rec_fish_bee, service, "relevance", data_fish); - record_assign_sortkey(nmem, rec_fish_bee, service, "title", data_fish); - record_add_metadata(nmem, rec_fish_bee, service, "title", data_bee); - YAZ_CHECK(rec_fish_bee); - - const char *mk_zebra_bee = "zebra bee"; - struct record *rec_zebra_bee = 0; - rec_zebra_bee - = record_create(nmem, service->num_metadata, service->num_sortkeys); - record_add_metadata(nmem, rec_zebra_bee, service, "title", data_zebra); - //record_assign_sortkey(nmem, rec_zebra_bee, service, "relevance", data_zebra); - record_assign_sortkey(nmem, rec_zebra_bee, service, "title", data_zebra); - record_add_metadata(nmem, rec_zebra_bee, service, "title", data_bee); - YAZ_CHECK(rec_zebra_bee); - - - struct reclist *list = 0; - list = reclist_create(nmem, no_recs); - YAZ_CHECK(list); - - int no_merged = 0; - - - const char * queryterms[] = - {"ape", "fish", 0}; - // {"ål", "økologi", "æble", 0}; - - - //struct relevance *rel = 0; - //rel = relevance_create(nmem, queryterms, no_recs); - //YAZ_CHECK(rel); - - struct record_cluster *cluster = 0; - - - // insert records into recordlist and get clusters - // since metadata keys differ, we get multiple clusters ?? - cluster - = reclist_insert(list, service, rec_ape_fish, mk_ape_fish, &no_merged); - YAZ_CHECK(cluster); - data_types_assign(nmem, &cluster->sortkeys[0], *rec_ape_fish->sortkeys[0]); - //relevance_newrec(rel, cluster); - - cluster - = reclist_insert(list, service, rec_bee_fish, mk_bee_fish, &no_merged); - YAZ_CHECK(cluster); - data_types_assign(nmem, &cluster->sortkeys[0], *rec_bee_fish->sortkeys[0]); - //relevance_newrec(rel, cluster); - - cluster - = reclist_insert(list, service, rec_fish_bee, mk_fish_bee, &no_merged); - YAZ_CHECK(cluster); - data_types_assign(nmem, &cluster->sortkeys[0], *rec_fish_bee->sortkeys[0]); - //relevance_newrec(rel, cluster); - - cluster - = reclist_insert(list, service, rec_zebra_bee, mk_zebra_bee, &no_merged); - YAZ_CHECK(cluster); - data_types_assign(nmem, &cluster->sortkeys[0], *rec_zebra_bee->sortkeys[0]); - //relevance_newrec(rel, cluster); - - - YAZ_CHECK(no_recs == no_merged); - - // now sorting according to sorting criteria, here ascending title - struct reclist_sortparms *sort_parms = 0; - - reclist_sortparms_insert(nmem, &sort_parms, service, "title", 1); - - //reclist_sortparms_insert(nmem, &sort_parms, service, "relevance", 1); - - // crashes with a fat segmentation fault! To be traced tomorrow - reclist_sort(list, sort_parms); - - - - //mergekey_norm = (xmlChar *) nmem_strdup(se->nmem, (char*) mergekey); - //normalize_mergekey((char *) mergekey_norm, 0); - - - - - - - //relevance_prepare_read(rel, list); - - - //relevance_donerecord(rel, cluster); - // relevance_countwords(se->rel, cluster, - // (char *) value, service->metadata->rank); - // - - - nmem_destroy(nmem); - - //YAZ_CHECK(0 == 0); - //YAZ_CHECK_EQ(0, 1); -} - -#endif - -int main(int argc, char **argv) -{ - YAZ_CHECK_INIT(argc, argv); - YAZ_CHECK_LOG(); - - - //test_relevance_7bit(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 - */ -