1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2009 Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 /** \brief test special element set names zebra:: and friends */
24 const char *myrec[] = {
26 " <title>My title</title>\n"
30 static void tst(int argc, char **argv)
34 const char * zebra_xml_sysno
35 = "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\"/>\n";
37 const char * zebra_xml_meta
38 = "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\" base=\"Default\" type=\"grs.sgml\" rank=\"0\" size=\"41\" set=\"zebra::meta\"/>\n";
40 const char * zebra_xml_index_title_p
41 = "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\" set=\"zebra::index::title:p/\">\n"
42 " <index name=\"title\" type=\"p\" seq=\"4\">my title</index>\n"
45 ZebraService zs = tl_start_up(0, argc, argv);
46 ZebraHandle zh = zebra_open(zs, 0);
48 YAZ_CHECK(tl_init_data(zh, myrec));
50 res = zebra_search_PQF(zh, "@attr 1=4 my", "rsetname", &hits);
51 YAZ_CHECK_EQ(res, ZEBRA_OK);
52 YAZ_CHECK_EQ(hits, 1);
54 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::data", yaz_oid_recsyn_xml,
55 "mismatch"), ZEBRA_FAIL);
57 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::data", yaz_oid_recsyn_sutrs,
60 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::data", yaz_oid_recsyn_xml,
63 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::meta::sysno",
67 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::meta::sysno",
69 zebra_xml_sysno), ZEBRA_OK);
71 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::meta", yaz_oid_recsyn_xml,
72 zebra_xml_meta), ZEBRA_OK);
74 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::index::title:p",
76 zebra_xml_index_title_p), ZEBRA_OK);
78 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::nonexistent",
79 yaz_oid_recsyn_xml, ""), ZEBRA_OK);
81 YAZ_CHECK_EQ(tl_fetch_first_compare(zh, "zebra::index::nonexistent",
82 yaz_oid_recsyn_xml, ""), ZEBRA_OK);
84 YAZ_CHECK(tl_close_down(zh, zs));
92 * indent-tabs-mode: nil
94 * vim: shiftwidth=4 tabstop=8 expandtab