The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
Macros | Functions | Variables
pair_nested_tests.c File Reference
#include "acutest_common_init.h"
#include "acutest_helpers.h"
#include "pair_test_helpers.h"
#include <freeradius-devel/util/conf.h>
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/util/sbuff.h>
+ Include dependency graph for pair_nested_tests.c:

Go to the source code of this file.

Macros

#define TEST_PRINT_PAIR(_func, _parent, _vp, _expected)
 Print one pair into a buffer, and compare it against what we expect.
 
#define USE_CONSTRUCTOR
 The 'TEST_INIT' macro provided by 'acutest.h' allowing to register a function to be called before call the unit tests.
 

Functions

int dict_protocol_add (fr_dict_t *dict)
 Add a protocol to the global protocol table.
 
static void test_fr_dict_by_protocol_substr_no_overflow (void)
 
static void test_fr_pair_afrom_child_num (void)
 
static void test_fr_pair_afrom_da (void)
 
static void test_fr_pair_afrom_da_nested (void)
 
static void test_fr_pair_append (void)
 
static void test_fr_pair_append_by_da_parent (void)
 
static void test_fr_pair_cmp (void)
 
static void test_fr_pair_copy (void)
 
static void test_fr_pair_dcursor_by_ancestor_init (void)
 
static void test_fr_pair_dcursor_by_da_init (void)
 
static void test_fr_pair_dcursor_value_init (void)
 
static void test_fr_pair_debug (void)
 fr_pair_debug() and fr_pair_list_debug() write to a FILE, not to an sbuff
 
static void test_fr_pair_delete (void)
 
static void test_fr_pair_delete_by_child_num (void)
 
static void test_fr_pair_delete_by_da (void)
 
static void test_fr_pair_delete_by_da_nested (void)
 
static void test_fr_pair_find_by_child_num_idx (void)
 
static void test_fr_pair_find_by_da_idx (void)
 
static void test_fr_pair_find_by_da_nested (void)
 
static void test_fr_pair_list_cmp (void)
 
static void test_fr_pair_list_copy (void)
 
static void test_fr_pair_list_copy_by_ancestor (void)
 
static void test_fr_pair_list_copy_by_da (void)
 
static void test_fr_pair_list_print (void)
 
static void test_fr_pair_list_sort (void)
 
static void test_fr_pair_nested_verify (void)
 
static void test_fr_pair_prepend_by_da (void)
 
static void test_fr_pair_print (void)
 
static void test_fr_pair_print_name (void)
 
static void test_fr_pair_print_secure (void)
 
static void test_fr_pair_print_secure_children (void)
 fr_pair_print_secure() walks the children of a structural pair
 
static void test_fr_pair_print_value_quoted (void)
 
static void test_fr_pair_raw_afrom_pair (void)
 
static void test_fr_pair_steal (void)
 
static void test_fr_pair_update_by_da_parent (void)
 
static void test_fr_pair_value_aprintf (void)
 
static void test_fr_pair_value_bstr_alloc (void)
 
static void test_fr_pair_value_bstr_realloc (void)
 
static void test_fr_pair_value_bstrdup_buffer (void)
 
static void test_fr_pair_value_bstrdup_buffer_shallow (void)
 
static void test_fr_pair_value_bstrndup (void)
 
static void test_fr_pair_value_bstrndup_shallow (void)
 
static void test_fr_pair_value_copy (void)
 
static void test_fr_pair_value_enum (void)
 
static void test_fr_pair_value_enum_box (void)
 
static void test_fr_pair_value_from_str (void)
 
static void test_fr_pair_value_mem_alloc (void)
 
static void test_fr_pair_value_mem_realloc (void)
 
static void test_fr_pair_value_memdup (void)
 
static void test_fr_pair_value_memdup_buffer (void)
 
static void test_fr_pair_value_memdup_buffer_shallow (void)
 
static void test_fr_pair_value_memdup_shallow (void)
 
static void test_fr_pair_value_strdup (void)
 
static void test_fr_pair_value_strdup_shallow (void)
 
static void test_fr_pair_value_strtrim (void)
 
static void test_init (void)
 Global initialisation.
 

Variables

 TEST_LIST
 

Macro Definition Documentation

◆ TEST_PRINT_PAIR

#define TEST_PRINT_PAIR (   _func,
  _parent,
  _vp,
  _expected 
)
Value:
do { \
char buffer[1024]; \
fr_sbuff_t sbuff = FR_SBUFF_OUT(buffer, sizeof(buffer)); \
ssize_t slen; \
\
slen = _func(&sbuff, _parent, _vp); \
TEST_CHECK(slen > 0); \
TEST_MSG(#_func " returned %zd: %s", slen, fr_strerror()); \
\
TEST_CHECK(strcmp(buffer, _expected) == 0); \
TEST_MSG("expected: %s", _expected); \
TEST_MSG("got : %s", buffer); \
} while (0)
static int const char char buffer[256]
Definition acutest.h:576
long int ssize_t
#define FR_SBUFF_OUT(_start, _len_or_end)
char const * fr_strerror(void)
Get the last library error.
Definition strerror.c:558

Print one pair into a buffer, and compare it against what we expect.

Definition at line 1334 of file pair_nested_tests.c.

◆ USE_CONSTRUCTOR

#define USE_CONSTRUCTOR

The 'TEST_INIT' macro provided by 'acutest.h' allowing to register a function to be called before call the unit tests.

Therefore, It calls the function ALL THE TIME causing an overhead. That is why we are initializing test_init() by "__attribute__((constructor));" reducing the test execution by 50% of the time.

Definition at line 30 of file pair_nested_tests.c.

Function Documentation

◆ dict_protocol_add()

int dict_protocol_add ( fr_dict_t *  dict)
extern

Add a protocol to the global protocol table.

Inserts a protocol into the global protocol table. Uses the root attributes of the dictionary for comparisons.

Parameters
[in]dictof protocol we're inserting.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1564 of file dict_util.c.

+ Here is the caller graph for this function:

◆ test_fr_dict_by_protocol_substr_no_overflow()

static void test_fr_dict_by_protocol_substr_no_overflow ( void  )
static

Definition at line 1303 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_afrom_child_num()

static void test_fr_pair_afrom_child_num ( void  )
static

Definition at line 110 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_afrom_da()

static void test_fr_pair_afrom_da ( void  )
static

Definition at line 89 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_afrom_da_nested()

static void test_fr_pair_afrom_da_nested ( void  )
static

Definition at line 127 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_append()

static void test_fr_pair_append ( void  )
static

Definition at line 472 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_append_by_da_parent()

static void test_fr_pair_append_by_da_parent ( void  )
static

Definition at line 498 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_cmp()

static void test_fr_pair_cmp ( void  )
static

Definition at line 630 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_copy()

static void test_fr_pair_copy ( void  )
static

Definition at line 190 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_dcursor_by_ancestor_init()

static void test_fr_pair_dcursor_by_ancestor_init ( void  )
static

Definition at line 276 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_dcursor_by_da_init()

static void test_fr_pair_dcursor_by_da_init ( void  )
static

Definition at line 250 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_dcursor_value_init()

static void test_fr_pair_dcursor_value_init ( void  )
static

Definition at line 302 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_debug()

static void test_fr_pair_debug ( void  )
static

fr_pair_debug() and fr_pair_list_debug() write to a FILE, not to an sbuff

Definition at line 1507 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_delete()

static void test_fr_pair_delete ( void  )
static

Definition at line 615 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_delete_by_child_num()

static void test_fr_pair_delete_by_child_num ( void  )
static

Definition at line 549 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_delete_by_da()

static void test_fr_pair_delete_by_da ( void  )
static

Definition at line 603 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_delete_by_da_nested()

static void test_fr_pair_delete_by_da_nested ( void  )
static

Definition at line 156 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_find_by_child_num_idx()

static void test_fr_pair_find_by_child_num_idx ( void  )
static

Definition at line 371 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_find_by_da_idx()

static void test_fr_pair_find_by_da_idx ( void  )
static

Definition at line 357 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_find_by_da_nested()

static void test_fr_pair_find_by_da_nested ( void  )
static

Definition at line 385 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_list_cmp()

static void test_fr_pair_list_cmp ( void  )
static

Definition at line 656 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_list_copy()

static void test_fr_pair_list_copy ( void  )
static

Definition at line 676 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_list_copy_by_ancestor()

static void test_fr_pair_list_copy_by_ancestor ( void  )
static

Definition at line 712 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_list_copy_by_da()

static void test_fr_pair_list_copy_by_da ( void  )
static

Definition at line 691 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_list_print()

static void test_fr_pair_list_print ( void  )
static

Definition at line 1476 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_list_sort()

static void test_fr_pair_list_sort ( void  )
static

Definition at line 749 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_nested_verify()

static void test_fr_pair_nested_verify ( void  )
static

Definition at line 183 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_prepend_by_da()

static void test_fr_pair_prepend_by_da ( void  )
static

Definition at line 561 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_print()

static void test_fr_pair_print ( void  )
static

Definition at line 1349 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_print_name()

static void test_fr_pair_print_name ( void  )
static

Definition at line 1366 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_print_secure()

static void test_fr_pair_print_secure ( void  )
static

Definition at line 1422 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_print_secure_children()

static void test_fr_pair_print_secure_children ( void  )
static

fr_pair_print_secure() walks the children of a structural pair

Each child but the last is followed by a separator, so the interesting cases are no children, one child, and more than one.

Definition at line 1445 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_print_value_quoted()

static void test_fr_pair_print_value_quoted ( void  )
static

Definition at line 1398 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_raw_afrom_pair()

static void test_fr_pair_raw_afrom_pair ( void  )
static

Definition at line 232 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_steal()

static void test_fr_pair_steal ( void  )
static

Definition at line 214 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_update_by_da_parent()

static void test_fr_pair_update_by_da_parent ( void  )
static

Definition at line 580 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_aprintf()

static void test_fr_pair_value_aprintf ( void  )
static

Definition at line 918 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_bstr_alloc()

static void test_fr_pair_value_bstr_alloc ( void  )
static

Definition at line 942 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_bstr_realloc()

static void test_fr_pair_value_bstr_realloc ( void  )
static

Definition at line 969 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_bstrdup_buffer()

static void test_fr_pair_value_bstrdup_buffer ( void  )
static

Definition at line 1016 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_bstrdup_buffer_shallow()

static void test_fr_pair_value_bstrdup_buffer_shallow ( void  )
static

Definition at line 1062 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_bstrndup()

static void test_fr_pair_value_bstrndup ( void  )
static

Definition at line 999 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_bstrndup_shallow()

static void test_fr_pair_value_bstrndup_shallow ( void  )
static

Definition at line 1039 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_copy()

static void test_fr_pair_value_copy ( void  )
static

Definition at line 800 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_enum()

static void test_fr_pair_value_enum ( void  )
static

Definition at line 1233 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_enum_box()

static void test_fr_pair_value_enum_box ( void  )
static

Definition at line 1256 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_from_str()

static void test_fr_pair_value_from_str ( void  )
static

Definition at line 827 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_mem_alloc()

static void test_fr_pair_value_mem_alloc ( void  )
static

Definition at line 1085 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_mem_realloc()

static void test_fr_pair_value_mem_realloc ( void  )
static

Definition at line 1109 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_memdup()

static void test_fr_pair_value_memdup ( void  )
static

Definition at line 1147 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_memdup_buffer()

static void test_fr_pair_value_memdup_buffer ( void  )
static

Definition at line 1164 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_memdup_buffer_shallow()

static void test_fr_pair_value_memdup_buffer_shallow ( void  )
static

Definition at line 1210 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_memdup_shallow()

static void test_fr_pair_value_memdup_shallow ( void  )
static

Definition at line 1187 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_strdup()

static void test_fr_pair_value_strdup ( void  )
static

Definition at line 847 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_strdup_shallow()

static void test_fr_pair_value_strdup_shallow ( void  )
static

Definition at line 867 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_fr_pair_value_strtrim()

static void test_fr_pair_value_strtrim ( void  )
static

Definition at line 895 of file pair_nested_tests.c.

+ Here is the call graph for this function:

◆ test_init()

static void test_init ( void  )
static

Global initialisation.

Definition at line 36 of file pair_nested_tests.c.

Variable Documentation

◆ TEST_LIST

TEST_LIST

Definition at line 1552 of file pair_nested_tests.c.