Allow record subsystem to return system numbers (document ID) with a fake
[idzebra-moved-to-github.git] / test / sort / sort1.c
1 /* $Id: sort1.c,v 1.5 2005-08-09 12:30:47 adam Exp $
2    Copyright (C) 1995-2005
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 Zebra; see the file LICENSE.zebra.  If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 */
22
23 #include <assert.h>
24 #include "../api/testlib.h"
25
26 int main(int argc, char **argv)
27 {
28     ZebraService zs = start_up(0, argc, argv);
29     ZebraHandle  zh = zebra_open(zs);
30     zint ids[5];
31     char path[256];
32     int i;
33
34     zebra_select_database(zh, "Default");
35
36     zebra_init(zh);
37
38     zebra_begin_trans(zh, 1);
39     for (i = 1; i <= 4; i++)
40     {
41         sprintf(path, "%.200s/rec%d.xml", get_srcdir(), i);
42         zebra_repository_update(zh, path);
43     }
44     zebra_end_trans(zh);
45     zebra_commit(zh);
46
47     ids[0] = 3;
48     ids[1] = 2;
49     ids[2] = 4;
50     ids[3] = 5;
51     do_sort(zh, "@or computer @attr 7=1 @attr 1=30 0", 4, ids);
52
53     ids[0] = 5;
54     ids[1] = 4;
55     ids[2] = 2;
56     ids[3] = 3;
57     do_sort(zh, "@or computer @attr 7=1 @attr 1=1021 0", 4, ids);
58
59     ids[0] = 2;
60     ids[1] = 5;
61     ids[2] = 4;
62     ids[3] = 3;
63     do_sort(zh, "@or computer @attr 7=1 @attr 1=1021 @attr 4=109 0", 4, ids);
64
65     return close_down(zh, zs, 0);
66 }