4 BEGIN_TEST(prefixcmp_empty_empty
)
5 must_be_true(git__prefixcmp("", "") == 0);
8 BEGIN_TEST(prefixcmp_a_empty
)
9 must_be_true(git__prefixcmp("a", "") == 0);
12 BEGIN_TEST(prefixcmp_empty_a
)
13 must_be_true(git__prefixcmp("", "a") < 0);
16 BEGIN_TEST(prefixcmp_a_b
)
17 must_be_true(git__prefixcmp("a", "b") < 0);
20 BEGIN_TEST(prefixcmp_b_a
)
21 must_be_true(git__prefixcmp("b", "a") > 0);
24 BEGIN_TEST(prefixcmp_ab_a
)
25 must_be_true(git__prefixcmp("ab", "a") == 0);
28 BEGIN_TEST(prefixcmp_ab_ac
)
29 must_be_true(git__prefixcmp("ab", "ac") < 0);
32 BEGIN_TEST(prefixcmp_ab_aa
)
33 must_be_true(git__prefixcmp("ab", "aa") > 0);
37 BEGIN_TEST(suffixcmp_empty_empty
)
38 must_be_true(git__suffixcmp("", "") == 0);
41 BEGIN_TEST(suffixcmp_a_empty
)
42 must_be_true(git__suffixcmp("a", "") == 0);
45 BEGIN_TEST(suffixcmp_empty_a
)
46 must_be_true(git__suffixcmp("", "a") < 0);
49 BEGIN_TEST(suffixcmp_a_b
)
50 must_be_true(git__suffixcmp("a", "b") < 0);
53 BEGIN_TEST(suffixcmp_b_a
)
54 must_be_true(git__suffixcmp("b", "a") > 0);
57 BEGIN_TEST(suffixcmp_ba_a
)
58 must_be_true(git__suffixcmp("ba", "a") == 0);
61 BEGIN_TEST(suffixcmp_zaa_ac
)
62 must_be_true(git__suffixcmp("zaa", "ac") < 0);
65 BEGIN_TEST(suffixcmp_zaz_ac
)
66 must_be_true(git__suffixcmp("zaz", "ac") > 0);
72 must_be_true(!(git__dirname(dir
, sizeof(dir
), NULL
) < 0));
73 must_be_true(!strcmp(dir
, "."));
75 must_be_true(!(git__dirname(dir
, sizeof(dir
), "") < 0));
76 must_be_true(!strcmp(dir
, "."));
78 must_be_true(!(git__dirname(dir
, sizeof(dir
), "a") < 0));
79 must_be_true(!strcmp(dir
, "."));
81 must_be_true(!(git__dirname(dir
, sizeof(dir
), "/") < 0));
82 must_be_true(!strcmp(dir
, "/"));
84 must_be_true(!(git__dirname(dir
, sizeof(dir
), "/usr") < 0));
85 must_be_true(!strcmp(dir
, "/"));
87 /* TODO: should this be "/" instead (ie strip trailing / first) */
88 must_be_true(!(git__dirname(dir
, sizeof(dir
), "/usr/") < 0));
89 must_be_true(!strcmp(dir
, "/usr"));
91 must_be_true(!(git__dirname(dir
, sizeof(dir
), "/usr/lib") < 0));
92 must_be_true(!strcmp(dir
, "/usr"));
94 must_be_true(!(git__dirname(dir
, sizeof(dir
), "usr/lib") < 0));
95 must_be_true(!strcmp(dir
, "usr"));
101 must_be_true(!(git__basename(base
, sizeof(base
), NULL
) < 0));
102 must_be_true(!strcmp(base
, "."));
104 must_be_true(!(git__basename(base
, sizeof(base
), "") < 0));
105 must_be_true(!strcmp(base
, "."));
107 must_be_true(!(git__basename(base
, sizeof(base
), "a") < 0));
108 must_be_true(!strcmp(base
, "a"));
110 must_be_true(!(git__basename(base
, sizeof(base
), "/") < 0));
111 must_be_true(!strcmp(base
, "/"));
113 must_be_true(!(git__basename(base
, sizeof(base
), "/usr") < 0));
114 must_be_true(!strcmp(base
, "usr"));
116 /* TODO: should this be "usr" instead (ie strip trailing / first) */
117 must_be_true(!(git__basename(base
, sizeof(base
), "/usr/") < 0));
118 must_be_true(!strcmp(base
, ""));
120 must_be_true(!(git__basename(base
, sizeof(base
), "/usr/lib") < 0));
121 must_be_true(!strcmp(base
, "lib"));
123 must_be_true(!(git__basename(base
, sizeof(base
), "usr/lib") < 0));
124 must_be_true(!strcmp(base
, "lib"));