1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/****************************************************************************
* $IBMCopyrightBlock:
*
* IBM Confidential
*
* Licensed Internal Code Source Materials
*
* IBM HostBoot Licensed Internal Code
*
* (C) Copyright IBM Corp. 2011
*
* The source code for this program is not published or other-
* wise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
* $
****************************************************************************/
#ifndef __TEST_CXXTESTTEST_H
#define __TEST_CXXTESTTEST_H
/**
* @file cxxtesttest.H
*
* unit tests for TS_TRACE, TS_WARN, and TS_FAIL macros
*
*/
/**
* @class cxxtest
*
* - test TS_TRACE, TS_WARN and TS_FAIL macros
*
*/
#include <cxxtest/TestSuite.H>
class CxxTestTest: public CxxTest::TestSuite
{
public:
/**
* @test TS_TRACE macro
*
*/
void testCxxTestTrace(void)
{
int32_t l_dec = 1234567890;
uint32_t l_hex = 0x12345678;
uint64_t l_bighex = 0x1234567890abcdef;
TS_TRACE( "CxxTest Trace dec=%d", l_dec );
TS_TRACE( "CxxTest Trace hex=0x%x", l_hex );
TS_TRACE( "CxxTest Trace bighex=0x%llx", l_bighex );
TS_TRACE( "CxxTest Trace pointer=%p", &l_bighex );
TS_TRACE( "CxxTest Trace string=%s", "testing...\n" );
// all-in one.
TS_TRACE( "CxxTest Trace dec=%d, hex=0x%x, bighex=0x%llx, ptr=%p, str=%s",
l_dec, l_hex, l_bighex, &l_bighex, "testing..." );
}
/**
* @test TS_WARN will run if the testExampleWarn_function FAILS
*
* @note: please leave this here, but disabled. It is useful for
* sandbox testing.
*/
// void testCxxTestWarn(void)
// {
// int32_t l_dec = 1234567890;
// uint32_t l_hex = 0x12345678;
// uint64_t l_bighex = 0x1234567890abcdef;
//
// TS_WARN( "CxxTest Warning dec=%d", l_dec );
// TS_WARN( "CxxTest Warning hex=0x%x", l_hex );
// TS_WARN( "CxxTest Warning bighex=0x%llx", l_bighex );
// TS_WARN( "CxxTest Warning pointer=%p", &l_bighex );
// TS_WARN( "CxxTest Warning string=%s", "testing...\n" );
//
// // all-in one.
// TS_WARN( "CxxTest Warn dec=%d, hex=0x%x, bighex=0x%llx, ptr=%p, str=%s",
// l_dec, l_hex, l_bighex, &l_bighex, "testing..." );
//
// }
/**
* @test TS_FAIL will run if the testExampleFail function FAILS
*
* @note: please leave this here, but disabled. It is useful for
* sandbox testing.
*/
// void testCxxTestFail(void)
// {
// int32_t l_dec = 1234567890;
// uint32_t l_hex = 0x12345678;
// uint64_t l_bighex = 0x1234567890abcdef;
//
// TS_FAIL( "CxxTest Fail dec=%d", l_dec );
// TS_FAIL( "CxxTest Fail hex=0x%x", l_hex );
// TS_FAIL( "CxxTest Fail bighex=0x%llx", l_bighex );
// TS_FAIL( "CxxTest Fail pointer=%p", &l_bighex );
// TS_FAIL( "CxxTest Fail string=%s", "testing...\n" );
//
// // all-in one.
// TS_FAIL( "CxxTest FAIL dec=%d, hex=0x%x, bighex=0x%llx, ptr=%p, str=%s",
// l_dec, l_hex, l_bighex, &l_bighex, "testing..." );
//
// }
}; // end class
#endif
|