PageRenderTime 48ms CodeModel.GetById 47ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/sparrowhawk/test_framework/ESTFSystemAssert.h

http://github.com/jtblatt/duderino
C Header | 61 lines | 14 code | 7 blank | 40 comment | 6 complexity | 5478855ef1148c2837141f51a917cb68 MD5 | raw file
 1/** @file ESTFSystemAssert.h
 2 *  @brief Macros that pass test case results to the system assert facility.
 3 *
 4 * Copyright (c) 2009 Yahoo! Inc.
 5 * The copyrights embodied in the content of this file are licensed by Yahoo! Inc.
 6 * under the BSD (revised) open source license.
 7 *
 8 * Derived from code that is Copyright (c) 2009 Joshua Blatt and offered under both
 9 * BSD and Apache 2.0 licenses (http://sourceforge.net/projects/sparrowhawk/).
10 *
11 *  $Author: blattj $
12 *  $Date: 2009/05/25 21:51:19 $
13 *  $Name:  $
14 *  $Revision: 1.3 $
15 */
16
17#ifndef ESTF_SYSTEM_ASSERT_H
18#define ESTF_SYSTEM_ASSERT_H
19
20#ifndef ESTF_CONFIG_H
21#include <ESTFConfig.h>
22#endif
23
24/** Evaluate an expression and record the result in a result collector.  The
25 *  expression itself will be used as the decription of the test record.
26 *
27 *  @param collector The result collector to modify
28 *  @param expr The expression to test
29 *  @ingroup test
30 */
31#define ESTF_ASSERT( collector, expr ) \
32    if ( collector ) ESTF_NATIVE_ASSERT( expr );
33
34/** Add a success result to a result collector.
35 *
36 *  @param collector The result collector to modify
37 *  @param description The description of the success result.
38 *  @ingroup test
39 */
40#define ESTF_SUCCESS( collector, description )  \
41    if ( collector );
42
43/** Add a failure result to a result collector.
44 *
45 *  @param collector The result collector to modify
46 *  @param description The description of the failure result.
47 *  @ingroup test
48 */
49#define ESTF_FAILURE( collector, description ) \
50    if ( collector ) ESTF_NATIVE_ASSERT( (void *) "FAILURE: " == (void *) description )
51
52/** Add an error result to a result collector.
53 *
54 *  @param collector The result collector to modify
55 *  @param description The description of the error condition.
56 *  @ingroup test
57 */
58#define ESTF_ERROR( collector, description ) \
59    if ( collector ) ESTF_NATIVE_ASSERT( (void *) "ERROR: " == (void *) description )
60
61#endif