1 /*******************************/
2 /* GENERATED FILE, DO NOT EDIT */
3 /*******************************/
7 /*******************************/
8 /* GENERATED FILE, DO NOT EDIT */
9 /*******************************/
14 #define mytest(name, input, expected) \
15 xbt_test_add0(name); \
16 d=xbt_str_split_quoted(input); \
17 s=xbt_str_join(d,"XXX"); \
18 xbt_test_assert3(!strcmp(s,expected),\
19 "Input (%s) leads to (%s) instead of (%s)", \
24 XBT_TEST_UNIT("xbt_str_split_quoted",test_split_quoted, "test the function xbt_str_split_quoted") {
28 mytest("Empty", "", "");
29 mytest("Basic test", "toto tutu", "totoXXXtutu");
30 mytest("Useless backslashes", "\\t\\o\\t\\o \\t\\u\\t\\u", "totoXXXtutu");
31 mytest("Protected space", "toto\\ tutu", "toto tutu");
32 mytest("Several spaces", "toto tutu", "totoXXXtutu");
33 mytest("LTriming", " toto tatu", "totoXXXtatu");
34 mytest("Triming", " toto tutu ", "totoXXXtutu");
35 mytest("Single quotes", "'toto tutu' tata", "toto tutuXXXtata");
36 mytest("Double quotes", "\"toto tutu\" tata", "toto tutuXXXtata");
37 mytest("Mixed quotes", "\"toto' 'tutu\" tata", "toto' 'tutuXXXtata");
38 mytest("Backslashed quotes", "\\'toto tutu\\' tata", "'totoXXXtutu'XXXtata");
39 mytest("Backslashed quotes + quotes", "'toto \\'tutu' tata", "toto 'tutuXXXtata");
43 #define mytest_str(name, input, separator, expected) \
44 xbt_test_add0(name); \
45 d=xbt_str_split_str(input, separator); \
46 s=xbt_str_join(d,"XXX"); \
47 xbt_test_assert3(!strcmp(s,expected),\
48 "Input (%s) leads to (%s) instead of (%s)", \
53 XBT_TEST_UNIT("xbt_str_split_str",test_split_str, "test the function xbt_str_split_str") {
57 mytest_str("Empty string and separator", "", "", "");
58 mytest_str("Empty string", "", "##", "");
59 mytest_str("Empty separator", "toto", "", "toto");
60 mytest_str("String with no separator in it", "toto", "##", "toto");
61 mytest_str("Basic test", "toto##tutu", "##", "totoXXXtutu");
63 /*******************************/
64 /* GENERATED FILE, DO NOT EDIT */
65 /*******************************/