OpenVPN
Data Structures | Macros | Functions
test_buffer.c File Reference
#include "syshead.h"
#include <setjmp.h>
#include <cmocka.h>
#include "buffer.h"
#include "buffer.c"
#include "test_common.h"
Include dependency graph for test_buffer.c:

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)
 

Functions

static void test_buffer_strprefix (void **state)
 
static void test_buffer_printf_catrunc (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)
 
void test_buffer_chomp (void **state)
 
int main (void)
 

Macro Definition Documentation

◆ assert_buf_equals_str

#define assert_buf_equals_str (   buf,
  str 
)
Value:
assert_int_equal(BLEN(buf), strlen(str)); \
assert_memory_equal(BPTR(buf), str, BLEN(buf));
#define BPTR(buf)
Definition buffer.h:124
#define BLEN(buf)
Definition buffer.h:127

Definition at line 53 of file test_buffer.c.

◆ testnosep

#define testnosep   ""

Definition at line 48 of file test_buffer.c.

◆ testsep

#define testsep   ","

Definition at line 47 of file test_buffer.c.

◆ teststr1

#define teststr1   "one"

Definition at line 49 of file test_buffer.c.

◆ teststr2

#define teststr2   "two"

Definition at line 50 of file test_buffer.c.

◆ teststr3

#define teststr3   "three"

Definition at line 51 of file test_buffer.c.

Function Documentation

◆ main()

int main ( void  )

◆ test_buffer_chomp()

void test_buffer_chomp ( void **  state)

◆ test_buffer_format_hex_ex()

static void test_buffer_format_hex_ex ( void **  state)
static

Definition at line 83 of file test_buffer.c.

References format_hex_ex(), gc, gc_free(), gc_new(), and buffer::len.

Referenced by main().

◆ test_buffer_free_gc_one()

static void test_buffer_free_gc_one ( void **  state)
static

Definition at line 251 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().

◆ test_buffer_free_gc_two()

static void test_buffer_free_gc_two ( void **  state)
static

Definition at line 264 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().

◆ test_buffer_gc_realloc()

static void test_buffer_gc_realloc ( void **  state)
static

Definition at line 294 of file test_buffer.c.

References gc, gc_free(), gc_new(), and gc_realloc().

Referenced by main().

◆ test_buffer_list_aggregate_separator_all()

static void test_buffer_list_aggregate_separator_all ( void **  state)
static

◆ test_buffer_list_aggregate_separator_empty()

static void test_buffer_list_aggregate_separator_empty ( void **  state)
static

◆ test_buffer_list_aggregate_separator_emptybuffers()

static void test_buffer_list_aggregate_separator_emptybuffers ( void **  state)
static

◆ test_buffer_list_aggregate_separator_noop()

static void test_buffer_list_aggregate_separator_noop ( void **  state)
static

◆ test_buffer_list_aggregate_separator_nosep()

static void test_buffer_list_aggregate_separator_nosep ( void **  state)
static

◆ test_buffer_list_aggregate_separator_two()

static void test_buffer_list_aggregate_separator_two ( void **  state)
static

◆ test_buffer_list_aggregate_separator_zerolen()

static void test_buffer_list_aggregate_separator_zerolen ( void **  state)
static

◆ test_buffer_list_setup()

static int test_buffer_list_setup ( void **  state)
static

◆ test_buffer_list_teardown()

static int test_buffer_list_teardown ( void **  state)
static

◆ test_buffer_printf_catrunc()

static void test_buffer_printf_catrunc ( void **  state)
static

Definition at line 58 of file test_buffer.c.

References alloc_buf_gc(), assert_buf_equals_str, buf_catrunc(), buf_printf(), gc, gc_free(), and gc_new().

Referenced by main().

◆ test_buffer_strprefix()

static void test_buffer_strprefix ( void **  state)
static

Definition at line 38 of file test_buffer.c.

References strprefix().

Referenced by main().

◆ test_character_class()

static void test_character_class ( void **  state)
static

◆ test_character_string_mod_buf()

static void test_character_string_mod_buf ( void **  state)
static

◆ test_snprintf()

static void test_snprintf ( void **  state)
static

Definition at line 380 of file test_buffer.c.

References buffer::len.

Referenced by main().