1 /* lib/vfs - get vfs_path_t from string
3 Copyright (C) 2011 Free Software Foundation, Inc.
6 Slava Zanko <slavazanko@gmail.com>, 2011
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public License
10 as published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public
19 License along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #define TEST_SUITE_NAME "/lib/vfs"
28 #include "lib/global.h"
29 #include "lib/strutil.h"
30 #include "lib/vfs/xdirentry.h"
31 #include "lib/vfs/path.c" /* for testing static methods */
33 #include "src/vfs/local/local.c"
35 struct vfs_s_subclass test_subclass1
, test_subclass2
, test_subclass3
;
36 struct vfs_class vfs_test_ops1
, vfs_test_ops2
, vfs_test_ops3
;
42 str_init_strings (NULL
);
46 vfs_setup_work_dir ();
49 test_subclass1
.flags
= VFS_S_REMOTE
;
50 vfs_s_init_class (&vfs_test_ops1
, &test_subclass1
);
52 vfs_test_ops1
.name
= "testfs1";
53 vfs_test_ops1
.flags
= VFSF_NOLINKS
;
54 vfs_test_ops1
.prefix
= "test1:";
55 vfs_register_class (&vfs_test_ops1
);
57 vfs_s_init_class (&vfs_test_ops2
, &test_subclass2
);
58 vfs_test_ops2
.name
= "testfs2";
59 vfs_test_ops2
.prefix
= "test2:";
60 vfs_register_class (&vfs_test_ops2
);
62 vfs_s_init_class (&vfs_test_ops3
, &test_subclass3
);
63 vfs_test_ops3
.name
= "testfs3";
64 vfs_test_ops3
.prefix
= "test3:";
65 vfs_register_class (&vfs_test_ops3
);
75 /* --------------------------------------------------------------------------------------------- */
77 START_TEST (test_vfs_path_from_string
)
81 vpath
= vfs_path_from_str ("/#test1://bla-bla/some/path/#test2://bla-bla/some/path#test3:/111/22/33");
83 vpath_len
= vfs_path_length(vpath
);
84 // fail_unless(vpath_len == 3, "vpath length should be 3 (actial: %d)",vpath_len);
89 /* --------------------------------------------------------------------------------------------- */
96 Suite
*s
= suite_create (TEST_SUITE_NAME
);
97 TCase
*tc_core
= tcase_create ("Core");
100 tcase_add_checked_fixture (tc_core
, setup
, teardown
);
102 /* Add new tests here: *************** */
103 tcase_add_test (tc_core
, test_vfs_path_from_string
);
104 /* *********************************** */
106 suite_add_tcase (s
, tc_core
);
107 sr
= srunner_create (s
);
108 srunner_set_log (sr
, "get_vfs_class.log");
109 srunner_run_all (sr
, CK_NORMAL
);
110 number_failed
= srunner_ntests_failed (sr
);
112 return (number_failed
== 0) ? 0 : 1;
115 /* --------------------------------------------------------------------------------------------- */