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/vfs"
27
28 #include "tests/mctest.h"
29
30 #include "lib/vfs/path.h"
31
32
33
34
35 static void
36 setup (void)
37 {
38 }
39
40
41
42
43 static void
44 teardown (void)
45 {
46 }
47
48
49
50
51
52 static const struct test_vfs_get_encoding_ds
53 {
54 const char *path;
55 const char *expected_encoding;
56 } test_vfs_get_encoding_ds[] =
57 {
58 {
59 "",
60 NULL
61 },
62 {
63 "aaaa",
64 NULL
65 },
66 {
67 "/aaaa",
68 NULL
69 },
70 {
71 "aaaa/bbbb",
72 NULL
73 },
74 {
75 "/aaaa/bbbb",
76 NULL
77 },
78 {
79 "#enc:UTF-8/aaaa",
80 "UTF-8"
81 },
82 {
83 "/#enc:UTF-8/aaaa",
84 "UTF-8"
85 },
86 {
87 "/aaaa/#enc:UTF-8/bbbb",
88 "UTF-8"
89 },
90 {
91 "/aaaa/#enc:UTF-8/bbbb/#enc:KOI8-R",
92 "KOI8-R"
93 },
94 {
95 "/aaaa/#enc:UTF-8/bbbb/#enc:KOI8-R/cccc",
96 "KOI8-R"
97 },
98 {
99 "/aaaa/#enc:UTF-8/bbbb/cccc#enc:KOI8-R/dddd",
100 "UTF-8"
101 },
102 {
103 "/#enc:UTF-8/bbbb/cccc#enc:KOI8-R/dddd",
104 "UTF-8"
105 },
106 {
107 "#enc:UTF-8/bbbb/cccc#enc:KOI8-R/dddd",
108 "UTF-8"
109 },
110 {
111 "aaaa#enc:UTF-8/bbbb/cccc#enc:KOI8-R/dddd",
112 NULL
113 },
114 {
115 "/aaaa/#enc:UTF-8/bbbb/#enc:KOI8-R#enc:CP866/cccc",
116 "KOI8-R#enc:CP866"
117 }
118 };
119
120
121
122
123 START_PARAMETRIZED_TEST (test_vfs_get_encoding, test_vfs_get_encoding_ds)
124
125 {
126
127 char *actual_encoding;
128
129
130 actual_encoding = vfs_get_encoding (data->path, -1);
131
132
133 mctest_assert_str_eq (actual_encoding, data->expected_encoding);
134
135 g_free (actual_encoding);
136 }
137
138 END_PARAMETRIZED_TEST
139
140
141
142
143 int
144 main (void)
145 {
146 TCase *tc_core;
147
148 tc_core = tcase_create ("Core");
149
150 tcase_add_checked_fixture (tc_core, setup, teardown);
151
152
153 mctest_add_parameterized_test (tc_core, test_vfs_get_encoding, test_vfs_get_encoding_ds);
154
155
156 return mctest_run_all (tc_core);
157 }
158
159