1
/* $Id: tstErrUnique.cpp 4071 2007-08-07 17:07:59Z vboxsync $ */
3
* innotek Portable Runtime Testcase - Error Messages.
7
* Copyright (C) 2006-2007 innotek GmbH
9
* This file is part of VirtualBox Open Source Edition (OSE), as
10
* available from http://www.virtualbox.org. This file is free software;
11
* you can redistribute it and/or modify it under the terms of the GNU
12
* General Public License as published by the Free Software Foundation,
13
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14
* distribution. VirtualBox OSE is distributed in the hope that it will
15
* be useful, but WITHOUT ANY WARRANTY of any kind.
19
/*******************************************************************************
21
*******************************************************************************/
23
#include <iprt/string.h>
24
#include <iprt/stream.h>
25
#include <iprt/runtime.h>
29
/******************************************************************************** Global Variables ********************************************************************************//** Array of messages.
30
* The data is generated by a sed script.
32
static const RTSTATUSMSG g_aErrorMessages[] =
34
#include "errmsgdata.h"
37
static bool strIsPermissibleDuplicate(const RTSTATUSMSG *msg)
39
const char *pszMsgShort = msg->pszMsgShort;
40
const char *pszDefine = msg->pszDefine;
41
size_t cbDefine = strlen(pszDefine);
43
return (strstr(pszMsgShort, "(mapped to") != 0)
44
|| (strstr(pszDefine, "FIRST") == pszDefine + (cbDefine - 5))
45
|| (strstr(pszDefine, "LAST") == pszDefine + (cbDefine - 4));
52
RTPrintf("tstErrUnique: TESTING\n");
55
for (uint32_t i = 0; i < ELEMENTS(g_aErrorMessages) - 1; i++)
57
if (strIsPermissibleDuplicate(&g_aErrorMessages[i]))
60
for (uint32_t j = i + 1; j < ELEMENTS(g_aErrorMessages); j++)
62
if (strIsPermissibleDuplicate(&g_aErrorMessages[j]))
65
if (g_aErrorMessages[i].iCode == g_aErrorMessages[j].iCode)
67
RTPrintf("tstErrUnique: status code %d can mean '%s' or '%s'\n", g_aErrorMessages[i].iCode, g_aErrorMessages[i].pszMsgShort, g_aErrorMessages[j]);
77
RTPrintf("tstErrUnique: SUCCESS\n");
79
RTPrintf("tstErrUnique: FAILURE - %d errors\n", cErrors);