1 /*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2  * librsync -- dynamic caching and delta update in HTTP
3  *
4  * Copyright (C) 2000 by Martin Pool <mbp@sourcefrog.net>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 
21 /* Force DEBUG on so that tests can use assert(). */
22 #undef NDEBUG
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <assert.h>
27 
28 #include "isprefix.h"
29 
30 /* Test driver for isprefix. */
main(int argc,char ** argv)31 int main(int argc, char **argv)
32 {
33     assert(isprefix("foo", "foobar"));
34     assert(isprefix("", "foobar"));
35     assert(isprefix("foobar", "foobar"));
36     assert(isprefix("", ""));
37     assert(isprefix("f", "foorbar"));
38 
39     assert(!isprefix("foobar", "foo"));
40     assert(!isprefix("goo", "foo"));
41     assert(!isprefix("foo", ""));
42     assert(!isprefix("f", "g"));
43 
44     return 0;
45 }
46