MyTAP API

MySQL support for performing unit tests according to TAP. More...

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.

Detailed Description

MySQL support for performing unit tests according to TAP.


Define Documentation

#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.

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);
   }

See also:
skip
Examples:
skip.t.c.


Function Documentation

void diag char const *  fmt,
  ...
 

Print a diagnostics message.

Parameters:
fmt Diagnostics message in printf() format.

void int exit_status void   ) 
 

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();

Returns:
EXIT_SUCCESS if all tests passed, EXIT_FAILURE if one or more tests failed.

void format printf  ,
,
 

void ok int  pass,
char const *  fmt,
  ...
 

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);

Parameters:
pass Zero if the test failed, non-zero if it passed.
fmt Format string in printf() format. NULL is allowed, in which case nothing is printed.

void plan int  count  ) 
 

Set number of tests that is planned to execute.

The function also accepts the predefined constant NO_PLAN. If the function is not called, it is as if it was called with NO_PLAN, i.e., the test plan will be printed after all the test lines.

Parameters:
count The planned number of tests to run.

void void skip int  how_many,
char const *  reason,
  ...
 

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 SKIP_BLOCK_IF, which does the skipping for you.

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);
   }

See also:
SKIP_BLOCK_IF
Parameters:
how_many Number of tests that are to be skipped.
reason A reason for skipping the tests

void skip_all char const *  reason,
  ...
 

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.

void void todo_end  ) 
 

End a section of tests that are not yet ready.

void todo_start char const *  message,
  ...
 

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();

See also:
todo_end
Note:
It is not possible to nest todo sections.
Parameters:
message Message that will be printed before the todo tests.


Generated on Fri Oct 20 21:13:28 2006 by  doxygen 1.4.6