~ubuntu-branches/debian/stretch/ccache/stretch

« back to all changes in this revision

Viewing changes to test/test_util.c

  • Committer: Bazaar Package Importer
  • Author(s): Joel Rosdahl
  • Date: 2010-12-02 21:05:17 UTC
  • mfrom: (5.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20101202210517-ji5owl2qa3s5c1rg
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2010 Joel Rosdahl
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License as published by the Free
 
6
 * Software Foundation; either version 3 of the License, or (at your option)
 
7
 * any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful, but WITHOUT
 
10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 
12
 * more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along with
 
15
 * this program; if not, write to the Free Software Foundation, Inc., 51
 
16
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
17
 */
 
18
 
 
19
/*
 
20
 * This file contains tests for functions in util.c.
 
21
 */
 
22
 
 
23
#include "ccache.h"
 
24
#include "test/framework.h"
 
25
 
 
26
TEST_SUITE(util)
 
27
 
 
28
TEST(basename)
 
29
{
 
30
        CHECK_STR_EQ_FREE2("foo.c", basename("foo.c"));
 
31
        CHECK_STR_EQ_FREE2("foo.c", basename("dir1/dir2/foo.c"));
 
32
        CHECK_STR_EQ_FREE2("foo.c", basename("/dir/foo.c"));
 
33
        CHECK_STR_EQ_FREE2("", basename("dir1/dir2/"));
 
34
}
 
35
 
 
36
TEST(dirname)
 
37
{
 
38
        CHECK_STR_EQ_FREE2(".", dirname("foo.c"));
 
39
        CHECK_STR_EQ_FREE2("dir1/dir2", dirname("dir1/dir2/foo.c"));
 
40
        CHECK_STR_EQ_FREE2("/dir", dirname("/dir/foo.c"));
 
41
        CHECK_STR_EQ_FREE2("dir1/dir2", dirname("dir1/dir2/"));
 
42
}
 
43
 
 
44
TEST_SUITE_END