MoonUnit
Main Page
Related Pages
Modules
Data Structures
All
Data Structures
Variables
Enumerations
Enumerator
Groups
Pages
test.h
1
/*
2
* Copyright (c) 2008, Brian Koropoff
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
* * Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* * Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
* * Neither the name of the Moonunit project nor the
13
* names of its contributors may be used to endorse or promote products
14
* derived from this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY BRIAN KOROPOFF ``AS IS'' AND ANY
17
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
* DISCLAIMED. IN NO EVENT SHALL BRIAN KOROPOFF BE LIABLE FOR ANY
20
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*/
27
28
#ifndef __MU_TEST_H__
29
#define __MU_TEST_H__
30
31
#include <moonunit/internal/boilerplate.h>
32
#include <moonunit/type.h>
33
43
/* @{ */
44
45
C_BEGIN_DECLS
46
47
/* Forward declarations */
48
struct
MuTestToken;
49
struct
MuTest;
50
struct
MuLoader
;
51
struct
MuLibrary
;
52
56
typedef
enum
MuTestStatus
57
{
59
MU_STATUS_SUCCESS
= 0,
61
MU_STATUS_FAILURE
,
63
MU_STATUS_ASSERTION
,
65
MU_STATUS_CRASH
,
67
MU_STATUS_TIMEOUT
,
69
MU_STATUS_EXCEPTION
,
71
MU_STATUS_RESOURCE
,
73
MU_STATUS_SKIPPED
74
}
MuTestStatus
;
75
79
typedef
enum
MuTestStage
80
{
82
MU_STAGE_LIBRARY_SETUP
,
84
MU_STAGE_FIXTURE_SETUP
,
86
MU_STAGE_TEST
,
88
MU_STAGE_FIXTURE_TEARDOWN
,
90
MU_STAGE_LIBRARY_TEARDOWN
,
92
MU_STAGE_UNKNOWN
93
}
MuTestStage
;
94
95
#ifndef DOXYGEN
96
typedef
struct
MuBacktrace
97
{
98
unsigned
long
return_addr;
99
unsigned
long
func_addr;
100
const
char
* file_name;
101
const
char
* func_name;
102
struct
MuBacktrace* up;
103
/* Reserved */
104
void
* reserved1;
105
void
* reserved2;
106
} MuBacktrace;
107
108
typedef
struct
MuTestResult
109
{
111
MuTestStatus
status;
113
MuTestStatus
expected;
115
MuTestStage
stage;
117
const
char
* reason;
119
const
char
* file;
121
unsigned
int
line;
123
MuBacktrace* backtrace;
124
/* Reserved */
125
void
* reserved1;
126
void
* reserved2;
127
} MuTestResult;
128
#endif
129
133
typedef
enum
134
{
136
MU_LEVEL_WARNING
,
138
MU_LEVEL_INFO
,
140
MU_LEVEL_VERBOSE
,
142
MU_LEVEL_DEBUG
,
144
MU_LEVEL_TRACE
145
}
MuLogLevel
;
146
147
#ifndef DOXYGEN
148
149
typedef
struct
MuLogEvent
150
{
152
MuTestStage
stage;
154
const
char
* file;
156
unsigned
int
line;
158
MuLogLevel
level;
160
const
char
* message;
161
/* Reserved */
162
void
* reserved1;
163
void
* reserved2;
164
} MuLogEvent;
165
166
typedef
struct
MuTest
167
{
168
struct
MuLoader
* loader;
169
struct
MuLibrary
* library;
170
} MuTest;
171
172
typedef
void (*MuThunk) (void);
173
174
const
char
* mu_test_status_to_string(
MuTestStatus
status);
175
const
char
* mu_test_stage_to_string(
MuTestStage
stage);
176
const
char
* mu_test_name(MuTest* test);
177
const
char
* mu_test_suite(MuTest* test);
178
179
#endif
180
181
C_END_DECLS
182
183
/* @} */
184
185
#endif
MuTestStage
MuTestStage
Definition:
test.h:79
MU_STATUS_CRASH
Definition:
test.h:65
MU_STAGE_LIBRARY_SETUP
Definition:
test.h:82
MU_LEVEL_INFO
Definition:
test.h:138
MuLibrary
Definition:
library.h:38
MU_LEVEL_TRACE
Definition:
test.h:144
MU_STATUS_RESOURCE
Definition:
test.h:71
MU_STATUS_FAILURE
Definition:
test.h:61
MU_STAGE_TEST
Definition:
test.h:86
MU_STATUS_EXCEPTION
Definition:
test.h:69
MU_STATUS_TIMEOUT
Definition:
test.h:67
MU_LEVEL_WARNING
Definition:
test.h:136
MU_LEVEL_VERBOSE
Definition:
test.h:140
MuLogLevel
MuLogLevel
Definition:
test.h:133
MuTestStatus
MuTestStatus
Definition:
test.h:56
MU_STAGE_FIXTURE_TEARDOWN
Definition:
test.h:88
MU_STAGE_FIXTURE_SETUP
Definition:
test.h:84
MuLoader
Definition:
loader.h:44
MU_STATUS_ASSERTION
Definition:
test.h:63
MU_STAGE_UNKNOWN
Definition:
test.h:92
MU_STATUS_SUCCESS
Definition:
test.h:59
MU_STATUS_SKIPPED
Definition:
test.h:73
MU_LEVEL_DEBUG
Definition:
test.h:142
MU_STAGE_LIBRARY_TEARDOWN
Definition:
test.h:90
moonunit
test.h
Generated by
1.8.6