2 #ifndef SEEN_DIR_UTIL_TEST_H
3 #define SEEN_DIR_UTIL_TEST_H
5 #include <cxxtest/TestSuite.h>
7 #include "dir-util.h"
9 class DirUtilTest : public CxxTest::TestSuite
10 {
11 public:
12 void testBase()
13 {
14 char const* cases[][3] = {
15 {"/foo/bar", "/foo", "bar"},
16 {"/foo/barney", "/foo/bar", "/foo/barney"},
17 {"/foo/bar/baz", "/foo/", "bar/baz"},
18 {"/foo/bar/baz", "/", "foo/bar/baz"},
19 {"/foo/bar/baz", "/foo/qux", "/foo/bar/baz"},
20 {"/foo", NULL, "/foo"}
21 };
23 for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
24 {
25 char const* result = sp_relative_path_from_path( cases[i][0], cases[i][1] );
26 TS_ASSERT( result );
27 TS_ASSERT( cases[i][2] );
28 if ( result && cases[i][2] )
29 {
30 TS_ASSERT_EQUALS( std::string(result), std::string(cases[i][2]) );
31 }
32 }
33 }
35 };
37 #endif // SEEN_DIR_UTIL_TEST_H
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 :