This source file includes following definitions.
- START_PARAMETRIZED_TEST
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #define TEST_SUITE_NAME "/lib"
27
28 #include "tests/mctest.h"
29
30 #include "lib/strutil.h"
31 #include "lib/util.h"
32
33
34
35
36 static const struct test_x_basename_ds
37 {
38 const char *input_value;
39 const char *expected_result;
40 } test_x_basename_ds[] = {
41 {
42 "/test/path/test2/path2",
43 "path2",
44 },
45 {
46 "/test/path/test2/path2#vfsprefix",
47 "path2#vfsprefix",
48 },
49 {
50 "/test/path/test2/path2/vfsprefix://",
51 "path2/vfsprefix://",
52 },
53 {
54 "/test/path/test2/path2/vfsprefix://subdir",
55 "subdir",
56 },
57 {
58 "/test/path/test2/path2/vfsprefix://subdir/",
59 "subdir/",
60 },
61 {
62 "/test/path/test2/path2/vfsprefix://subdir/subdir2",
63 "subdir2",
64 },
65 {
66 "/test/path/test2/path2/vfsprefix:///",
67 "/",
68 },
69 };
70
71
72 START_PARAMETRIZED_TEST (test_x_basename, test_x_basename_ds)
73 {
74
75 const char *actual_result;
76
77
78 actual_result = x_basename (data->input_value);
79
80
81 mctest_assert_str_eq (actual_result, data->expected_result);
82 }
83 END_PARAMETRIZED_TEST
84
85
86
87 int
88 main (void)
89 {
90 TCase *tc_core;
91
92 tc_core = tcase_create ("Core");
93
94
95 mctest_add_parameterized_test (tc_core, test_x_basename, test_x_basename_ds);
96
97
98 return mctest_run_all (tc_core);
99 }
100
101