From 3ce61c3b5cc0d80fa8d095662ef7a5d1ed13c387 Mon Sep 17 00:00:00 2001 From: Marc Cromme Date: Tue, 24 Apr 2007 13:50:07 +0000 Subject: [PATCH] adding additional checks for correct side conditions on next metadata in record --- src/record.c | 12 ++++++------ src/test_record.c | 13 +++++++++++-- src/test_relevance.c | 8 +++++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/record.c b/src/record.c index fdaad9d..d8e0ff1 100644 --- a/src/record.c +++ b/src/record.c @@ -1,4 +1,4 @@ -/* $Id: record.c,v 1.3 2007-04-23 12:33:00 marc Exp $ +/* $Id: record.c,v 1.4 2007-04-24 13:50:07 marc Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -19,7 +19,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: record.c,v 1.3 2007-04-23 12:33:00 marc Exp $ */ +/* $Id: record.c,v 1.4 2007-04-24 13:50:07 marc Exp $ */ #include @@ -70,14 +70,14 @@ struct record * record_create(NMEM nmem, int num_metadata, int num_sortkeys) record->metadata = nmem_malloc(nmem, sizeof(struct record_metadata*) * num_metadata); - memset(record->metadata, 0, - sizeof(struct record_metadata*) * num_metadata); + //memset(record->metadata, 0, + //(( sizeof(struct record_metadata*) * num_metadata); record->sortkeys = nmem_malloc(nmem, sizeof(union data_types*) * num_sortkeys); - memset(record->metadata, 0, - sizeof(union data_types*) * num_sortkeys); + //memset(record->metadata, 0, + // sizeof(union data_types*) * num_sortkeys); return record; diff --git a/src/test_record.c b/src/test_record.c index 0427512..54317e1 100644 --- a/src/test_record.c +++ b/src/test_record.c @@ -1,4 +1,4 @@ -/* $Id: test_record.c,v 1.1 2007-04-23 12:33:00 marc Exp $ +/* $Id: test_record.c,v 1.2 2007-04-24 13:50:07 marc Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -107,20 +107,29 @@ void test_record(int argc, char **argv) struct record_metadata * tmp_md = 0; tmp_md = record_metadata_insert(nmem, &(record->metadata[0]), data_text); YAZ_CHECK(tmp_md); - tmp_md = record_metadata_insert(nmem, &tmp_md, data_text); + 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(record_assign_sortkey_field_id(nmem, record, 0, data_text)); YAZ_CHECK(record_assign_sortkey_field_id(nmem, record, 1, data_text)); YAZ_CHECK(record_assign_sortkey_field_id(nmem, record, 2, data_num)); + 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)); diff --git a/src/test_relevance.c b/src/test_relevance.c index f5b1668..1745c84 100644 --- a/src/test_relevance.c +++ b/src/test_relevance.c @@ -1,4 +1,4 @@ -/* $Id: test_relevance.c,v 1.7 2007-04-23 12:33:00 marc Exp $ +/* $Id: test_relevance.c,v 1.8 2007-04-24 13:50:07 marc Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -66,7 +66,7 @@ void test_relevance(int argc, char **argv) //int total = 0; struct relevance *rel = 0; - struct client *client = 0; + //struct client *client = 0; rel = relevance_create(nmem, queryterms, numrecs); @@ -111,7 +111,7 @@ void test_relevance(int argc, char **argv) YAZ_CHECK(record); // why on earth do we have a client dangeling from the record ?? - record->client = client; + // record->client = client; char * bla = "blabla"; union data_types data_text; @@ -143,6 +143,8 @@ void test_relevance(int argc, char **argv) YAZ_CHECK(record_assign_sortkey(nmem, record, service, "title", data_text)); YAZ_CHECK(record_assign_sortkey(nmem, record, service, "year", data_num)); + + -- 1.7.10.4