Defines | |
#define | SKIP_BLOCK_IF(SKIP_IF_TRUE, COUNT, REASON) if (SKIP_IF_TRUE) skip((COUNT),(REASON)); else |
Helper macro to skip a block of code. | |
Functions | |
void | plan (int count) |
Set number of tests that is planned to execute. | |
void | ok (int pass, char const *fmt,...) __attribute__((format(printf |
Report test result as a TAP line. | |
void void | skip (int how_many, char const *reason,...) __attribute__((format(printf |
Skip a determined number of tests. | |
void | diag (char const *fmt,...) __attribute__((format(printf |
Print a diagnostics message. | |
void int | exit_status (void) |
Print summary report and return exit status. | |
void | skip_all (char const *reason,...) __attribute__((noreturn |
Skip entire test suite. | |
void | format (printf, 1, 2))) |
void | todo_start (char const *message,...) __attribute__((format(printf |
Start section of tests that are not yet ready. | |
void void | todo_end () |
End a section of tests that are not yet ready. |
|
Helper macro to skip a block of code. The macro can be used to simplify conditionally skipping a block of code. It is used in the following manner:
SKIP_BLOCK_IF(ducks == 0, 2, "No ducks in the pond") { int i; for (i = 0 ; i < 2 ; ++i) ok(duck[i] == paddling, "is duck %d paddling?", i); }
|
|
Print a diagnostics message.
|
|
Print summary report and return exit status. This function will print a summary report of how many tests passed, how many were skipped, and how many remains to do. The function should be called after all tests are executed in the following manner:
return exit_status();
|
|
|
|
Report test result as a TAP line. Function used to write status of an individual test. Call this function in the following manner:
ok(ducks == paddling, "%d ducks did not paddle", ducks - paddling);
|
|
Set number of tests that is planned to execute.
The function also accepts the predefined constant
|
|
Skip a determined number of tests.
Function to print that how_many tests have been skipped. The reason is printed for each skipped test. Observe that this function does not do the actual skipping for you, it just prints information that tests have been skipped. This function is not usually used, but rather the macro It shall be used in the following manner:
if (ducks == 0) { skip(2, "No ducks in the pond"); } else { int i; for (i = 0 ; i < 2 ; ++i) ok(duck[i] == paddling, "is duck %d paddling?", i); }
|
|
Skip entire test suite. To skip the entire test suite, use this function. It will automatically call exit(), so there is no need to have checks around it. |
|
End a section of tests that are not yet ready.
|
|
Start section of tests that are not yet ready. To start a section of tests that are not ready and are expected to fail, use this function and todo_end() in the following manner:
todo_start("Not ready yet"); ok(is_rocketeering(duck), "Rocket-propelled ducks"); ok(is_kamikaze(duck), "Kamikaze ducks"); todo_end();
|