|
OpenVPN
|
#include "syshead.h"#include <setjmp.h>#include <cmocka.h>#include "buffer.h"#include "buffer.c"#include "test_common.h"
Go to the source code of this file.
Data Structures | |
| struct | test_buffer_list_aggregate_ctx |
Macros | |
| #define | testsep "," |
| #define | testnosep "" |
| #define | teststr1 "one" |
| #define | teststr2 "two" |
| #define | teststr3 "three" |
| #define | assert_buf_equals_str(buf, str) |
| #define | A_TIMES_256 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO" |
Functions | |
| static void | test_buffer_strprefix (void **state) |
| static void | test_buffer_printf_catrunc (void **state) |
| static void | test_buffer_puts (void **state) |
| static void | test_buffer_format_hex_ex (void **state) |
| static int | test_buffer_list_setup (void **state) |
| static int | test_buffer_list_teardown (void **state) |
| static void | test_buffer_list_aggregate_separator_empty (void **state) |
| static void | test_buffer_list_aggregate_separator_noop (void **state) |
| static void | test_buffer_list_aggregate_separator_two (void **state) |
| static void | test_buffer_list_aggregate_separator_all (void **state) |
| static void | test_buffer_list_aggregate_separator_nosep (void **state) |
| static void | test_buffer_list_aggregate_separator_zerolen (void **state) |
| static void | test_buffer_list_aggregate_separator_emptybuffers (void **state) |
| static void | test_buffer_free_gc_one (void **state) |
| static void | test_buffer_free_gc_two (void **state) |
| static void | test_buffer_gc_realloc (void **state) |
| static void | test_character_class (void **state) |
| static void | test_character_string_mod_buf (void **state) |
| static void | test_snprintf (void **state) |
| static void | test_checked_snprintf (void **state) |
| void | test_string_chomp (void **state) |
| void | test_buffer_chomp (void **state) |
| static void | test_buffer_extract_field (void **state) |
| void | test_buffer_null_terminate (void **state) |
| static void | test_buffer_null_predicates (void **state) |
| void | test_buffer_parse (void **state) |
| int | main (void) |
| #define A_TIMES_256 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO" |
Definition at line 585 of file test_buffer.c.
| #define assert_buf_equals_str | ( | buf, | |
| str | |||
| ) |
Definition at line 52 of file test_buffer.c.
| #define testnosep "" |
Definition at line 47 of file test_buffer.c.
| #define testsep "," |
Definition at line 46 of file test_buffer.c.
| #define teststr1 "one" |
Definition at line 48 of file test_buffer.c.
| #define teststr2 "two" |
Definition at line 49 of file test_buffer.c.
| #define teststr3 "three" |
Definition at line 50 of file test_buffer.c.
| int main | ( | void | ) |
Definition at line 657 of file test_buffer.c.
References openvpn_unit_test_setup(), test_buffer_chomp(), test_buffer_extract_field(), test_buffer_format_hex_ex(), test_buffer_free_gc_one(), test_buffer_free_gc_two(), test_buffer_gc_realloc(), test_buffer_list_aggregate_separator_all(), test_buffer_list_aggregate_separator_empty(), test_buffer_list_aggregate_separator_emptybuffers(), test_buffer_list_aggregate_separator_noop(), test_buffer_list_aggregate_separator_nosep(), test_buffer_list_aggregate_separator_two(), test_buffer_list_aggregate_separator_zerolen(), test_buffer_list_setup(), test_buffer_list_teardown(), test_buffer_null_predicates(), test_buffer_null_terminate(), test_buffer_parse(), test_buffer_printf_catrunc(), test_buffer_puts(), test_buffer_strprefix(), test_character_class(), test_character_string_mod_buf(), test_checked_snprintf(), test_snprintf(), and test_string_chomp().
| void test_buffer_chomp | ( | void ** | state | ) |
Definition at line 504 of file test_buffer.c.
References alloc_buf_gc(), BSTR, buf_chomp(), buf_write(), CC_CRLF, CC_NULL, CC_PRINT, gc, gc_free(), gc_new(), buffer::len, and string_check_buf().
Referenced by main().
|
static |
Definition at line 529 of file test_buffer.c.
References alloc_buf_gc(), buf_bptr(), buf_extract_field(), buf_len(), buf_write(), gc, gc_free(), gc_new(), and buffer::len.
Referenced by main().
|
static |
Definition at line 110 of file test_buffer.c.
References format_hex_ex(), gc, gc_free(), gc_new(), and buffer::len.
Referenced by main().
|
static |
Definition at line 275 of file test_buffer.c.
References alloc_buf_gc(), buffer::data, free_buf_gc(), gc, gc_free(), gc_new(), buffer::len, and gc_arena::list.
Referenced by main().
|
static |
Definition at line 288 of file test_buffer.c.
References alloc_buf_gc(), buffer::data, free_buf_gc(), gc, gc_free(), gc_new(), buffer::len, gc_arena::list, and gc_entry::next.
Referenced by main().
|
static |
Definition at line 318 of file test_buffer.c.
References gc, gc_free(), gc_new(), and gc_realloc().
Referenced by main().
|
static |
Definition at line 225 of file test_buffer.c.
References assert_buf_equals_str, buffer_list_aggregate_separator(), buffer_list_peek(), test_buffer_list_aggregate_ctx::one_two_three, buffer_list::size, testsep, teststr1, teststr2, and teststr3.
Referenced by main().
|
static |
Definition at line 188 of file test_buffer.c.
References buffer_list_aggregate_separator(), test_buffer_list_aggregate_ctx::empty, buffer_list::head, and testsep.
Referenced by main().
|
static |
Definition at line 262 of file test_buffer.c.
References BLEN, buffer_list_aggregate_separator(), buffer_list_peek(), test_buffer_list_aggregate_ctx::empty_buffers, buffer::len, buffer_list::size, and testnosep.
Referenced by main().
|
static |
Definition at line 198 of file test_buffer.c.
References assert_buf_equals_str, buffer_list_aggregate_separator(), buffer_list_peek(), test_buffer_list_aggregate_ctx::one_two_three, buffer_list::size, testsep, and teststr1.
Referenced by main().
|
static |
Definition at line 237 of file test_buffer.c.
References assert_buf_equals_str, buffer_list_aggregate_separator(), buffer_list_peek(), test_buffer_list_aggregate_ctx::one_two_three, buffer_list::size, testnosep, teststr1, teststr2, and teststr3.
Referenced by main().
|
static |
Definition at line 210 of file test_buffer.c.
References assert_buf_equals_str, buffer_list_aggregate_separator(), buffer_list_peek(), buffer::len, test_buffer_list_aggregate_ctx::one_two_three, buffer_list::size, testsep, teststr1, and teststr2.
Referenced by main().
|
static |
Definition at line 249 of file test_buffer.c.
References assert_buf_equals_str, buffer_list_aggregate_separator(), buffer_list_peek(), buffer::len, buffer_list::size, testnosep, and test_buffer_list_aggregate_ctx::zero_length_strings.
Referenced by main().
|
static |
Definition at line 151 of file test_buffer.c.
References buffer_list_new(), buffer_list_push(), buffer_list_push_data(), test_buffer_list_aggregate_ctx::empty, test_buffer_list_aggregate_ctx::empty_buffers, test_buffer_list_aggregate_ctx::one_two_three, teststr1, teststr2, teststr3, and test_buffer_list_aggregate_ctx::zero_length_strings.
Referenced by main().
|
static |
Definition at line 175 of file test_buffer.c.
References buffer_list_free(), test_buffer_list_aggregate_ctx::empty, test_buffer_list_aggregate_ctx::empty_buffers, test_buffer_list_aggregate_ctx::one_two_three, and test_buffer_list_aggregate_ctx::zero_length_strings.
Referenced by main().
|
static |
Definition at line 588 of file test_buffer.c.
References alloc_buf(), buf_defined(), buf_len(), buf_valid(), free_buf(), and buffer::len.
Referenced by main().
| void test_buffer_null_terminate | ( | void ** | state | ) |
Definition at line 559 of file test_buffer.c.
References alloc_buf_gc(), BPTR, BSTR, buf_inc_len(), buf_null_terminate(), buf_write(), buf_write_u8(), CLEAR, gc, gc_free(), gc_new(), and buffer::len.
Referenced by main().
| void test_buffer_parse | ( | void ** | state | ) |
Definition at line 610 of file test_buffer.c.
References A_TIMES_256, alloc_buf_gc(), buf_parse(), buf_reset_len(), buf_write(), gc, gc_free(), gc_new(), buffer::len, and status.
Referenced by main().
|
static |
Definition at line 57 of file test_buffer.c.
References alloc_buf_gc(), assert_buf_equals_str, BCAP, buf_catrunc(), buf_printf(), gc, gc_free(), gc_new(), and buffer::len.
Referenced by main().
|
static |
Definition at line 86 of file test_buffer.c.
References alloc_buf_gc(), BSTR, buf_puts(), buf_reset_len(), gc, gc_free(), gc_new(), and buffer::len.
Referenced by main().
|
static |
|
static |
Definition at line 347 of file test_buffer.c.
References CC_ALPHA, CC_ANY, CC_ASTERISK, CC_BACKSLASH, CC_BLANK, CC_DIGIT, CC_DOUBLE_QUOTE, CC_NEWLINE, CC_PRINT, CC_SINGLE_QUOTE, and string_mod().
Referenced by main().
|
static |
Definition at line 383 of file test_buffer.c.
References alloc_buf_gc(), buf_inc_len(), buf_write(), CC_ALNUM, CC_DIGIT, CC_NULL, CC_SPACE, gc, gc_free(), gc_new(), buffer::len, and string_check_buf().
Referenced by main().
|
static |
Definition at line 456 of file test_buffer.c.
References checked_snprintf(), and buffer::len.
Referenced by main().
|
static |
| void test_string_chomp | ( | void ** | state | ) |
Definition at line 466 of file test_buffer.c.
References chomp(), buffer::len, and rm_trailing_chars().
Referenced by main().