Renamed files for sort tests.
[idzebra-moved-to-github.git] / test / api / t10.c
1 /* This file is part of the Zebra server.
2    Copyright (C) 1995-2008 Index Data
3
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
7 version.
8
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
12 for more details.
13
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
17
18 */
19
20 /* Creates a few result sets */
21
22 #include "testlib.h"
23
24 const char *myrec[] ={
25         "<t10>\n"
26         "  <title>My title</title>\n"
27         "</t10>\n",
28         0};
29
30 static void tst(int argc, char **argv)
31 {
32     ZebraService zs = tl_start_up("zebra10.cfg", argc, argv);
33     ZebraHandle zh = zebra_open(zs, 0);
34
35     YAZ_CHECK(tl_init_data(zh, myrec));
36
37     zebra_commit(zh);
38
39     // string attributes in search
40     YAZ_CHECK(tl_query(zh, "@attr 1=title my", 1));
41     YAZ_CHECK(tl_query(zh, "@attr 1=title my", 1));
42     YAZ_CHECK(tl_query(zh, "@attr 1=title titlex", 0));
43     YAZ_CHECK(tl_query(zh, "@attr 1=extra_title my", 1));
44
45     // numeric attributes with Bib-1 should produce an error
46     YAZ_CHECK(tl_query_x(zh, 
47                          "@attr 1=4 my", 0, 121));
48     YAZ_CHECK(tl_query_x(zh, 
49                          "@attr 1=7 my", 0, 121));
50     // private OID with incorrect use attribute
51     YAZ_CHECK(tl_query_x(zh, 
52                          "@attr 1.2.840.10003.3.1000.1000.1 1=4 my", 0, 114));
53     // private OID with OK use attribute
54     YAZ_CHECK(tl_query(zh, 
55                        "@attr 1.2.840.10003.3.1000.1000.1 1=7 my", 1));
56
57     YAZ_CHECK(tl_query(zh, 
58                        "@attr 1.2.840.10003.3.1000.1000.1 1=8 my", 1));
59
60     YAZ_CHECK(tl_close_down(zh, zs));
61 }
62
63 TL_MAIN
64
65 /*
66  * Local variables:
67  * c-basic-offset: 4
68  * indent-tabs-mode: nil
69  * End:
70  * vim: shiftwidth=4 tabstop=8 expandtab
71  */
72