1 /* $Id: tst_match_glob.c,v 1.1 2007-10-24 13:50:03 adam Exp $
2 Copyright (C) 1995-2007
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 this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <yaz/match_glob.h>
30 YAZ_CHECK_EQ(yaz_match_glob("a", "a"), 1);
31 YAZ_CHECK_EQ(yaz_match_glob("", ""), 1);
32 YAZ_CHECK_EQ(yaz_match_glob("a", ""), 0);
33 YAZ_CHECK_EQ(yaz_match_glob("", "a"), 0);
34 YAZ_CHECK_EQ(yaz_match_glob("a", "b"), 0);
35 YAZ_CHECK_EQ(yaz_match_glob("b", "a"), 0);
37 YAZ_CHECK_EQ(yaz_match_glob("?", "a"), 1);
38 YAZ_CHECK_EQ(yaz_match_glob("a", "?"), 0);
39 YAZ_CHECK_EQ(yaz_match_glob("?", "aa"), 0);
40 YAZ_CHECK_EQ(yaz_match_glob("?a", "aa"), 1);
41 YAZ_CHECK_EQ(yaz_match_glob("a?", "aa"), 1);
42 YAZ_CHECK_EQ(yaz_match_glob("??", "aa"), 1);
44 YAZ_CHECK_EQ(yaz_match_glob("*", ""), 1);
45 YAZ_CHECK_EQ(yaz_match_glob("*", "a"), 1);
46 YAZ_CHECK_EQ(yaz_match_glob("**", "a"), 1);
47 YAZ_CHECK_EQ(yaz_match_glob("*a", "a"), 1);
48 YAZ_CHECK_EQ(yaz_match_glob("a*", "a"), 1);
49 YAZ_CHECK_EQ(yaz_match_glob("b*", "a"), 0);
50 YAZ_CHECK_EQ(yaz_match_glob("*b", "a"), 0);
51 YAZ_CHECK_EQ(yaz_match_glob("**b", "a"), 0);
52 YAZ_CHECK_EQ(yaz_match_glob("*b*", "a"), 0);
54 YAZ_CHECK_EQ(yaz_match_glob("*:w", "title:w"), 1);
55 YAZ_CHECK_EQ(yaz_match_glob("title:w", "title:w"), 1);
56 YAZ_CHECK_EQ(yaz_match_glob("title:*", "title:w"), 1);
59 int main(int argc, char **argv)
61 YAZ_CHECK_INIT(argc, argv);
71 * indent-tabs-mode: nil
73 * vim: shiftwidth=4 tabstop=8 expandtab