3 #include "testing/testing.h"
16 #define TESTFAIL(test) \
22 if (listbase->
first) {
23 const Link *prev, *link;
34 }
while ((
void)(prev = link), (link = link->next));
41 }
while ((
void)(prev = link), (link = link->prev));
55 static int char_switch(
char *
string,
char ch_src,
char ch_dst)
58 while (*
string != 0) {
59 if (*
string == ch_src) {
68 TEST(listbase, FindLinkOrIndex)
104 int i = strcmp(*(
const char **)
a, *(
const char **)b);
105 return (i > 0) ? 1 : (i < 0) ? -1 : 0;
112 int i = strcmp((
const char *)link_a->
data, (
const char *)link_b->
data);
113 return (i > 0) ? 1 : (i < 0) ? -1 : 0;
133 for (i = 0; i < arr_tot; i++) {
134 if (strcmp(arr[i], (
char *)link_step->
data) != 0) {
137 link_step = link_step->
next;
152 while (link_step && link_step->
next) {
153 if (strcmp((
const char *)link_step->
data, (
const char *)link_step->
next->
data) == 0) {
154 if ((link_step < link_step->
next) != forward) {
158 link_step = link_step->
next;
165 const int words_len =
sizeof(
words10k) - 1;
177 words_arr = (
char **)
MEM_mallocN(
sizeof(*words_arr) * words_tot, __func__);
179 words_linkdata_arr = (
LinkData *)
MEM_mallocN(
sizeof(*words_linkdata_arr) * words_tot, __func__);
183 for (i = 0; i < words_tot; i++) {
184 words_arr[i] = w_step;
185 w_step += strlen(w_step) + 1;
208 for (i = 0; i < words_tot; i++) {
209 LinkData *link = &words_linkdata_arr[i];
212 w_step += strlen(w_step) + 1;
Generic array manipulation API.
#define BLI_array_reverse(arr, arr_len)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void void BLI_listbase_sort(struct ListBase *listbase, int(*cmp)(const void *, const void *)) ATTR_NONNULL(1
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void * BLI_rfindlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void void void void void BLI_listbase_reverse(struct ListBase *lb) ATTR_NONNULL(1)
static int testsort_listbase_str_cmp(const void *a, const void *b)
static int testsort_array_str_cmp(const void *a, const void *b)
static bool listbase_is_valid(const ListBase *listbase)
static bool testsort_listbase_array_str_cmp(ListBase *lb, char **arr, int arr_tot)
static int testsort_array_str_cmp_reverse(const void *a, const void *b)
TEST(listbase, FindLinkOrIndex)
static int char_switch(char *string, char ch_src, char ch_dst)
static int testsort_listbase_str_cmp_reverse(const void *a, const void *b)
static bool testsort_listbase_sort_is_stable(ListBase *lb, bool forward)
char * BLI_strdupn(const char *str, const size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Read Guarded memory(de)allocation.
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)