CppTest home page CppTest project page

Macros
cpptest-assert.h File Reference

Go to the source code of this file.

Macros

#define TEST_FAIL(msg)
 
#define TEST_ASSERT(expr)
 
#define TEST_ASSERT_MSG(expr, msg)
 
#define TEST_ASSERT_DELTA(a, b, delta)
 
#define TEST_ASSERT_DELTA_MSG(a, b, delta, msg)
 
#define TEST_THROWS(expr, x)
 
#define TEST_THROWS_MSG(expr, x, msg)
 
#define TEST_THROWS_ANYTHING(expr)
 
#define TEST_THROWS_ANYTHING_MSG(expr, msg)
 
#define TEST_THROWS_NOTHING(expr)
 
#define TEST_THROWS_NOTHING_MSG(expr, msg)
 

Macro Definition Documentation

#define TEST_FAIL (   msg)

Unconditional failure.

Used in conjunction with Test::Suite.

Parameters
msgProvided 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
exprExpression 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
exprExpression to test.
msgUser 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
aFirst expression to test.
bSecond expression to test.
deltaConstant.
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
aFirst expression to test.
bSecond expression to test.
deltaConstant.
msgUser 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
exprExpression to test.
xExpected 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
exprExpression to test.
xExpected exception.
msgUser 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
exprExpression 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
exprExpression to test.
msgUser 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
exprExpression 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
exprExpression to test.
msgUser message.
See Also
TEST_THROWS_NOTHING(expr)

For a description of all asserts, see Available asserts.


Supported by:

SourceForge Logo