tstGuestCtrlParseBuffer.cpp revision 154ed29e9462101350c438a9ace34cb60d92e56f
/* $Id$ */
/** @file
*
* Output stream parsing test cases.
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* 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.
*/
#include <map>
/** @todo Use original source of GuestCtrlImpl.cpp! */
typedef struct VBOXGUESTCTRL_BUFFER_VALUE
{
char *pszValue;
#ifndef RT_OS_WINDOWS
#endif
static struct
{
const char *pbData;
int iResult;
} aTests[] =
{
/* Invalid stuff. */
{ NULL, 0, 0, 0, VERR_INVALID_POINTER },
{ "", 0, 0, 0, VERR_INVALID_PARAMETER },
{ "foo=bar", 0, 0, 0, VERR_INVALID_PARAMETER },
/* Parsing stuff. */
};
int outputBufferParse(const BYTE *pbData, size_t cbData, uint32_t *puOffset, GuestBufferMap& mapBuf)
{
int rc = VINF_SUCCESS;
{
/* Search and of current pair (key=value\0). */
while ( *pszEnd != '\0'
{
pszEnd++;
}
if (!uLen)
continue;
while ( *pszSep != '='
{
pszSep++;
}
{
continue;
}
if (uKeyLen)
{
if (!pszKey)
{
rc = VERR_NO_MEMORY;
break;
}
if (uValLen)
{
if (!pszVal)
{
rc = VERR_NO_MEMORY;
break;
}
}
}
}
return rc;
}
int main()
{
if (rc)
return rc;
{
{
}
{
}
{
}
}
/*
* Summary.
*/
return RTTestSummaryAndDestroy(hTest);
}