string-util.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. #include <glib.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include "test.h"
  5. /* This test is just to be used with valgrind */
  6. RESULT
  7. test_strfreev ()
  8. {
  9. gchar **array = g_new (gchar *, 4);
  10. array [0] = g_strdup ("one");
  11. array [1] = g_strdup ("two");
  12. array [2] = g_strdup ("three");
  13. array [3] = NULL;
  14. g_strfreev (array);
  15. g_strfreev (NULL);
  16. return OK;
  17. }
  18. RESULT
  19. test_concat ()
  20. {
  21. gchar *x = g_strconcat ("Hello", ", ", "world", NULL);
  22. if (strcmp (x, "Hello, world") != 0)
  23. return FAILED("concat failed, got: %s", x);
  24. g_free (x);
  25. return OK;
  26. }
  27. RESULT
  28. test_split ()
  29. {
  30. const gchar *to_split = "Hello world, how are we doing today?";
  31. gint i;
  32. gchar **v;
  33. v= g_strsplit(to_split, " ", 0);
  34. if(v == NULL) {
  35. return FAILED("split failed, got NULL vector (1)");
  36. }
  37. for(i = 0; v[i] != NULL; i++);
  38. if(i != 7) {
  39. return FAILED("split failed, expected 7 tokens, got %d", i);
  40. }
  41. g_strfreev(v);
  42. v = g_strsplit(to_split, ":", -1);
  43. if(v == NULL) {
  44. return FAILED("split failed, got NULL vector (2)");
  45. }
  46. for(i = 0; v[i] != NULL; i++);
  47. if(i != 1) {
  48. return FAILED("split failed, expected 1 token, got %d", i);
  49. }
  50. if(strcmp(v[0], to_split) != 0) {
  51. return FAILED("expected vector[0] to be '%s' but it was '%s'",
  52. to_split, v[0]);
  53. }
  54. g_strfreev(v);
  55. v = g_strsplit ("", ":", 0);
  56. if (v == NULL)
  57. return FAILED ("g_strsplit returned NULL");
  58. g_strfreev (v);
  59. v = g_strsplit ("/home/miguel/dingus", "/", 0);
  60. if (v [0][0] != 0)
  61. return FAILED ("Got a non-empty first element");
  62. g_strfreev (v);
  63. v = g_strsplit ("appdomain1, Version=0.0.0.0, Culture=neutral", ",", 4);
  64. if (strcmp (v [0], "appdomain1") != 0)
  65. return FAILED ("Invalid value");
  66. if (strcmp (v [1], " Version=0.0.0.0") != 0)
  67. return FAILED ("Invalid value");
  68. if (strcmp (v [2], " Culture=neutral") != 0)
  69. return FAILED ("Invalid value");
  70. if (v [3] != NULL)
  71. return FAILED ("Expected only 3 elements");
  72. g_strfreev (v);
  73. v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 4);
  74. if (strcmp (v [0], "abc") != 0)
  75. return FAILED ("Invalid value 0");
  76. if (strcmp (v [1], "defXghi") != 0)
  77. return FAILED ("Invalid value 1");
  78. if (strcmp (v [2], "jklYmno") != 0)
  79. return FAILED ("Invalid value 2");
  80. if (v [3] != NULL)
  81. return FAILED ("Expected only 3 elements (1)");
  82. g_strfreev (v);
  83. v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 2);
  84. if (strcmp (v [0], "abc") != 0)
  85. return FAILED ("Invalid value 3");
  86. if (strcmp (v [1], "defXghiXYjklYmno") != 0)
  87. return FAILED ("Invalid value 4");
  88. if (v [2] != NULL)
  89. return FAILED ("Expected only 2 elements (2)");
  90. g_strfreev (v);
  91. v = g_strsplit ("abcXYdefXghiXYjklYmnoXY", "XY", 3);
  92. if (strcmp (v [0], "abc") != 0)
  93. return FAILED ("Invalid value 5");
  94. if (strcmp (v [1], "defXghi") != 0)
  95. return FAILED ("Invalid value 6");
  96. if (strcmp (v [2], "jklYmnoXY") != 0)
  97. return FAILED ("Invalid value 7");
  98. if (v [3] != NULL)
  99. return FAILED ("Expected only 3 elements (3)");
  100. g_strfreev (v);
  101. v = g_strsplit ("abcXYXYXYdefXY", "XY", -1);
  102. if (strcmp (v [0], "abc") != 0)
  103. return FAILED ("Invalid value 8");
  104. if (strcmp (v [1], "") != 0)
  105. return FAILED ("Invalid value 9");
  106. if (strcmp (v [2], "") != 0)
  107. return FAILED ("Invalid value 10");
  108. if (strcmp (v [3], "def") != 0)
  109. return FAILED ("Invalid value 11");
  110. if (strcmp (v [4], "") != 0)
  111. return FAILED ("Invalid value 12");
  112. if (v [5] != NULL)
  113. return FAILED ("Expected only 5 elements (4)");
  114. g_strfreev (v);
  115. v = g_strsplit ("XYXYXYabcXYdef", "XY", -1);
  116. if (strcmp (v [0], "") != 0)
  117. return FAILED ("Invalid value 13");
  118. if (strcmp (v [1], "") != 0)
  119. return FAILED ("Invalid value 14");
  120. if (strcmp (v [2], "") != 0)
  121. return FAILED ("Invalid value 15");
  122. if (strcmp (v [3], "abc") != 0)
  123. return FAILED ("Invalid value 16");
  124. if (strcmp (v [4], "def") != 0)
  125. return FAILED ("Invalid value 17");
  126. if (v [5] != NULL)
  127. return FAILED ("Expected only 5 elements (5)");
  128. g_strfreev (v);
  129. v = g_strsplit ("value=", "=", 2);
  130. if (strcmp (v [0], "value") != 0)
  131. return FAILED ("Invalid value 18; expected 'value', got '%s'", v [0]);
  132. if (strcmp (v [1], "") != 0)
  133. return FAILED ("Invalid value 19; expected '', got '%s'", v [1]);
  134. if (v [2] != NULL)
  135. return FAILED ("Expected only 2 elements (6)");
  136. g_strfreev (v);
  137. return OK;
  138. }
  139. RESULT
  140. test_split_set ()
  141. {
  142. gchar **v;
  143. v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 6);
  144. if (strcmp (v [0], "abc") != 0)
  145. return FAILED ("Invalid value 0");
  146. if (strcmp (v [1], "") != 0)
  147. return FAILED ("Invalid value 1");
  148. if (strcmp (v [2], "def") != 0)
  149. return FAILED ("Invalid value 2");
  150. if (strcmp (v [3], "ghi") != 0)
  151. return FAILED ("Invalid value 3");
  152. if (strcmp (v [4], "") != 0)
  153. return FAILED ("Invalid value 4");
  154. if (strcmp (v [5], "jklYmno") != 0)
  155. return FAILED ("Invalid value 5");
  156. if (v [6] != NULL)
  157. return FAILED ("Expected only 6 elements (1)");
  158. g_strfreev (v);
  159. v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 3);
  160. if (strcmp (v [0], "abc") != 0)
  161. return FAILED ("Invalid value 6");
  162. if (strcmp (v [1], "") != 0)
  163. return FAILED ("Invalid value 7");
  164. if (strcmp (v [2], "defXghiXYjklYmno") != 0)
  165. return FAILED ("Invalid value 8");
  166. if (v [3] != NULL)
  167. return FAILED ("Expected only 3 elements (2)");
  168. g_strfreev (v);
  169. v = g_strsplit_set ("abcXdefYghiXjklYmnoX", "XY", 5);
  170. if (strcmp (v [0], "abc") != 0)
  171. return FAILED ("Invalid value 9");
  172. if (strcmp (v [1], "def") != 0)
  173. return FAILED ("Invalid value 10");
  174. if (strcmp (v [2], "ghi") != 0)
  175. return FAILED ("Invalid value 11");
  176. if (strcmp (v [3], "jkl") != 0)
  177. return FAILED ("Invalid value 12");
  178. if (strcmp (v [4], "mnoX") != 0)
  179. return FAILED ("Invalid value 13");
  180. if (v [5] != NULL)
  181. return FAILED ("Expected only 5 elements (5)");
  182. g_strfreev (v);
  183. v = g_strsplit_set ("abcXYXdefXY", "XY", -1);
  184. if (strcmp (v [0], "abc") != 0)
  185. return FAILED ("Invalid value 14");
  186. if (strcmp (v [1], "") != 0)
  187. return FAILED ("Invalid value 15");
  188. if (strcmp (v [2], "") != 0)
  189. return FAILED ("Invalid value 16");
  190. if (strcmp (v [3], "def") != 0)
  191. return FAILED ("Invalid value 17");
  192. if (strcmp (v [4], "") != 0)
  193. return FAILED ("Invalid value 18");
  194. if (strcmp (v [5], "") != 0)
  195. return FAILED ("Invalid value 19");
  196. if (v [6] != NULL)
  197. return FAILED ("Expected only 6 elements (4)");
  198. g_strfreev (v);
  199. v = g_strsplit_set ("XYXabcXYdef", "XY", -1);
  200. if (strcmp (v [0], "") != 0)
  201. return FAILED ("Invalid value 20");
  202. if (strcmp (v [1], "") != 0)
  203. return FAILED ("Invalid value 21");
  204. if (strcmp (v [2], "") != 0)
  205. return FAILED ("Invalid value 22");
  206. if (strcmp (v [3], "abc") != 0)
  207. return FAILED ("Invalid value 23");
  208. if (strcmp (v [4], "") != 0)
  209. return FAILED ("Invalid value 24");
  210. if (strcmp (v [5], "def") != 0)
  211. return FAILED ("Invalid value 25");
  212. if (v [6] != NULL)
  213. return FAILED ("Expected only 6 elements (5)");
  214. g_strfreev (v);
  215. return OK;
  216. }
  217. RESULT
  218. test_strreverse ()
  219. {
  220. RESULT res = OK;
  221. gchar *a = g_strdup ("onetwothree");
  222. gchar *a_target = "eerhtowteno";
  223. gchar *b = g_strdup ("onetwothre");
  224. gchar *b_target = "erhtowteno";
  225. gchar *c = g_strdup ("");
  226. gchar *c_target = "";
  227. g_strreverse (a);
  228. if (strcmp (a, a_target)) {
  229. res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", a, a_target);
  230. goto cleanup;
  231. }
  232. g_strreverse (b);
  233. if (strcmp (b, b_target)) {
  234. res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
  235. goto cleanup;
  236. }
  237. g_strreverse (c);
  238. if (strcmp (c, c_target)) {
  239. res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
  240. goto cleanup;
  241. }
  242. cleanup:
  243. g_free (c);
  244. g_free (b);
  245. g_free (a);
  246. return res;
  247. }
  248. RESULT
  249. test_strjoin ()
  250. {
  251. char *s;
  252. s = g_strjoin (NULL, "a", "b", NULL);
  253. if (strcmp (s, "ab") != 0)
  254. return FAILED ("Join of two strings with no separator fails");
  255. g_free (s);
  256. s = g_strjoin ("", "a", "b", NULL);
  257. if (strcmp (s, "ab") != 0)
  258. return FAILED ("Join of two strings with empty separator fails");
  259. g_free (s);
  260. s = g_strjoin ("-", "a", "b", NULL);
  261. if (strcmp (s, "a-b") != 0)
  262. return FAILED ("Join of two strings with separator fails");
  263. g_free (s);
  264. s = g_strjoin ("-", "aaaa", "bbbb", "cccc", "dddd", NULL);
  265. if (strcmp (s, "aaaa-bbbb-cccc-dddd") != 0)
  266. return FAILED ("Join of multiple strings fails");
  267. g_free (s);
  268. s = g_strjoin ("-", NULL);
  269. if (s == NULL || (strcmp (s, "") != 0))
  270. return FAILED ("Failed to join empty arguments");
  271. g_free (s);
  272. return OK;
  273. }
  274. RESULT
  275. test_strchug ()
  276. {
  277. char *str = g_strdup (" \t\n hola");
  278. g_strchug (str);
  279. if (strcmp ("hola", str)) {
  280. fprintf (stderr, "%s\n", str);
  281. g_free (str);
  282. return FAILED ("Failed.");
  283. }
  284. g_free (str);
  285. return OK;
  286. }
  287. RESULT
  288. test_strchomp ()
  289. {
  290. char *str = g_strdup ("hola \t");
  291. g_strchomp (str);
  292. if (strcmp ("hola", str)) {
  293. fprintf (stderr, "%s\n", str);
  294. g_free (str);
  295. return FAILED ("Failed.");
  296. }
  297. g_free (str);
  298. return OK;
  299. }
  300. RESULT
  301. test_strstrip ()
  302. {
  303. char *str = g_strdup (" \t hola ");
  304. g_strstrip (str);
  305. if (strcmp ("hola", str)) {
  306. fprintf (stderr, "%s\n", str);
  307. g_free (str);
  308. return FAILED ("Failed.");
  309. }
  310. g_free (str);
  311. return OK;
  312. }
  313. #define urit(so,j) do { s = g_filename_to_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return FAILED("Got %s expected %s", s, j); g_free (s); } while (0);
  314. #define errit(so) do { s = g_filename_to_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, expected NULL", s); } while (0);
  315. RESULT
  316. test_filename_to_uri ()
  317. {
  318. #ifdef G_OS_WIN32
  319. #else
  320. char *s;
  321. urit ("/a", "file:///a");
  322. urit ("/home/miguel", "file:///home/miguel");
  323. urit ("/home/mig uel", "file:///home/mig%20uel");
  324. urit ("/\303\241", "file:///%C3%A1");
  325. urit ("/\303\241/octal", "file:///%C3%A1/octal");
  326. urit ("/%", "file:///%25");
  327. urit ("/\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040", "file:///%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20");
  328. urit ("/!$&'()*+,-./", "file:///!$&'()*+,-./");
  329. urit ("/\042\043\045", "file:///%22%23%25");
  330. urit ("/0123456789:=", "file:///0123456789:=");
  331. urit ("/\073\074\076\077", "file:///%3B%3C%3E%3F");
  332. urit ("/\133\134\135\136_\140\173\174\175", "file:///%5B%5C%5D%5E_%60%7B%7C%7D");
  333. urit ("/\173\174\175\176\177\200", "file:///%7B%7C%7D~%7F%80");
  334. urit ("/@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "file:///@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
  335. errit ("a");
  336. errit ("./hola");
  337. #endif
  338. return OK;
  339. }
  340. #define fileit(so,j) do { s = g_filename_from_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return FAILED("Got %s expected %s", s, j); g_free (s); } while (0);
  341. #define ferrit(so) do { s = g_filename_from_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, expected NULL", s); } while (0);
  342. RESULT
  343. test_filename_from_uri ()
  344. {
  345. #ifdef G_OS_WIN32
  346. #else
  347. char *s;
  348. fileit ("file:///a", "/a");
  349. fileit ("file:///%41", "/A");
  350. fileit ("file:///home/miguel", "/home/miguel");
  351. fileit ("file:///home/mig%20uel", "/home/mig uel");
  352. ferrit ("/a");
  353. ferrit ("a");
  354. ferrit ("file://a");
  355. ferrit ("file:a");
  356. ferrit ("file:///%");
  357. ferrit ("file:///%0");
  358. ferrit ("file:///%jj");
  359. #endif
  360. return OK;
  361. }
  362. RESULT
  363. test_ascii_xdigit_value ()
  364. {
  365. int i;
  366. gchar j;
  367. i = g_ascii_xdigit_value ('9' + 1);
  368. if (i != -1)
  369. return FAILED ("'9' + 1");
  370. i = g_ascii_xdigit_value ('0' - 1);
  371. if (i != -1)
  372. return FAILED ("'0' - 1");
  373. i = g_ascii_xdigit_value ('a' - 1);
  374. if (i != -1)
  375. return FAILED ("'a' - 1");
  376. i = g_ascii_xdigit_value ('f' + 1);
  377. if (i != -1)
  378. return FAILED ("'f' + 1");
  379. i = g_ascii_xdigit_value ('A' - 1);
  380. if (i != -1)
  381. return FAILED ("'A' - 1");
  382. i = g_ascii_xdigit_value ('F' + 1);
  383. if (i != -1)
  384. return FAILED ("'F' + 1");
  385. for (j = '0'; j < '9'; j++) {
  386. int c = g_ascii_xdigit_value (j);
  387. if (c != (j - '0'))
  388. return FAILED ("Digits %c -> %d", j, c);
  389. }
  390. for (j = 'a'; j < 'f'; j++) {
  391. int c = g_ascii_xdigit_value (j);
  392. if (c != (j - 'a' + 10))
  393. return FAILED ("Lower %c -> %d", j, c);
  394. }
  395. for (j = 'A'; j < 'F'; j++) {
  396. int c = g_ascii_xdigit_value (j);
  397. if (c != (j - 'A' + 10))
  398. return FAILED ("Upper %c -> %d", j, c);
  399. }
  400. return OK;
  401. }
  402. RESULT
  403. test_strdelimit ()
  404. {
  405. gchar *str;
  406. str = g_strdup (G_STR_DELIMITERS);
  407. str = g_strdelimit (str, NULL, 'a');
  408. if (0 != strcmp ("aaaaaaa", str))
  409. return FAILED ("All delimiters: '%s'", str);
  410. g_free (str);
  411. str = g_strdup ("hola");
  412. str = g_strdelimit (str, "ha", '+');
  413. if (0 != strcmp ("+ol+", str))
  414. return FAILED ("2 delimiters: '%s'", str);
  415. g_free (str);
  416. return OK;
  417. }
  418. #define NUMBERS "0123456789"
  419. RESULT
  420. test_strlcpy ()
  421. {
  422. const gchar *src = "onetwothree";
  423. gchar *dest;
  424. gsize i;
  425. dest = g_malloc (strlen (src) + 1);
  426. memset (dest, 0, strlen (src) + 1);
  427. i = g_strlcpy (dest, src, (gsize)-1);
  428. if (i != strlen (src))
  429. return FAILED ("Test1 got %d", i);
  430. if (0 != strcmp (dest, src))
  431. return FAILED ("Src and dest not equal");
  432. i = g_strlcpy (dest, src, 3);
  433. if (i != strlen (src))
  434. return FAILED ("Test1 got %d", i);
  435. if (0 != strcmp (dest, "on"))
  436. return FAILED ("Test2");
  437. i = g_strlcpy (dest, src, 1);
  438. if (i != strlen (src))
  439. return FAILED ("Test3 got %d", i);
  440. if (*dest != '\0')
  441. return FAILED ("Test4");
  442. i = g_strlcpy (dest, src, 12345);
  443. if (i != strlen (src))
  444. return FAILED ("Test4 got %d", i);
  445. if (0 != strcmp (dest, src))
  446. return FAILED ("Src and dest not equal 2");
  447. g_free (dest);
  448. /* This is a test for g_filename_from_utf8, even if it does not look like it */
  449. dest = g_filename_from_utf8 (NUMBERS, strlen (NUMBERS), NULL, NULL, NULL);
  450. if (0 != strcmp (dest, NUMBERS))
  451. return FAILED ("problem [%s] and [%s]", dest, NUMBERS);
  452. g_free (dest);
  453. return OK;
  454. }
  455. RESULT
  456. test_strescape ()
  457. {
  458. gchar *str;
  459. str = g_strescape ("abc", NULL);
  460. if (strcmp ("abc", str))
  461. return FAILED ("#1");
  462. str = g_strescape ("\t\b\f\n\r\\\"abc", NULL);
  463. if (strcmp ("\\t\\b\\f\\n\\r\\\\\\\"abc", str))
  464. return FAILED ("#2 %s", str);
  465. str = g_strescape ("\001abc", NULL);
  466. if (strcmp ("\\001abc", str))
  467. return FAILED ("#3 %s", str);
  468. str = g_strescape ("\001abc", "\001");
  469. if (strcmp ("\001abc", str))
  470. return FAILED ("#3 %s", str);
  471. return OK;
  472. }
  473. RESULT
  474. test_ascii_strncasecmp ()
  475. {
  476. int n;
  477. n = g_ascii_strncasecmp ("123", "123", 1);
  478. if (n != 0)
  479. return FAILED ("Should have been 0");
  480. n = g_ascii_strncasecmp ("423", "123", 1);
  481. if (n != 3)
  482. return FAILED ("Should have been 3, got %d", n);
  483. n = g_ascii_strncasecmp ("123", "423", 1);
  484. if (n != -3)
  485. return FAILED ("Should have been -3, got %d", n);
  486. n = g_ascii_strncasecmp ("1", "1", 10);
  487. if (n != 0)
  488. return FAILED ("Should have been 0, got %d", n);
  489. return OK;
  490. }
  491. RESULT
  492. test_ascii_strdown ()
  493. {
  494. const gchar *a = "~09+AaBcDeFzZ$0909EmPAbCdEEEEEZZZZAAA";
  495. const gchar *b = "~09+aabcdefzz$0909empabcdeeeeezzzzaaa";
  496. gchar *c;
  497. gint n, l;
  498. l = (gint)strlen (b);
  499. c = g_ascii_strdown (a, l);
  500. n = g_ascii_strncasecmp (b, c, l);
  501. if (n != 0) {
  502. g_free (c);
  503. return FAILED ("Should have been 0, got %d", n);
  504. }
  505. g_free (c);
  506. return OK;
  507. }
  508. RESULT
  509. test_strdupv ()
  510. {
  511. gchar **one;
  512. gchar **two;
  513. gint len;
  514. one = g_strdupv (NULL);
  515. if (one)
  516. return FAILED ("Should have been NULL");
  517. one = g_malloc (sizeof (gchar *));
  518. *one = NULL;
  519. two = g_strdupv (one);
  520. if (!two)
  521. FAILED ("Should have been not NULL");
  522. len = g_strv_length (two);
  523. if (len)
  524. FAILED ("Should have been 0");
  525. g_strfreev (two);
  526. g_strfreev (one);
  527. return NULL;
  528. }
  529. static Test strutil_tests [] = {
  530. {"g_strfreev", test_strfreev},
  531. {"g_strconcat", test_concat},
  532. {"g_strsplit", test_split},
  533. {"g_strsplit_set", test_split_set},
  534. {"g_strreverse", test_strreverse},
  535. {"g_strjoin", test_strjoin},
  536. {"g_strchug", test_strchug},
  537. {"g_strchomp", test_strchomp},
  538. {"g_strstrip", test_strstrip},
  539. {"g_filename_to_uri", test_filename_to_uri},
  540. {"g_filename_from_uri", test_filename_from_uri},
  541. {"g_ascii_xdigit_value", test_ascii_xdigit_value},
  542. {"g_strdelimit", test_strdelimit},
  543. {"g_strlcpy", test_strlcpy},
  544. {"g_strescape", test_strescape},
  545. {"g_ascii_strncasecmp", test_ascii_strncasecmp },
  546. {"g_ascii_strdown", test_ascii_strdown },
  547. {"g_strdupv", test_strdupv },
  548. {NULL, NULL}
  549. };
  550. DEFINE_TEST_GROUP_INIT(strutil_tests_init, strutil_tests)