1 /* $Id: t16.c,v 1.14 2007-11-30 12:19:09 adam Exp $
2 Copyright (C) 1995-2007
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 /** \brief test special element set names zebra:: and friends */
27 const char *myrec[] = {
29 " <title>My title</title>\n"
33 static void tst(int argc, char **argv)
37 const char * zebra_xml_sysno
38 = "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\"/>\n";
40 const char * zebra_xml_meta
41 = "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\" base=\"Default\" type=\"grs.sgml\" rank=\"0\" size=\"41\" set=\"zebra::meta\"/>\n";
43 const char * zebra_xml_index_title_p
44 = "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\" set=\"zebra::index::title:p/\">\n"
45 " <index name=\"title\" type=\"p\" seq=\"4\">my title</index>\n"
48 ZebraService zs = tl_start_up(0, argc, argv);
49 ZebraHandle zh = zebra_open(zs, 0);
51 YAZ_CHECK(tl_init_data(zh, myrec));
53 res = zebra_search_PQF(zh, "@attr 1=4 my", "rsetname", &hits);
54 YAZ_CHECK_EQ(res, ZEBRA_OK);
55 YAZ_CHECK_EQ(hits, 1);
57 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::data", yaz_oid_recsyn_xml,
58 "mismatch"), ZEBRA_FAIL);
60 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::data", yaz_oid_recsyn_sutrs,
63 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::data", yaz_oid_recsyn_xml,
66 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::meta::sysno",
70 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::meta::sysno",
72 zebra_xml_sysno), ZEBRA_OK);
74 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::meta", yaz_oid_recsyn_xml,
75 zebra_xml_meta), ZEBRA_OK);
77 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::index::title:p",
79 zebra_xml_index_title_p), ZEBRA_OK);
81 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::nonexistent",
82 yaz_oid_recsyn_xml, ""), ZEBRA_OK);
84 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::index::nonexistent",
85 yaz_oid_recsyn_xml, ""), ZEBRA_OK);
87 YAZ_CHECK(tl_close_down(zh, zs));
95 * indent-tabs-mode: nil
97 * vim: shiftwidth=4 tabstop=8 expandtab