Defined log level bits app2 and app3
[yaz-moved-to-github.git] / util / tstmatchstr.c
1 /*
2  * Copyright (c) 2002-2003, Index Data
3  * See the file LICENSE for details.
4  *
5  * $Id: tstmatchstr.c,v 1.1 2003-05-06 10:07:33 adam Exp $
6  */
7
8 #include <stdio.h>
9
10 #include <yaz/yaz-iconv.h>
11
12 struct {
13     char *s1;
14     char *s2;
15     int res;
16 } comp_strings[] = {
17     "x", "x", 0,
18     "x", "X", 0,
19     "a", "b", 1,
20     "b", "a", 1,
21     "aa","a", 1,
22     "a-", "a", 1,
23     "A-b", "ab", 0,
24     "A--b", "ab", 1,
25     "A--b", "a-b", 1,
26     "A--b", "a--b", 0,
27     "a123",  "a?", 0,
28     "a123",   "a1.3", 0,
29     "a123",   "..?", 0,
30     "a123",   "a1.", 1,
31     "a123",   "a...", 0,
32     0,     0, 0};
33
34 int main (int argc, char **argv)
35 {
36     int i;
37     for (i = 0; comp_strings[i].s1; i++)
38     {
39         int got = yaz_matchstr(comp_strings[i].s1,comp_strings[i].s2);
40         if (got > 0)
41             got = 1;
42         else if (got < 0)
43             got = -1;
44         if (got != comp_strings[i].res)
45         {
46             printf ("tststr %d got=%d res=%d\n", i,
47                     got, comp_strings[i].res);
48             exit(1);
49         }
50     }
51     exit(0);
52 }
53