CUnit Programmers Reference
3.0
|
Data Structures | |
struct | APPWINDOWS |
Pointers to curses interface windows. More... | |
struct | APPPAD |
Window elements. More... | |
Macros | |
#define | curses_run_tests() CU_curses_run_tests() |
Deprecated (version 1). More... | |
#define | false (0) |
Local boolean definition for false. | |
#define | true (~false) |
Local boolean definition for true. | |
#define | STRING_LENGTH 128 |
Standard string length. | |
Enumerations | |
enum | STATUS { CONTINUE = 1 , MOVE_UP , STOP } |
Curses interface status flag. More... | |
enum | MENU_TYPE |
Menu type. | |
Functions | |
CU_EXPORT void | CU_curses_run_tests (void) |
Run registered CUnit tests using the curses interface. | |
static bool | initialize_windows (void) |
Initialize the curses interface windows. | |
static void | uninitialize_windows (void) |
Clean up and delete curses interface windows. | |
static void | refresh_windows (void) |
Refresh curses interface windows. More... | |
static void | refresh_title_window (void) |
Refresh the title window. | |
static void | refresh_progress_window (void) |
Refresh the progress bar window. | |
static void | refresh_summary_window (void) |
Refresh the summary window. | |
static void | refresh_run_summary_window (void) |
Refresh the run summary window. | |
static void | refresh_details_window (void) |
Refresh the details window. | |
static void | refresh_options_window (void) |
Refresh the options window. | |
static void | show_detail_window_message (const char *msg) |
Prints a custom message in the detail window. | |
static bool | create_pad (APPPAD *pPad, WINDOW *pParent, unsigned int uiRows, unsigned int uiCols) |
Create a window having specified parent and dimensions. More... | |
static void | scroll_window (int nCommand, APPPAD *pPad, void(*parent_refresh)(void)) |
Scroll a window. More... | |
static bool | test_initialize (void) |
Initialize the message handlers in preparation for running tests. | |
static void | show_progress_bar (void) |
Show the progress bar window. | |
static const char * | get_hotkey (const char *szStr, int *pPos) |
Parse a string and return the coded hotkeys. More... | |
static void | read_input_string (const char szPrompt[], char szValue[], int nBytes) |
Display a prompt, then read a string from the keyboard. More... | |
static STATUS | curses_registry_level_run (CU_pTestRegistry pRegistry) |
Main loop for curses interface. More... | |
static STATUS | curses_suite_level_run (CU_pSuite pSuite) |
Run a selected suite within the curses interface. More... | |
static STATUS | curses_set_options_run (void) |
Sets CUnit options interactively using curses interface. More... | |
static CU_ErrorCode | curses_run_all_tests (CU_pTestRegistry pRegistry) |
Run all tests within the curses interface. More... | |
static CU_ErrorCode | curses_run_suite_tests (CU_pSuite pSuite) |
Run a specified suite within the curses interface. More... | |
static CU_ErrorCode | curses_run_single_test (CU_pSuite pSuite, CU_pTest pTest) |
Run a specific test for the specified suite within the curses interface. More... | |
static void | curses_test_start_message_handler (const CU_pTest pTest, const CU_pSuite pSuite) |
Handler function called at start of each test. More... | |
static void | curses_test_complete_message_handler (const CU_pTest pTest, const CU_pSuite pSuite, const CU_pFailureRecord pFailure) |
Handler function called at completion of each test. More... | |
static void | curses_all_tests_complete_message_handler (const CU_pFailureRecord pFailure) |
Handler function called at completion of all tests in a suite. More... | |
static void | curses_suite_init_failure_message_handler (const CU_pSuite pSuite) |
Handler function called when suite initialization fails. More... | |
static void | list_suites (CU_pTestRegistry pRegistry) |
Print a list of registered suites to the detail window. More... | |
static void | list_tests (CU_pSuite pSuite) |
Print a list of tests contained in a specified suite to the detail window. More... | |
static void | show_failures (void) |
Display the record of test failures in the detail window. | |
static void | show_registry_level_help (void) |
Prints help text for registry level to detail window. | |
static void | show_suite_level_help (CU_pSuite pSuite) |
Prints help text for suite level to detail window. | |
static void | reset_run_parameters (void) |
Reset the local run counters and prepare for a test run. | |
Variables | |
static const char * | MAIN_OPTIONS |
String holding main menu run options. | |
static const char * | SUITE_OPTIONS |
String holding suite menu run options. | |
static const int | CLEAR_COLOR = 1 |
Clear color. | |
static const int | TITLE_COLOR = 2 |
Title color. | |
static const int | PROGRESS_BACKGROUND_COLOR = 3 |
progress bar background color. | |
static const int | PROGRESS_SUCCESS_COLOR = 4 |
Progress bar success color. | |
static const int | PROGRESS_FAILURE_COLOR = 5 |
Progress bar failure color. | |
static const int | MENU_COLOR = 6 |
Menu color. | |
static const char *const | f_szProgress = N_("Progress ") |
Text for progress bar. | |
static const char * | f_szOptions = NULL |
String containing options. | |
static CU_pTest | f_pCurrentTest = NULL |
Pointer to the test currently being run. | |
static CU_pSuite | f_pCurrentSuite = NULL |
Pointer to the suite currently being run. | |
static unsigned int | f_uiTotalTests = 0 |
Number of tests in registered suites. | |
static unsigned int | f_uiTestsRun = 0 |
Number of tests actually run. | |
static unsigned int | f_uiTestsSkipped = 0 |
Number of tests skipped during run. | |
static unsigned int | f_uiTestsFailed = 0 |
Number of tests having failed assertions. | |
static unsigned int | f_uiTestsRunSuccessful = 0 |
Number of tests run with no failed assertions. | |
static unsigned int | f_uiTotalSuites = 0 |
Number of registered suites. | |
static unsigned int | f_uiSuitesSkipped = 0 |
Number of suites skipped during run. | |
static short | f_nLeft |
Left window position. | |
static short | f_nTop |
Top window position. | |
static short | f_nWidth |
Width of window. | |
static short | f_nHeight |
Height of window. | |
static size_t | f_yes_width = 0 |
Common width measurements for output formatting. | |
static APPWINDOWS | application_windows = {NULL, NULL, NULL, NULL, NULL, NULL, NULL} |
Pointers to curses interface windows. | |
static APPPAD | details_pad = {NULL, 0, 0, 0, 0, 0, 0, 0, 0} |
Details window definition. | |
#define curses_run_tests | ( | ) | CU_curses_run_tests() |
Deprecated (version 1).
enum STATUS |
|
static |
Create a window having specified parent and dimensions.
pPad | Pointer to the new window. |
pParent | Parent window. |
uiRows | Number of rows for new window. |
uiCols | Number of columnss for new window. |
References application_windows, APPWINDOWS::pDetailsWin, APPPAD::pPad, APPPAD::uiColumns, APPPAD::uiPadCol, APPPAD::uiPadRow, APPPAD::uiRows, APPPAD::uiWinColumns, APPPAD::uiWinLeft, APPPAD::uiWinRows, and APPPAD::uiWinTop.
Referenced by curses_all_tests_complete_message_handler(), curses_set_options_run(), list_tests(), show_detail_window_message(), show_registry_level_help(), and show_suite_level_help().
|
static |
Handler function called at completion of all tests in a suite.
pFailure | Pointer to the test failure record list. |
References application_windows, create_pad(), details_pad, f_pCurrentSuite, f_pCurrentTest, APPWINDOWS::pDetailsWin, and APPPAD::pPad.
Referenced by test_initialize().
|
static |
Main loop for curses interface.
Displays actions and responds based on user imput.
pRegistry | The CU_pTestRegistry to use for testing. If NULL, uses the default registry. |
References CU_get_registry(), and STRING_LENGTH.
|
static |
Run all tests within the curses interface.
The test registry is changed to the specified registry before running the tests, and reset to the original registry when done.
pRegistry | The CU_pTestRegistry containing the tests to be run (non-NULL). |
References CU_run_all_tests(), CU_set_registry(), f_uiTotalSuites, f_uiTotalTests, reset_run_parameters(), CU_TestRegistry::uiNumberOfSuites, and CU_TestRegistry::uiNumberOfTests.
|
static |
Run a specific test for the specified suite within the curses interface.
pSuite | The suite containing the test to be run (non-NULL). |
pTest | The test to be run (non-NULL). |
References CU_run_test(), f_uiTotalSuites, f_uiTotalTests, and reset_run_parameters().
|
static |
Run a specified suite within the curses interface.
pSuite | The suite to be run (non-NULL). |
References CU_run_suite(), f_uiTotalSuites, f_uiTotalTests, reset_run_parameters(), and CU_Suite::uiNumberOfTests.
|
static |
Sets CUnit options interactively using curses interface.
Displays actions and responds based on user imput.
References application_windows, CONTINUE, create_pad(), details_pad, APPWINDOWS::pDetailsWin, APPPAD::pPad, and STRING_LENGTH.
|
static |
Handler function called when suite initialization fails.
pSuite | The suite for which initialization failed. |
References f_uiSuitesSkipped, f_uiTestsSkipped, refresh_progress_window(), refresh_summary_window(), and CU_Suite::uiNumberOfTests.
Referenced by test_initialize().
Run a selected suite within the curses interface.
Displays actions and responds based on user imput.
pSuite | The suite to use for testing (non-NULL). |
References CU_get_registry(), f_szOptions, CU_Suite::pName, and STRING_LENGTH.
|
static |
Handler function called at completion of each test.
pTest | The test being run. |
pSuite | The suite containing the test. |
pFailure | Pointer to the 1st failure record for this test. |
References CU_get_number_of_tests_failed(), f_uiTestsFailed, f_uiTestsRun, f_uiTestsRunSuccessful, refresh_progress_window(), and refresh_summary_window().
Referenced by test_initialize().
|
static |
Handler function called at start of each test.
pTest | The test being run. |
pSuite | The suite containing the test. |
References f_pCurrentSuite, f_pCurrentTest, and refresh_run_summary_window().
Referenced by test_initialize().
|
static |
Parse a string and return the coded hotkeys.
If called with szStr non-NULL, the string is simply stored. Subsequent calls with szStr NULL will cause the hotkeys in the string (chars between parentheses) to be returned sequentially in the order in which they appear in the original string.
szStr | String to parse (non-NULL to set, NULL to parse). |
pPos | Used to store position of the next '('. |
Referenced by refresh_options_window().
|
static |
Print a list of registered suites to the detail window.
pRegistry | The CU_pTestRegistry to query (non-NULL). |
References CU_get_registry(), show_detail_window_message(), STRING_LENGTH, and CU_TestRegistry::uiNumberOfSuites.
|
static |
Print a list of tests contained in a specified suite to the detail window.
pSuite | The suite to query (non-NULL). |
References application_windows, create_pad(), details_pad, APPWINDOWS::pDetailsWin, CU_Suite::pName, STRING_LENGTH, and CU_Suite::uiNumberOfTests.
|
static |
Display a prompt, then read a string from the keyboard.
szPrompt | The prompt to display. |
szValue | The string in which to store the response. |
nBytes | The length of the szValue buffer. |
References application_windows, APPWINDOWS::pOptionsWin, and refresh_options_window().
|
static |
Refresh curses interface windows.
References application_windows, f_nHeight, f_nLeft, f_nTop, f_nWidth, APPWINDOWS::pMainWin, refresh_details_window(), refresh_options_window(), refresh_progress_window(), refresh_run_summary_window(), refresh_summary_window(), and refresh_title_window().
Referenced by initialize_windows().
|
static |
Scroll a window.
nCommand | Code for the direction to scroll. |
pPad | The window to scroll. |
parent_refresh | Function to call to refresh the parent window. |
References details_pad, APPPAD::pPad, APPPAD::uiColumns, APPPAD::uiPadCol, APPPAD::uiPadRow, APPPAD::uiRows, APPPAD::uiWinColumns, and APPPAD::uiWinRows.