- Timestamp:
- Jul 15, 2020 12:12:37 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstRTStrSplit.cpp
r85345 r85348 32 32 33 33 #include <iprt/test.h> 34 #include <iprt/mem.h> 34 35 #include <iprt/stream.h> 35 36 … … 51 52 size_t cStrings = 0; 52 53 54 #define DO_CLEANUP() \ 55 for (size_t i = 0; i < cStrings; ++i) \ 56 RTStrFree(papszStrings[i]); \ 57 RTMemFree(papszStrings); 58 cStrings = 0; 59 53 60 /* Empty stuff. */ 54 61 const char szEmpty[] = ""; 55 62 RTTEST_CHECK_RC(hTest, RTStrSplit(szEmpty, sizeof(szEmpty), "\r\n", &papszStrings, &cStrings), VINF_SUCCESS); 56 63 RTTEST_CHECK(hTest, cStrings == 0); 64 DO_CLEANUP(); 57 65 58 66 /* No separator given. */ … … 61 69 RTTEST_CHECK(hTest, cStrings == 1); 62 70 RTTEST_CHECK(hTest, RTStrICmp(papszStrings[0], "foo") == 0); 71 DO_CLEANUP(); 63 72 64 73 /* Single string w/ separator. */ … … 67 76 RTTEST_CHECK(hTest, cStrings == 1); 68 77 RTTEST_CHECK(hTest, papszStrings && RTStrICmp(papszStrings[0], "foo") == 0); 78 DO_CLEANUP(); 69 79 70 80 /* Multiple strings w/ separator. */ … … 76 86 && RTStrICmp(papszStrings[0], "foo") == 0 77 87 && RTStrICmp(papszStrings[1], "bar") == 0); 88 DO_CLEANUP(); 78 89 79 90 /* Multiple strings w/ two consequtive separators. */ … … 85 96 && RTStrICmp(papszStrings[0], "foo") == 0 86 97 && RTStrICmp(papszStrings[1], "bar") == 0); 98 DO_CLEANUP(); 87 99 88 100 /* Multiple strings w/ two consequtive separators. */ … … 95 107 && RTStrICmp(papszStrings[1], "bar") == 0 96 108 && RTStrICmp(papszStrings[2], "baz") == 0); 109 DO_CLEANUP(); 97 110 98 111 /* Multiple strings w/ trailing separators. */ … … 105 118 && RTStrICmp(papszStrings[1], "bar") == 0 106 119 && RTStrICmp(papszStrings[2], "baz") == 0); 120 DO_CLEANUP(); 121 122 #undef DO_CLEANUP 123 107 124 /* 108 125 * Summary.
Note:
See TracChangeset
for help on using the changeset viewer.