MoonUnit
 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 {
74 } MuTestStatus;
75 
79 typedef enum MuTestStage
80 {
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 {
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
Definition: test.h:79
Definition: test.h:65
Definition: test.h:82
Definition: test.h:138
Definition: library.h:38
Definition: test.h:144
Definition: test.h:71
Definition: test.h:61
Definition: test.h:86
Definition: test.h:69
Definition: test.h:67
Definition: test.h:136
Definition: test.h:140
MuLogLevel
Definition: test.h:133
MuTestStatus
Definition: test.h:56
Definition: test.h:88
Definition: test.h:84
Definition: loader.h:44
Definition: test.h:63
Definition: test.h:92
Definition: test.h:59
Definition: test.h:73
Definition: test.h:142
Definition: test.h:90