VirtualBox

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

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

InnoTek -> innotek: all the headers and comments.

  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1/* $Id: tstErrUnique.cpp 2981 2007-06-01 16:01:28Z 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 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#include <iprt/err.h>
27#include <iprt/string.h>
28#include <iprt/stream.h>
29#include <iprt/runtime.h>
30#include <VBox/err.h>
31
32
33/******************************************************************************** Global Variables ********************************************************************************//** Array of messages.
34 * The data is generated by a sed script.
35 */
36static const RTSTATUSMSG g_aErrorMessages[] =
37{
38#include "errmsgdata.h"
39};
40
41static bool strIsPermissibleDuplicate(const RTSTATUSMSG *msg)
42{
43 const char *pszMsgShort = msg->pszMsgShort;
44 const char *pszDefine = msg->pszDefine;
45 size_t cbDefine = strlen(pszDefine);
46
47 return (strstr(pszMsgShort, "(mapped to") != 0)
48 || (strstr(pszDefine, "FIRST") == pszDefine + (cbDefine - 5))
49 || (strstr(pszDefine, "LAST") == pszDefine + (cbDefine - 4));
50}
51
52
53int main()
54{
55 int cErrors = 0;
56 RTPrintf("tstErrUnique: TESTING\n");
57 RTR3Init();
58
59 for (uint32_t i = 0; i < ELEMENTS(g_aErrorMessages) - 1; i++)
60 {
61 if (strIsPermissibleDuplicate(&g_aErrorMessages[i]))
62 continue;
63
64 for (uint32_t j = i + 1; j < ELEMENTS(g_aErrorMessages); j++)
65 {
66 if (strIsPermissibleDuplicate(&g_aErrorMessages[j]))
67 continue;
68
69 if (g_aErrorMessages[i].iCode == g_aErrorMessages[j].iCode)
70 {
71 RTPrintf("tstErrUnique: status code %d can mean '%s' or '%s'\n", g_aErrorMessages[i].iCode, g_aErrorMessages[i].pszMsgShort, g_aErrorMessages[j]);
72 cErrors++;
73 }
74 }
75 }
76
77 /*
78 * Summary
79 */
80 if (cErrors == 0)
81 RTPrintf("tstErrUnique: SUCCESS\n");
82 else
83 RTPrintf("tstErrUnique: FAILURE - %d errors\n", cErrors);
84 return !!cErrors;
85}
86
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