tstPath.cpp revision 8787f920cdb31f37ca6b5fc8bafd2a4c268b16fd
/* $Id$ */
/** @file
* innotek Portable Runtime Testcase - Test various path functions.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
do { \
if (RT_FAILURE(rc)) \
{ \
cErrors++; \
} \
} while (0)
int main()
{
/*
* Init RT.
*/
int rc;
int cErrors = 0;
if (RT_FAILURE(rc))
return 1;
/*
* RTPathProgram
*/
char szPath[RTPATH_MAX];
/*
* RTPathAbsEx
*/
RTPrintf("tstPath: TESTING RTPathAbsEx()\n");
static const char *aInput[] =
{
// NULL, NULL, -- assertion in RTStrUtf8ToUcs2
NULL, "/absolute/..",
NULL, "/absolute\\\\../..",
NULL, "/absolute//../path",
NULL, "/absolute/../../path",
NULL, "\\",
"relative_base/dir\\", "\\from_root",
"relative_base/dir/", "relative_also",
NULL, "C:\\",
"C:\\", "..",
"C:\\temp", "..",
"C:\\VirtualBox/Machines", "..\\VirtualBox.xml",
"C:\\temp", "D:\\data",
/* the three below use cases should fail with VERR_INVALID_NAME */
//NULL, "\\\\server",
//NULL, "\\\\",
//NULL, "\\\\\\something",
"\\\\server\\share_as_base", "/from_root",
"\\\\just_server", "/from_root",
"\\\\server\\share_as_base", "relative\\data",
/* this is not (and I guess should not be) supported, should fail */
///@todo "\\\\?\\UNC\\base", "/from_root",
#else
"\\temp", "..",
"\\VirtualBox/Machines", "..\\VirtualBox.xml",
"\\temp", "\\data",
#endif
};
{
if (RT_SUCCESS(rc))
}
/*
* Summary.
*/
if (!cErrors)
RTPrintf("tstTimer: SUCCESS\n");
else
return !!cErrors;
}