summaryrefslogtreecommitdiffstats
path: root/src/usr/example/test/exampletest.H
blob: 8e89cb03dbb405d605a26c34fd6aef13f6c72239 (plain)
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
121
//  IBM_PROLOG_BEGIN_TAG
//  This is an automatically generated prolog.
//
//  $Source: src/usr/example/test/exampletest.H $
//
//  IBM CONFIDENTIAL
//
//  COPYRIGHT International Business Machines Corp. 2011
//
//  p1
//
//  Object Code Only (OCO) source materials
//  Licensed Internal Code Source Materials
//  IBM HostBoot Licensed Internal Code
//
//  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.
//
//  Origin: 30
//
//  IBM_PROLOG_END
#ifndef __TEST_EXAMPLETEST_H
#define __TEST_EXAMPLETEST_H

/**
 *  @file exampletest.H
 *
 *  @brief Example for people to use when writing test cases for their module.
 *  @todo  add more doxygen blocks
 */

#include <cxxtest/TestSuite.H>
#include <example/example.H>


class ExampleTest: public CxxTest::TestSuite
{
public:


    /**
     * @test TS_WARN will run if the testExampleWarn_function FAILS
     */
    void testExampleWarn(void)
    {
        uint64_t    l_rc = 0;
        l_rc = example1_function();
        if(l_rc)
        {
            TS_WARN("Warning, Call to testExampleWarn returned bad value.\n");
        }
    }


    /**
     * @test TS_TRACE will run if the testExampleTrace function FAILS
     *
     */
    void testExampleTrace(void)
    {
        uint64_t    l_rc = 0;
        l_rc = example1_function();
        if(l_rc)
        {
            TS_TRACE("Tracing a failure in testExampleTrace function1\n");
        }
    }

    /**
     * @test TS_FAIL will run if the testExampleFail function FAILS
     */
    void testExampleFail(void)
    {
        uint64_t    l_rc = 0;
        l_rc = example1_function();
        if(l_rc)
        {
            TS_FAIL("Call to testExampleFail failed!\n");
        }
    }
    /**
     * @test this will always run TS_FAIL
     */
    void testExampleForceFail(void)
    {

        TS_FAIL("Run TS_FAIL() as part of the example test.\n" );
    }

    /**
     * @test this will always run TS_WARN
     */
    void testExampleForceWarn(void)
    {

        TS_WARN("Run TS_WARN() as part of the example test\n" );
    }
    /**
     * @test this will always run TS_TRACE
     */
    void testExampleForceTrace(void)
    {
        uint32_t i_32test   =   0xdeadbeef;
        uint64_t i_64test   =   0xbadc0ffee0ddf00d;

        TS_TRACE("Run TS_TRACE() as part of the example test\n" );

        TS_TRACE("Run TS_TRACE() with one print parameter: %d\n", 5 );

        TS_TRACE("Run TS_TRACE() with 2 parameters: 0x%x 0x%x \n", i_32test, 0x78 );

        TS_TRACE("Run TS_TRACE() with 3 parameters:  %d, 0x%llx, %p", 328, i_64test, &i_64test );
    }



};

#endif

OpenPOWER on IntegriCloud