chiark / gitweb /
64-bit macos fix
[disorder] / libtests / t-trackname.c
CommitLineData
e307c6fe
RK
1/*
2 * This file is part of DisOrder.
3 * Copyright (C) 2008 Richard Kettlewell
4 *
e7eb3a27 5 * This program is free software: you can redistribute it and/or modify
e307c6fe 6 * it under the terms of the GNU General Public License as published by
e7eb3a27 7 * the Free Software Foundation, either version 3 of the License, or
e307c6fe 8 * (at your option) any later version.
e7eb3a27
RK
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
e307c6fe 15 * You should have received a copy of the GNU General Public License
e7eb3a27 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
e307c6fe
RK
17 */
18#include "test.h"
19#include "trackname.h"
20
21#define CHECK_PATH_ORDER(A,B,EXPECTED) do { \
22 const unsigned char a[] = A, b[] = B; \
23 insist(compare_path_raw(a, (sizeof a) - 1, \
24 b, (sizeof b) - 1) == (EXPECTED)); \
25 insist(compare_path_raw(b, (sizeof b) - 1, \
26 a, (sizeof a) - 1) == -(EXPECTED)); \
27} while(0)
28
c68d8eba 29static void test_trackname(void) {
e307c6fe
RK
30 CHECK_PATH_ORDER("/a/b", "/aa/", -1);
31 CHECK_PATH_ORDER("/a/b", "/a", 1);
32 CHECK_PATH_ORDER("/ab", "/a", 1);
33 CHECK_PATH_ORDER("/ab", "/aa", 1);
34 CHECK_PATH_ORDER("/aa", "/aa", 0);
35 CHECK_PATH_ORDER("/", "/", 0);
36}
37
c68d8eba
RK
38TEST(trackname);
39
e307c6fe
RK
40/*
41Local Variables:
42c-basic-offset:2
43comment-column:40
44fill-column:79
45indent-tabs-mode:nil
46End:
47*/