Changeset 80832 in vbox for trunk/src/VBox/Runtime/testcase
- Timestamp:
- Sep 16, 2019 6:10:52 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 133402
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstRTPath.cpp
r79570 r80832 278 278 char *pszRet = RTPathPurgeFilename(szPath, s_aTests[i].fFlags); 279 279 RTTEST_CHECK(hTest, pszRet == &szPath[0]); 280 if (strcmp(szPath, s_aTests[i].pszOut) != 0) 281 RTTestFailed(hTest, "sub-test #%u: got '%s', expected '%s' (style %#x)", 282 i, szPath, s_aTests[i].pszOut, s_aTests[i].fFlags); 283 } 284 } 285 286 287 static void testEnsureTrailingSeparator(RTTEST hTest) 288 { 289 static struct 290 { 291 const char *pszIn, *pszOut; 292 uint32_t fFlags; 293 } const s_aTests[] = 294 { 295 { "/foo", "/foo/", RTPATH_STR_F_STYLE_UNIX }, 296 { "/foo\\", "/foo\\/", RTPATH_STR_F_STYLE_UNIX }, 297 { "/foo:", "/foo:/", RTPATH_STR_F_STYLE_UNIX }, 298 { "/foo/", "/foo/", RTPATH_STR_F_STYLE_UNIX }, 299 { "D:/foo", "D:/foo\\", RTPATH_STR_F_STYLE_DOS }, 300 { "D:/foo\\", "D:/foo\\", RTPATH_STR_F_STYLE_DOS }, 301 { "", "./", RTPATH_STR_F_STYLE_UNIX}, 302 { "", ".\\", RTPATH_STR_F_STYLE_DOS }, 303 { "", "." RTPATH_SLASH_STR, RTPATH_STR_F_STYLE_HOST }, 304 { ".", "." RTPATH_SLASH_STR, RTPATH_STR_F_STYLE_HOST }, 305 { "x", "x" RTPATH_SLASH_STR, RTPATH_STR_F_STYLE_HOST }, 306 { "y" RTPATH_SLASH_STR, "y" RTPATH_SLASH_STR, RTPATH_STR_F_STYLE_HOST }, 307 }; 308 RTTestSub(hTest, "RTPathEnsureTrailingSeparatorEx"); 309 for (uint32_t i = 0; i < RT_ELEMENTS(s_aTests); i++) 310 { 311 char szPath[RTPATH_MAX]; 312 strcpy(szPath, s_aTests[i].pszIn); 313 size_t cchRet = RTPathEnsureTrailingSeparatorEx(szPath, sizeof(szPath), s_aTests[i].fFlags); 314 RTTEST_CHECK(hTest, cchRet == strlen(s_aTests[i].pszOut)); 280 315 if (strcmp(szPath, s_aTests[i].pszOut) != 0) 281 316 RTTestFailed(hTest, "sub-test #%u: got '%s', expected '%s' (style %#x)", … … 1014 1049 testParentLength(hTest); 1015 1050 testPurgeFilename(hTest); 1051 testEnsureTrailingSeparator(hTest); 1016 1052 1017 1053 /*
Note:
See TracChangeset
for help on using the changeset viewer.