1 /* This file is part of the Zebra server.
2 Copyright (C) 1995-2008 Index Data
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
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
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
20 #include <idzebra/bfile.h>
24 static void tst1(zebra_sort_index_t si)
26 zint sysno = 12; /* just some sysno */
27 int my_type = 2; /* just some type ID */
28 char read_buf[SORT_IDX_ENTRYSIZE];
30 zebra_sort_type(si, my_type);
32 zebra_sort_sysno(si, sysno);
33 YAZ_CHECK_EQ(zebra_sort_read(si, read_buf), 0);
35 zebra_sort_add(si, "abcde1", 6);
37 zebra_sort_sysno(si, sysno);
38 YAZ_CHECK_EQ(zebra_sort_read(si, read_buf), 1);
39 YAZ_CHECK(!strcmp(read_buf, "abcde1"));
41 zebra_sort_sysno(si, sysno+1);
42 YAZ_CHECK_EQ(zebra_sort_read(si, read_buf), 0);
44 zebra_sort_sysno(si, sysno-1);
45 YAZ_CHECK_EQ(zebra_sort_read(si, read_buf), 0);
47 zebra_sort_sysno(si, sysno);
48 zebra_sort_delete(si);
49 YAZ_CHECK_EQ(zebra_sort_read(si, read_buf), 0);
52 static void tst(int argc, char **argv)
54 BFiles bfs = bfs_create(".:50M", 0);
55 zebra_sort_index_t si;
61 si = zebra_sort_open(bfs, 1, ZEBRA_SORT_TYPE_ISAMB);
73 si = zebra_sort_open(bfs, 1, ZEBRA_SORT_TYPE_FLAT);
89 * indent-tabs-mode: nil
91 * vim: shiftwidth=4 tabstop=8 expandtab