The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions | Variables
sbuff_tests.c File Reference

Tests for a generic string buffer structure for string printing and parsing. More...

#include <freeradius-devel/util/acutest.h>
#include <freeradius-devel/util/acutest_helpers.h>
#include "sbuff.h"
+ Include dependency graph for sbuff_tests.c:

Go to the source code of this file.

Macros

#define PATTERN_LEN   (sizeof(PATTERN) - 1)
 
#define TEST_SBUFF_LEN(_sbuff, _num)
 
#define TEST_SBUFF_USED(_sbuff, _num)
 

Functions

static void test_adv_past_allowed (void)
 
static void test_adv_past_str (void)
 
static void test_adv_past_strcase (void)
 
static void test_adv_past_whitespace (void)
 
static void test_adv_to_chr (void)
 
static void test_adv_to_str (void)
 
static void test_adv_to_strcase (void)
 
static void test_adv_to_utf8 (void)
 
static void test_adv_until (void)
 
static void test_bstrncpy (void)
 
static void test_bstrncpy_allowed (void)
 
static void test_bstrncpy_exact (void)
 
static void test_bstrncpy_until (void)
 
static void test_eof_terminal (void)
 
static void test_file_extend (void)
 
static void test_file_extend_max (void)
 
static void test_is_char (void)
 
static void test_next_if_char (void)
 
static void test_next_unless_char (void)
 
static void test_no_advance (void)
 
static void test_parse_init (void)
 
static void test_talloc_extend (void)
 
static void test_talloc_extend_init_zero (void)
 
static void test_talloc_extend_multi_level (void)
 
static void test_talloc_extend_with_marker (void)
 
static void test_terminal_merge (void)
 
static void test_unescape_multi_char_terminals (void)
 
static void test_unescape_until (void)
 

Variables

static bool allow_lowercase_and_space [UINT8_MAX+1]
 
static bool allow_lowercase_and_space_no_t [UINT8_MAX+1]
 
 TEST_LIST
 

Detailed Description

Tests for a generic string buffer structure for string printing and parsing.

Definition in file sbuff_tests.c.

Macro Definition Documentation

◆ PATTERN_LEN

#define PATTERN_LEN   (sizeof(PATTERN) - 1)

◆ TEST_SBUFF_LEN

#define TEST_SBUFF_LEN (   _sbuff,
  _num 
)
Value:
do { \
size_t _len; \
_len = talloc_array_length((_sbuff)->buff); \
TEST_CHECK(_len == (size_t)_num); \
TEST_MSG("Expected length : %zu", (size_t)_num); \
TEST_MSG("Got length : %zu", _len); \
} while(0)
static char buff[sizeof("18446744073709551615")+3]
Definition: size_tests.c:41

Definition at line 30 of file sbuff_tests.c.

◆ TEST_SBUFF_USED

#define TEST_SBUFF_USED (   _sbuff,
  _num 
)
Value:
do { \
size_t _len; \
_len = fr_sbuff_used(_sbuff); \
TEST_CHECK(_len == (size_t)_num); \
TEST_MSG("Expected length : %zu", (size_t)_num); \
TEST_MSG("Got length : %zu", _len); \
} while(0)
#define fr_sbuff_used(_sbuff_or_marker)

Definition at line 39 of file sbuff_tests.c.

Function Documentation

◆ test_adv_past_allowed()

static void test_adv_past_allowed ( void  )
static

Definition at line 1219 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_adv_past_str()

static void test_adv_past_str ( void  )
static

Definition at line 1121 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_adv_past_strcase()

static void test_adv_past_strcase ( void  )
static

Definition at line 1152 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_adv_past_whitespace()

static void test_adv_past_whitespace ( void  )
static

Definition at line 1183 of file sbuff_tests.c.

◆ test_adv_to_chr()

static void test_adv_to_chr ( void  )
static

Definition at line 1353 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_adv_to_str()

static void test_adv_to_str ( void  )
static

Definition at line 1398 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_adv_to_strcase()

static void test_adv_to_strcase ( void  )
static

Definition at line 1459 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_adv_to_utf8()

static void test_adv_to_utf8 ( void  )
static

Definition at line 1293 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_adv_until()

static void test_adv_until ( void  )
static

Definition at line 1257 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_bstrncpy()

static void test_bstrncpy ( void  )
static

Definition at line 156 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_bstrncpy_allowed()

static void test_bstrncpy_allowed ( void  )
static

Definition at line 226 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_bstrncpy_exact()

static void test_bstrncpy_exact ( void  )
static

Definition at line 104 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_bstrncpy_until()

static void test_bstrncpy_until ( void  )
static

Definition at line 314 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_eof_terminal()

static void test_eof_terminal ( void  )
static

Definition at line 732 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_file_extend()

static void test_file_extend ( void  )
static

Definition at line 1036 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_file_extend_max()

static void test_file_extend_max ( void  )
static

Definition at line 1099 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_is_char()

static void test_is_char ( void  )
static

Definition at line 75 of file sbuff_tests.c.

◆ test_next_if_char()

static void test_next_if_char ( void  )
static

Definition at line 1520 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_next_unless_char()

static void test_next_unless_char ( void  )
static

Definition at line 1543 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_no_advance()

static void test_no_advance ( void  )
static

Definition at line 826 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_parse_init()

static void test_parse_init ( void  )
static

Definition at line 48 of file sbuff_tests.c.

◆ test_talloc_extend()

static void test_talloc_extend ( void  )
static

Definition at line 843 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_talloc_extend_init_zero()

static void test_talloc_extend_init_zero ( void  )
static

Definition at line 923 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_talloc_extend_multi_level()

static void test_talloc_extend_multi_level ( void  )
static

Definition at line 954 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_talloc_extend_with_marker()

static void test_talloc_extend_with_marker ( void  )
static

Definition at line 987 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_terminal_merge()

static void test_terminal_merge ( void  )
static

Definition at line 762 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_unescape_multi_char_terminals()

static void test_unescape_multi_char_terminals ( void  )
static

Definition at line 697 of file sbuff_tests.c.

+ Here is the call graph for this function:

◆ test_unescape_until()

static void test_unescape_until ( void  )
static

Definition at line 406 of file sbuff_tests.c.

+ Here is the call graph for this function:

Variable Documentation

◆ allow_lowercase_and_space

bool allow_lowercase_and_space[UINT8_MAX+1]
static
Initial value:
= {
['a'] = true, ['b'] = true, ['c'] = true, ['d'] = true, ['e'] = true,
['f'] = true, ['g'] = true, ['h'] = true, ['i'] = true, ['j'] = true,
['k'] = true, ['l'] = true, ['m'] = true, ['n'] = true, ['o'] = true,
['p'] = true, ['q'] = true, ['r'] = true, ['s'] = true, ['t'] = true,
['u'] = true, ['v'] = true, ['w'] = true, ['x'] = true, ['y'] = true,
['z'] = true, [' '] = true
}

Definition at line 208 of file sbuff_tests.c.

◆ allow_lowercase_and_space_no_t

bool allow_lowercase_and_space_no_t[UINT8_MAX+1]
static
Initial value:
= {
['a'] = true, ['b'] = true, ['c'] = true, ['d'] = true, ['e'] = true,
['f'] = true, ['g'] = true, ['h'] = true, ['i'] = true, ['j'] = true,
['k'] = true, ['l'] = true, ['m'] = true, ['n'] = true, ['o'] = true,
['p'] = true, ['q'] = true, ['r'] = true, ['s'] = true, ['t'] = false,
['u'] = true, ['v'] = true, ['w'] = true, ['x'] = true, ['y'] = true,
['z'] = true, [' '] = true
}

Definition at line 217 of file sbuff_tests.c.

◆ TEST_LIST

TEST_LIST

Definition at line 1566 of file sbuff_tests.c.