Code

Placemark for gradient export
[inkscape.git] / src / dir-util-test.cpp
1 #include "utest/test-2ary-cases.h"
2 #include "dir-util.h"
3 #include "streq.h"
5 struct streq_functor {
6     bool operator()(char const *a, char const *b)
7     {
8         return streq(a, b);
9     }
10 };
12 static bool
13 test_sp_relative_path_from_path()
14 {
15     utest_start("sp_relative_path_from_path");
16     struct Case2<char const *, char const *, char const *> cases[] = {
17         {"/foo/bar", "/foo", "bar"},
18         {"/foo/barney", "/foo/bar", "/foo/barney"},
19         {"/foo/bar/baz", "/foo/", "bar/baz"},
20         {"/foo/bar/baz", "/", "foo/bar/baz"},
21         {"/foo/bar/baz", "/foo/qux", "/foo/bar/baz"},
22         {"/foo", NULL, "/foo"}
23     };
24     test_2ary_cases<char const *, char const *, char const *, char const *, streq_functor>
25         ("sp_relative_path_from_path",
26          sp_relative_path_from_path,
27          G_N_ELEMENTS(cases), cases);
28     return utest_end();
29 }
31 int main()
32 {
33     return ( test_sp_relative_path_from_path()
34              ? EXIT_SUCCESS
35              : EXIT_FAILURE );
36 }
39 /*
40   Local Variables:
41   mode:c++
42   c-file-style:"stroustrup"
43   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
44   indent-tabs-mode:nil
45   fill-column:99
46   End:
47 */
48 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :