1 | /* $Id: tstLog.cpp 45173 2013-03-25 14:04:00Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT Testcase - Log Formatting.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2011 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | /*******************************************************************************
|
---|
28 | * Header Files *
|
---|
29 | *******************************************************************************/
|
---|
30 | #include <iprt/log.h>
|
---|
31 | #include <iprt/initterm.h>
|
---|
32 | #include <iprt/err.h>
|
---|
33 | #include <iprt/stream.h>
|
---|
34 |
|
---|
35 | #include <stdio.h>
|
---|
36 |
|
---|
37 | int main()
|
---|
38 | {
|
---|
39 | RTR3InitExeNoArguments(0);
|
---|
40 | uint32_t a = 0x80000000, b = 0x80000000, c = 0x80000000;
|
---|
41 | RTPrintf("%d %d", 0x80000000, 0x80000000);
|
---|
42 | printf("tstLog: Requires manual inspection of the log output!\n");
|
---|
43 | RTLogPrintf("%%Rrc %d: %Rrc\n", VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER);
|
---|
44 | RTLogPrintf("%%Rrs %d: %Rrs\n", VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER);
|
---|
45 | RTLogPrintf("%%Rrf %d: %Rrf\n", VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER);
|
---|
46 | RTLogPrintf("%%Rra %d: %Rra\n", VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER);
|
---|
47 |
|
---|
48 | static uint8_t au8Hex[256];
|
---|
49 | for (unsigned iHex = 0; iHex < sizeof(au8Hex); iHex++)
|
---|
50 | au8Hex[iHex] = (uint8_t)iHex;
|
---|
51 | RTLogPrintf("%%Rhxs : %Rhxs\n", &au8Hex[0]);
|
---|
52 | RTLogPrintf("%%.32Rhxs: %.32Rhxs\n", &au8Hex[0]);
|
---|
53 |
|
---|
54 | RTLogPrintf("%%Rhxd :\n%Rhxd\n", &au8Hex[0]);
|
---|
55 | RTLogPrintf("%%.64Rhxd:\n%.64Rhxd\n", &au8Hex[0]);
|
---|
56 | RTLogPrintf("%%.*Rhxd:\n%.*Rhxd\n", 64, &au8Hex[0]);
|
---|
57 | RTLogPrintf("%%32.256Rhxd : \n%32.256Rhxd\n", &au8Hex[0]);
|
---|
58 | RTLogPrintf("%%32.*Rhxd : \n%32.*Rhxd\n", 256, &au8Hex[0]);
|
---|
59 | RTLogPrintf("%%7.32Rhxd : \n%7.32Rhxd\n", &au8Hex[0]);
|
---|
60 | RTLogPrintf("%%7.*Rhxd : \n%7.*Rhxd\n", 32, &au8Hex[0]);
|
---|
61 | RTLogPrintf("%%*.*Rhxd : \n%*.*Rhxd\n", 7, 32, &au8Hex[0]);
|
---|
62 |
|
---|
63 | RTLogPrintf("%%RGp: %RGp\n", (RTGCPHYS)0x87654321);
|
---|
64 | RTLogPrintf("%%RGv: %RGv\n", (RTGCPTR)0x87654321);
|
---|
65 | RTLogPrintf("%%RHp: %RHp\n", (RTGCPHYS)0x87654321);
|
---|
66 | RTLogPrintf("%%RHv: %RHv\n", (RTGCPTR)0x87654321);
|
---|
67 |
|
---|
68 | RTLogPrintf("%%RI8 : %RI8\n", (uint8_t)808);
|
---|
69 | RTLogPrintf("%%RI16: %RI16\n", (uint16_t)16016);
|
---|
70 | RTLogPrintf("%%RI32: %RI32\n", _1G);
|
---|
71 | RTLogPrintf("%%RI64: %RI64\n", _1E);
|
---|
72 |
|
---|
73 | RTLogPrintf("%%RU8 : %RU8\n", (uint8_t)808);
|
---|
74 | RTLogPrintf("%%RU16: %RU16\n", (uint16_t)16016);
|
---|
75 | RTLogPrintf("%%RU32: %RU32\n", _2G32);
|
---|
76 | RTLogPrintf("%%RU64: %RU64\n", _2E);
|
---|
77 |
|
---|
78 | RTLogPrintf("%%RX8 : %RX8 %#RX8\n", (uint8_t)808, (uint8_t)808);
|
---|
79 | RTLogPrintf("%%RX16: %RX16 %#RX16\n", (uint16_t)16016, (uint16_t)16016);
|
---|
80 | RTLogPrintf("%%RX32: %RX32 %#RX32\n", _2G32, _2G32);
|
---|
81 | RTLogPrintf("%%RX64: %RX64 %#RX64\n", _2E, _2E);
|
---|
82 |
|
---|
83 | RTLogFlush(NULL);
|
---|
84 |
|
---|
85 | return 0;
|
---|
86 | }
|
---|
87 |
|
---|