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 teststr4   "four"
 
#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)
 
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));

Definition at line 54 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.

◆ teststr4

#define teststr4   "four"

Definition at line 52 of file test_buffer.c.

Function Documentation

◆ main()

int main ( void  )

◆ test_buffer_format_hex_ex()

static void test_buffer_format_hex_ex ( void **  state)
static

Definition at line 84 of file test_buffer.c.

References format_hex_ex(), gc_free(), and gc_new().

Referenced by main().

◆ test_buffer_free_gc_one()

static void test_buffer_free_gc_one ( void **  state)
static

Definition at line 252 of file test_buffer.c.

References alloc_buf_gc(), buffer::data, free_buf_gc(), gc_free(), gc_new(), 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 265 of file test_buffer.c.

References alloc_buf_gc(), buffer::data, free_buf_gc(), gc_free(), gc_new(), 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 295 of file test_buffer.c.

References 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 59 of file test_buffer.c.

References alloc_buf_gc(), assert_buf_equals_str, buf_catrunc(), buf_printf(), 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 381 of file test_buffer.c.

Referenced by main().

BLEN
#define BLEN(buf)
Definition: buffer.h:127
BPTR
#define BPTR(buf)
Definition: buffer.h:124