Changeset 76589 in vbox for trunk/src/VBox/Runtime/testcase
- Timestamp:
- Jan 1, 2019 8:56:07 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstRTPath.cpp
r76553 r76589 742 742 { 743 743 const char *pszFrom; 744 bool fFromFile; 744 745 const char *pszTo; 745 746 int rc; … … 747 748 } s_aRelPath[] = 748 749 { 749 { "/home/test.ext", "/home/test2.ext", VINF_SUCCESS, "test2.ext"}, 750 { "/dir/test.ext", "/dir/dir2/test2.ext", VINF_SUCCESS, "dir2/test2.ext"}, 751 { "/dir/dir2/test.ext", "/dir/test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "test2.ext"}, 752 { "/dir/dir2/test.ext", "/dir/dir3/test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "dir3/test2.ext"}, 750 { "/home/test.ext", true, "/home/test2.ext", VINF_SUCCESS, "test2.ext" }, 751 { "/dir/test.ext", true, "/dir/dir2/test2.ext", VINF_SUCCESS, "dir2/test2.ext" }, 752 { "/dir/dir2/test.ext", true, "/dir/test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "test2.ext" }, 753 { "/dir/dir2/test.ext", true, "/dir/dir3/test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "dir3/test2.ext" }, 754 { "/dir/dir2", false, "/dir/dir3/test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "dir3/test2.ext" }, 755 { "/dir/dir2", false, "/dir/dir3//test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "dir3//test2.ext" }, 756 { "/dir/dir2/", false, "/dir/dir3/test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "dir3/test2.ext" }, 757 { "/dir/dir2////", false, "/dir//dir3/test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "dir3/test2.ext" }, 758 { "/include/iprt", false, "/include/iprt/cdefs.h", VINF_SUCCESS, "cdefs.h" }, 759 { "/include/iprt/", false, "/include/iprt/cdefs.h", VINF_SUCCESS, "cdefs.h" }, 760 { "/include/iprt/tt.h", true, "/include/iprt/cdefs.h", VINF_SUCCESS, "cdefs.h" }, 753 761 #if defined (RT_OS_OS2) || defined (RT_OS_WINDOWS) 754 { "\\\\server\\share\\test.ext", "\\\\server\\share2\\test2.ext", VERR_NOT_SUPPORTED, ""}, 755 { "c:\\dir\\test.ext", "f:\\dir\\test.ext", VERR_NOT_SUPPORTED, ""} 762 { "\\\\server\\share\\test.ext", true, "\\\\server\\share2\\test2.ext", VERR_NOT_SUPPORTED, "" }, 763 { "c:\\dir\\test.ext", true, "f:\\dir\\test.ext", VERR_NOT_SUPPORTED, "" }, 764 { "F:\\dir\\test.ext", false, "f:/dir//test.ext", VINF_SUCCESS, "." } , 765 { "F:\\dir\\test.ext", true, "f:/dir//test.ext", VINF_SUCCESS, "test.ext" } , 756 766 #endif 757 767 }; 758 768 for (unsigned i = 0; i < RT_ELEMENTS(s_aRelPath); i++) 759 769 { 760 const char *pszFrom = s_aRelPath[i].pszFrom; 761 const char *pszTo = s_aRelPath[i].pszTo; 762 763 rc = RTPathCalcRelative(szPath, sizeof(szPath), pszFrom, pszTo); 770 const char *pszFrom = s_aRelPath[i].pszFrom; 771 bool fFromFile = s_aRelPath[i].fFromFile; 772 const char *pszTo = s_aRelPath[i].pszTo; 773 774 rc = RTPathCalcRelative(szPath, sizeof(szPath), pszFrom, fFromFile, pszTo); 764 775 if (rc != s_aRelPath[i].rc) 765 RTTestIFailed("Unexpected return code \n"776 RTTestIFailed("Unexpected return code for %s .. %s\n" 766 777 " got: %Rrc\n" 767 778 "expected: %Rrc", 768 rc, s_aRelPath[i].rc);779 pszFrom, pszTo, rc, s_aRelPath[i].rc); 769 780 else if ( RT_SUCCESS(rc) 770 781 && strcmp(szPath, s_aRelPath[i].pszExpected)) 771 782 RTTestIFailed("Unexpected result\n" 772 " from: '%s' \n"783 " from: '%s' (%s)\n" 773 784 " to: '%s'\n" 774 785 " output: '%s'\n" 775 786 "expected: '%s'", 776 pszFrom, pszTo, szPath, s_aRelPath[i].pszExpected);787 pszFrom, fFromFile ? "file" : "dir", pszTo, szPath, s_aRelPath[i].pszExpected); 777 788 } 778 789
Note:
See TracChangeset
for help on using the changeset viewer.