VirtualBox

source: vbox/trunk/src/VBox/Runtime/testcase/tstErrUnique.cpp@ 4071

Last change on this file since 4071 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1/* $Id: tstErrUnique.cpp 4071 2007-08-07 17:07:59Z vboxsync $ */
2/** @file
3 * innotek Portable Runtime Testcase - Error Messages.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
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.
16 */
17
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include <iprt/err.h>
23#include <iprt/string.h>
24#include <iprt/stream.h>
25#include <iprt/runtime.h>
26#include <VBox/err.h>
27
28
29/******************************************************************************** Global Variables ********************************************************************************//** Array of messages.
30 * The data is generated by a sed script.
31 */
32static const RTSTATUSMSG g_aErrorMessages[] =
33{
34#include "errmsgdata.h"
35};
36
37static bool strIsPermissibleDuplicate(const RTSTATUSMSG *msg)
38{
39 const char *pszMsgShort = msg->pszMsgShort;
40 const char *pszDefine = msg->pszDefine;
41 size_t cbDefine = strlen(pszDefine);
42
43 return (strstr(pszMsgShort, "(mapped to") != 0)
44 || (strstr(pszDefine, "FIRST") == pszDefine + (cbDefine - 5))
45 || (strstr(pszDefine, "LAST") == pszDefine + (cbDefine - 4));
46}
47
48
49int main()
50{
51 int cErrors = 0;
52 RTPrintf("tstErrUnique: TESTING\n");
53 RTR3Init();
54
55 for (uint32_t i = 0; i < ELEMENTS(g_aErrorMessages) - 1; i++)
56 {
57 if (strIsPermissibleDuplicate(&g_aErrorMessages[i]))
58 continue;
59
60 for (uint32_t j = i + 1; j < ELEMENTS(g_aErrorMessages); j++)
61 {
62 if (strIsPermissibleDuplicate(&g_aErrorMessages[j]))
63 continue;
64
65 if (g_aErrorMessages[i].iCode == g_aErrorMessages[j].iCode)
66 {
67 RTPrintf("tstErrUnique: status code %d can mean '%s' or '%s'\n", g_aErrorMessages[i].iCode, g_aErrorMessages[i].pszMsgShort, g_aErrorMessages[j]);
68 cErrors++;
69 }
70 }
71 }
72
73 /*
74 * Summary
75 */
76 if (cErrors == 0)
77 RTPrintf("tstErrUnique: SUCCESS\n");
78 else
79 RTPrintf("tstErrUnique: FAILURE - %d errors\n", cErrors);
80 return !!cErrors;
81}
82
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette