1*11131415SAlexandru Ardelean // SPDX-License-Identifier: GPL-2.0+
2*11131415SAlexandru Ardelean /*
3*11131415SAlexandru Ardelean * Test cases for bitfield helpers.
4*11131415SAlexandru Ardelean */
5*11131415SAlexandru Ardelean
6*11131415SAlexandru Ardelean #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7*11131415SAlexandru Ardelean
8*11131415SAlexandru Ardelean #include <kunit/test.h>
9*11131415SAlexandru Ardelean #include <linux/util_macros.h>
10*11131415SAlexandru Ardelean
11*11131415SAlexandru Ardelean #define FIND_CLOSEST_RANGE_CHECK(from, to, array, exp_idx) \
12*11131415SAlexandru Ardelean { \
13*11131415SAlexandru Ardelean int i; \
14*11131415SAlexandru Ardelean for (i = from; i <= to; i++) { \
15*11131415SAlexandru Ardelean int found = find_closest(i, array, ARRAY_SIZE(array)); \
16*11131415SAlexandru Ardelean KUNIT_ASSERT_EQ(ctx, exp_idx, found); \
17*11131415SAlexandru Ardelean } \
18*11131415SAlexandru Ardelean }
19*11131415SAlexandru Ardelean
test_find_closest(struct kunit * ctx)20*11131415SAlexandru Ardelean static void test_find_closest(struct kunit *ctx)
21*11131415SAlexandru Ardelean {
22*11131415SAlexandru Ardelean /* This will test a few arrays that are found in drivers */
23*11131415SAlexandru Ardelean static const int ina226_avg_tab[] = { 1, 4, 16, 64, 128, 256, 512, 1024 };
24*11131415SAlexandru Ardelean static const unsigned int ad7616_oversampling_avail[] = {
25*11131415SAlexandru Ardelean 1, 2, 4, 8, 16, 32, 64, 128,
26*11131415SAlexandru Ardelean };
27*11131415SAlexandru Ardelean static u32 wd_timeout_table[] = { 2, 4, 6, 8, 16, 32, 48, 64 };
28*11131415SAlexandru Ardelean static int array_prog1a[] = { 1, 2, 3, 4, 5 };
29*11131415SAlexandru Ardelean static u32 array_prog1b[] = { 2, 3, 4, 5, 6 };
30*11131415SAlexandru Ardelean static int array_prog1mix[] = { -2, -1, 0, 1, 2 };
31*11131415SAlexandru Ardelean static int array_prog2a[] = { 1, 3, 5, 7 };
32*11131415SAlexandru Ardelean static u32 array_prog2b[] = { 2, 4, 6, 8 };
33*11131415SAlexandru Ardelean static int array_prog3a[] = { 1, 4, 7, 10 };
34*11131415SAlexandru Ardelean static u32 array_prog3b[] = { 2, 5, 8, 11 };
35*11131415SAlexandru Ardelean static int array_prog4a[] = { 1, 5, 9, 13 };
36*11131415SAlexandru Ardelean static u32 array_prog4b[] = { 2, 6, 10, 14 };
37*11131415SAlexandru Ardelean
38*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 2, ina226_avg_tab, 0);
39*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(3, 10, ina226_avg_tab, 1);
40*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(11, 40, ina226_avg_tab, 2);
41*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(41, 96, ina226_avg_tab, 3);
42*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(97, 192, ina226_avg_tab, 4);
43*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(193, 384, ina226_avg_tab, 5);
44*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(385, 768, ina226_avg_tab, 6);
45*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(769, 2048, ina226_avg_tab, 7);
46*11131415SAlexandru Ardelean
47*11131415SAlexandru Ardelean /* The array that found the bug that caused this kunit to exist */
48*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 1, ad7616_oversampling_avail, 0);
49*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(2, 3, ad7616_oversampling_avail, 1);
50*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(4, 6, ad7616_oversampling_avail, 2);
51*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(7, 12, ad7616_oversampling_avail, 3);
52*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(13, 24, ad7616_oversampling_avail, 4);
53*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(25, 48, ad7616_oversampling_avail, 5);
54*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(49, 96, ad7616_oversampling_avail, 6);
55*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(97, 256, ad7616_oversampling_avail, 7);
56*11131415SAlexandru Ardelean
57*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 3, wd_timeout_table, 0);
58*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(4, 5, wd_timeout_table, 1);
59*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(6, 7, wd_timeout_table, 2);
60*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(8, 12, wd_timeout_table, 3);
61*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(13, 24, wd_timeout_table, 4);
62*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(25, 40, wd_timeout_table, 5);
63*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(41, 56, wd_timeout_table, 6);
64*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(57, 128, wd_timeout_table, 7);
65*11131415SAlexandru Ardelean
66*11131415SAlexandru Ardelean /* One could argue that find_closest() should not be used for monotonic
67*11131415SAlexandru Ardelean * arrays (like 1,2,3,4,5), but even so, it should work as long as the
68*11131415SAlexandru Ardelean * array is sorted ascending. */
69*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 1, array_prog1a, 0);
70*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(2, 2, array_prog1a, 1);
71*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(3, 3, array_prog1a, 2);
72*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(4, 4, array_prog1a, 3);
73*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(5, 8, array_prog1a, 4);
74*11131415SAlexandru Ardelean
75*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 2, array_prog1b, 0);
76*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(3, 3, array_prog1b, 1);
77*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(4, 4, array_prog1b, 2);
78*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(5, 5, array_prog1b, 3);
79*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(6, 8, array_prog1b, 4);
80*11131415SAlexandru Ardelean
81*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-4, -2, array_prog1mix, 0);
82*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-1, -1, array_prog1mix, 1);
83*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(0, 0, array_prog1mix, 2);
84*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(1, 1, array_prog1mix, 3);
85*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(2, 5, array_prog1mix, 4);
86*11131415SAlexandru Ardelean
87*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 2, array_prog2a, 0);
88*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(3, 4, array_prog2a, 1);
89*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(5, 6, array_prog2a, 2);
90*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(7, 10, array_prog2a, 3);
91*11131415SAlexandru Ardelean
92*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 3, array_prog2b, 0);
93*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(4, 5, array_prog2b, 1);
94*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(6, 7, array_prog2b, 2);
95*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(8, 10, array_prog2b, 3);
96*11131415SAlexandru Ardelean
97*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 2, array_prog3a, 0);
98*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(3, 5, array_prog3a, 1);
99*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(6, 8, array_prog3a, 2);
100*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(9, 20, array_prog3a, 3);
101*11131415SAlexandru Ardelean
102*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 3, array_prog3b, 0);
103*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(4, 6, array_prog3b, 1);
104*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(7, 9, array_prog3b, 2);
105*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(10, 20, array_prog3b, 3);
106*11131415SAlexandru Ardelean
107*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 3, array_prog4a, 0);
108*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(4, 7, array_prog4a, 1);
109*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(8, 11, array_prog4a, 2);
110*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(12, 20, array_prog4a, 3);
111*11131415SAlexandru Ardelean
112*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(-3, 4, array_prog4b, 0);
113*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(5, 8, array_prog4b, 1);
114*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(9, 12, array_prog4b, 2);
115*11131415SAlexandru Ardelean FIND_CLOSEST_RANGE_CHECK(13, 20, array_prog4b, 3);
116*11131415SAlexandru Ardelean }
117*11131415SAlexandru Ardelean
118*11131415SAlexandru Ardelean #define FIND_CLOSEST_DESC_RANGE_CHECK(from, to, array, exp_idx) \
119*11131415SAlexandru Ardelean { \
120*11131415SAlexandru Ardelean int i; \
121*11131415SAlexandru Ardelean for (i = from; i <= to; i++) { \
122*11131415SAlexandru Ardelean int found = find_closest_descending(i, array, \
123*11131415SAlexandru Ardelean ARRAY_SIZE(array)); \
124*11131415SAlexandru Ardelean KUNIT_ASSERT_EQ(ctx, exp_idx, found); \
125*11131415SAlexandru Ardelean } \
126*11131415SAlexandru Ardelean }
127*11131415SAlexandru Ardelean
test_find_closest_descending(struct kunit * ctx)128*11131415SAlexandru Ardelean static void test_find_closest_descending(struct kunit *ctx)
129*11131415SAlexandru Ardelean {
130*11131415SAlexandru Ardelean /* Same arrays as 'test_find_closest' but reversed */
131*11131415SAlexandru Ardelean static const int ina226_avg_tab[] = { 1024, 512, 256, 128, 64, 16, 4, 1 };
132*11131415SAlexandru Ardelean static const unsigned int ad7616_oversampling_avail[] = {
133*11131415SAlexandru Ardelean 128, 64, 32, 16, 8, 4, 2, 1
134*11131415SAlexandru Ardelean };
135*11131415SAlexandru Ardelean static u32 wd_timeout_table[] = { 64, 48, 32, 16, 8, 6, 4, 2 };
136*11131415SAlexandru Ardelean static int array_prog1a[] = { 5, 4, 3, 2, 1 };
137*11131415SAlexandru Ardelean static u32 array_prog1b[] = { 6, 5, 4, 3, 2 };
138*11131415SAlexandru Ardelean static int array_prog1mix[] = { 2, 1, 0, -1, -2 };
139*11131415SAlexandru Ardelean static int array_prog2a[] = { 7, 5, 3, 1 };
140*11131415SAlexandru Ardelean static u32 array_prog2b[] = { 8, 6, 4, 2 };
141*11131415SAlexandru Ardelean static int array_prog3a[] = { 10, 7, 4, 1 };
142*11131415SAlexandru Ardelean static u32 array_prog3b[] = { 11, 8, 5, 2 };
143*11131415SAlexandru Ardelean static int array_prog4a[] = { 13, 9, 5, 1 };
144*11131415SAlexandru Ardelean static u32 array_prog4b[] = { 14, 10, 6, 2 };
145*11131415SAlexandru Ardelean
146*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 2, ina226_avg_tab, 7);
147*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(3, 10, ina226_avg_tab, 6);
148*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(11, 40, ina226_avg_tab, 5);
149*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(41, 96, ina226_avg_tab, 4);
150*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(97, 192, ina226_avg_tab, 3);
151*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(193, 384, ina226_avg_tab, 2);
152*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(385, 768, ina226_avg_tab, 1);
153*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(769, 2048, ina226_avg_tab, 0);
154*11131415SAlexandru Ardelean
155*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 1, ad7616_oversampling_avail, 7);
156*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(2, 3, ad7616_oversampling_avail, 6);
157*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(4, 6, ad7616_oversampling_avail, 5);
158*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(7, 12, ad7616_oversampling_avail, 4);
159*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(13, 24, ad7616_oversampling_avail, 3);
160*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(25, 48, ad7616_oversampling_avail, 2);
161*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(49, 96, ad7616_oversampling_avail, 1);
162*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(97, 256, ad7616_oversampling_avail, 0);
163*11131415SAlexandru Ardelean
164*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 3, wd_timeout_table, 7);
165*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(4, 5, wd_timeout_table, 6);
166*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(6, 7, wd_timeout_table, 5);
167*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(8, 12, wd_timeout_table, 4);
168*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(13, 24, wd_timeout_table, 3);
169*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(25, 40, wd_timeout_table, 2);
170*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(41, 56, wd_timeout_table, 1);
171*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(57, 128, wd_timeout_table, 0);
172*11131415SAlexandru Ardelean
173*11131415SAlexandru Ardelean /* One could argue that find_closest_descending() should not be used
174*11131415SAlexandru Ardelean * for monotonic arrays (like 5,4,3,2,1), but even so, it should still
175*11131415SAlexandru Ardelean * it should work as long as the array is sorted descending. */
176*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 1, array_prog1a, 4);
177*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(2, 2, array_prog1a, 3);
178*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(3, 3, array_prog1a, 2);
179*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(4, 4, array_prog1a, 1);
180*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(5, 8, array_prog1a, 0);
181*11131415SAlexandru Ardelean
182*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 2, array_prog1b, 4);
183*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(3, 3, array_prog1b, 3);
184*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(4, 4, array_prog1b, 2);
185*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(5, 5, array_prog1b, 1);
186*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(6, 8, array_prog1b, 0);
187*11131415SAlexandru Ardelean
188*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-4, -2, array_prog1mix, 4);
189*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-1, -1, array_prog1mix, 3);
190*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(0, 0, array_prog1mix, 2);
191*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(1, 1, array_prog1mix, 1);
192*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(2, 5, array_prog1mix, 0);
193*11131415SAlexandru Ardelean
194*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 2, array_prog2a, 3);
195*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(3, 4, array_prog2a, 2);
196*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(5, 6, array_prog2a, 1);
197*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(7, 10, array_prog2a, 0);
198*11131415SAlexandru Ardelean
199*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 3, array_prog2b, 3);
200*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(4, 5, array_prog2b, 2);
201*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(6, 7, array_prog2b, 1);
202*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(8, 10, array_prog2b, 0);
203*11131415SAlexandru Ardelean
204*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 2, array_prog3a, 3);
205*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(3, 5, array_prog3a, 2);
206*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(6, 8, array_prog3a, 1);
207*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(9, 20, array_prog3a, 0);
208*11131415SAlexandru Ardelean
209*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 3, array_prog3b, 3);
210*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(4, 6, array_prog3b, 2);
211*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(7, 9, array_prog3b, 1);
212*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(10, 20, array_prog3b, 0);
213*11131415SAlexandru Ardelean
214*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 3, array_prog4a, 3);
215*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(4, 7, array_prog4a, 2);
216*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(8, 11, array_prog4a, 1);
217*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(12, 20, array_prog4a, 0);
218*11131415SAlexandru Ardelean
219*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(-3, 4, array_prog4b, 3);
220*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(5, 8, array_prog4b, 2);
221*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(9, 12, array_prog4b, 1);
222*11131415SAlexandru Ardelean FIND_CLOSEST_DESC_RANGE_CHECK(13, 20, array_prog4b, 0);
223*11131415SAlexandru Ardelean }
224*11131415SAlexandru Ardelean
225*11131415SAlexandru Ardelean static struct kunit_case __refdata util_macros_test_cases[] = {
226*11131415SAlexandru Ardelean KUNIT_CASE(test_find_closest),
227*11131415SAlexandru Ardelean KUNIT_CASE(test_find_closest_descending),
228*11131415SAlexandru Ardelean {}
229*11131415SAlexandru Ardelean };
230*11131415SAlexandru Ardelean
231*11131415SAlexandru Ardelean static struct kunit_suite util_macros_test_suite = {
232*11131415SAlexandru Ardelean .name = "util_macros.h",
233*11131415SAlexandru Ardelean .test_cases = util_macros_test_cases,
234*11131415SAlexandru Ardelean };
235*11131415SAlexandru Ardelean
236*11131415SAlexandru Ardelean kunit_test_suites(&util_macros_test_suite);
237*11131415SAlexandru Ardelean
238*11131415SAlexandru Ardelean MODULE_AUTHOR("Alexandru Ardelean <aardelean@baylibre.com>");
239*11131415SAlexandru Ardelean MODULE_DESCRIPTION("Test cases for util_macros.h helpers");
240*11131415SAlexandru Ardelean MODULE_LICENSE("GPL");
241