Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

Test Case Functions


Detailed Description

Functions that are used to define, start, and complete test cases.


Defines

#define XTESTS_CASE_BEGIN(name, desc)
 Begins a test case, of the given name and description.
#define XTESTS_CASE_END(name)
 Ends the current test case.
#define XTESTS_RUN_CASE_WITH_NAME_AND_DESC(name, desc, fn)
 Runs the given test case function, specifying a name and description.
#define XTESTS_RUN_CASE_WITH_DESC(fn, desc)
 Runs the given test case function, specifying a description.
#define XTESTS_RUN_CASE(fn)
 Runs the given test case function.
#define XTESTS_RUN_CASE_THAT_THROWS_WITH_NAME_AND_DESC(name, desc, fn, type)
 Runs the given test case function, specifying a name and description, and the type of an exception that is expected.
#define XTESTS_RUN_CASE_THAT_THROWS_WITH_DESC(fn, desc, type)
 Runs the given test case function, specifying a description, and the type of an exception that is expected.
#define XTESTS_RUN_CASE_THAT_THROWS(fn, type)
 Runs the given test case function, specifying the type of an exception that is expected.


Define Documentation

#define XTESTS_CASE_BEGIN ( name,
desc   ) 

Value:

\
    (0 == XTESTS_NS_C_QUAL(xtests_beginTestCase)((name), (desc)))
Begins a test case, of the given name and description.

Parameters:
name The name of the test case
desc The description of the test case. May be NULL or the empty string ("").
Examples:
c/example.c.runner/example.c.runner.c.

#define XTESTS_CASE_END ( name   ) 

Value:

\
    stlsoft_static_cast(void, XTESTS_NS_C_QUAL(xtests_endTestCase)((name)))
Ends the current test case.

Parameters:
name The name of the test case
Note:
The name parameter is ignored in the current implementation, which can only run one test case at a time.
Examples:
c/example.c.runner/example.c.runner.c.

#define XTESTS_RUN_CASE ( fn   ) 

Value:

Runs the given test case function.

Parameters:
fn A function, taking no parameters and returning void, that executes a number of tests representing a test case.
Note:
This can only be invoked after a successful invocation of XTESTS_CASE_BEGIN() and before invocation of XTESTS_CASE_END().

#define XTESTS_RUN_CASE_THAT_THROWS ( fn,
type   ) 

Value:

Runs the given test case function, specifying the type of an exception that is expected.

Parameters:
fn A function, taking no parameters and returning void, that executes a number of tests representing a test case.
type The type of the exception that is expected to be thrown
Note:
This can only be invoked after a successful invocation of XTESTS_CASE_BEGIN() and before invocation of XTESTS_CASE_END().

#define XTESTS_RUN_CASE_THAT_THROWS_WITH_DESC ( fn,
desc,
type   ) 

Value:

Runs the given test case function, specifying a description, and the type of an exception that is expected.

Parameters:
fn A function, taking no parameters and returning void, that executes a number of tests representing a test case.
desc Description of the test case
type The type of the exception that is expected to be thrown
Note:
This can only be invoked after a successful invocation of XTESTS_CASE_BEGIN() and before invocation of XTESTS_CASE_END().

#define XTESTS_RUN_CASE_THAT_THROWS_WITH_NAME_AND_DESC ( name,
desc,
fn,
type   ) 

Value:

\
    do                                                                                  \
    {                                                                                   \
        if(XTESTS_CASE_BEGIN(name, desc))                                               \
        {                                                                               \
            XTESTS_INVOKE_TEST_CASE_FN_THROWS_(fn, name, type);                         \
                                                                                        \
            XTESTS_CASE_END(name);                                                      \
        }                                                                               \
                                                                                        \
    } while(0)
Runs the given test case function, specifying a name and description, and the type of an exception that is expected.

Parameters:
name Name of the test case
desc Description of the test case
fn A function, taking no parameters and returning void, that executes a number of tests representing a test case.
type The type of the exception that is expected to be thrown
Note:
This can only be invoked after a successful invocation of XTESTS_CASE_BEGIN() and before invocation of XTESTS_CASE_END().

#define XTESTS_RUN_CASE_WITH_DESC ( fn,
desc   ) 

Value:

Runs the given test case function, specifying a description.

Parameters:
fn A function, taking no parameters and returning void, that executes a number of tests representing a test case.
desc Description of the test case
Note:
This can only be invoked after a successful invocation of XTESTS_CASE_BEGIN() and before invocation of XTESTS_CASE_END().
Examples:
c/example.c.tests/example.c.tests.c.

#define XTESTS_RUN_CASE_WITH_NAME_AND_DESC ( name,
desc,
fn   ) 

Value:

\
    do                                                                                  \
    {                                                                                   \
        if(XTESTS_CASE_BEGIN(name, desc))                                               \
        {                                                                               \
            XTESTS_INVOKE_TEST_CASE_FN_(fn, name);                                      \
                                                                                        \
            XTESTS_CASE_END(name);                                                      \
        }                                                                               \
                                                                                        \
    } while(0)
Runs the given test case function, specifying a name and description.

Parameters:
name Name of the test case
desc Description of the test case
fn A function, taking no parameters and returning void, that executes a number of tests representing a test case.
Note:
This can only be invoked after a successful invocation of XTESTS_CASE_BEGIN() and before invocation of XTESTS_CASE_END().


xTests Library documentation Matthew Wilson and Synesis Software Pty Ltd, 1999-2009 SourceForge.net Logo