|
libpulsar
A modular compiler for the pulsar programming language
|
Provides assertion macros for unit tests. More...
#include "def.h"Go to the source code of this file.
Macros | |
| #define | PS_BEGIN_UNIT_TESTS() _PS_BEGIN_UNIT_TESTS(__FILE__) |
| Begin unit tests. | |
| #define | PS_UNIT_ASSERT(result, ...) _PS_UNIT_ASSERT(result, #result, __func__, __LINE__, "" __VA_ARGS__) |
| Assert that the result is true. | |
| #define | PS_UNIT_ASSERT_EQ(exp, act, fmt, msg, ...) |
| Assert that the two values are equal. | |
| #define | PS_UNIT_SUPPRESS(msg) _PS_UNIT_SUPPRESS(msg, __func__, __LINE__) |
| Suppress unit test output. | |
Functions | |
| void | _PS_BEGIN_UNIT_TESTS (STR file) |
| void | PS_END_UNIT_TESTS (void) |
| End unit tests. | |
| void | _PS_UNIT_ASSERT (int result, STR expr, STR func, u64 line, STR msg,...) |
| void | _PS_UNIT_SUPPRESS (STR msg, STR func, u64 line) |
| void | PS_UNIT_UNSUPPRESS (void) |
| Unsuppress unit test output. | |
Provides assertion macros for unit tests.
Definition in file unit_testing.h.
| #define PS_BEGIN_UNIT_TESTS | ( | ) | _PS_BEGIN_UNIT_TESTS(__FILE__) |
Begin unit tests.
Definition at line 34 of file unit_testing.h.
| #define PS_UNIT_ASSERT | ( | result, | |
| ... | |||
| ) | _PS_UNIT_ASSERT(result, #result, __func__, __LINE__, "" __VA_ARGS__) |
Assert that the result is true.
| result | The result to assert. |
| ... | The message to print (with optional args) if the assertion fails. |
Definition at line 41 of file unit_testing.h.
| #define PS_UNIT_ASSERT_EQ | ( | exp, | |
| act, | |||
| fmt, | |||
| msg, | |||
| ... | |||
| ) |
Assert that the two values are equal.
| exp | The expected value. |
| act | The actual value. |
| fmt | The format string for the expected and actual values. |
| msg | The message to print (with optional args) if the assertion fails. |
Definition at line 51 of file unit_testing.h.
| #define PS_UNIT_SUPPRESS | ( | msg | ) | _PS_UNIT_SUPPRESS(msg, __func__, __LINE__) |
Suppress unit test output.
Must call PS_UNIT_UNSURPRESS before calling again.
| msg | The message to print when suppressing. |
Definition at line 66 of file unit_testing.h.
| void _PS_BEGIN_UNIT_TESTS | ( | STR | file | ) |
Definition at line 32 of file unit_testing.c.
Definition at line 70 of file unit_testing.c.
Definition at line 109 of file unit_testing.c.
| void PS_END_UNIT_TESTS | ( | void | ) |
End unit tests.
Do not call this function directly. Instead, PS_BEGIN_UNIT_TESTS will call this function for you.
Definition at line 56 of file unit_testing.c.
| void PS_UNIT_UNSUPPRESS | ( | void | ) |
Unsuppress unit test output.
Definition at line 119 of file unit_testing.c.