27#include <freeradius-devel/util/dlist.h>
59 TEST_CASE(
"Two items - Linking is correct running forwards");
72 TEST_CASE(
"Two items - Linking is correct running backwards");
85 TEST_CASE(
"Two items - Old list is really empty");
100 TEST_CASE(
"One item - Linking is correct running forwards");
108 TEST_CASE(
"One item - Linking is correct running backwards");
116 TEST_CASE(
"One item - Old list is really empty");
148 TEST_CASE(
"Three items - Linking is correct running forwards");
156 TEST_CASE(
"Three items - Linking is correct running backwards");
172 unsigned int count = 0;
199 return CMP(strcmp(a->
id, b->id), 0);
218 TEST_CASE(
"comparator error leaves the list intact");
#define TEST_CHECK_LEN(_got, _exp)
#define TEST_CHECK_RET(_got, _exp)
#define TEST_CHECK_STRCMP(_got, _exp)
#define CMP(_a, _b)
Same as CMP_PREFER_SMALLER use when you don't really care about ordering, you just want an ordering.
#define fr_dlist_init(_head, _type, _field)
Initialise the head structure of a doubly linked list.
static int fr_dlist_sort(fr_dlist_head_t *list, fr_cmp_t cmp)
Sort a dlist using merge sort.
static void * fr_dlist_head(fr_dlist_head_t const *list_head)
Return the HEAD item of a list or NULL if the list is empty.
#define fr_dlist_foreach(_list_head, _type, _iter)
Iterate over the contents of a list.
static void * fr_dlist_remove(fr_dlist_head_t *list_head, void *ptr)
Remove an item from the list.
static void * fr_dlist_prev(fr_dlist_head_t const *list_head, void const *ptr)
Get the previous item in a list.
static unsigned int fr_dlist_num_elements(fr_dlist_head_t const *head)
Return the number of elements in the dlist.
static void * fr_dlist_tail(fr_dlist_head_t const *list_head)
Return the TAIL item of a list or NULL if the list is empty.
static int fr_dlist_insert_tail(fr_dlist_head_t *list_head, void *ptr)
Insert an item into the tail of a list.
static int fr_dlist_move(fr_dlist_head_t *list_dst, fr_dlist_head_t *list_src)
Merge two lists, inserting the source at the tail of the destination.
static void fr_dlist_entry_move(fr_dlist_t *dst, fr_dlist_t *src)
Link in a sublist before the current entry.
static void * fr_dlist_next(fr_dlist_head_t const *list_head, void const *ptr)
Get the next item in a list.
Head of a doubly linked list.
Entry in a doubly linked list.
static void test_dlist_sort_cmp_err(void)
static fr_cmp_ret_t _dlist_id_cmp(void const *one, void const *two)
static void test_dlist_move(void)
static void test_dlist_foreach_safe(void)
static void test_dlist_entry_move(void)
fr_cmp_ret_t
Result of an ordering comparison.
@ CMP_ERR
comparison failed
#define fr_strerror_const(_msg)