The world's most popular open source database
#include "my_global.h"Include dependency graph for tap.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| struct | TEST_DATA |
Defines | |
| #define | NO_PLAN (0) |
| #define | SKIP_BLOCK_IF(SKIP_IF_TRUE, COUNT, REASON) if (SKIP_IF_TRUE) skip((COUNT),(REASON)); else |
Functions | |
| void | plan (int count) |
| void | ok (int pass, char const *fmt,...) __attribute__((format(printf |
| void void | skip (int how_many, char const *reason,...) __attribute__((format(printf |
| void | diag (char const *fmt,...) __attribute__((format(printf |
| void int | exit_status (void) |
| void | skip_all (char const *reason,...) __attribute__((noreturn |
| void | format (printf, 1, 2))) |
| void | todo_start (char const *message,...) __attribute__((format(printf |
| void void | todo_end () |
| #define NO_PLAN (0) |
| #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 skip
Definition at line 138 of file tap.h.
Referenced by main().
| void diag | ( | char const * | fmt, | |
| ... | ||||
| ) |
Print a diagnostics message.
| 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();
Definition at line 193 of file tap.c.
References diag(), g_test, NO_PLAN, and plan().
Referenced by main().
00193 { 00194 /* 00195 If there were no plan, we write one last instead. 00196 */ 00197 if (g_test.plan == NO_PLAN) 00198 plan(g_test.last); 00199 00200 if (g_test.plan != g_test.last) 00201 { 00202 diag("%d tests planned but%s %d executed", 00203 g_test.plan, (g_test.plan > g_test.last ? " only" : ""), g_test.last); 00204 return EXIT_FAILURE; 00205 } 00206 00207 if (g_test.failed > 0) 00208 { 00209 diag("Failed %d tests!", g_test.failed); 00210 return EXIT_FAILURE; 00211 } 00212 00213 return EXIT_SUCCESS; 00214 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void format | ( | printf | , | |
| 1 | , | |||
| 2 | ||||
| ) |
Referenced by _sanity(), sys_var_thd_date_time_format::check(), date_time_format_copy(), extract_date_time(), Item_func_str_to_date::fix_length_and_dec(), Item_func_date_format::format_length(), Item_func_str_to_date::get_date(), get_date_time_format_str(), make_date_time(), my_error(), net_printf_error(), Ndbfs::readWriteRequest(), sys_var_thd_date_time_format::set_default(), sp_head::show_routine_code(), Item_func_get_format::val_str(), Item_date_add_interval::val_str(), Item_func_date_format::val_str(), and sys_var_thd_date_time_format::value_ptr().
Here is the caller graph for this function:

| 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);
| 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.
| count | The planned number of tests to run. |
Definition at line 112 of file tap.c.
References g_test, NO_PLAN, and tapout.
Referenced by exit_status(), main(), opt_check_order_by(), opt_classify_cols(), opt_classify_comparison(), opt_clust_access(), opt_determine_and_normalize_test_conds(), opt_find_all_cols(), opt_find_copy_cols(), opt_find_test_conds(), opt_print_query_plan(), opt_search_plan_for_table(), pars_update_statement(), plan_reset_cursor(), row_sel(), row_sel_build_prev_vers(), row_sel_get_clust_rec(), row_sel_open_pcur(), row_sel_restore_pcur_pos(), row_sel_test_end_conds(), row_sel_test_other_conds(), row_sel_try_search_shortcut(), sel_node_free_private(), sel_pop_prefetched_row(), and sel_push_prefetched_row().
00113 { 00114 g_test.plan= count; 00115 switch (count) 00116 { 00117 case NO_PLAN: 00118 break; 00119 default: 00120 if (count > 0) 00121 fprintf(tapout, "1..%d\n", count); 00122 break; 00123 } 00124 }
Here is the caller graph for this function:

| 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. 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); }
| 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 | ( | ) |
| 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();
| message | Message that will be printed before the todo tests. |
1.4.7

