X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fapi%2Ft16.c;h=974b7039f7d03b1fcf084e620d60c8913b12d1fc;hb=5a42423347510f085e18bb656f16e6c65cc474ee;hp=cf8dd176d1d4a29a68d0dd3e05a6c58e40b788fc;hpb=724e70cf7629655ad7ef628f1b42ced08cc372f1;p=idzebra-moved-to-github.git diff --git a/test/api/t16.c b/test/api/t16.c index cf8dd17..974b703 100644 --- a/test/api/t16.c +++ b/test/api/t16.c @@ -1,4 +1,4 @@ -/* $Id: t16.c,v 1.1 2006-11-16 12:48:28 adam Exp $ +/* $Id: t16.c,v 1.5 2006-11-22 10:26:12 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -63,8 +63,8 @@ static ZEBRA_RES fetch_first(ZebraHandle zh, const char *element_set, static ZEBRA_RES fetch_first_compare(ZebraHandle zh, const char *element_set, oid_value format, const char *cmp_rec) { - const char *rec_buf; - size_t rec_len; + const char *rec_buf = 0; + size_t rec_len = 0; ODR odr = odr_createmem(ODR_ENCODE); ZEBRA_RES res = fetch_first(zh, element_set, format, odr, &rec_buf, &rec_len); @@ -85,6 +85,13 @@ static void tst(int argc, char **argv) { zint hits; ZEBRA_RES res; + const char * zebra_xml_sysno + = "\n"; + + const char * zebra_xml_index_title_p + = "\n" +" my title\n" +"\n"; ZebraService zs = tl_start_up(0, argc, argv); ZebraHandle zh = zebra_open(zs, 0); @@ -96,11 +103,30 @@ static void tst(int argc, char **argv) YAZ_CHECK_EQ(hits, 1); YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", VAL_TEXT_XML, + "mismatch"), ZEBRA_FAIL); + + YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", VAL_SUTRS, myrec[0]), ZEBRA_OK); YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", VAL_TEXT_XML, - "mismatch"), ZEBRA_FAIL); + myrec[0]), ZEBRA_OK); + YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", VAL_SUTRS, + "2"), ZEBRA_OK); + + YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", VAL_TEXT_XML, + zebra_xml_sysno), ZEBRA_OK); + + YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::title:p", + VAL_TEXT_XML, + zebra_xml_index_title_p), ZEBRA_OK); + + YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::nonexistent", + VAL_TEXT_XML, ""), ZEBRA_OK); + + YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::nonexistent", + VAL_TEXT_XML, ""), ZEBRA_OK); + YAZ_CHECK(tl_close_down(zh, zs)); }