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/widget"
27
28 #include "tests/mctest.h"
29
30 #include "lib/widget.h"
31
32 #define C(x) ((char *) x)
33
34
35
36
37 static const struct test_hotkey_equal_ds
38 {
39 const hotkey_t hotkey1;
40 const hotkey_t hotkey2;
41 gboolean expected_result;
42 } test_hotkey_equal_ds[] = {
43 {
44
45 { .start = C ("abc"), .hotkey = NULL, .end = NULL },
46 { .start = C ("abc"), .hotkey = NULL, .end = NULL },
47 TRUE,
48 },
49 {
50
51 { .start = C (""), .hotkey = C (""), .end = C ("") },
52 { .start = C (""), .hotkey = C (""), .end = C ("") },
53 TRUE,
54 },
55 {
56
57 { .start = C ("abc"), .hotkey = C ("d"), .end = C ("efg") },
58 { .start = C ("abc"), .hotkey = C ("d"), .end = C ("efg") },
59 TRUE,
60 },
61 {
62
63 { .start = C ("abc"), .hotkey = NULL, .end = C ("efg") },
64 { .start = C ("abc"), .hotkey = NULL, .end = C ("efg") },
65 TRUE,
66 },
67 {
68
69 { .start = C ("abc"), .hotkey = C ("d"), .end = NULL },
70 { .start = C ("abc"), .hotkey = C ("d"), .end = NULL },
71 TRUE,
72 },
73 {
74
75 { .start = C ("abc"), .hotkey = C ("d"), .end = C ("efg") },
76 { .start = C ("_bc"), .hotkey = C ("d"), .end = C ("efg") },
77 FALSE,
78 },
79 {
80
81 { .start = C ("abc"), .hotkey = C ("d"), .end = C ("efg") },
82 { .start = C ("abc"), .hotkey = C ("_"), .end = C ("efg") },
83 FALSE,
84 },
85 {
86
87 { .start = C ("abc"), .hotkey = C ("d"), .end = C ("efg") },
88 { .start = C ("abc"), .hotkey = C ("d"), .end = C ("_fg") },
89 FALSE,
90 },
91 {
92
93 { .start = C ("abc"), .hotkey = C ("d"), .end = C ("efg") },
94 { .start = C ("adc"), .hotkey = NULL, .end = C ("efg") },
95 FALSE,
96 },
97 {
98
99 { .start = C ("abc"), .hotkey = C ("d"), .end = C ("efg") },
100 { .start = C ("abc"), .hotkey = C ("d"), .end = NULL },
101 FALSE,
102 },
103 {
104
105 { .start = C ("abc"), .hotkey = C ("d"), .end = C ("efg") },
106 { .start = C ("abc"), .hotkey = NULL, .end = NULL },
107 FALSE,
108 },
109 };
110
111
112 START_PARAMETRIZED_TEST (test_hotkey_equal, test_hotkey_equal_ds)
113 {
114
115 gboolean result;
116
117
118 result = hotkey_equal (data->hotkey1, data->hotkey2);
119
120
121 ck_assert_int_eq (result, data->expected_result);
122 }
123 END_PARAMETRIZED_TEST
124
125
126
127 int
128 main (void)
129 {
130 TCase *tc_core;
131
132 tc_core = tcase_create ("Core");
133
134
135 mctest_add_parameterized_test (tc_core, test_hotkey_equal, test_hotkey_equal_ds);
136
137
138 return mctest_run_all (tc_core);
139 }
140
141