2 lib - x_basename() function testing
4 Copyright (C) 2011-2024
5 Free Software Foundation, Inc.
8 Slava Zanko <slavazanko@gmail.com>, 2011, 2013
10 This file is part of the Midnight Commander.
12 The Midnight Commander is free software: you can redistribute it
13 and/or modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation, either version 3 of the License,
15 or (at your option) any later version.
17 The Midnight Commander is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #define TEST_SUITE_NAME "/lib"
28 #include "tests/mctest.h"
32 #include "lib/strutil.h"
35 /* --------------------------------------------------------------------------------------------- */
43 /* --------------------------------------------------------------------------------------------- */
51 /* --------------------------------------------------------------------------------------------- */
53 /* @DataSource("test_x_basename_ds") */
55 static const struct test_x_basename_ds
57 const char *input_value
;
58 const char *expected_result
;
59 } test_x_basename_ds
[] =
62 "/test/path/test2/path2",
66 "/test/path/test2/path2#vfsprefix",
70 "/test/path/test2/path2/vfsprefix://",
74 "/test/path/test2/path2/vfsprefix://subdir",
78 "/test/path/test2/path2/vfsprefix://subdir/",
82 "/test/path/test2/path2/vfsprefix://subdir/subdir2",
86 "/test/path/test2/path2/vfsprefix:///",
92 /* @Test(dataSource = "test_x_basename_ds") */
94 START_PARAMETRIZED_TEST (test_x_basename
, test_x_basename_ds
)
98 const char *actual_result
;
101 actual_result
= x_basename (data
->input_value
);
104 mctest_assert_str_eq (actual_result
, data
->expected_result
);
107 END_PARAMETRIZED_TEST
110 /* --------------------------------------------------------------------------------------------- */
117 tc_core
= tcase_create ("Core");
119 tcase_add_checked_fixture (tc_core
, setup
, teardown
);
121 /* Add new tests here: *************** */
122 mctest_add_parameterized_test (tc_core
, test_x_basename
, test_x_basename_ds
);
123 /* *********************************** */
125 return mctest_run_all (tc_core
);
128 /* --------------------------------------------------------------------------------------------- */