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