00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ACEUNITLOGGING_H
00029
00030 #define ACEUNITLOGGING_H 1
00031
00032 #include "AceUnit.h"
00033
00048 #define ACEUNIT_LOGGING_STYLE_SIMPLE 1
00049
00054 #define ACEUNIT_LOGGING_STYLE_FULL 2
00055
00056 #ifndef ACEUNIT_LOGGING_STYLE
00057
00064 #ifdef ACEUNIT_EMBEDDED
00065 #define ACEUNIT_LOGGING_STYLE ACEUNIT_LOGGING_STYLE_SIMPLE
00066 #else
00067 #define ACEUNIT_LOGGING_STYLE ACEUNIT_LOGGING_STYLE_FULL
00068 #endif
00069 #endif
00070
00071 #if ACEUNIT_LOGGING_STYLE == ACEUNIT_LOGGING_STYLE_FULL
00072
00073 #define ACEUNIT_LOG_RUNNER
00074 #endif
00075
00076 #if ACEUNIT_LOGGING_STYLE == ACEUNIT_LOGGING_STYLE_FULL
00077
00078 #define ACEUNIT_LOG_SUITE
00079 #endif
00080
00081 #if ACEUNIT_LOGGING_STYLE == ACEUNIT_LOGGING_STYLE_FULL
00082
00083 #define ACEUNIT_LOG_FIXTURE
00084 #endif
00085
00086 #if ACEUNIT_LOGGING_STYLE == ACEUNIT_LOGGING_STYLE_FULL
00087
00088 #define ACEUNIT_LOG_TESTCASE
00089 #endif
00090
00091
00092
00102 typedef struct {
00103
00104 #ifdef ACEUNIT_LOG_RUNNER
00105
00108 void(*runnerStarted)(void);
00109 #endif
00110
00111 #ifdef ACEUNIT_LOG_SUITE
00112
00115 void(*suiteStarted)(SuiteId_t const suiteId);
00116 #endif
00117
00118 #ifdef ACEUNIT_LOG_FIXTURE
00119
00123 void(*fixtureStarted)(const FixtureId_t fixture);
00124 #endif
00125
00126 #ifdef ACEUNIT_LOG_TESTCASE
00127
00131 void(*testCaseStarted)(TestCaseId_t testCase);
00132 #endif
00133
00138 void(*testCaseFailed)(const AssertionError_t *error);
00139
00140 #ifdef ACEUNIT_LOG_TESTCASE
00141
00146 void(*testCaseEnded)(TestCaseId_t testCase);
00147 #endif
00148
00149 #ifdef ACEUNIT_LOG_FIXTURE
00150
00154 void(*fixtureEnded)(FixtureId_t fixture);
00155 #endif
00156
00157 #ifdef ACEUNIT_LOG_SUITE
00158
00161 void(*suiteEnded)(SuiteId_t const suiteId);
00162 #endif
00163
00164 #ifdef ACEUNIT_LOG_RUNNER
00165
00168 void(*runnerEnded)(void);
00169 #endif
00170
00171 } TestLogger_t;
00172
00187
00188 #if !defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE)
00189 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00190 testCaseFailed\
00191 }
00192 #elif !defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE)
00193 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00194 testCaseStarted,\
00195 testCaseFailed,\
00196 testCaseEnded\
00197 }
00198 #elif !defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE)
00199 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00200 fixtureStarted,\
00201 testCaseFailed,\
00202 fixtureEnded,\
00203 }
00204 #elif !defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE)
00205 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00206 fixtureStarted,\
00207 testCaseStarted,\
00208 testCaseFailed,\
00209 testCaseEnded,\
00210 fixtureEnded,\
00211 }
00212 #elif !defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE)
00213 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00214 suiteStarted,\
00215 testCaseFailed,\
00216 suiteEnded,\
00217 }
00218 #elif !defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE)
00219 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00220 suiteStarted,\
00221 testCaseStarted,\
00222 testCaseFailed,\
00223 testCaseEnded,\
00224 suiteEnded\
00225 }
00226 #elif !defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE)
00227 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00228 suiteStarted,\
00229 fixtureStarted,\
00230 testCaseFailed,\
00231 fixtureEnded,\
00232 suiteEnded\
00233 }
00234 #elif !defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE)
00235 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00236 suiteStarted,\
00237 fixtureStarted,\
00238 testCaseStarted,\
00239 testCaseFailed,\
00240 testCaseEnded,\
00241 fixtureEnded,\
00242 suiteEnded\
00243 }
00244 #elif defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE)
00245 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00246 runnerStarted,\
00247 testCaseFailed,\
00248 runnerEnded\
00249 }
00250 #elif defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE)
00251 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00252 runnerStarted,\
00253 testCaseStarted,\
00254 testCaseFailed,\
00255 testCaseEnded,\
00256 runnerEnded\
00257 }
00258 #elif defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE)
00259 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00260 runnerStarted,\
00261 fixtureStarted,\
00262 testCaseFailed,\
00263 fixtureEnded,\
00264 runnerEnded\
00265 }
00266 #elif defined(ACEUNIT_LOG_RUNNER) && !defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE)
00267 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00268 runnerStarted,\
00269 fixtureStarted,\
00270 testCaseStarted,\
00271 testCaseFailed,\
00272 testCaseEnded,\
00273 fixtureEnded,\
00274 runnerEnded\
00275 }
00276 #elif defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE)
00277 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00278 runnerStarted,\
00279 suiteStarted,\
00280 testCaseFailed,\
00281 suiteEnded,\
00282 runnerEnded\
00283 }
00284 #elif defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && !defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE)
00285 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00286 runnerStarted,\
00287 suiteStarted,\
00288 testCaseStarted,\
00289 testCaseFailed,\
00290 testCaseEnded,\
00291 suiteEnded,\
00292 runnerEnded\
00293 }
00294 #elif defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && !defined(ACEUNIT_LOG_TESTCASE)
00295 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00296 runnerStarted,\
00297 suiteStarted,\
00298 fixtureStarted,\
00299 testCaseFailed,\
00300 fixtureEnded,\
00301 suiteEnded,\
00302 runnerEnded\
00303 }
00304 #elif defined(ACEUNIT_LOG_RUNNER) && defined(ACEUNIT_LOG_SUITE) && defined(ACEUNIT_LOG_FIXTURE) && defined(ACEUNIT_LOG_TESTCASE)
00305 #define AceUnitNewLogger(name, runnerStarted, suiteStarted, fixtureStarted, testCaseStarted, testCaseFailed, testCaseEnded, fixtureEnded, suiteEnded, runnerEnded) TestLogger_t name = {\
00306 runnerStarted,\
00307 suiteStarted,\
00308 fixtureStarted,\
00309 testCaseStarted,\
00310 testCaseFailed,\
00311 testCaseEnded,\
00312 fixtureEnded,\
00313 suiteEnded,\
00314 runnerEnded\
00315 }
00316 #else
00317 #error Internal error, missing log combination.
00318 #endif
00319
00320 #endif