CppTest home page CppTest project page

cpptest-assert.h File Reference

Go to the source code of this file.

Defines


Detailed Description


Define Documentation

#define TEST_FAIL ( msg   ) 

Unconditional failure.

Used in conjunction with Test::Suite.

Parameters:
msg Provided message.
Example:
 void MySuite::test()
 {
    // ...

    switch (flag)
    {
        // handling valid cases ...

        default:
            TEST_FAIL("This should not happen")
    }
 }
For a description of all asserts, see Available asserts.

#define TEST_ASSERT ( expr   ) 

Verify an expression and issues an assertment if it fails.

Used in conjunction with Test::Suite.

Parameters:
expr Expression to test.
See also:
TEST_ASSERT_MSG(expr, msg)
Example:
 void MySuite::test()
 {
    int i;

    // ...

    TEST_ASSERT(i == 13)
 }
For a description of all asserts, see Available asserts.

#define TEST_ASSERT_MSG ( expr,
msg   ) 

Verify an expression and issues an assertment if it fails.

Used in conjunction with Test::Suite.

Parameters:
expr Expression to test.
msg User message.
See also:
TEST_ASSERT(expr)
For a description of all asserts, see Available asserts.

#define TEST_ASSERT_DELTA ( a,
b,
delta   ) 

Verify that two expressions are equal up to a constant, issues an assertment if it fails.

Used in conjunction with Test::Suite.

Parameters:
a First expression to test.
b Second expression to test.
delta Constant.
See also:
TEST_ASSERT_DELTA_MSG(a, b, delta, msg)
For a description of all asserts, see Available asserts.

#define TEST_ASSERT_DELTA_MSG ( a,
b,
delta,
msg   ) 

Verify that two expressions are equal up to a constant, issues an assertment if it fails.

Used in conjunction with Test::Suite.

Parameters:
a First expression to test.
b Second expression to test.
delta Constant.
msg User message.
See also:
TEST_ASSERT_DELTA(a, b, delta)
For a description of all asserts, see Available asserts.

#define TEST_THROWS ( expr,
 ) 

Verify an expression and expects an exception in return. An assertment is issued if the exception is not thrown.

Used in conjunction with Test::Suite.

Parameters:
expr Expression to test.
x Expected exception.
See also:
TEST_THROWS_MSG(expr, x, msg)
For a description of all asserts, see Available asserts.

#define TEST_THROWS_MSG ( expr,
x,
msg   ) 

Verify an expression and expects an exception in return. An assertment is issued if the exception is not thrown.

Used in conjunction with Test::Suite.

Parameters:
expr Expression to test.
x Expected exception.
msg User message.
See also:
TEST_THROWS(expr, x)
For a description of all asserts, see Available asserts.

#define TEST_THROWS_ANYTHING ( expr   ) 

Verify an expression and expects any exception in return. An assertment is issued if no exception is thrown.

Used in conjunction with Test::Suite.

Parameters:
expr Expression to test.
See also:
TEST_THROWS_ANYTHING_MSG(expr, msg)
For a description of all asserts, see Available asserts.

#define TEST_THROWS_ANYTHING_MSG ( expr,
msg   ) 

Verify an expression and expects any exception in return. An assertment is issued if no exception is thrown.

Used in conjunction with Test::Suite.

Parameters:
expr Expression to test.
msg User message.
See also:
TEST_THROWS_ANYTHING(expr)
For a description of all asserts, see Available asserts.

#define TEST_THROWS_NOTHING ( expr   ) 

Verify an expression and expects no exception in return. An assertment is issued if any exception is thrown.

Used in conjunction with Test::Suite.

Parameters:
expr Expression to test.
See also:
TEST_THROWS_NOTHING_MSG(expr, msg)
For a description of all asserts, see Available asserts.

#define TEST_THROWS_NOTHING_MSG ( expr,
msg   ) 

Verify an expression and expects no exception in return. An assertment is issued if any exception is thrown.

Used in conjunction with Test::Suite.

Parameters:
expr Expression to test.
msg User message.
See also:
TEST_THROWS_NOTHING(expr)
For a description of all asserts, see Available asserts.


Supported by:

SourceForge Logo