Changeset 78702 in vbox for trunk/src/VBox/Runtime/testcase
- Timestamp:
- May 24, 2019 12:11:00 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstRTPath.cpp
r78153 r78702 189 189 else 190 190 RTTestIFailed("RTPathSplitReassemble -> %Rrc", rc); 191 } 192 } 193 } 194 195 196 static void testParentLength(RTTEST hTest) 197 { 198 static struct 199 { 200 const char *pszPath; 201 uint32_t cchNonParent; 202 uint32_t fFlags; 203 } const s_aTests[] = 204 { 205 { "/usr/bin", 3, RTPATH_STR_F_STYLE_UNIX }, 206 { "/usr/bin", 3, RTPATH_STR_F_STYLE_DOS }, 207 { "\\usr\\bin", 3, RTPATH_STR_F_STYLE_DOS }, 208 { "/usr/bin/", 4, RTPATH_STR_F_STYLE_UNIX }, 209 { "/usr/bin/", 4, RTPATH_STR_F_STYLE_DOS }, 210 { "\\usr\\bin\\", 4, RTPATH_STR_F_STYLE_DOS }, 211 { "A:\\usr\\bin\\", 4, RTPATH_STR_F_STYLE_DOS }, 212 { "/bin", 3, RTPATH_STR_F_STYLE_UNIX }, 213 { "/bin", 3, RTPATH_STR_F_STYLE_DOS }, 214 { "\\bin", 3, RTPATH_STR_F_STYLE_DOS }, 215 { "A:\\bin", 3, RTPATH_STR_F_STYLE_DOS }, 216 { "A:/bin", 3, RTPATH_STR_F_STYLE_DOS }, 217 { "A:bin", 3, RTPATH_STR_F_STYLE_DOS }, 218 { "/bin/", 4, RTPATH_STR_F_STYLE_UNIX }, 219 { "/bin/", 4, RTPATH_STR_F_STYLE_DOS }, 220 { "A:\\bin\\", 4, RTPATH_STR_F_STYLE_DOS }, 221 { "A:/bin\\", 4, RTPATH_STR_F_STYLE_DOS }, 222 { "A:bin\\", 4, RTPATH_STR_F_STYLE_DOS }, 223 { "/", 0, RTPATH_STR_F_STYLE_UNIX }, 224 { "/", 0, RTPATH_STR_F_STYLE_DOS }, 225 { "\\", 0, RTPATH_STR_F_STYLE_DOS }, 226 { "A:\\", 0, RTPATH_STR_F_STYLE_DOS }, 227 { "A:", 0, RTPATH_STR_F_STYLE_DOS }, 228 { "bin", 3, RTPATH_STR_F_STYLE_UNIX }, 229 { "bin", 3, RTPATH_STR_F_STYLE_DOS }, 230 { "//unc/bin/bin", 3, RTPATH_STR_F_STYLE_DOS }, 231 { "//unc/bin/bin/", 4, RTPATH_STR_F_STYLE_DOS }, 232 { "//unc/bin", 3, RTPATH_STR_F_STYLE_DOS }, 233 { "//unc/bin/", 4, RTPATH_STR_F_STYLE_DOS }, 234 { "//unc/", 0, RTPATH_STR_F_STYLE_DOS }, 235 { "//unc", 0, RTPATH_STR_F_STYLE_DOS }, 236 }; 237 238 RTTestSub(hTest, "RTPathParentLength"); 239 for (uint32_t i = 0; i < RT_ELEMENTS(s_aTests); i++) 240 { 241 size_t const cchParent = RTPathParentLengthEx(s_aTests[i].pszPath, s_aTests[i].fFlags); 242 size_t const cchExpected = strlen(s_aTests[i].pszPath) - s_aTests[i].cchNonParent; 243 if (cchParent != cchExpected) 244 RTTestFailed(hTest, "sub-test #%u: got %u, expected %u (%s)", 245 i, cchParent, cchExpected, s_aTests[i].pszPath); 246 if (s_aTests[i].fFlags == RTPATH_STYLE) 247 { 248 size_t const cchParent2 = RTPathParentLength(s_aTests[i].pszPath); 249 if (cchParent2 != cchExpected) 250 RTTestFailed(hTest, "sub-test #%u: RTPathParentLength returned %u, expected %u (%s)", 251 i, cchParent2, cchExpected, s_aTests[i].pszPath); 191 252 } 192 253 } … … 921 982 922 983 testParserAndSplitter(hTest); 984 testParentLength(hTest); 923 985 924 986 /*
Note:
See TracChangeset
for help on using the changeset viewer.