|
iPXE
|
Line buffer self-tests. More...
Go to the source code of this file.
Data Structures | |
| struct | linebuf_test |
| A line buffer test. More... | |
Macros | |
| #define | DATA(...) { __VA_ARGS__ } |
| Define inline raw data. More... | |
| #define | LINES(...) { __VA_ARGS__ } |
| Define inline lines. More... | |
| #define | LINEBUF_TEST(name, DATA, LINES) |
| Define a line buffer test. More... | |
| #define | linebuf_init_ok(linebuf) linebuf_init_okx ( linebuf, __FILE__, __LINE__ ) |
| #define | linebuf_consume_ok(test, linebuf) linebuf_consume_okx ( test, linebuf, __FILE__, __LINE__ ) |
| #define | linebuf_accumulated_ok(test, linebuf) linebuf_accumulated_okx ( test, linebuf, __FILE__, __LINE__ ) |
| #define | linebuf_empty_ok(linebuf) linebuf_empty_okx ( linebuf, __FILE__, __LINE__ ) |
| #define | linebuf_ok(test) linebuf_okx ( test, __FILE__, __LINE__ ) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| LINEBUF_TEST (simple,("HTTP/1.1 200 OK\r\n" "Content-Length: 123\r\n" "Content-Type: text/plain\r\n" "\r\n"), LINES("HTTP/1.1 200 OK", "Content-Length: 123", "Content-Type: text/plain", "")) | |
| Simple line buffer test. More... | |
| LINEBUF_TEST (mixed,("LF only\n" "CRLF\r\n" "\n" "\n" "\r\n" "\r\n" "CR only\r"), LINES("LF only", "CRLF", "", "", "", "", NULL)) | |
| Mixed line terminators. More... | |
| LINEBUF_TEST (split_1,("This line was"), LINES(NULL)) | |
| Split consumption: part 1. More... | |
| LINEBUF_TEST (split_2,(" split across"), LINES(NULL)) | |
| Split consumption: part 2. More... | |
| LINEBUF_TEST (split_3,(" multiple calls\r\nand so was this one\r"), LINES("This line was split across multiple calls", NULL)) | |
| Split consumption: part 3. More... | |
| LINEBUF_TEST (split_4,("\nbut not this one\r\n"), LINES("and so was this one", "but not this one")) | |
| Split consumption: part 4. More... | |
| LINEBUF_TEST (split_5,(""), LINES(NULL)) | |
| Split consumption: part 5. More... | |
| LINEBUF_TEST (split_6,("This line came after a zero-length call\r\n"), LINES("This line came after a zero-length call")) | |
| Split consumption: part 6. More... | |
| LINEBUF_TEST (embedded_nuls,("This\r\ntest\r\nincludes\r\n\r\nsome\0binary\0data\r\n"), LINES("This", "test", "includes", "", linebuf_failure)) | |
| Embedded NULs. More... | |
| static void | linebuf_init_okx (struct line_buffer *linebuf, const char *file, unsigned int line) |
| Report line buffer initialisation test result. More... | |
| static void | linebuf_consume_okx (struct linebuf_test *test, struct line_buffer *linebuf, const char *file, unsigned int line) |
| Report line buffer consumption test result. More... | |
| static void | linebuf_accumulated_okx (struct linebuf_test *test, struct line_buffer *linebuf, const char *file, unsigned int line) |
| Report line buffer accumulation test result. More... | |
| static void | linebuf_empty_okx (struct line_buffer *linebuf, const char *file, unsigned int line) |
| Report line buffer emptying test result. More... | |
| static void | linebuf_okx (struct linebuf_test *test, const char *file, unsigned int line) |
| Report line buffer combined test result. More... | |
| static void | linebuf_test_exec (void) |
| Perform line buffer self-tests. More... | |
Variables | |
| static const char | linebuf_failure [1] |
| Line buffer test expected failure indicator. More... | |
| struct self_test linebuf_test | __self_test |
| Line buffer self-test. More... | |
Line buffer self-tests.
Definition in file linebuf_test.c.
| #define DATA | ( | ... | ) | { __VA_ARGS__ } |
Define inline raw data.
Definition at line 41 of file linebuf_test.c.
| #define LINES | ( | ... | ) | { __VA_ARGS__ } |
Define inline lines.
Definition at line 44 of file linebuf_test.c.
Define a line buffer test.
| name | Test name |
| DATA | Raw data |
| LINES | Expected sequence of lines |
| test | Line buffer test |
Definition at line 69 of file linebuf_test.c.
| #define linebuf_init_ok | ( | linebuf | ) | linebuf_init_okx ( linebuf, __FILE__, __LINE__ ) |
Definition at line 146 of file linebuf_test.c.
| #define linebuf_consume_ok | ( | test, | |
| linebuf | |||
| ) | linebuf_consume_okx ( test, linebuf, __FILE__, __LINE__ ) |
Definition at line 217 of file linebuf_test.c.
| #define linebuf_accumulated_ok | ( | test, | |
| linebuf | |||
| ) | linebuf_accumulated_okx ( test, linebuf, __FILE__, __LINE__ ) |
Definition at line 252 of file linebuf_test.c.
| #define linebuf_empty_ok | ( | linebuf | ) | linebuf_empty_okx ( linebuf, __FILE__, __LINE__ ) |
Definition at line 269 of file linebuf_test.c.
| #define linebuf_ok | ( | test | ) | linebuf_okx ( test, __FILE__, __LINE__ ) |
Definition at line 288 of file linebuf_test.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| LINEBUF_TEST | ( | simple | , |
| ("HTTP/1.1 200 OK\r\n" "Content-Length: 123\r\n" "Content-Type: text/plain\r\n" "\r\n") | , | ||
| LINES("HTTP/1.1 200 OK", "Content-Length: 123", "Content-Type: text/plain", "") | |||
| ) |
Simple line buffer test.
| LINEBUF_TEST | ( | mixed | , |
| ("LF only\n" "CRLF\r\n" "\n" "\n" "\r\n" "\r\n" "CR only\r") | , | ||
| LINES("LF only", "CRLF", "", "", "", "", NULL) | |||
| ) |
Mixed line terminators.
| LINEBUF_TEST | ( | split_3 | , |
| (" multiple calls\r\nand so was this one\r") | , | ||
| LINES("This line was split across multiple calls", NULL) | |||
| ) |
Split consumption: part 3.
| LINEBUF_TEST | ( | split_4 | , |
| ("\nbut not this one\r\n") | , | ||
| LINES("and so was this one", "but not this one") | |||
| ) |
Split consumption: part 4.
| LINEBUF_TEST | ( | split_6 | , |
| ("This line came after a zero-length call\r\n") | , | ||
| LINES("This line came after a zero-length call") | |||
| ) |
Split consumption: part 6.
| LINEBUF_TEST | ( | embedded_nuls | , |
| ("This\r\ntest\r\nincludes\r\n\r\nsome\0binary\0data\r\n") | , | ||
| LINES("This", "test", "includes", "", linebuf_failure) | |||
| ) |
Embedded NULs.
|
static |
Report line buffer initialisation test result.
| linebuf | Line buffer |
| file | Test code file |
| line | Test code line |
Definition at line 139 of file linebuf_test.c.
References buffered_line(), memset(), NULL, and okx.
Referenced by linebuf_okx().
|
static |
Report line buffer consumption test result.
| test | Line buffer test |
| linebuf | Line buffer |
| file | Test code file |
| line | Test code line |
Definition at line 157 of file linebuf_test.c.
References buffered_line(), data, DBGC, DBGC_HDA, len, line_buffer(), linebuf_failure, NULL, okx, rc, strcmp(), strerror(), and test.
Referenced by linebuf_okx().
|
static |
Report line buffer accumulation test result.
| test | Line buffer test |
| linebuf | Line buffer |
| file | Test code file |
| line | Test code line |
Definition at line 228 of file linebuf_test.c.
References line_buffer::data, line_buffer::len, linebuf_failure, NULL, okx, strcmp(), strlen(), and test.
Referenced by linebuf_okx().
|
static |
Report line buffer emptying test result.
| linebuf | Line buffer |
| file | Test code file |
| line | Test code line |
Definition at line 262 of file linebuf_test.c.
References buffered_line(), empty_line_buffer(), NULL, and okx.
Referenced by linebuf_okx().
|
static |
Report line buffer combined test result.
| test | Line buffer test |
| file | Test code file |
| line | Test code line |
Definition at line 279 of file linebuf_test.c.
References linebuf_accumulated_okx(), linebuf_consume_okx(), linebuf_empty_okx(), linebuf_init_okx(), and test.
|
static |
Perform line buffer self-tests.
Definition at line 295 of file linebuf_test.c.
References linebuf_consume_ok, linebuf_empty_ok, linebuf_init_ok, and linebuf_ok.
|
static |
Line buffer test expected failure indicator.
Definition at line 59 of file linebuf_test.c.
Referenced by linebuf_accumulated_okx(), and linebuf_consume_okx().
| struct self_test linebuf_test __self_test |
Line buffer self-test.
Definition at line 317 of file linebuf_test.c.
1.8.15