This source file includes following definitions.
- setup
- teardown
- 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 <stdio.h>
31
32 #include "lib/strutil.h"
33 #include "lib/util.h"
34
35
36
37
38 static void
39 setup (void)
40 {
41 }
42
43
44
45
46 static void
47 teardown (void)
48 {
49 }
50
51
52
53
54
55 static const struct test_x_basename_ds
56 {
57 const char *input_value;
58 const char *expected_result;
59 } test_x_basename_ds[] =
60 {
61 {
62 "/test/path/test2/path2",
63 "path2"
64 },
65 {
66 "/test/path/test2/path2#vfsprefix",
67 "path2#vfsprefix"
68 },
69 {
70 "/test/path/test2/path2/vfsprefix://",
71 "path2/vfsprefix://"
72 },
73 {
74 "/test/path/test2/path2/vfsprefix://subdir",
75 "subdir"
76 },
77 {
78 "/test/path/test2/path2/vfsprefix://subdir/",
79 "subdir/"
80 },
81 {
82 "/test/path/test2/path2/vfsprefix://subdir/subdir2",
83 "subdir2"
84 },
85 {
86 "/test/path/test2/path2/vfsprefix:///",
87 "/"
88 },
89 };
90
91
92
93
94 START_PARAMETRIZED_TEST (test_x_basename, test_x_basename_ds)
95
96 {
97
98 const char *actual_result;
99
100
101 actual_result = x_basename (data->input_value);
102
103
104 mctest_assert_str_eq (actual_result, data->expected_result);
105 }
106
107 END_PARAMETRIZED_TEST
108
109
110
111
112 int
113 main (void)
114 {
115 TCase *tc_core;
116
117 tc_core = tcase_create ("Core");
118
119 tcase_add_checked_fixture (tc_core, setup, teardown);
120
121
122 mctest_add_parameterized_test (tc_core, test_x_basename, test_x_basename_ds);
123
124
125 return mctest_run_all (tc_core);
126 }
127
128