1*644b4646SEd Maste /*
2*644b4646SEd Maste * Regress test for misc helper functions.
3*644b4646SEd Maste *
4*644b4646SEd Maste * Placed in the public domain.
5*644b4646SEd Maste */
6*644b4646SEd Maste
7*644b4646SEd Maste #include "includes.h"
8*644b4646SEd Maste
9*644b4646SEd Maste #include <sys/types.h>
10*644b4646SEd Maste #include <stdio.h>
11*644b4646SEd Maste #include <stdint.h>
12*644b4646SEd Maste #include <stdlib.h>
13*644b4646SEd Maste #include <string.h>
14*644b4646SEd Maste
15*644b4646SEd Maste #include "../test_helper/test_helper.h"
16*644b4646SEd Maste
17*644b4646SEd Maste #include "log.h"
18*644b4646SEd Maste #include "misc.h"
19*644b4646SEd Maste #include "xmalloc.h"
20*644b4646SEd Maste
21*644b4646SEd Maste void test_misc(void);
22*644b4646SEd Maste
23*644b4646SEd Maste static void
test_chop(void)24*644b4646SEd Maste test_chop(void)
25*644b4646SEd Maste {
26*644b4646SEd Maste char *s;
27*644b4646SEd Maste
28*644b4646SEd Maste TEST_START("chop newline");
29*644b4646SEd Maste s = xstrdup("hello\n");
30*644b4646SEd Maste ASSERT_STRING_EQ(chop(s), "hello");
31*644b4646SEd Maste free(s);
32*644b4646SEd Maste TEST_DONE();
33*644b4646SEd Maste
34*644b4646SEd Maste TEST_START("chop carriage return");
35*644b4646SEd Maste s = xstrdup("hello\r");
36*644b4646SEd Maste ASSERT_STRING_EQ(chop(s), "hello");
37*644b4646SEd Maste free(s);
38*644b4646SEd Maste TEST_DONE();
39*644b4646SEd Maste
40*644b4646SEd Maste TEST_START("chop CRLF");
41*644b4646SEd Maste s = xstrdup("hello\r\n");
42*644b4646SEd Maste ASSERT_STRING_EQ(chop(s), "hello");
43*644b4646SEd Maste free(s);
44*644b4646SEd Maste TEST_DONE();
45*644b4646SEd Maste
46*644b4646SEd Maste TEST_START("chop newline in middle");
47*644b4646SEd Maste s = xstrdup("he\nllo");
48*644b4646SEd Maste ASSERT_STRING_EQ(chop(s), "he");
49*644b4646SEd Maste free(s);
50*644b4646SEd Maste TEST_DONE();
51*644b4646SEd Maste
52*644b4646SEd Maste TEST_START("chop no newline");
53*644b4646SEd Maste s = xstrdup("hello");
54*644b4646SEd Maste ASSERT_STRING_EQ(chop(s), "hello");
55*644b4646SEd Maste free(s);
56*644b4646SEd Maste TEST_DONE();
57*644b4646SEd Maste
58*644b4646SEd Maste TEST_START("chop empty string");
59*644b4646SEd Maste s = xstrdup("");
60*644b4646SEd Maste ASSERT_STRING_EQ(chop(s), "");
61*644b4646SEd Maste free(s);
62*644b4646SEd Maste TEST_DONE();
63*644b4646SEd Maste
64*644b4646SEd Maste TEST_START("chop only newline");
65*644b4646SEd Maste s = xstrdup("\n");
66*644b4646SEd Maste ASSERT_STRING_EQ(chop(s), "");
67*644b4646SEd Maste free(s);
68*644b4646SEd Maste TEST_DONE();
69*644b4646SEd Maste
70*644b4646SEd Maste TEST_START("chop only CR");
71*644b4646SEd Maste s = xstrdup("\r");
72*644b4646SEd Maste ASSERT_STRING_EQ(chop(s), "");
73*644b4646SEd Maste free(s);
74*644b4646SEd Maste TEST_DONE();
75*644b4646SEd Maste
76*644b4646SEd Maste TEST_START("chop only CRLF");
77*644b4646SEd Maste s = xstrdup("\r\n");
78*644b4646SEd Maste ASSERT_STRING_EQ(chop(s), "");
79*644b4646SEd Maste free(s);
80*644b4646SEd Maste TEST_DONE();
81*644b4646SEd Maste }
82*644b4646SEd Maste
83*644b4646SEd Maste static void
test_rtrim(void)84*644b4646SEd Maste test_rtrim(void)
85*644b4646SEd Maste {
86*644b4646SEd Maste char *s;
87*644b4646SEd Maste
88*644b4646SEd Maste TEST_START("rtrim trailing space");
89*644b4646SEd Maste s = xstrdup("hello ");
90*644b4646SEd Maste rtrim(s);
91*644b4646SEd Maste ASSERT_STRING_EQ(s, "hello");
92*644b4646SEd Maste free(s);
93*644b4646SEd Maste TEST_DONE();
94*644b4646SEd Maste
95*644b4646SEd Maste TEST_START("rtrim trailing tab");
96*644b4646SEd Maste s = xstrdup("hello\t\t");
97*644b4646SEd Maste rtrim(s);
98*644b4646SEd Maste ASSERT_STRING_EQ(s, "hello");
99*644b4646SEd Maste free(s);
100*644b4646SEd Maste TEST_DONE();
101*644b4646SEd Maste
102*644b4646SEd Maste TEST_START("rtrim trailing mixed whitespace");
103*644b4646SEd Maste s = xstrdup("hello \t ");
104*644b4646SEd Maste rtrim(s);
105*644b4646SEd Maste ASSERT_STRING_EQ(s, "hello");
106*644b4646SEd Maste free(s);
107*644b4646SEd Maste TEST_DONE();
108*644b4646SEd Maste
109*644b4646SEd Maste TEST_START("rtrim no trailing whitespace");
110*644b4646SEd Maste s = xstrdup("hello");
111*644b4646SEd Maste rtrim(s);
112*644b4646SEd Maste ASSERT_STRING_EQ(s, "hello");
113*644b4646SEd Maste free(s);
114*644b4646SEd Maste TEST_DONE();
115*644b4646SEd Maste
116*644b4646SEd Maste TEST_START("rtrim whitespace in middle");
117*644b4646SEd Maste s = xstrdup("he llo");
118*644b4646SEd Maste rtrim(s);
119*644b4646SEd Maste ASSERT_STRING_EQ(s, "he llo");
120*644b4646SEd Maste free(s);
121*644b4646SEd Maste TEST_DONE();
122*644b4646SEd Maste
123*644b4646SEd Maste TEST_START("rtrim empty string");
124*644b4646SEd Maste s = xstrdup("");
125*644b4646SEd Maste rtrim(s);
126*644b4646SEd Maste ASSERT_STRING_EQ(s, "");
127*644b4646SEd Maste free(s);
128*644b4646SEd Maste TEST_DONE();
129*644b4646SEd Maste
130*644b4646SEd Maste TEST_START("rtrim only whitespace");
131*644b4646SEd Maste s = xstrdup(" \t");
132*644b4646SEd Maste rtrim(s);
133*644b4646SEd Maste ASSERT_STRING_EQ(s, "");
134*644b4646SEd Maste free(s);
135*644b4646SEd Maste TEST_DONE();
136*644b4646SEd Maste }
137*644b4646SEd Maste
138*644b4646SEd Maste static void
test_strprefix(void)139*644b4646SEd Maste test_strprefix(void)
140*644b4646SEd Maste {
141*644b4646SEd Maste const char *s;
142*644b4646SEd Maste
143*644b4646SEd Maste TEST_START("strprefix basic match");
144*644b4646SEd Maste s = strprefix("hello world", "hello", 0);
145*644b4646SEd Maste ASSERT_PTR_NE(s, NULL);
146*644b4646SEd Maste ASSERT_STRING_EQ(s, " world");
147*644b4646SEd Maste TEST_DONE();
148*644b4646SEd Maste
149*644b4646SEd Maste TEST_START("strprefix no match");
150*644b4646SEd Maste s = strprefix("hello world", "world", 0);
151*644b4646SEd Maste ASSERT_PTR_EQ(s, NULL);
152*644b4646SEd Maste TEST_DONE();
153*644b4646SEd Maste
154*644b4646SEd Maste TEST_START("strprefix full match");
155*644b4646SEd Maste s = strprefix("hello", "hello", 0);
156*644b4646SEd Maste ASSERT_PTR_NE(s, NULL);
157*644b4646SEd Maste ASSERT_STRING_EQ(s, "");
158*644b4646SEd Maste TEST_DONE();
159*644b4646SEd Maste
160*644b4646SEd Maste TEST_START("strprefix empty string");
161*644b4646SEd Maste s = strprefix("", "hello", 0);
162*644b4646SEd Maste ASSERT_PTR_EQ(s, NULL);
163*644b4646SEd Maste TEST_DONE();
164*644b4646SEd Maste
165*644b4646SEd Maste TEST_START("strprefix empty prefix");
166*644b4646SEd Maste s = strprefix("hello", "", 0);
167*644b4646SEd Maste ASSERT_PTR_NE(s, NULL);
168*644b4646SEd Maste ASSERT_STRING_EQ(s, "hello");
169*644b4646SEd Maste TEST_DONE();
170*644b4646SEd Maste
171*644b4646SEd Maste TEST_START("strprefix case sensitive no match");
172*644b4646SEd Maste s = strprefix("Hello world", "hello", 0);
173*644b4646SEd Maste ASSERT_PTR_EQ(s, NULL);
174*644b4646SEd Maste TEST_DONE();
175*644b4646SEd Maste
176*644b4646SEd Maste TEST_START("strprefix case insensitive match");
177*644b4646SEd Maste s = strprefix("Hello world", "hello", 1);
178*644b4646SEd Maste ASSERT_PTR_NE(s, NULL);
179*644b4646SEd Maste ASSERT_STRING_EQ(s, " world");
180*644b4646SEd Maste TEST_DONE();
181*644b4646SEd Maste
182*644b4646SEd Maste TEST_START("strprefix case insensitive full match");
183*644b4646SEd Maste s = strprefix("HELLO", "hello", 1);
184*644b4646SEd Maste ASSERT_PTR_NE(s, NULL);
185*644b4646SEd Maste ASSERT_STRING_EQ(s, "");
186*644b4646SEd Maste TEST_DONE();
187*644b4646SEd Maste }
188*644b4646SEd Maste
189*644b4646SEd Maste static void
test_fmt_timeframe(void)190*644b4646SEd Maste test_fmt_timeframe(void)
191*644b4646SEd Maste {
192*644b4646SEd Maste TEST_START("fmt_timeframe seconds");
193*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(0), "00:00:00");
194*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(59), "00:00:59");
195*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(60), "00:01:00");
196*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(3599), "00:59:59");
197*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(3600), "01:00:00");
198*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(86399), "23:59:59");
199*644b4646SEd Maste TEST_DONE();
200*644b4646SEd Maste
201*644b4646SEd Maste TEST_START("fmt_timeframe days");
202*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(86400), "1d00h00m");
203*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(90061), "1d01h01m");
204*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(604799), "6d23h59m");
205*644b4646SEd Maste TEST_DONE();
206*644b4646SEd Maste
207*644b4646SEd Maste TEST_START("fmt_timeframe weeks");
208*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(604800), "01w0d00h");
209*644b4646SEd Maste ASSERT_STRING_EQ(fmt_timeframe(694861), "01w1d01h");
210*644b4646SEd Maste TEST_DONE();
211*644b4646SEd Maste }
212*644b4646SEd Maste
213*644b4646SEd Maste static void
test_arglist(void)214*644b4646SEd Maste test_arglist(void)
215*644b4646SEd Maste {
216*644b4646SEd Maste arglist args;
217*644b4646SEd Maste u_int i;
218*644b4646SEd Maste
219*644b4646SEd Maste memset(&args, 0, sizeof(args));
220*644b4646SEd Maste
221*644b4646SEd Maste TEST_START("addargs initial");
222*644b4646SEd Maste addargs(&args, "one");
223*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 1);
224*644b4646SEd Maste ASSERT_U_INT_EQ(args.nalloc, 32);
225*644b4646SEd Maste ASSERT_PTR_NE(args.list, NULL);
226*644b4646SEd Maste ASSERT_STRING_EQ(args.list[0], "one");
227*644b4646SEd Maste ASSERT_PTR_EQ(args.list[1], NULL);
228*644b4646SEd Maste TEST_DONE();
229*644b4646SEd Maste
230*644b4646SEd Maste TEST_START("addargs second");
231*644b4646SEd Maste addargs(&args, "two");
232*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 2);
233*644b4646SEd Maste ASSERT_U_INT_EQ(args.nalloc, 32);
234*644b4646SEd Maste ASSERT_PTR_NE(args.list, NULL);
235*644b4646SEd Maste ASSERT_STRING_EQ(args.list[0], "one");
236*644b4646SEd Maste ASSERT_STRING_EQ(args.list[1], "two");
237*644b4646SEd Maste ASSERT_PTR_EQ(args.list[2], NULL);
238*644b4646SEd Maste TEST_DONE();
239*644b4646SEd Maste
240*644b4646SEd Maste TEST_START("addargs with format");
241*644b4646SEd Maste addargs(&args, "three=%d", 3);
242*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 3);
243*644b4646SEd Maste ASSERT_U_INT_EQ(args.nalloc, 32);
244*644b4646SEd Maste ASSERT_PTR_NE(args.list, NULL);
245*644b4646SEd Maste ASSERT_STRING_EQ(args.list[0], "one");
246*644b4646SEd Maste ASSERT_STRING_EQ(args.list[1], "two");
247*644b4646SEd Maste ASSERT_STRING_EQ(args.list[2], "three=3");
248*644b4646SEd Maste ASSERT_PTR_EQ(args.list[3], NULL);
249*644b4646SEd Maste TEST_DONE();
250*644b4646SEd Maste
251*644b4646SEd Maste TEST_START("replacearg middle");
252*644b4646SEd Maste replacearg(&args, 1, "TWO!");
253*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 3);
254*644b4646SEd Maste ASSERT_STRING_EQ(args.list[0], "one");
255*644b4646SEd Maste ASSERT_STRING_EQ(args.list[1], "TWO!");
256*644b4646SEd Maste ASSERT_STRING_EQ(args.list[2], "three=3");
257*644b4646SEd Maste ASSERT_PTR_EQ(args.list[3], NULL);
258*644b4646SEd Maste TEST_DONE();
259*644b4646SEd Maste
260*644b4646SEd Maste TEST_START("replacearg first");
261*644b4646SEd Maste replacearg(&args, 0, "ONE!");
262*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 3);
263*644b4646SEd Maste ASSERT_STRING_EQ(args.list[0], "ONE!");
264*644b4646SEd Maste ASSERT_STRING_EQ(args.list[1], "TWO!");
265*644b4646SEd Maste ASSERT_STRING_EQ(args.list[2], "three=3");
266*644b4646SEd Maste ASSERT_PTR_EQ(args.list[3], NULL);
267*644b4646SEd Maste TEST_DONE();
268*644b4646SEd Maste
269*644b4646SEd Maste TEST_START("replacearg last");
270*644b4646SEd Maste replacearg(&args, 2, "THREE=3!");
271*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 3);
272*644b4646SEd Maste ASSERT_STRING_EQ(args.list[0], "ONE!");
273*644b4646SEd Maste ASSERT_STRING_EQ(args.list[1], "TWO!");
274*644b4646SEd Maste ASSERT_STRING_EQ(args.list[2], "THREE=3!");
275*644b4646SEd Maste ASSERT_PTR_EQ(args.list[3], NULL);
276*644b4646SEd Maste TEST_DONE();
277*644b4646SEd Maste
278*644b4646SEd Maste TEST_START("replacearg with format");
279*644b4646SEd Maste replacearg(&args, 1, "two=%d", 2);
280*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 3);
281*644b4646SEd Maste ASSERT_STRING_EQ(args.list[0], "ONE!");
282*644b4646SEd Maste ASSERT_STRING_EQ(args.list[1], "two=2");
283*644b4646SEd Maste ASSERT_STRING_EQ(args.list[2], "THREE=3!");
284*644b4646SEd Maste ASSERT_PTR_EQ(args.list[3], NULL);
285*644b4646SEd Maste TEST_DONE();
286*644b4646SEd Maste
287*644b4646SEd Maste TEST_START("addargs reallocation");
288*644b4646SEd Maste for (i = args.num; i < 33; i++)
289*644b4646SEd Maste addargs(&args, "pad-%d", i);
290*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 33);
291*644b4646SEd Maste ASSERT_U_INT_GE(args.nalloc, 33);
292*644b4646SEd Maste ASSERT_STRING_EQ(args.list[32], "pad-32");
293*644b4646SEd Maste ASSERT_PTR_EQ(args.list[33], NULL);
294*644b4646SEd Maste TEST_DONE();
295*644b4646SEd Maste
296*644b4646SEd Maste TEST_START("freeargs");
297*644b4646SEd Maste freeargs(&args);
298*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 0);
299*644b4646SEd Maste ASSERT_U_INT_EQ(args.nalloc, 0);
300*644b4646SEd Maste ASSERT_PTR_EQ(args.list, NULL);
301*644b4646SEd Maste TEST_DONE();
302*644b4646SEd Maste
303*644b4646SEd Maste TEST_START("freeargs on NULL");
304*644b4646SEd Maste freeargs(NULL);
305*644b4646SEd Maste TEST_DONE();
306*644b4646SEd Maste
307*644b4646SEd Maste TEST_START("freeargs on empty");
308*644b4646SEd Maste memset(&args, 0, sizeof(args));
309*644b4646SEd Maste freeargs(&args);
310*644b4646SEd Maste ASSERT_U_INT_EQ(args.num, 0);
311*644b4646SEd Maste ASSERT_U_INT_EQ(args.nalloc, 0);
312*644b4646SEd Maste ASSERT_PTR_EQ(args.list, NULL);
313*644b4646SEd Maste TEST_DONE();
314*644b4646SEd Maste }
315*644b4646SEd Maste
316*644b4646SEd Maste static void
test_tohex(void)317*644b4646SEd Maste test_tohex(void)
318*644b4646SEd Maste {
319*644b4646SEd Maste char *hex;
320*644b4646SEd Maste
321*644b4646SEd Maste TEST_START("tohex simple");
322*644b4646SEd Maste hex = tohex("foo", 3);
323*644b4646SEd Maste ASSERT_STRING_EQ(hex, "666f6f");
324*644b4646SEd Maste free(hex);
325*644b4646SEd Maste TEST_DONE();
326*644b4646SEd Maste
327*644b4646SEd Maste TEST_START("tohex with null");
328*644b4646SEd Maste hex = tohex("a\0b", 3);
329*644b4646SEd Maste ASSERT_STRING_EQ(hex, "610062");
330*644b4646SEd Maste free(hex);
331*644b4646SEd Maste TEST_DONE();
332*644b4646SEd Maste
333*644b4646SEd Maste TEST_START("tohex empty");
334*644b4646SEd Maste hex = tohex("", 0);
335*644b4646SEd Maste ASSERT_STRING_EQ(hex, "");
336*644b4646SEd Maste free(hex);
337*644b4646SEd Maste TEST_DONE();
338*644b4646SEd Maste }
339*644b4646SEd Maste
340*644b4646SEd Maste static void
test_lowercase(void)341*644b4646SEd Maste test_lowercase(void)
342*644b4646SEd Maste {
343*644b4646SEd Maste char *s;
344*644b4646SEd Maste
345*644b4646SEd Maste TEST_START("lowercase mixed");
346*644b4646SEd Maste s = xstrdup("HeLlO WoRlD 123");
347*644b4646SEd Maste lowercase(s);
348*644b4646SEd Maste ASSERT_STRING_EQ(s, "hello world 123");
349*644b4646SEd Maste free(s);
350*644b4646SEd Maste TEST_DONE();
351*644b4646SEd Maste
352*644b4646SEd Maste TEST_START("lowercase empty");
353*644b4646SEd Maste s = xstrdup("");
354*644b4646SEd Maste lowercase(s);
355*644b4646SEd Maste ASSERT_STRING_EQ(s, "");
356*644b4646SEd Maste free(s);
357*644b4646SEd Maste TEST_DONE();
358*644b4646SEd Maste }
359*644b4646SEd Maste
360*644b4646SEd Maste static void
test_path_absolute(void)361*644b4646SEd Maste test_path_absolute(void)
362*644b4646SEd Maste {
363*644b4646SEd Maste TEST_START("path_absolute absolute");
364*644b4646SEd Maste ASSERT_INT_EQ(path_absolute("/foo/bar"), 1);
365*644b4646SEd Maste TEST_DONE();
366*644b4646SEd Maste
367*644b4646SEd Maste TEST_START("path_absolute relative");
368*644b4646SEd Maste ASSERT_INT_EQ(path_absolute("foo/bar"), 0);
369*644b4646SEd Maste TEST_DONE();
370*644b4646SEd Maste
371*644b4646SEd Maste TEST_START("path_absolute empty");
372*644b4646SEd Maste ASSERT_INT_EQ(path_absolute(""), 0);
373*644b4646SEd Maste TEST_DONE();
374*644b4646SEd Maste }
375*644b4646SEd Maste
376*644b4646SEd Maste static void
test_skip_space(void)377*644b4646SEd Maste test_skip_space(void)
378*644b4646SEd Maste {
379*644b4646SEd Maste char *s, *p;
380*644b4646SEd Maste
381*644b4646SEd Maste TEST_START("skip_space leading spaces");
382*644b4646SEd Maste s = p = xstrdup(" hello");
383*644b4646SEd Maste skip_space(&p);
384*644b4646SEd Maste ASSERT_STRING_EQ(p, "hello");
385*644b4646SEd Maste free(s);
386*644b4646SEd Maste TEST_DONE();
387*644b4646SEd Maste
388*644b4646SEd Maste TEST_START("skip_space leading tabs");
389*644b4646SEd Maste s = p = xstrdup("\t\thello");
390*644b4646SEd Maste skip_space(&p);
391*644b4646SEd Maste ASSERT_STRING_EQ(p, "hello");
392*644b4646SEd Maste free(s);
393*644b4646SEd Maste TEST_DONE();
394*644b4646SEd Maste
395*644b4646SEd Maste TEST_START("skip_space leading mixed whitespace");
396*644b4646SEd Maste s = p = xstrdup(" \t hello");
397*644b4646SEd Maste skip_space(&p);
398*644b4646SEd Maste ASSERT_STRING_EQ(p, "hello");
399*644b4646SEd Maste free(s);
400*644b4646SEd Maste TEST_DONE();
401*644b4646SEd Maste
402*644b4646SEd Maste TEST_START("skip_space no leading whitespace");
403*644b4646SEd Maste s = p = xstrdup("hello");
404*644b4646SEd Maste skip_space(&p);
405*644b4646SEd Maste ASSERT_STRING_EQ(p, "hello");
406*644b4646SEd Maste free(s);
407*644b4646SEd Maste TEST_DONE();
408*644b4646SEd Maste
409*644b4646SEd Maste TEST_START("skip_space empty string");
410*644b4646SEd Maste s = p = xstrdup("");
411*644b4646SEd Maste skip_space(&p);
412*644b4646SEd Maste ASSERT_STRING_EQ(p, "");
413*644b4646SEd Maste free(s);
414*644b4646SEd Maste TEST_DONE();
415*644b4646SEd Maste
416*644b4646SEd Maste TEST_START("skip_space only whitespace");
417*644b4646SEd Maste s = p = xstrdup(" \t ");
418*644b4646SEd Maste skip_space(&p);
419*644b4646SEd Maste ASSERT_STRING_EQ(p, "");
420*644b4646SEd Maste free(s);
421*644b4646SEd Maste TEST_DONE();
422*644b4646SEd Maste }
423*644b4646SEd Maste
424*644b4646SEd Maste void
test_misc(void)425*644b4646SEd Maste test_misc(void)
426*644b4646SEd Maste {
427*644b4646SEd Maste test_chop();
428*644b4646SEd Maste test_rtrim();
429*644b4646SEd Maste test_strprefix();
430*644b4646SEd Maste test_fmt_timeframe();
431*644b4646SEd Maste test_arglist();
432*644b4646SEd Maste test_tohex();
433*644b4646SEd Maste test_lowercase();
434*644b4646SEd Maste test_path_absolute();
435*644b4646SEd Maste test_skip_space();
436*644b4646SEd Maste }
437