Omit CVS Id. Update copyright year.
[idzebra-moved-to-github.git] / test / charmap / charmap1.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 #include "../api/testlib.h"
21
22 static void tst(int argc, char **argv)
23 {
24     ZebraService zs = tl_start_up(0, argc, argv);
25     ZebraHandle  zh = zebra_open(zs, 0);
26     char path[256];
27
28     tl_check_filter(zs, "grs.xml");
29
30     YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK);
31
32     zebra_init(zh);
33
34     YAZ_CHECK(zebra_begin_trans(zh, 1) == ZEBRA_OK);
35
36     sprintf(path, "%.200s/x.xml", tl_get_srcdir());
37     zebra_repository_update(zh, path);
38     YAZ_CHECK(zebra_end_trans(zh) == ZEBRA_OK);
39     zebra_commit(zh);
40
41     YAZ_CHECK(tl_query(zh, "@attr 1=4 @term string æ", 1));
42
43     /* search for UNICODE 1E25 - letter h with dot below */
44     YAZ_CHECK(tl_query(zh, "@attr 1=4 @term string ḥ", 1));
45
46     /* search for UNICODE A ring */
47     YAZ_CHECK(tl_query(zh, "@attr 1=4 @term string lås", 1));
48
49     /* search for aa  */
50     YAZ_CHECK(tl_query(zh, "@attr 1=4 @term string laas", 1));
51
52     /* search for aa regular-1 */
53     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 5=102 @term string lås", 1));
54
55     /* search for aa regular-2 */
56     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 5=103 @term string lås", 1));
57
58     /* search for aa trunc=104 */
59     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 5=104 @term string laas", 1));
60
61     /* search for aa trunc=105 */
62     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 5=104 @term string laas", 1));
63
64     /* search for aaa  */
65     YAZ_CHECK(tl_query(zh, "@attr 1=4 @term string laaas", 0));
66     
67     /* search ABC in title:0 .  */
68     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 ABC", 1));
69     
70     /* search DEF in title:0 .  */
71     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 DEF", 0));
72     
73     /* search [ in title:0 .  */
74     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 [", 1));
75     
76     /* search \ in title:0 .  */
77     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 \\\\\\\\", 1));
78
79     /* search { in title:0 .  */
80     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 \\{", 1));
81     
82     YAZ_CHECK(tl_close_down(zh, zs));
83 }
84
85 TL_MAIN
86 /*
87  * Local variables:
88  * c-basic-offset: 4
89  * indent-tabs-mode: nil
90  * End:
91  * vim: shiftwidth=4 tabstop=8 expandtab
92  */
93