1 /* $Id: t11.c,v 1.3 2005-09-13 11:51:07 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 int main(int argc, char **argv)
34 ZebraService zs = start_up(0, argc, argv);
35 ZebraHandle zh = zebra_open(zs, 0);
41 /* scan before. nothing must be returned */
42 const char *ent[] = { "a", 0 };
43 do_scan(__LINE__, zh, "@attr 1=4 0", 1, 1, 1, 1, 0, ent);
47 /* scan after. nothing must be returned */
48 do_scan(__LINE__, zh, "@attr 1=4 m", 1, 1, 1, 0, 1, 0);
52 const char *ent[] = { "a", 0 };
53 do_scan(__LINE__, zh, "@attr 1=4 a", 1, 1, 1, 1, 0, ent);
57 const char *ent[] = { "b", "c", 0 };
58 do_scan(__LINE__, zh, "@attr 1=4 aa", 1, 2, 1, 2, 0, ent);
62 const char *ent[] = { "b", "c", 0 };
63 do_scan(__LINE__, zh, "@attr 1=4 aa", 1, 2, 1, 2, 0, ent);
67 const char *ent[] = { "e", "f", 0 };
68 do_scan(__LINE__, zh, "@attr 1=4 e", 1, 3, 1, 2, 1, ent);
72 const char *ent[] = { "c", "d", 0 };
73 do_scan(__LINE__, zh, "@attr 1=4 a", -1, 2, -1, 2, 0, ent);
77 const char *ent[] = { "d", 0 };
78 do_scan(__LINE__, zh, "@attr 1=4 a", -2, 1, -2, 1, 0, ent);
82 const char *ent[] = { "f", 0 };
83 do_scan(__LINE__, zh, "@attr 1=4 a", -4, 1, -4, 1, 0, ent);
87 const char *ent[] = { "f", 0 };
88 do_scan(__LINE__, zh, "@attr 1=4 a", -5, 1, -5, 0, 1, ent);
92 const char *ent[] = { "d", "e", "f", 0 };
93 do_scan(__LINE__, zh, "@attr 1=4 a", -2, 3, -2, 3, 0, ent);
97 const char *ent[] = { "d", "e", "f", 0 };
98 do_scan(__LINE__, zh, "@attr 1=4 a", -2, 4, -2, 3, 1, ent);
102 const char *ent[] = { "a", "b", "c", "d", "e", "f", 0 };
103 do_scan(__LINE__, zh, "@attr 1=4 0", 2, 100, 1, 6, 1, ent);
107 const char *ent[] = { "b", "c", "d", "e", "f", 0 };
108 do_scan(__LINE__, zh, "@attr 1=4 0", 0, 100, 0, 5, 1, ent);
112 const char *ent[] = { "a", "b", "c", "d", "e", "f", 0 };
113 do_scan(__LINE__, zh, "@attr 1=4 0", 10, 100, 1, 6, 1, ent);
117 const char *ent[] = { "a", "b", "c", "d", "e", "f", 0 };
118 do_scan(__LINE__, zh, "@attr 1=4 0", 22, 10, 1, 0, 1, ent);
122 do_scan(__LINE__, zh, "@attr 1=4 z", -22, 10, -22, 0, 1, 0);
124 return close_down(zh, zs, 0);