tstPath.cpp revision ad6025fdf797313667d02b6dd49b0be9b58d4a05
/* $Id$ */
/** @file
* Incredibly Portable Runtime Testcase - Test various path functions.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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 (GPL) 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* 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, RTPathUserHome
*/
char szPath[RTPATH_MAX];
if (RT_SUCCESS(rc))
if (RT_SUCCESS(rc))
/*
* RTPathAbsEx
*/
RTPrintf("tstPath: TESTING RTPathAbsEx()\n");
static const char *aInput[] =
{
// NULL, NULL, -- assertion in RTStrToUtf16
NULL, "/absolute/..",
NULL, "/absolute\\\\../..",
NULL, "/absolute//../path",
NULL, "/absolute/../../path",
NULL, "\\",
"relative_base/dir\\", "\\from_root",
"relative_base/dir/", "relative_also",
#if defined (RT_OS_OS2) || defined (RT_OS_WINDOWS)
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;
}