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 static const struct test_x_basename_ds
55 {
56 const char *input_value;
57 const char *expected_result;
58 } test_x_basename_ds[] = {
59 {
60 "/test/path/test2/path2",
61 "path2",
62 },
63 {
64 "/test/path/test2/path2#vfsprefix",
65 "path2#vfsprefix",
66 },
67 {
68 "/test/path/test2/path2/vfsprefix://",
69 "path2/vfsprefix://",
70 },
71 {
72 "/test/path/test2/path2/vfsprefix://subdir",
73 "subdir",
74 },
75 {
76 "/test/path/test2/path2/vfsprefix://subdir/",
77 "subdir/",
78 },
79 {
80 "/test/path/test2/path2/vfsprefix://subdir/subdir2",
81 "subdir2",
82 },
83 {
84 "/test/path/test2/path2/vfsprefix:///",
85 "/",
86 },
87 };
88
89
90 START_PARAMETRIZED_TEST (test_x_basename, test_x_basename_ds)
91 {
92
93 const char *actual_result;
94
95
96 actual_result = x_basename (data->input_value);
97
98
99 mctest_assert_str_eq (actual_result, data->expected_result);
100 }
101 END_PARAMETRIZED_TEST
102
103
104
105 int
106 main (void)
107 {
108 TCase *tc_core;
109
110 tc_core = tcase_create ("Core");
111
112 tcase_add_checked_fixture (tc_core, setup, teardown);
113
114
115 mctest_add_parameterized_test (tc_core, test_x_basename, test_x_basename_ds);
116
117
118 return mctest_run_all (tc_core);
119 }
120
121