1 /* $Id: t11.c,v 1.5 2006-05-10 08:13:35 adam Exp $
2 Copyright (C) 1995-2005
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 Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /** testing of scan */
26 const char *myrec[] = {
27 "<gils>\n<title>a b</title>\n</gils>\n",
28 "<gils>\n<title>c d</title>\n</gils>\n",
29 "<gils>\n<title>e f</title>\n</gils>\n" ,
32 static void tst(int argc, char **argv)
34 ZebraService zs = tl_start_up(0, argc, argv);
35 ZebraHandle zh = zebra_open(zs, 0);
39 YAZ_CHECK(tl_init_data(zh, myrec));
43 /* scan before. nothing must be returned */
44 const char *ent[] = { "a", 0 };
45 YAZ_CHECK(tl_scan(zh, "@attr 1=4 0", 1, 1, 1, 1, 0, ent));
49 /* scan after. nothing must be returned */
50 YAZ_CHECK(tl_scan(zh, "@attr 1=4 m", 1, 1, 1, 0, 1, 0));
54 const char *ent[] = { "a", 0 };
55 YAZ_CHECK(tl_scan(zh, "@attr 1=4 a", 1, 1, 1, 1, 0, ent));
59 const char *ent[] = { "b", "c", 0 };
60 YAZ_CHECK(tl_scan(zh, "@attr 1=4 aa", 1, 2, 1, 2, 0, ent));
64 const char *ent[] = { "b", "c", 0 };
65 YAZ_CHECK(tl_scan(zh, "@attr 1=4 aa", 1, 2, 1, 2, 0, ent));
69 const char *ent[] = { "e", "f", 0 };
70 YAZ_CHECK(tl_scan(zh, "@attr 1=4 e", 1, 3, 1, 2, 1, ent));
74 const char *ent[] = { "c", "d", 0 };
75 YAZ_CHECK(tl_scan(zh, "@attr 1=4 a", -1, 2, -1, 2, 0, ent));
79 const char *ent[] = { "d", 0 };
80 YAZ_CHECK(tl_scan(zh, "@attr 1=4 a", -2, 1, -2, 1, 0, ent));
84 const char *ent[] = { "f", 0 };
85 YAZ_CHECK(tl_scan(zh, "@attr 1=4 a", -4, 1, -4, 1, 0, ent));
89 const char *ent[] = { "f", 0 };
90 YAZ_CHECK(tl_scan(zh, "@attr 1=4 a", -5, 1, -5, 0, 1, ent));
94 const char *ent[] = { "d", "e", "f", 0 };
95 YAZ_CHECK(tl_scan(zh, "@attr 1=4 a", -2, 3, -2, 3, 0, ent));
99 const char *ent[] = { "d", "e", "f", 0 };
100 YAZ_CHECK(tl_scan(zh, "@attr 1=4 a", -2, 4, -2, 3, 1, ent));
104 const char *ent[] = { "a", "b", "c", "d", "e", "f", 0 };
105 YAZ_CHECK(tl_scan(zh, "@attr 1=4 0", 2, 100, 1, 6, 1, ent));
109 const char *ent[] = { "b", "c", "d", "e", "f", 0 };
110 YAZ_CHECK(tl_scan(zh, "@attr 1=4 0", 0, 100, 0, 5, 1, ent));
114 const char *ent[] = { "a", "b", "c", "d", "e", "f", 0 };
115 YAZ_CHECK(tl_scan(zh, "@attr 1=4 0", 10, 100, 1, 6, 1, ent));
119 const char *ent[] = { "a", "b", "c", "d", "e", "f", 0 };
120 YAZ_CHECK(tl_scan(zh, "@attr 1=4 0", 22, 10, 1, 0, 1, ent));
124 YAZ_CHECK(tl_scan(zh, "@attr 1=4 z", -22, 10, -22, 0, 1, 0));
126 YAZ_CHECK(tl_close_down(zh, zs));
134 * indent-tabs-mode: nil
136 * vim: shiftwidth=4 tabstop=8 expandtab