
Data Structures | |
| struct | TestCase |
Defines | |
| #define | TEST(testname) void testname(struct TestCase *tc) |
| #define | ASSERT_TRUE(condition, msg) assert_true(condition, tc, msg) |
| #define | ASSERT_FALSE(condition, msg) assert_false(condition, tc, msg) |
| #define | ASSERT_EQUALS(expected, actual) assert_equals(expected, actual, tc, "") |
| #define | ADD_TEST(testfunction) add_test(testfunction, #testfunction) |
Functions | |
| const char * | version () |
| void | assert_true (bool bool_expr, struct TestCase *tc, const char *msg) |
| void | assert_false (bool bool_expr, struct TestCase *tc, const char *msg) |
| void | assert_equals (const char *expected, char *actual, struct TestCase *tc, const char *msg) |
| void | assert_equals (int expected, int actual, struct TestCase *tc, const char *msg) |
| int | get_test_count () |
| bool | add_test (void(*test_function)(struct TestCase *tc), const char *test_case_name) |
| void | run_tests () |
| #define ADD_TEST | ( | testfunction | ) | add_test(testfunction, #testfunction) |
| #define ASSERT_EQUALS | ( | expected, | ||
| actual | ||||
| ) | assert_equals(expected, actual, tc, "") |
| #define ASSERT_FALSE | ( | condition, | ||
| msg | ||||
| ) | assert_false(condition, tc, msg) |
| #define ASSERT_TRUE | ( | condition, | ||
| msg | ||||
| ) | assert_true(condition, tc, msg) |
| #define TEST | ( | testname | ) | void testname(struct TestCase *tc) |
| bool add_test | ( | void(*)(struct TestCase *tc) | test_function, | |
| const char * | test_case_name | |||
| ) |
add_test creates a new test case and adds the a test function to this test case.
| test_function | Pointer to the test function to be added to the newly created test case. | |
| test_case_name | Name which should be assigned to the newly created test case. |
| void assert_equals | ( | int | expected, | |
| int | actual, | |||
| struct TestCase * | tc, | |||
| const char * | msg | |||
| ) |

| void assert_equals | ( | const char * | expected, | |
| char * | actual, | |||
| struct TestCase * | tc, | |||
| const char * | msg | |||
| ) |
assert_equals checks whether two values are equal. Currently the following data formats are supported:
| expected | The expected string value | |
| actual | The actual string value | |
| tc | Pointer to the test case which states this assertion. | |
| msg | Message to be printed if assertion evaluates to false. |
| void assert_false | ( | bool | bool_expr, | |
| struct TestCase * | tc, | |||
| const char * | msg | |||
| ) |
assert_false does the same as assert() but the boolean expression has to evaluate to false. If it evaluates to true the assertion fails.

| void assert_true | ( | bool | bool_expr, | |
| struct TestCase * | tc, | |||
| const char * | msg | |||
| ) |
assert_true checks, whether a boolean expression passed is true or false. in case it is false the test case stating the assertion is marked as failed and msg is printed.
| bool_expr | Expression which is evaluated. | |
| tc | Pointer to the test case which states this assertion. | |
| msg | Message to be printed if assertion evaluates to false. |
| int get_test_count | ( | ) |
| void run_tests | ( | ) |

| const char* version | ( | ) |
1.7.0