Assertion checks


Defines

#define tf_fail(message)   log_error("Test failed: %s (%s:%d)", message, __FILE__, __LINE__); return TEST_FAILED
 A helper macro to indicate test failure with given message.
#define tf_pass()   return TEST_PASSED
 A helper macro to indicate test success.
#define tf_assert(expression)   if (!(expression)) { log_error("Assertion '%s' failed at %s:%d", #expression, __FILE__, __LINE__); return TEST_FAILED; }
 A helper macro to check test assertion.
#define tf_assert_v(expression)   if (!(expression)) { log_error("Assertion '%s' failed at %s:%d", #expression, __FILE__, __LINE__); return; }
 A helper macro to check test assertion (for use in void function).
#define tf_assert_message(message, expression)   if (!(expression)) { log_error("Assertion '%s' failed, message: %s at %s:%d", #expression, #message, __FILE__, __LINE__); return TEST_FAILED; }
 A helper macro to check test assertion and report message in case of check failure.
#define tf_assert_null(expression)   tf_assert((expression)==NULL)
 A helper macro to check whether supplied expression is NULL.
#define tf_assert_null_message(message, expression)   tf_assert_message(message, (expression)==NULL)
 A helper macro to check whether supplied expression is NULL and report message in case of check failure.
#define tf_assert_not_null(expression)   tf_assert((expression)!=NULL)
 A helper macro to check whether supplied expression is not NULL.
#define tf_assert_not_null_message(message, expression)   tf_assert(message, (expression)!=NULL)
 A helper macro to check whether supplied expression is not NULL and report message in case of check failure.
#define tf_assert_same(expected, actual)   tf_assert((expected)==(actual))
 A helper macro to compare values of two expressions.
#define tf_assert_same_v(expected, actual)   tf_assert_v((expected)==(actual))
 A helper macro to compare values of two expressions (for use in void function).
#define tf_assert_same_message(message, expected, actual)   tf_assert_message(message, (expected)==(actual))
 A helper macro to compare values of two expressions and report message in case of mismatch Source file name and line nimber will be appended to the message.


Define Documentation

#define tf_fail ( message   )     log_error("Test failed: %s (%s:%d)", message, __FILE__, __LINE__); return TEST_FAILED

A helper macro to indicate test failure with given message.

Source file name and line number will be appended to the message.

Parameters:
message - text reason of test failure

 
#define tf_pass (  )     return TEST_PASSED

A helper macro to indicate test success.

#define tf_assert ( expression   )     if (!(expression)) { log_error("Assertion '%s' failed at %s:%d", #expression, __FILE__, __LINE__); return TEST_FAILED; }

A helper macro to check test assertion.

Parameters:
expression - a boolean expression to check, if it results in false then test will be failed.

#define tf_assert_v ( expression   )     if (!(expression)) { log_error("Assertion '%s' failed at %s:%d", #expression, __FILE__, __LINE__); return; }

A helper macro to check test assertion (for use in void function).

Parameters:
expression - a boolean expression to check, if it results in false then test will be failed.

#define tf_assert_message ( message,
expression   )     if (!(expression)) { log_error("Assertion '%s' failed, message: %s at %s:%d", #expression, #message, __FILE__, __LINE__); return TEST_FAILED; }

A helper macro to check test assertion and report message in case of check failure.

Source file name and line nimber will be appended to the message.

Parameters:
message - text reason of test failure.
expression - a boolean expression to check, if it results in false then test will be failed.

#define tf_assert_null ( expression   )     tf_assert((expression)==NULL)

A helper macro to check whether supplied expression is NULL.

Parameters:
expression - a boolean expression to check, if it results in false then test will be failed.

#define tf_assert_null_message ( message,
expression   )     tf_assert_message(message, (expression)==NULL)

A helper macro to check whether supplied expression is NULL and report message in case of check failure.

Source file name and line nimber will be appended to the message.

Parameters:
message - text reason of test failure.
expression - a boolean expression to check, if it results in false then test will be failed.

#define tf_assert_not_null ( expression   )     tf_assert((expression)!=NULL)

A helper macro to check whether supplied expression is not NULL.

Parameters:
expression - a boolean expression to check, if it results in false then test will be failed.

#define tf_assert_not_null_message ( message,
expression   )     tf_assert(message, (expression)!=NULL)

A helper macro to check whether supplied expression is not NULL and report message in case of check failure.

Source file name and line nimber will be appended to the message.

Parameters:
message - text reason of test failure.
expression - a boolean expression to check, if it results in false then test will be failed.

#define tf_assert_same ( expected,
actual   )     tf_assert((expected)==(actual))

A helper macro to compare values of two expressions.

Parameters:
expected - expected value
actual - actual value

#define tf_assert_same_v ( expected,
actual   )     tf_assert_v((expected)==(actual))

A helper macro to compare values of two expressions (for use in void function).

Parameters:
expected - expected value
actual - actual value

#define tf_assert_same_message ( message,
expected,
actual   )     tf_assert_message(message, (expected)==(actual))

A helper macro to compare values of two expressions and report message in case of mismatch Source file name and line nimber will be appended to the message.

Parameters:
message - text reason of test failure.
expected - expected value
actual - actual value


Genereated on Tue Mar 11 19:26:09 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.