|
iPXE
|
Editable string tests. More...
#include <stdlib.h>#include <string.h>#include <ctype.h>#include <ipxe/keys.h>#include <ipxe/editstring.h>#include <ipxe/test.h>Go to the source code of this file.
Data Structures | |
| struct | editstring_test |
| An editable string test. More... | |
Macros | |
| #define | KEYS(...) |
| Define an inline key sequence. | |
| #define | EDITSTRING_TEST(name, START, EXPECTED, KEYS) |
| Define an editable string test. | |
| #define | editstring_ok(test) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| EDITSTRING_TEST (simple, "", "hello world!", KEYS( 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!')) | |
| EDITSTRING_TEST (simple_null, NULL, "hi there", KEYS( 'h', 'i', ' ', 't', 'h', 'e', 'r', 'e')) | |
| EDITSTRING_TEST (insert, "in middle", "in the middle", KEYS(KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT, 't', 'h', 'e', ' ')) | |
| EDITSTRING_TEST (backspace_end, "byebye", "bye", KEYS(KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE)) | |
| EDITSTRING_TEST (backspace_all, "abc", "", KEYS(KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE)) | |
| EDITSTRING_TEST (backspace_empty, NULL, "", KEYS(KEY_BACKSPACE)) | |
| EDITSTRING_TEST (backspace_beyond, "too far", "", KEYS(KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE)) | |
| EDITSTRING_TEST (delete_dc, "go away", "goaway", KEYS(KEY_HOME, KEY_RIGHT, KEY_RIGHT, KEY_DC)) | |
| EDITSTRING_TEST (delete_ctrl_d, "not here", "nohere", KEYS(KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT, CTRL_D, CTRL_D)) | |
| EDITSTRING_TEST (word_end, "remove these two words", "remove these ", KEYS(CTRL_W, CTRL_W)) | |
| EDITSTRING_TEST (word_start, "no word", "word", KEYS(CTRL_A, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, CTRL_W)) | |
| EDITSTRING_TEST (word_mid, "delete this word", "delete word", KEYS(KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT, CTRL_W)) | |
| EDITSTRING_TEST (sol, "everything must go", "go", KEYS(KEY_LEFT, KEY_LEFT, CTRL_U)) | |
| EDITSTRING_TEST (eol, "all is lost", "all", KEYS(KEY_HOME, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, CTRL_K)) | |
| static void | editstring_okx (struct editstring_test *test, const char *file, unsigned int line) |
| Report an editable string test result. | |
| static void | editstring_test_exec (void) |
| Perform editable string self-tests. | |
Variables | |
| struct self_test editstring_test | __self_test |
| Editable string self-test. | |
Editable string tests.
Definition in file editstring_test.c.
| #define KEYS | ( | ... | ) |
Define an inline key sequence.
Definition at line 55 of file editstring_test.c.
Referenced by EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), EDITSTRING_TEST(), and EDITSTRING_TEST().
Define an editable string test.
Definition at line 58 of file editstring_test.c.
| #define editstring_ok | ( | test | ) |
Definition at line 170 of file editstring_test.c.
Referenced by editstring_test_exec().
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| EDITSTRING_TEST | ( | simple | , |
| "" | , | ||
| "hello world!" | , | ||
| KEYS('h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!') | ) |
References KEYS.
| EDITSTRING_TEST | ( | backspace_end | , |
| "byebye" | , | ||
| "bye" | , | ||
| KEYS(KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE) | ) |
References KEY_BACKSPACE, and KEYS.
| EDITSTRING_TEST | ( | backspace_all | , |
| "abc" | , | ||
| "" | , | ||
| KEYS(KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE) | ) |
References KEY_BACKSPACE, and KEYS.
| EDITSTRING_TEST | ( | backspace_empty | , |
| NULL | , | ||
| "" | , | ||
| KEYS(KEY_BACKSPACE) | ) |
References KEY_BACKSPACE, KEYS, and NULL.
| EDITSTRING_TEST | ( | backspace_beyond | , |
| "too far" | , | ||
| "" | , | ||
| KEYS(KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE, KEY_BACKSPACE) | ) |
References KEY_BACKSPACE, and KEYS.
|
static |
Report an editable string test result.
| test | Editable string test |
| file | Test code file |
| line | Test code line |
Definition at line 135 of file editstring_test.c.
References edit_string::cursor, DBGC, free, init_editstring(), isprint(), key, memset(), NULL, okx, replace_string(), strcmp(), string, strlen(), and test.
|
static |
Perform editable string self-tests.
Definition at line 176 of file editstring_test.c.
References editstring_ok.
| struct self_test editstring_test __self_test |
Editable string self-test.
Definition at line 195 of file editstring_test.c.