1 #include <r_util.h>
2 #include "minunit.h"
3 
4 //TODO test r_str_chop_path
5 
test_r_str_wrap(void)6 bool test_r_str_wrap(void) {
7 	char *s = r_str_wrap ("hello world\nhow are you\n", 5);
8 	char *res = strdup ("hello \nworld\nhow ar\ne you\n");
9 	mu_assert_streq (s, res, "error, invalid string wrapping");
10 	free (s);
11 	free (res);
12 	mu_end;
13 }
14 
test_r_str_replace_char_once(void)15 bool test_r_str_replace_char_once(void) {
16 	char* str = strdup ("hello world");
17 	(void) r_str_replace_char_once (str, 'l', 'x');
18 	mu_assert_streq (str, "hexlo world", "error, replace char once failed");
19 	free (str);
20 	mu_end;
21 }
22 
test_r_str_replace(void)23 bool test_r_str_replace(void) {
24 	// infinite loop test
25 	char *str = r_str_replace (strdup ("hello world"), "hell", "ihell", 0);
26 	mu_assert_streq (str, "ihello world", "error, replace char multi failed");
27 	free (str);
28 
29 	str = r_str_replace (strdup ("hello world"), "hell", "ihell", 1);
30 	mu_assert_streq (str, "ihello world", "error, replace char multi failed");
31 	free (str);
32 
33 	str = r_str_replace (strdup ("hello world"), "hello", "", 1);
34 	mu_assert_streq (str, " world", "error, replace char multi failed");
35 	free (str);
36 
37 	str = r_str_replace (strdup ("hello world"), "h", "hello", 0);
38 	mu_assert_streq (str, "helloello world", "error, replace char multi failed");
39 	free (str);
40 
41 	str = r_str_replace (strdup ("hello horld"), "h", "hello", 1);
42 	mu_assert_streq (str, "helloello helloorld", "error, replace char multi failed");
43 	free (str);
44 	str = r_str_replace (strdup ("hello horld"), "h", "hello", 0);
45 	mu_assert_streq (str, "helloello horld", "error, replace char multi failed");
46 	free (str);
47 	mu_end;
48 }
49 
test_r_str_replace_char(void)50 bool test_r_str_replace_char(void) {
51 	char* str = strdup ("hello world");
52 	(void) r_str_replace_char (str, 'l', 'x');
53 	mu_assert_streq (str, "hexxo worxd", "error, replace char multi failed");
54 	free (str);
55 	mu_end;
56 }
57 
58 //TODO test r_str_bits
59 
test_r_str_bits64(void)60 bool test_r_str_bits64(void) {
61 	char buf[65];
62 	(void)r_str_bits64 (buf, 0);
63 	mu_assert_streq (buf, "00000000", "binary of 0");
64 	(void)r_str_bits64 (buf, 1);
65 	mu_assert_streq (buf, "00000001", "binary of 1");
66 	(void)r_str_bits64 (buf, 2);
67 	mu_assert_streq (buf, "00000010", "binary of 2");
68 	mu_end;
69 }
70 
71 //TODO test r_str_bits_from_string
72 
test_r_str_rwx(void)73 bool test_r_str_rwx(void) {
74 	int rwx = r_str_rwx ("rwx");
75 	int rw =  r_str_rwx ("rw-");
76 	int rx = r_str_rwx ("rx");
77 	int none = r_str_rwx ("---");
78 	int number = r_str_rwx ("999");
79 	int rx_number = r_str_rwx ("5");
80 	int rwx_number = r_str_rwx ("7");
81 	mu_assert_eq (rwx, 7, "rwx");
82 	mu_assert_eq (rw, 6, "rw");
83 	mu_assert_eq (rx, 5, "rx");
84 	mu_assert_eq (none, 0, "no permissions");
85 	mu_assert_eq (number, 0, "large input number string");
86 	mu_assert_eq (rx_number, 5, "rx number");
87 	mu_assert_eq (rwx_number, 7, "rwx number");
88 	mu_end;
89 }
90 
91 //TODO test r_str_binstr2bin
92 
test_r_str_rwx_i(void)93 bool test_r_str_rwx_i(void) {
94 	const char* rwx = r_str_rwx_i (7);
95 	const char* rw = r_str_rwx_i (6);
96 	const char* rx = r_str_rwx_i (5);
97 	const char* invalid_mode = r_str_rwx_i (898);
98 	const char* invalid_mode_neg = r_str_rwx_i (-10);
99 	mu_assert_streq (rwx, "rwx", "rwx = 7 mode");
100 	mu_assert_streq (rw, "rw-", "rw = 6 mode");
101 	mu_assert_streq (rx, "r-x", "rx = 5 mode");
102 	mu_assert_streq (invalid_mode, "---", "invalid permissions mode");
103 	mu_assert_streq (invalid_mode_neg, "---", "invalid permissions mode (negative value)");
104 	mu_end;
105 }
106 
test_r_str_trim(void)107 bool test_r_str_trim(void) {
108 	//  1
109 	const char* one = r_str_trim_head_ro ("  hello  ");
110 	mu_assert_streq (one, "hello  ", "one");
111 	//  2
112 	char* two = strdup ("  hello  ");
113 	r_str_trim_head (two);
114 	mu_assert_streq (two, "hello  ", "two");
115 	r_str_trim (two);
116 	//  2
117 	mu_assert_streq (two, "hello", "three");
118 	free (two);
119 	mu_end;
120 }
121 //TODO find a way to test r_str_home.
122 
test_r_str_bool(void)123 bool test_r_str_bool(void) {
124 	const char* one = r_str_bool(1);
125 	const char* zero = r_str_bool(0);
126 	const char* fifty = r_str_bool(50);
127 	const char* negative = r_str_bool(-1);
128 	mu_assert_streq (one, "true", "one");
129 	mu_assert_streq (zero, "false", "zero");
130 	mu_assert_streq (fifty, "true", "large positive value");
131 	mu_assert_streq (negative, "true", "negative number");
132 	mu_end;
133 }
134 
test_r_str_case(void)135 bool test_r_str_case(void) {
136 	char* str1_mixedcase = strdup ("mIxEdCaSe");
137 	char* str2_mixedcase = strdup ("mIxEdCaSe");
138 	r_str_case (str1_mixedcase, true /*upcase*/);
139 	r_str_case (str2_mixedcase, false /*downcase*/);
140 	mu_assert_streq (str1_mixedcase, "MIXEDCASE", "upcase");
141 	mu_assert_streq (str2_mixedcase, "mixedcase", "downcase");
142 	char* non_alphanum_1 = strdup ("c00lstring!");
143 	char* non_alphanum_2 = strdup ("c00lstrinG!");
144 	r_str_case (non_alphanum_1, true /*upcase*/);
145 	r_str_case (non_alphanum_2, false /*downcase*/);
146 	mu_assert_streq (non_alphanum_1, "C00LSTRING!", "upcase, nonalpanum");
147 	mu_assert_streq (non_alphanum_2, "c00lstring!", "downcase, nonalpanum");
148 	free (str1_mixedcase);
149 	free (str2_mixedcase);
150 	free (non_alphanum_1);
151 	free (non_alphanum_2);
152 	mu_end;
153 }
154 
155 //TODO test r_str_hash64, r_str_hash
156 //TODO test r_str_delta (WTF!)
157 
test_r_str_split(void)158 bool test_r_str_split(void) {
159 	char* hi = strdup ("hello world");
160 	int r = r_str_split (hi, ' ');
161 	mu_assert_eq (r, 2, "split on space");
162 	char* hello = hi;
163 	char* world = hi + 6;
164 	mu_assert_streq (hello, "hello", "first string in split");
165 	mu_assert_streq (world, "world", "second string in split");
166 	free (hi);
167 	mu_end;
168 }
169 
test_r_str_tokenize(void)170 bool test_r_str_tokenize(void) {
171 	//XXX r_str_word0 doesn't work on "hello      world" to
172 	// tokenize into ["hello", "world"]
173 	char* hi = strdup ("hello world");
174 	int r = r_str_word_set0 (hi);
175 	mu_assert_eq (r, 2, "tokenize hello world");
176 	const char* hello = r_str_word_get0 (hi, 0);
177 	const char* world = r_str_word_get0 (hi, 1);
178 	mu_assert_streq (hello, "hello", "first string in split");
179 	mu_assert_streq (world, "world", "second string in split");
180 	free (hi);
181 	mu_end;
182 }
183 
test_r_str_char_count(void)184 bool test_r_str_char_count(void) {
185 	mu_assert_eq (r_str_char_count ("poop", 'p'), 2, "number of p in poop");
186 	mu_end;
187 }
188 
test_r_str_word_count(void)189 bool test_r_str_word_count(void) {
190 	mu_assert_eq (r_str_word_count ("let's test\nradare2 \t libraries!"), 4,
191 				"words in a string");
192 	mu_end;
193 }
194 
test_r_str_ichr(void)195 bool test_r_str_ichr(void) {
196 	char* test = "rrrrrradare2";
197 	char* out = r_str_ichr (test, 'r');
198 	mu_assert_streq (out, "adare2",
199 			"string after the first non-r character in rrrrrradare2");
200 	mu_end;
201 }
202 
test_r_str_lchr(void)203 bool test_r_str_lchr(void) {
204 	const char* test = "radare2";
205 	const char* out = r_str_lchr (test, 'r');
206 	mu_assert_streq (out, "re2", "pointer to last r in radare2");
207 	mu_end;
208 }
209 
test_r_sub_str_lchr(void)210 bool test_r_sub_str_lchr(void) {
211 	const char* test = "raddddare2d";
212 	const char* out = r_sub_str_lchr (test, 1, 8, 'd');
213 	mu_assert_streq (out, "dare2d", "pointer to last d in range in radddddare2d");
214 	mu_end;
215 }
216 
test_r_sub_str_rchr(void)217 bool test_r_sub_str_rchr(void) {
218 	const char* test = "raddddare2d";
219 	const char* out = r_sub_str_rchr (test, 1, 8, 'd');
220 	mu_assert_streq (out, "ddddare2d", "pointer to first d in range in radddddare2d");
221 	mu_end;
222 }
223 
test_r_str_rchr(void)224 bool test_r_str_rchr(void) {
225 	const char* test = "raddddare2d";
226 	const char* out = r_str_rchr (test, NULL, '2');
227 	mu_assert_streq (out, "2d", "pointer to last p in range in raddddare2d");
228 	out = r_str_rchr (test, NULL, 'p');
229 	if (out) {
230 		mu_assert ("non NULL value returned", 0);
231 	}
232 	out = test + 9;
233 	out = r_str_rchr (test, out, 'd');
234 	mu_assert_streq (out, "dare2d", "pointer to last d in range in raddddare2d");
235 	out = test + strlen (test);
236 	out = r_str_rchr (test, out, 'p');
237 	if (out) {
238 		mu_assert ("non NULL value of out", 0);
239 	}
240 	mu_end;
241 }
242 
test_r_str_ansi_len(void)243 bool test_r_str_ansi_len(void) {
244 	int len;
245 
246 	len = r_str_ansi_len ("radare2");
247 	mu_assert_eq (len, 7, "len(ascii only)");
248 
249 	len = r_str_ansi_len ("r\x1b[38;2;208;80;0madare2");
250 	mu_assert_eq (len, 7, "len(ascii + ansi ending with m)");
251 
252 	len = r_str_ansi_len ("r\x1b[0Jadare2");
253 	mu_assert_eq (len, 7, "len(ascii + ansi ending with J)");
254 
255 	len = r_str_ansi_len ("r\x1b[42;42Hadare2");
256 	mu_assert_eq (len, 7, "len(ascii + ansi ending with H)");
257 
258 	len = r_str_ansi_len ("r\xc3\xa4""dare2");
259 	mu_assert_eq (len, 8, "len(ascii + 2 byte utf-8 counted as 2 chars)");
260 
261 	len = r_str_ansi_len ("radar\xe2\x82\xac""2");
262 	mu_assert_eq (len, 9, "len(ascii + 3 byte utf-8 counted as 3 chars)");
263 
264 	len = r_str_ansi_len ("radar\xf0\x9d\x84\x9e""2");
265 	mu_assert_eq (len, 10, "len(ascii + 4 byte utf-8 counted as 4 chars)");
266 
267 	mu_end;
268 }
269 
test_r_str_len_utf8_ansi(void)270 bool test_r_str_len_utf8_ansi(void) {
271 	int len;
272 
273 	len = r_str_len_utf8_ansi ("radare2");
274 	mu_assert_eq (len, 7, "len(ascii only)");
275 
276 	len = r_str_len_utf8_ansi ("r\x1b[38;2;208;80;0madare2");
277 	mu_assert_eq (len, 7, "len(ascii + ansi ending with m)");
278 
279 	len = r_str_len_utf8_ansi ("r\x1b[0Jadare2");
280 	mu_assert_eq (len, 7, "len(ascii + ansi ending with J)");
281 
282 	len = r_str_len_utf8_ansi ("r\x1b[42;42Hadare2");
283 	mu_assert_eq (len, 7, "len(ascii + ansi ending with H)");
284 
285 	len = r_str_len_utf8_ansi ("r\xc3\xa4""dare2");
286 	mu_assert_eq (len, 7, "len(ascii + 2 byte utf-8 counted as 1 char)");
287 
288 	len = r_str_len_utf8_ansi ("radar\xe2\x82\xac""2");
289 	mu_assert_eq (len, 7, "len(ascii + 3 byte utf-8 counted as 1 char)");
290 
291 	len = r_str_len_utf8_ansi ("radar\xf0\x9d\x84\x9e""2");
292 	mu_assert_eq (len, 7, "len(ascii + 4 byte utf-8 counted as 1 char)");
293 
294 	mu_end;
295 }
296 
test_r_str_utf8_charsize(void)297 bool test_r_str_utf8_charsize(void) {
298 	char s[16] = "\x61\xc3\xa1\xe6\x97\xa5\xf0\x9f\x91\x8c\xf0\x9f\x91\x8c\x8c"; // aá日��
299 	int sz;
300 
301 	sz = r_str_utf8_charsize (s);
302 	mu_assert_eq (sz, 1, "1 byte UTF-8");
303 
304 	sz = r_str_utf8_charsize (s + 1);
305 	mu_assert_eq (sz, 2, "2 byte UTF-8");
306 
307 	sz = r_str_utf8_charsize (s + 3);
308 	mu_assert_eq (sz, 3, "3 byte UTF-8");
309 
310 	sz = r_str_utf8_charsize (s + 6);
311 	mu_assert_eq (sz, 4, "4 byte UTF-8");
312 
313 	sz = r_str_utf8_charsize (s + 10);
314 	mu_assert_eq (sz, 0, "Malformed UTF-8");
315 
316 	mu_end;
317 }
318 
test_r_str_utf8_charsize_prev(void)319 bool test_r_str_utf8_charsize_prev(void) {
320 	char s[16] = "\x61\xc3\xa1\xe6\x97\xa5\xf0\x9f\x91\x8c\xf0\x9f\x91\x8c\x8c"; // aá日��
321 	int sz;
322 
323 	sz = r_str_utf8_charsize_last (s);
324 	mu_assert_eq (sz, 0, "Malformed UTF-8");
325 
326 	sz = r_str_utf8_charsize_prev (s + 10, 10);
327 	mu_assert_eq (sz, 4, "4 byte UTF-8");
328 
329 	sz = r_str_utf8_charsize_prev (s + 6, 6);
330 	mu_assert_eq (sz, 3, "3 byte UTF-8");
331 
332 	sz = r_str_utf8_charsize_prev (s + 3, 3);
333 	mu_assert_eq (sz, 2, "2 byte UTF-8");
334 
335 	sz = r_str_utf8_charsize_prev (s + 1, 1);
336 	mu_assert_eq (sz, 1, "1 byte UTF-8");
337 
338 	mu_end;
339 }
340 
test_r_str_sanitize_sdb_key(void)341 bool test_r_str_sanitize_sdb_key(void) {
342 	char *s = r_str_sanitize_sdb_key("rada.re2<is>::Cool");
343 	mu_assert_streq (s, "rada_re2_is_::Cool", "sanitize");
344 	free (s);
345 	mu_end;
346 }
347 
test_r_str_escape_sh(void)348 bool test_r_str_escape_sh(void) {
349 	char *escaped = r_str_escape_sh ("Hello, \"World\"");
350 	mu_assert_streq (escaped, "Hello, \\\"World\\\"", "escaped \"double quotes\"");
351 	free (escaped);
352 	escaped = r_str_escape_sh ("Hello, \\World\\");
353 	mu_assert_streq (escaped, "Hello, \\\\World\\\\", "escaped backspace");
354 	free (escaped);
355 #if __UNIX__
356 	escaped = r_str_escape_sh ("Hello, $(World)");
357 	mu_assert_streq (escaped, "Hello, \\$(World)", "escaped $(command)");
358 	free (escaped);
359 	escaped = r_str_escape_sh ("Hello, `World`");
360 	mu_assert_streq (escaped, "Hello, \\`World\\`", "escaped `command`");
361 	free (escaped);
362 #endif
363 	mu_end;
364 }
365 
test_r_str_unescape(void)366 bool test_r_str_unescape(void) {
367 	char buf[] = "Hello\\x31World\\n";
368 	r_str_unescape (buf);
369 	mu_assert_streq (buf, "Hello1World\n", "unescaped");
370 	mu_end;
371 }
372 
test_r_str_newf(void)373 bool test_r_str_newf(void) {
374 	char *a = r_str_newf ("hello");
375 	mu_assert_streq (a, "hello", "oops");
376 	free (a);
377 
378 	a = r_str_newf ("%s/%s", "hello", "world");
379 	mu_assert_streq (a, "hello/world", "oops");
380 	free (a);
381 
382 	a = r_str_newf ("%s/%s", "hello", "world");
383 	a = r_str_appendf (a, "..%s/%s", "cow", "low");
384 	a = r_str_appendf (a, "PWN");
385 	mu_assert_streq (a, "hello/world..cow/lowPWN", "oops");
386 	free (a);
387 	mu_end;
388 }
389 
test_r_str_constpool(void)390 bool test_r_str_constpool(void) {
391 	RStrConstPool pool;
392 	bool s = r_str_constpool_init (&pool);
393 	mu_assert ("pool init success", s);
394 
395 	const char *a_ref = "deliverance";
396 	const char *a_pooled = r_str_constpool_get (&pool, a_ref);
397 	mu_assert_ptrneq (a_pooled, a_ref, "pooled != ref");
398 	mu_assert_streq (a_pooled, a_ref, "pooled == ref (strcmp)");
399 	const char *a_pooled2 = r_str_constpool_get (&pool, a_ref);
400 	mu_assert_ptreq (a_pooled2, a_pooled, "same on re-get");
401 	char *a_ref_cpy = strdup (a_ref);
402 	a_pooled2 = r_str_constpool_get (&pool, a_ref_cpy);
403 	free (a_ref_cpy);
404 	mu_assert_ptreq (a_pooled2, a_pooled, "same on re-get with different ptr");
405 
406 	const char *b_ref = "damnation";
407 	const char *b_pooled = r_str_constpool_get (&pool, b_ref);
408 	mu_assert_ptrneq (b_pooled, b_ref, "pooled != ref (second)");
409 	mu_assert_streq (b_pooled, b_ref, "pooled == ref (strcmp, second)");
410 
411 	r_str_constpool_fini (&pool);
412 	mu_end;
413 }
414 
test_r_str_format_msvc_argv()415 bool test_r_str_format_msvc_argv() {
416 	// Examples from http://daviddeley.com/autohotkey/parameters/parameters.htm#WINCRULES
417 	const char *a = "CallMePancake";
418 	char *str = r_str_format_msvc_argv (1, &a);
419 	mu_assert_streq (str, "CallMePancake", "no escaping");
420 	free (str);
421 
422 	a = "Call Me Pancake";
423 	str = r_str_format_msvc_argv (1, &a);
424 	mu_assert_streq (str, "\"Call Me Pancake\"", "just quoting");
425 	free (str);
426 
427 	a = "CallMe\"Pancake";
428 	str = r_str_format_msvc_argv (1, &a);
429 	mu_assert_streq (str, "CallMe\\\"Pancake", "just escaping");
430 	free (str);
431 
432 	a = "CallMePancake\\";
433 	str = r_str_format_msvc_argv (1, &a);
434 	mu_assert_streq (str, "CallMePancake\\", "no escaping of backslashes");
435 	free (str);
436 
437 	a = "Call Me Pancake\\";
438 	str = r_str_format_msvc_argv (1, &a);
439 	mu_assert_streq (str, "\"Call Me Pancake\\\\\"", "escaping of backslashes before closing quote");
440 	free (str);
441 
442 	a = "CallMe\\\"Pancake";
443 	str = r_str_format_msvc_argv (1, &a);
444 	mu_assert_streq (str, "CallMe\\\\\\\"Pancake", "escaping of backslashes before literal quote");
445 	free (str);
446 
447 	a = "Call Me\\\"Pancake";
448 	str = r_str_format_msvc_argv (1, &a);
449 	mu_assert_streq (str, "\"Call Me\\\\\\\"Pancake\"", "escaping of backslashes before literal quote in quote");
450 	free (str);
451 
452 	const char *args[] = { "rm", "-rf", "\\"};
453 	str = r_str_format_msvc_argv (3, args);
454 	mu_assert_streq (str, "rm -rf \\", "multiple args");
455 	free (str);
456 
457 	mu_end;
458 }
459 
test_r_str_str_xy(void)460 bool test_r_str_str_xy(void) {
461 	char *canvas = "Hello World\n"
462 		"This World is World\n"
463 		"World is Hello\n";
464 	int x = 0, y = 0;
465 	const char *next = r_str_str_xy (canvas, "World", NULL, &x, &y);
466 	mu_assert_eq (x, 6, "x of first occurrence");
467 	mu_assert_eq (y, 0, "y of first occurrence");
468 	next = r_str_str_xy (canvas, "World", next, &x, &y);
469 	mu_assert_eq (x, 5, "x of second occurrence");
470 	mu_assert_eq (y, 1, "y of second occurrence");
471 	next = r_str_str_xy (canvas, "World", next, &x, &y);
472 	mu_assert_eq (x, 14, "x of third occurrence");
473 	mu_assert_eq (y, 1, "y of third occurrence");
474 	next = r_str_str_xy (canvas, "World", next, &x, &y);
475 	mu_assert_eq (x, 0, "x of fourth occurrence");
476 	mu_assert_eq (y, 2, "y of fourth occurrence");
477 	next = r_str_str_xy (canvas, "World", next, &x, &y);
478 	mu_assert_null (next, "no more occurences");
479 	mu_end;
480 }
481 
test_r_str_encoded_json(void)482 bool test_r_str_encoded_json(void) {
483 	char *invalidJsonString = "This is my \xe2 sample © string\n";
484 	size_t len = strlen (invalidJsonString);
485 
486 	const char *array = r_str_encoded_json (invalidJsonString, len, PJ_ENCODING_STR_ARRAY);
487 	mu_assert_streq (array, "084,104,105,115,032,105,115,032,109,121,032,226,032,115,097,109,112,108,101,032,194,169,032,115,116,114,105,110,103,010", "string as array of uchar");
488 	free ((void *)array);
489 
490 	const char *hex = r_str_encoded_json (invalidJsonString, len, PJ_ENCODING_STR_HEX);
491 	mu_assert_streq (hex, "54686973206973206D7920E22073616D706C6520C2A920737472696E670A", "string as hexpairs");
492 	free ((void *)hex);
493 
494 	const char *b64 = r_str_encoded_json (invalidJsonString, len, PJ_ENCODING_STR_BASE64);
495 	mu_assert_streq (b64, "VGhpcyBpcyBteSDiIHNhbXBsZSDCqSBzdHJpbmcK", "string as base64 encoded");
496 	free ((void *)b64);
497 
498 	const char *stripped = r_str_encoded_json (invalidJsonString, len, PJ_ENCODING_STR_STRIP);
499 	mu_assert_streq (stripped, "This is my  sample © string\\n", "string with bad chars stripped");
500 	free ((void *)stripped);
501 
502 	const char *none = r_str_encoded_json (invalidJsonString, len, PJ_ENCODING_STR_DEFAULT);
503 	mu_assert_streq (none, "This is my \\xe2 sample © string\\n", "default encoding");
504 	free ((void *)none);
505 
506 	mu_end;
507 }
508 
all_tests()509 bool all_tests () {
510 	mu_run_test (test_r_str_wrap);
511 	mu_run_test (test_r_str_newf);
512 	mu_run_test (test_r_str_replace_char_once);
513 	mu_run_test (test_r_str_replace_char);
514 	mu_run_test (test_r_str_replace);
515 	mu_run_test (test_r_str_bits64);
516 	mu_run_test (test_r_str_rwx);
517 	mu_run_test (test_r_str_rwx_i);
518 	mu_run_test (test_r_str_bool);
519 	mu_run_test (test_r_str_trim);
520 	mu_run_test (test_r_str_case);
521 	mu_run_test (test_r_str_split);
522 	mu_run_test (test_r_str_tokenize);
523 	mu_run_test (test_r_str_char_count);
524 	mu_run_test (test_r_str_word_count);
525 	mu_run_test (test_r_str_ichr);
526 	mu_run_test (test_r_str_lchr);
527 	mu_run_test (test_r_sub_str_lchr);
528 	mu_run_test (test_r_sub_str_rchr);
529 	mu_run_test (test_r_str_rchr);
530 	mu_run_test (test_r_str_ansi_len);
531 	mu_run_test (test_r_str_len_utf8_ansi);
532 	mu_run_test (test_r_str_utf8_charsize);
533 	mu_run_test (test_r_str_utf8_charsize_prev);
534 	mu_run_test (test_r_str_sanitize_sdb_key);
535 	mu_run_test (test_r_str_escape_sh);
536 	mu_run_test (test_r_str_unescape);
537 	mu_run_test (test_r_str_constpool);
538 	mu_run_test (test_r_str_format_msvc_argv);
539 	mu_run_test (test_r_str_str_xy);
540 	mu_run_test (test_r_str_encoded_json);
541 	return tests_passed != tests_run;
542 }
543 
main(int argc,char ** argv)544 int main(int argc, char **argv) {
545 	return all_tests();
546 }
547