AceUnitAssert.h File Reference

AceUnit assertions. More...

#include "AceUnit.h"

Go to the source code of this file.

Defines

#define ACEUNITASSERT_H   1
 Include shield to protect the header file from being included more than once.
#define fail(message)   newAssertionError(message)
 Let a test case fail.
#define assertTrue(message, condition)   do { if (!(condition)) { fail(message); } } while (false)
 Asserts that the specified condition is true.
#define assertFalse(message, condition)   do { if (condition) { fail(message); } } while (false)
 Asserts that the specified condition is false.
#define assertEquals(message, expected, actual)   do { if (!((expected) == (actual))) { fail(message); } } while (false)
 Asserts that two values are equal.
#define assertNotEquals(message, unexpected, actual)   do { if ((unexpected) == (actual)) { fail(message); } } while (false)
 Asserts that two values are not equal.
#define assertNotNull(message, ptr)   do { if (NULL == (ptr)) { fail(message); } } while (false)
 Asserts that a pointer is not NULL.
#define assertNull(message, ptr)   do { if (NULL != (ptr)) { fail(message); } } while (false)
 Asserts that a pointer is NULL.


Detailed Description

AceUnit assertions.

Author:
Christian Hujer

Define Documentation

#define ACEUNITASSERT_H   1

Include shield to protect the header file from being included more than once.

#define assertEquals ( message,
expected,
actual   )     do { if (!((expected) == (actual))) { fail(message); } } while (false)

Asserts that two values are equal.

If the values are not equal, the test case fails and raises an Assertion Error that will be logged.

Note:
If ACEUNIT_EXPLICIT_MESSAGES is set, expected and actual are converted to int32_t.
Warning:
The underlying implementation simply compares expected and actual using !=. It is the responsibility of the user to care about the types of expected and actual.
Parameters:
message Message, usually with the positive description of why the assertion should not fail.
expected Expected value.
actual Actual value.

#define assertFalse ( message,
condition   )     do { if (condition) { fail(message); } } while (false)

Asserts that the specified condition is false.

If the condition is not false, the test case fails and raises an Assertion Error that will be logged.

Parameters:
message Message, usually with the positive description of why the assertion should not fail.
condition Condition to assert for false.

#define assertNotEquals ( message,
unexpected,
actual   )     do { if ((unexpected) == (actual)) { fail(message); } } while (false)

Asserts that two values are not equal.

If the values are equal, the test case fails and raises an AssertionError_t that will be logged.

Note:
If ACEUNIT_EXPLICIT_MESSAGES is set, expected and actual are converted to int32_t.
Warning:
The underlying implementation simply compares expected and actual using ==. It is the responsibility of the user to care about the types of expected and actual.
Parameters:
message Message, usually with the positive description of why the assertion should not fail.
unexpected Not expected value.
actual Actual value.

#define assertNotNull ( message,
ptr   )     do { if (NULL == (ptr)) { fail(message); } } while (false)

Asserts that a pointer is not NULL.

If the pointer is NULL, the test case fails and raises an AssertionError_t that will be logged.

Parameters:
message Message, usually with the positive description of why the assertion should not fail.
ptr Pointer expected to be not NULL.

#define assertNull ( message,
ptr   )     do { if (NULL != (ptr)) { fail(message); } } while (false)

Asserts that a pointer is NULL.

If the pointer is not NULL, the test case fails and raises an AssertionError_t that will be logged.

Parameters:
message Message, usually with the positive description of why the assertion should not fail.
ptr Pointer expected to be NULL.

#define assertTrue ( message,
condition   )     do { if (!(condition)) { fail(message); } } while (false)

Asserts that the specified condition is true.

If the condition is not true, the test case fails and raises an Assertion Error that will be logged.

Parameters:
message Message, usually with the positive description of why the assertion should not fail.
condition Condition to assert.

#define fail ( message   )     newAssertionError(message)

Let a test case fail.

Parameters:
message Message, usually with the reason why the test case failed.


Generated on Sun Feb 13 11:10:16 2011 for AceUnit by  doxygen 1.5.3