Asterisk - The Open Source Telephony Project GIT-master-3dae2cf
Data Structures | Macros | Functions | Variables
test_linkedlists.c File Reference

Linked List Tests. More...

#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/test.h"
#include "asterisk/strings.h"
#include "asterisk/logger.h"
#include "asterisk/linkedlists.h"
#include "asterisk/dlinkedlists.h"
Include dependency graph for test_linkedlists.c:

Go to the source code of this file.

Data Structures

struct  test_dbl_llist
 
struct  test_llist
 
struct  test_val
 

Macros

#define ELEM_OR_FAIL(x, y)
 
#define MATCH_OR_FAIL(list, val, retbuf)
 
#define MATCH_OR_FAIL_DBL(list, val, retbuf)
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
 AST_TEST_DEFINE (double_ll_tests)
 
 AST_TEST_DEFINE (single_ll_tests)
 
static int dbl_list_expect_forward (struct test_dbl_llist *test_list, const char *expect, struct ast_str **buf)
 
static int dbl_list_expect_reverse (struct test_dbl_llist *test_list, const char *expect, struct ast_str **buf)
 
static int list_expect (struct test_llist *test_list, const char *expect, struct ast_str **buf)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Test Linked Lists" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
 
static struct test_val a = { "A" }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct test_val b = { "B" }
 
static struct test_val c = { "C" }
 
static struct test_val d = { "D" }
 

Detailed Description

Linked List Tests.

Author
Terry Wilson twils.nosp@m.on@d.nosp@m.igium.nosp@m..com

Definition in file test_linkedlists.c.

Macro Definition Documentation

◆ ELEM_OR_FAIL

#define ELEM_OR_FAIL (   x,
 
)
Value:
if ((x) != (y)) { \
ast_test_status_update(test, "Expected: %s, Got: %s\n", (x)->name, (y)->name); \
return AST_TEST_FAIL; \
}
static const char name[]
Definition: format_mp3.c:68
@ AST_TEST_FAIL
Definition: test.h:196

Definition at line 119 of file test_linkedlists.c.

◆ MATCH_OR_FAIL

#define MATCH_OR_FAIL (   list,
  val,
  retbuf 
)
Value:
if (list_expect(list, val, &retbuf)) { \
ast_test_status_update(test, "Expected: %s, Got: %s\n", val, ast_str_buffer(retbuf)); \
return AST_TEST_FAIL; \
}
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:761
Definition: ast_expr2.c:325
static int list_expect(struct test_llist *test_list, const char *expect, struct ast_str **buf)

Definition at line 103 of file test_linkedlists.c.

◆ MATCH_OR_FAIL_DBL

#define MATCH_OR_FAIL_DBL (   list,
  val,
  retbuf 
)

Definition at line 109 of file test_linkedlists.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 662 of file test_linkedlists.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 662 of file test_linkedlists.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 662 of file test_linkedlists.c.

◆ AST_TEST_DEFINE() [1/2]

AST_TEST_DEFINE ( double_ll_tests  )

Definition at line 337 of file test_linkedlists.c.

338{
339 RAII_VAR(struct ast_str *, buf, NULL, ast_free);
340 struct test_dbl_llist test_list = { 0, };
341 struct test_dbl_llist other_list = { 0, };
342 struct test_val *bogus;
343
344 switch (cmd) {
345 case TEST_INIT:
346 info->name = "double_ll_tests";
347 info->category = "/main/linkedlists/";
348 info->summary = "double linked list unit test";
349 info->description =
350 "Test the double linked list API";
351 return AST_TEST_NOT_RUN;
352 case TEST_EXECUTE:
353 break;
354 }
355
356 if (!(buf = ast_str_create(16))) {
357 return AST_TEST_FAIL;
358 }
359
360 bogus = ast_alloca(sizeof(*bogus));
361
362 if (AST_DLLIST_REMOVE_VERIFY(&test_list, bogus, dbl_list)) {
363 ast_test_status_update(test, "AST_DLLIST_REMOVE_VERIFY should safely return NULL for missing element from empty list\n");
364 return AST_TEST_FAIL;
365 }
366
367 /* INSERT_HEAD and REMOVE_HEAD tests */
368 AST_DLLIST_INSERT_HEAD(&test_list, &a, dbl_list);
369 MATCH_OR_FAIL_DBL(&test_list, "A", buf);
370 AST_DLLIST_INSERT_HEAD(&test_list, &b, dbl_list);
371 MATCH_OR_FAIL_DBL(&test_list, "BA", buf);
372 AST_DLLIST_REMOVE_HEAD(&test_list, dbl_list);
373 MATCH_OR_FAIL_DBL(&test_list, "A", buf);
374 AST_DLLIST_REMOVE_HEAD(&test_list, dbl_list);
375 MATCH_OR_FAIL_DBL(&test_list, "", buf);
376 if (AST_DLLIST_REMOVE_HEAD(&test_list, dbl_list)) {
377 ast_test_status_update(test, "Somehow removed an item from the head of a list that didn't exist\n");
378 return AST_TEST_FAIL;
379 }
380 MATCH_OR_FAIL_DBL(&test_list, "", buf);
381
382 /* Check empty list test */
383
384 if (!AST_DLLIST_EMPTY(&test_list)) {
385 ast_test_status_update(test, "List should be empty\n");
386 return AST_TEST_FAIL;
387 }
388
389 /* Insert tail and remove specific item tests. */
390
391 AST_DLLIST_INSERT_TAIL(&test_list, &a, dbl_list);
392 MATCH_OR_FAIL_DBL(&test_list, "A", buf);
393 AST_DLLIST_INSERT_TAIL(&test_list, &b, dbl_list);
394 MATCH_OR_FAIL_DBL(&test_list, "AB", buf);
395 AST_DLLIST_INSERT_TAIL(&test_list, &c, dbl_list);
396 MATCH_OR_FAIL_DBL(&test_list, "ABC", buf);
397 AST_DLLIST_INSERT_TAIL(&test_list, &d, dbl_list);
398 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
399 if (AST_DLLIST_REMOVE_VERIFY(&test_list, bogus, dbl_list)) {
400 ast_test_status_update(test, "AST_DLLIST_REMOVE_VERIFY should safely return NULL for missing element\n");
401 return AST_TEST_FAIL;
402 }
403 bogus = NULL;
404 if (AST_DLLIST_REMOVE_VERIFY(&test_list, bogus, dbl_list)) {
405 ast_test_status_update(test, "AST_DLLIST_REMOVE_VERIFY should safely return NULL for element set to NULL\n");
406 return AST_TEST_FAIL;
407 }
408 AST_DLLIST_REMOVE(&test_list, &b, dbl_list);
409 MATCH_OR_FAIL_DBL(&test_list, "ACD", buf);
410 AST_DLLIST_REMOVE(&test_list, &d, dbl_list);
411 MATCH_OR_FAIL_DBL(&test_list, "AC", buf);
412 AST_DLLIST_REMOVE(&test_list, &a, dbl_list);
413 MATCH_OR_FAIL_DBL(&test_list, "C", buf);
414 AST_DLLIST_REMOVE(&test_list, &c, dbl_list);
415 MATCH_OR_FAIL_DBL(&test_list, "", buf);
416 if (!AST_DLLIST_EMPTY(&test_list)) {
417 ast_test_status_update(test, "List should be empty\n");
418 return AST_TEST_FAIL;
419 }
420 if (AST_DLLIST_REMOVE_VERIFY(&test_list, bogus, dbl_list)) {
421 ast_test_status_update(test, "AST_DLLIST_REMOVE_VERIFY should safely return NULL asked to remove a NULL pointer from an empty list\n");
422 return AST_TEST_FAIL;
423 }
424
425 /* Insert item after and before specific item tests */
426
427 AST_DLLIST_INSERT_HEAD(&test_list, &a, dbl_list);
428 MATCH_OR_FAIL_DBL(&test_list, "A", buf);
429 AST_DLLIST_INSERT_TAIL(&test_list, &c, dbl_list);
430 MATCH_OR_FAIL_DBL(&test_list, "AC", buf);
431 AST_DLLIST_INSERT_AFTER(&test_list, &a, &b, dbl_list);
432 MATCH_OR_FAIL_DBL(&test_list, "ABC", buf);
433 AST_DLLIST_INSERT_AFTER(&test_list, &c, &d, dbl_list);
434 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
435 AST_DLLIST_REMOVE_TAIL(&test_list, dbl_list);
436 MATCH_OR_FAIL_DBL(&test_list, "ABC", buf);
437 AST_DLLIST_REMOVE_TAIL(&test_list, dbl_list);
438 MATCH_OR_FAIL_DBL(&test_list, "AB", buf);
439 AST_DLLIST_INSERT_TAIL(&test_list, &d, dbl_list);
440 MATCH_OR_FAIL_DBL(&test_list, "ABD", buf);
441 AST_DLLIST_INSERT_BEFORE(&test_list, &d, &c, dbl_list);
442 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
443 AST_DLLIST_REMOVE_HEAD(&test_list, dbl_list);
444 MATCH_OR_FAIL_DBL(&test_list, "BCD", buf);
445 AST_DLLIST_INSERT_BEFORE(&test_list, &b, &a, dbl_list);
446 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
447
448 ELEM_OR_FAIL(AST_DLLIST_FIRST(&test_list), &a);
449 ELEM_OR_FAIL(AST_DLLIST_LAST(&test_list), &d);
452
453 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
455 }
457
458 if (!AST_DLLIST_EMPTY(&test_list)) {
459 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
460 return AST_TEST_FAIL;
461 }
462
463 /* Append list test */
464
465 AST_DLLIST_INSERT_HEAD(&test_list, &a, dbl_list);
466 MATCH_OR_FAIL_DBL(&test_list, "A", buf);
467 AST_DLLIST_INSERT_TAIL(&test_list, &b, dbl_list);
468 MATCH_OR_FAIL_DBL(&test_list, "AB", buf);
469 AST_DLLIST_INSERT_HEAD(&other_list, &c, dbl_list);
470 MATCH_OR_FAIL_DBL(&other_list, "C", buf);
471 AST_DLLIST_INSERT_TAIL(&other_list, &d, dbl_list);
472 MATCH_OR_FAIL_DBL(&other_list, "CD", buf);
473 AST_DLLIST_APPEND_DLLIST(&test_list, &other_list, dbl_list);
474 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
475 MATCH_OR_FAIL_DBL(&other_list, "", buf);
476 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
478 }
480 if (!AST_DLLIST_EMPTY(&test_list)) {
481 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
482 return AST_TEST_FAIL;
483 }
484
485 /*
486 * Safe traversal list modification tests
487 * Traverse starting from first element
488 */
489
490 AST_DLLIST_INSERT_HEAD(&test_list, &a, dbl_list);
491 MATCH_OR_FAIL_DBL(&test_list, "A", buf);
492 AST_DLLIST_INSERT_TAIL(&test_list, &d, dbl_list);
493 MATCH_OR_FAIL_DBL(&test_list, "AD", buf);
494 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
495 if (bogus == &d) {
497 MATCH_OR_FAIL_DBL(&test_list, "ABD", buf);
499 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
501 MATCH_OR_FAIL_DBL(&test_list, "ABC", buf);
502 }
503 }
505 MATCH_OR_FAIL_DBL(&test_list, "ABC", buf);
506 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
508 }
510 if (!AST_DLLIST_EMPTY(&test_list)) {
511 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
512 return AST_TEST_FAIL;
513 }
514
515 AST_DLLIST_INSERT_HEAD(&test_list, &b, dbl_list);
516 MATCH_OR_FAIL_DBL(&test_list, "B", buf);
517 AST_DLLIST_INSERT_TAIL(&test_list, &d, dbl_list);
518 MATCH_OR_FAIL_DBL(&test_list, "BD", buf);
519 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
520 if (bogus == &b) {
522 MATCH_OR_FAIL_DBL(&test_list, "ABD", buf);
524 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
526 MATCH_OR_FAIL_DBL(&test_list, "ACD", buf);
527 }
528 }
530 MATCH_OR_FAIL_DBL(&test_list, "ACD", buf);
531 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
533 }
535 if (!AST_DLLIST_EMPTY(&test_list)) {
536 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
537 return AST_TEST_FAIL;
538 }
539
540 AST_DLLIST_INSERT_HEAD(&test_list, &b, dbl_list);
541 MATCH_OR_FAIL_DBL(&test_list, "B", buf);
542 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
543 if (bogus == &b) {
545 MATCH_OR_FAIL_DBL(&test_list, "AB", buf);
547 MATCH_OR_FAIL_DBL(&test_list, "ABD", buf);
549 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
551 MATCH_OR_FAIL_DBL(&test_list, "ACD", buf);
552 }
553 }
555 MATCH_OR_FAIL_DBL(&test_list, "ACD", buf);
556 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
558 }
560 if (!AST_DLLIST_EMPTY(&test_list)) {
561 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
562 return AST_TEST_FAIL;
563 }
564
565 /*
566 * Safe traversal list modification tests
567 * Traverse starting from last element
568 */
569
570 AST_DLLIST_INSERT_HEAD(&test_list, &a, dbl_list);
571 MATCH_OR_FAIL_DBL(&test_list, "A", buf);
572 AST_DLLIST_INSERT_TAIL(&test_list, &d, dbl_list);
573 MATCH_OR_FAIL_DBL(&test_list, "AD", buf);
575 if (bogus == &d) {
577 MATCH_OR_FAIL_DBL(&test_list, "ABD", buf);
579 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
581 MATCH_OR_FAIL_DBL(&test_list, "ABC", buf);
582 }
583 }
585 MATCH_OR_FAIL_DBL(&test_list, "ABC", buf);
588 }
590 if (!AST_DLLIST_EMPTY(&test_list)) {
591 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
592 return AST_TEST_FAIL;
593 }
594
595 AST_DLLIST_INSERT_HEAD(&test_list, &b, dbl_list);
596 MATCH_OR_FAIL_DBL(&test_list, "B", buf);
597 AST_DLLIST_INSERT_TAIL(&test_list, &d, dbl_list);
598 MATCH_OR_FAIL_DBL(&test_list, "BD", buf);
600 if (bogus == &b) {
602 MATCH_OR_FAIL_DBL(&test_list, "ABD", buf);
604 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
606 MATCH_OR_FAIL_DBL(&test_list, "ACD", buf);
607 }
608 }
610 MATCH_OR_FAIL_DBL(&test_list, "ACD", buf);
611 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
613 }
615 if (!AST_DLLIST_EMPTY(&test_list)) {
616 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
617 return AST_TEST_FAIL;
618 }
619
620 AST_DLLIST_INSERT_HEAD(&test_list, &b, dbl_list);
621 MATCH_OR_FAIL_DBL(&test_list, "B", buf);
623 if (bogus == &b) {
625 MATCH_OR_FAIL_DBL(&test_list, "AB", buf);
627 MATCH_OR_FAIL_DBL(&test_list, "ABD", buf);
629 MATCH_OR_FAIL_DBL(&test_list, "ABCD", buf);
631 MATCH_OR_FAIL_DBL(&test_list, "ACD", buf);
632 }
633 }
635 MATCH_OR_FAIL_DBL(&test_list, "ACD", buf);
636 AST_DLLIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, dbl_list) {
638 }
640 if (!AST_DLLIST_EMPTY(&test_list)) {
641 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
642 return AST_TEST_FAIL;
643 }
644
645 return AST_TEST_PASS;
646}
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
Definition: astmm.h:288
#define ast_free(a)
Definition: astmm.h:180
#define AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: dlinkedlists.h:888
#define AST_DLLIST_INSERT_AFTER_CURRENT(elm, field)
Inserts a list node after the current node during a traversal.
Definition: dlinkedlists.h:723
#define AST_DLLIST_EMPTY(head)
Checks whether the specified list contains any entries.
Definition: dlinkedlists.h:469
#define AST_DLLIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Definition: dlinkedlists.h:446
#define AST_DLLIST_INSERT_AFTER(head, listelm, elm, field)
Inserts a list entry after a given entry.
#define AST_DLLIST_REMOVE_TAIL(head, field)
Removes and returns the tail node from a list.
#define AST_DLLIST_APPEND_DLLIST(head, list, field)
Appends a whole list to the tail of a list.
#define AST_DLLIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
#define AST_DLLIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_DLLIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: dlinkedlists.h:849
#define AST_DLLIST_PREV(elm, field)
Returns the previous entry in the list before the given entry.
Definition: dlinkedlists.h:457
#define AST_DLLIST_INSERT_BEFORE_CURRENT(elm, field)
Inserts a list node before the current node during a traversal.
Definition: dlinkedlists.h:696
#define AST_DLLIST_INSERT_BEFORE(head, listelm, elm, field)
Inserts a list entry before a given entry.
#define AST_DLLIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_DLLIST_REMOVE_VERIFY(head, elm, field)
Removes a specific node from a list if it is in the list.
#define AST_DLLIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: dlinkedlists.h:753
#define AST_DLLIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_DLLIST_FIRST(head)
Returns the first entry contained in a list.
Definition: dlinkedlists.h:422
#define AST_DLLIST_LAST(head)
Returns the last entry contained in a list.
Definition: dlinkedlists.h:431
#define AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END
Closes a safe loop traversal block.
Definition: dlinkedlists.h:921
#define AST_DLLIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: dlinkedlists.h:913
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
def info(msg)
#define NULL
Definition: resample.c:96
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
Definition: strings.h:659
Support for dynamic strings.
Definition: strings.h:623
struct test_val::@502 dbl_list
@ TEST_INIT
Definition: test.h:200
@ TEST_EXECUTE
Definition: test.h:201
#define ast_test_status_update(a, b, c...)
Definition: test.h:129
@ AST_TEST_PASS
Definition: test.h:195
@ AST_TEST_NOT_RUN
Definition: test.h:194
static struct test_val b
static struct test_val a
static struct test_val d
#define MATCH_OR_FAIL_DBL(list, val, retbuf)
static struct test_val c
#define ELEM_OR_FAIL(x, y)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

References a, ast_alloca, AST_DLLIST_APPEND_DLLIST, AST_DLLIST_EMPTY, AST_DLLIST_FIRST, AST_DLLIST_INSERT_AFTER, AST_DLLIST_INSERT_AFTER_CURRENT, AST_DLLIST_INSERT_BEFORE, AST_DLLIST_INSERT_BEFORE_CURRENT, AST_DLLIST_INSERT_HEAD, AST_DLLIST_INSERT_TAIL, AST_DLLIST_LAST, AST_DLLIST_NEXT, AST_DLLIST_PREV, AST_DLLIST_REMOVE, AST_DLLIST_REMOVE_CURRENT, AST_DLLIST_REMOVE_HEAD, AST_DLLIST_REMOVE_TAIL, AST_DLLIST_REMOVE_VERIFY, AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN, AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END, AST_DLLIST_TRAVERSE_SAFE_BEGIN, AST_DLLIST_TRAVERSE_SAFE_END, ast_free, ast_str_create, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, b, buf, c, d, test_val::dbl_list, ELEM_OR_FAIL, sip_to_pjsip::info(), MATCH_OR_FAIL_DBL, NULL, RAII_VAR, TEST_EXECUTE, and TEST_INIT.

◆ AST_TEST_DEFINE() [2/2]

AST_TEST_DEFINE ( single_ll_tests  )

Definition at line 125 of file test_linkedlists.c.

126{
127 RAII_VAR(struct ast_str *, buf, NULL, ast_free);
128 struct test_llist test_list = { 0, };
129 struct test_llist other_list = { 0, };
130 struct test_val *bogus;
131
132 switch (cmd) {
133 case TEST_INIT:
134 info->name = "ll_tests";
135 info->category = "/main/linkedlists/";
136 info->summary = "single linked list unit test";
137 info->description =
138 "Test the single linked list API";
139 return AST_TEST_NOT_RUN;
140 case TEST_EXECUTE:
141 break;
142 }
143
144 if (!(buf = ast_str_create(16))) {
145 return AST_TEST_FAIL;
146 }
147
148 if (!(bogus = ast_alloca(sizeof(*bogus)))) {
149 return AST_TEST_FAIL;
150 }
151 memset(bogus, 0, sizeof(*bogus));
152
153 if (AST_LIST_REMOVE(&test_list, bogus, list)) {
154 ast_test_status_update(test, "AST_LIST_REMOVE should safely return NULL for missing element from empty list\n");
155 return AST_TEST_FAIL;
156 }
157
158 /* INSERT_HEAD and REMOVE_HEAD tests */
159 AST_LIST_INSERT_HEAD(&test_list, &a, list);
160 MATCH_OR_FAIL(&test_list, "A", buf);
161 AST_LIST_INSERT_HEAD(&test_list, &b, list);
162 MATCH_OR_FAIL(&test_list, "BA", buf);
163 AST_LIST_REMOVE_HEAD(&test_list, list);
164 MATCH_OR_FAIL(&test_list, "A", buf);
165 AST_LIST_REMOVE_HEAD(&test_list, list);
166 MATCH_OR_FAIL(&test_list, "", buf);
167 if (AST_LIST_REMOVE_HEAD(&test_list, list)) {
168 ast_test_status_update(test, "Somehow removed an item from the head of a list that didn't exist\n");
169 return AST_TEST_FAIL;
170 }
171 MATCH_OR_FAIL(&test_list, "", buf);
172
173 /* Check empty list test */
174
175 if (!AST_LIST_EMPTY(&test_list)) {
176 ast_test_status_update(test, "List should be empty\n");
177 return AST_TEST_FAIL;
178 }
179
180 /* Insert tail and remove specific item tests. */
181
182 AST_LIST_INSERT_TAIL(&test_list, &a, list);
183 MATCH_OR_FAIL(&test_list, "A", buf);
184 AST_LIST_INSERT_TAIL(&test_list, &b, list);
185 MATCH_OR_FAIL(&test_list, "AB", buf);
186 AST_LIST_INSERT_TAIL(&test_list, &c, list);
187 MATCH_OR_FAIL(&test_list, "ABC", buf);
188 AST_LIST_INSERT_TAIL(&test_list, &d, list);
189 MATCH_OR_FAIL(&test_list, "ABCD", buf);
190 if (AST_LIST_REMOVE(&test_list, bogus, list)) {
191 ast_test_status_update(test, "AST_LIST_REMOVE should safely return NULL for missing element\n");
192 return AST_TEST_FAIL;
193 }
194 bogus = NULL;
195 if (AST_LIST_REMOVE(&test_list, bogus, list)) {
196 ast_test_status_update(test, "AST_LIST_REMOVE should safely return NULL for element set to NULL\n");
197 return AST_TEST_FAIL;
198 }
199 AST_LIST_REMOVE(&test_list, &b, list);
200 MATCH_OR_FAIL(&test_list, "ACD", buf);
201 AST_LIST_REMOVE(&test_list, &d, list);
202 MATCH_OR_FAIL(&test_list, "AC", buf);
203 AST_LIST_REMOVE(&test_list, &a, list);
204 MATCH_OR_FAIL(&test_list, "C", buf);
205 AST_LIST_REMOVE(&test_list, &c, list);
206 MATCH_OR_FAIL(&test_list, "", buf);
207 if (!AST_LIST_EMPTY(&test_list)) {
208 ast_test_status_update(test, "List should be empty\n");
209 return AST_TEST_FAIL;
210 }
211 if (AST_LIST_REMOVE(&test_list, bogus, list)) {
212 ast_test_status_update(test, "AST_LIST_REMOVE should safely return NULL asked to remove a NULL pointer from an empty list\n");
213 return AST_TEST_FAIL;
214 }
215
216 /* Insert item after specific item tests */
217
218 AST_LIST_INSERT_HEAD(&test_list, &a, list);
219 MATCH_OR_FAIL(&test_list, "A", buf);
220 AST_LIST_INSERT_TAIL(&test_list, &c, list);
221 MATCH_OR_FAIL(&test_list, "AC", buf);
222 AST_LIST_INSERT_AFTER(&test_list, &a, &b, list);
223 MATCH_OR_FAIL(&test_list, "ABC", buf);
224 AST_LIST_INSERT_AFTER(&test_list, &c, &d, list);
225 MATCH_OR_FAIL(&test_list, "ABCD", buf);
226
227 ELEM_OR_FAIL(AST_LIST_FIRST(&test_list), &a);
228 ELEM_OR_FAIL(AST_LIST_LAST(&test_list), &d);
230
231 AST_LIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, list) {
233 }
235
236 if (!AST_LIST_EMPTY(&test_list)) {
237 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
238 return AST_TEST_FAIL;
239 }
240
241 /* Append list test */
242
243 AST_LIST_INSERT_HEAD(&test_list, &a, list);
244 MATCH_OR_FAIL(&test_list, "A", buf);
245 AST_LIST_INSERT_TAIL(&test_list, &b, list);
246 MATCH_OR_FAIL(&test_list, "AB", buf);
247 AST_LIST_INSERT_HEAD(&other_list, &c, list);
248 MATCH_OR_FAIL(&other_list, "C", buf);
249 AST_LIST_INSERT_TAIL(&other_list, &d, list);
250 MATCH_OR_FAIL(&other_list, "CD", buf);
251 AST_LIST_APPEND_LIST(&test_list, &other_list, list);
252 MATCH_OR_FAIL(&test_list, "ABCD", buf);
253 MATCH_OR_FAIL(&other_list, "", buf);
254 AST_LIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, list) {
256 }
258 if (!AST_LIST_EMPTY(&test_list)) {
259 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
260 return AST_TEST_FAIL;
261 }
262
263 /* Insert list after specific item in middle test */
264
265 AST_LIST_INSERT_HEAD(&test_list, &a, list);
266 MATCH_OR_FAIL(&test_list, "A", buf);
267 AST_LIST_INSERT_TAIL(&test_list, &d, list);
268 MATCH_OR_FAIL(&test_list, "AD", buf);
269 AST_LIST_INSERT_HEAD(&other_list, &b, list);
270 MATCH_OR_FAIL(&other_list, "B", buf);
271 AST_LIST_INSERT_TAIL(&other_list, &c, list);
272 MATCH_OR_FAIL(&other_list, "BC", buf);
273 AST_LIST_INSERT_LIST_AFTER(&test_list, &other_list, &a, list);
274 MATCH_OR_FAIL(&test_list, "ABCD", buf);
275 MATCH_OR_FAIL(&other_list, "", buf);
276 AST_LIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, list) {
278 }
280 if (!AST_LIST_EMPTY(&test_list)) {
281 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
282 return AST_TEST_FAIL;
283 }
284
285 /* Insert list after specific item on end test */
286
287 AST_LIST_INSERT_HEAD(&test_list, &a, list);
288 MATCH_OR_FAIL(&test_list, "A", buf);
289 AST_LIST_INSERT_TAIL(&test_list, &b, list);
290 MATCH_OR_FAIL(&test_list, "AB", buf);
291 AST_LIST_INSERT_HEAD(&other_list, &c, list);
292 MATCH_OR_FAIL(&other_list, "C", buf);
293 AST_LIST_INSERT_TAIL(&other_list, &d, list);
294 MATCH_OR_FAIL(&other_list, "CD", buf);
295 AST_LIST_INSERT_LIST_AFTER(&test_list, &other_list, &b, list);
296 MATCH_OR_FAIL(&test_list, "ABCD", buf);
297 MATCH_OR_FAIL(&other_list, "", buf);
298 AST_LIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, list) {
300 }
302 if (!AST_LIST_EMPTY(&test_list)) {
303 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
304 return AST_TEST_FAIL;
305 }
306
307 /* Safe traversal list modification tests */
308
309 AST_LIST_INSERT_HEAD(&test_list, &a, list);
310 MATCH_OR_FAIL(&test_list, "A", buf);
311 AST_LIST_INSERT_TAIL(&test_list, &d, list);
312 MATCH_OR_FAIL(&test_list, "AD", buf);
313 AST_LIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, list) {
314 if (bogus == &d) {
316 MATCH_OR_FAIL(&test_list, "ABD", buf);
318 MATCH_OR_FAIL(&test_list, "ABCD", buf);
320 MATCH_OR_FAIL(&test_list, "ABC", buf);
321 }
322 }
324 MATCH_OR_FAIL(&test_list, "ABC", buf);
325 AST_LIST_TRAVERSE_SAFE_BEGIN(&test_list, bogus, list) {
327 }
329 if (!AST_LIST_EMPTY(&test_list)) {
330 ast_test_status_update(test, "List should be empty after traversing and removal. It wasn't.\n");
331 return AST_TEST_FAIL;
332 }
333
334 return AST_TEST_PASS;
335}
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
Definition: linkedlists.h:429
#define AST_LIST_INSERT_LIST_AFTER(head, list, elm, field)
Inserts a whole list after a specific entry in a list.
Definition: linkedlists.h:812
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
Definition: linkedlists.h:450
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:731
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
#define AST_LIST_INSERT_BEFORE_CURRENT(elm, field)
Inserts a list entry before the current entry during a traversal.
Definition: linkedlists.h:599
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
Definition: linkedlists.h:711
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
Definition: linkedlists.h:856
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:557
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:833
#define AST_LIST_INSERT_AFTER(head, listelm, elm, field)
Inserts a list entry after a given entry.
Definition: linkedlists.h:695
#define AST_LIST_APPEND_LIST(head, list, field)
Appends a whole list to the tail of a list.
Definition: linkedlists.h:783
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
Definition: linkedlists.h:421
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Definition: linkedlists.h:439
struct test_val::@501 list
#define MATCH_OR_FAIL(list, val, retbuf)

References a, ast_alloca, ast_free, AST_LIST_APPEND_LIST, AST_LIST_EMPTY, AST_LIST_FIRST, AST_LIST_INSERT_AFTER, AST_LIST_INSERT_BEFORE_CURRENT, AST_LIST_INSERT_HEAD, AST_LIST_INSERT_LIST_AFTER, AST_LIST_INSERT_TAIL, AST_LIST_LAST, AST_LIST_NEXT, AST_LIST_REMOVE, AST_LIST_REMOVE_CURRENT, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_str_create, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, b, buf, c, d, ELEM_OR_FAIL, sip_to_pjsip::info(), test_val::list, MATCH_OR_FAIL, NULL, RAII_VAR, TEST_EXECUTE, and TEST_INIT.

◆ dbl_list_expect_forward()

static int dbl_list_expect_forward ( struct test_dbl_llist test_list,
const char *  expect,
struct ast_str **  buf 
)
static

Definition at line 66 of file test_linkedlists.c.

67{
68 struct test_val *i;
69
71 AST_DLLIST_TRAVERSE(test_list, i, dbl_list) {
72 ast_str_append(buf, 0, "%s", i->name);
73 }
74
75 return strcmp(expect, ast_str_buffer(*buf));
76}
#define AST_DLLIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: dlinkedlists.h:576
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1139
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
Definition: strings.h:693
const char * name

References AST_DLLIST_TRAVERSE, ast_str_append(), ast_str_buffer(), ast_str_reset(), buf, test_val::dbl_list, and test_val::name.

◆ dbl_list_expect_reverse()

static int dbl_list_expect_reverse ( struct test_dbl_llist test_list,
const char *  expect,
struct ast_str **  buf 
)
static

Definition at line 78 of file test_linkedlists.c.

79{
80 struct test_val *i;
81 char *str;
82 int len = strlen(expect);
83 int idx;
84
87 ast_str_append(buf, 0, "%s", i->name);
88 }
89
90 /* Check reverse string. */
92 if (len != strlen(str)) {
93 return 1;
94 }
95 for (idx = 0; idx < len; ++idx) {
96 if (expect[idx] != str[len - idx - 1]) {
97 return 1;
98 }
99 }
100 return 0;
101}
const char * str
Definition: app_jack.c:147
#define AST_DLLIST_TRAVERSE_BACKWARDS(head, var, field)
Loops over (traverses) the entries in a list in reverse order, starting at the end.
Definition: dlinkedlists.h:618
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)

References AST_DLLIST_TRAVERSE_BACKWARDS, ast_str_append(), ast_str_buffer(), ast_str_reset(), buf, test_val::dbl_list, len(), test_val::name, and str.

◆ list_expect()

static int list_expect ( struct test_llist test_list,
const char *  expect,
struct ast_str **  buf 
)
static

Definition at line 54 of file test_linkedlists.c.

55{
56 struct test_val *i;
57
59 AST_LIST_TRAVERSE(test_list, i, list) {
60 ast_str_append(buf, 0, "%s", i->name);
61 }
62
63 return strcmp(expect, ast_str_buffer(*buf));
64}
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491

References AST_LIST_TRAVERSE, ast_str_append(), ast_str_buffer(), ast_str_reset(), buf, test_val::list, and test_val::name.

◆ load_module()

static int load_module ( void  )
static

Definition at line 655 of file test_linkedlists.c.

656{
657 AST_TEST_REGISTER(single_ll_tests);
658 AST_TEST_REGISTER(double_ll_tests);
660}
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
#define AST_TEST_REGISTER(cb)
Definition: test.h:127

References AST_MODULE_LOAD_SUCCESS, and AST_TEST_REGISTER.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 648 of file test_linkedlists.c.

649{
650 AST_TEST_UNREGISTER(single_ll_tests);
651 AST_TEST_UNREGISTER(double_ll_tests);
652 return 0;
653}
#define AST_TEST_UNREGISTER(cb)
Definition: test.h:128

References AST_TEST_UNREGISTER.

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Test Linked Lists" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 662 of file test_linkedlists.c.

◆ a

struct test_val a = { "A" }
static
Examples
app_skel.c.

Definition at line 46 of file test_linkedlists.c.

Referenced by __ast_cli_generator(), __ast_cli_register(), __ast_format_def_register(), __ast_register_translator(), __bt_defcmp(), __bt_defpfx(), __bt_split(), __say_cli_init(), a2lsf(), aeap_cli_show(), age_cmp(), agent_handle_logoff_cmd(), agent_handle_show_all(), agent_handle_show_online(), agent_handle_show_specific(), agent_show_requested(), alias_show(), anaFilter(), analog_swap_subs(), ao2_iterator_init(), aoc_cli_debug_enable(), ari_mkpasswd(), ari_set_debug(), ari_show(), ari_show_app(), ari_show_apps(), ari_show_user(), ari_show_users(), ast_channel_internal_oldest_linkedid(), ast_channel_internal_swap_endpoint_forward(), ast_channel_internal_swap_snapshots(), ast_channel_internal_swap_topics(), ast_channel_internal_swap_uniqueid_and_linkedid(), ast_cli_command_full(), ast_extension_cmp(), ast_hashtab_compare_ints(), ast_hashtab_compare_shorts(), ast_hashtab_compare_strings(), ast_hashtab_compare_strings_nocase(), ast_namedgroups_intersect(), ast_prod(), ast_pthread_create_stack(), ast_sip_are_media_types_equal(), ast_sip_cli_traverse_objects(), ast_sip_is_media_type_in(), ast_sockaddr_cmp(), ast_sockaddr_cmp_addr(), AST_TEST_DEFINE(), ast_tvadd(), ast_tvsub(), ast_xml_doc_item_cmp_fn(), attestation_show(), bridge_show_specific_print_channel(), build_expression_queue(), check_switch_expr(), chk_div(), chk_minus(), chk_plus(), chk_times(), cli_alias_passthrough(), cli_complete_notify(), cli_complete_show(), cli_complete_subscription_callid(), cli_console_active(), cli_console_answer(), cli_console_autoanswer(), cli_console_dial(), cli_console_flash(), cli_console_hangup(), cli_console_mute(), cli_console_sendtext(), cli_dump_endpt(), cli_eprofile_show(), cli_eprofile_show_all(), cli_fax_set_debug(), cli_fax_show_capabilities(), cli_fax_show_session(), cli_fax_show_sessions(), cli_fax_show_settings(), cli_fax_show_stats(), cli_fax_show_version(), cli_list_available(), cli_list_devices(), cli_list_subscriptions_inout(), cli_mute_unmute_helper(), cli_notify(), cli_odbc_read(), cli_odbc_write(), cli_profile_show(), cli_profile_show_all(), cli_qualify(), cli_realtime_destroy(), cli_realtime_load(), cli_realtime_store(), cli_realtime_update(), cli_realtime_update2(), cli_register(), cli_reload_qualify_aor(), cli_reload_qualify_endpoint(), cli_show_channel(), cli_show_channels(), cli_show_endpoint_identifiers(), cli_show_help(), cli_show_module_options(), cli_show_module_type(), cli_show_module_types(), cli_show_modules(), cli_show_monitors(), cli_show_qualify_aor(), cli_show_qualify_endpoint(), cli_show_settings(), cli_show_subscription_inout(), cli_show_subscriptions_inout(), cli_show_tasks(), cli_subsystem_alert_report(), cli_tn_show(), cli_tn_show_all(), cli_tps_ping(), cli_tps_report(), cli_tps_reset_stats(), cli_tps_reset_stats_all(), cli_unregister(), cli_verification_show(), cli_verify_cert(), client_config_show(), client_config_show_all(), compare_categories(), compare_char(), complete_ari_app(), complete_ari_show_user(), complete_ari_user(), complete_channeltypes(), complete_country(), complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_context(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), complete_indications(), complete_ulimit(), complete_voicemail_move_message(), complete_voicemail_show_mailbox(), config_object_cli_show(), contact_transport_monitor_matcher(), convshort(), corosync_ping(), corosync_show_config(), corosync_show_members(), dahdi_create_channels(), dahdi_destroy_channels(), dahdi_restart_cmd(), dahdi_set_dnd(), dahdi_set_hwgain(), dahdi_set_mwi(), dahdi_set_swgain(), dahdi_show_channel(), dahdi_show_channels(), dahdi_show_status(), dahdi_show_version(), display_entry_list(), display_results(), display_single_entry(), dll_tests(), do_alignment_detection(), do_cli_dump_endpt(), do_say(), dummy_start(), dundi_do_lookup(), dundi_do_precache(), dundi_do_query(), dundi_flush(), dundi_set_debug(), dundi_show_cache(), dundi_show_entityid(), dundi_show_hints(), dundi_show_mappings(), dundi_show_peer(), dundi_show_peers(), dundi_show_precache(), dundi_show_requests(), dundi_show_trans(), dundi_store_history(), ext_cmp(), fax_session_tab_complete(), filter_history(), forward_message_from_mailbox(), fsk_serial(), function_realtime_store(), gen_events(), geoloc_config_cli_reload(), geoloc_config_list_locations(), geoloc_config_list_profiles(), geoloc_config_show_profiles(), geoloc_gml_list_to_xml(), group_show_channels(), GSM_ADD(), GSM_SUB(), handle_abort_shutdown(), handle_bridge_kick_channel(), handle_bridge_show_all(), handle_bridge_show_specific(), handle_bridge_technology_show(), handle_bridge_technology_suspend(), handle_cc_kill(), handle_cc_status(), handle_cdr_pgsql_status(), handle_chanlist(), handle_cli_ael_reload(), handle_cli_ael_set_debug(), handle_cli_agi_add_cmd(), handle_cli_agi_debug(), handle_cli_agi_dump_html(), handle_cli_agi_show(), handle_cli_check_permissions(), handle_cli_confbridge_kick(), handle_cli_confbridge_list(), handle_cli_confbridge_list_item(), handle_cli_confbridge_lock(), handle_cli_confbridge_mute(), handle_cli_confbridge_show_bridge_profile(), handle_cli_confbridge_show_bridge_profiles(), handle_cli_confbridge_show_menu(), handle_cli_confbridge_show_menus(), handle_cli_confbridge_show_user_profile(), handle_cli_confbridge_show_user_profiles(), handle_cli_confbridge_start_record(), handle_cli_confbridge_stop_record(), handle_cli_confbridge_unlock(), handle_cli_confbridge_unmute(), handle_cli_config_list(), handle_cli_config_reload(), handle_cli_core_show_channeltype(), handle_cli_core_show_channeltypes(), handle_cli_core_show_config_mappings(), handle_cli_core_show_file_formats(), handle_cli_core_show_translation(), handle_cli_database_del(), handle_cli_database_deltree(), handle_cli_database_get(), handle_cli_database_put(), handle_cli_database_query(), handle_cli_database_show(), handle_cli_database_showkey(), handle_cli_debug(), handle_cli_devstate_change(), handle_cli_devstate_list(), handle_cli_dialplan_add_extension(), handle_cli_dialplan_add_ignorepat(), handle_cli_dialplan_add_include(), handle_cli_dialplan_reload(), handle_cli_dialplan_remove_context(), handle_cli_dialplan_remove_extension(), handle_cli_dialplan_remove_ignorepat(), handle_cli_dialplan_remove_include(), handle_cli_dialplan_save(), handle_cli_dynamic_level_test(), handle_cli_file_convert(), handle_cli_iax2_provision(), handle_cli_iax2_prune_realtime(), handle_cli_iax2_set_debug(), handle_cli_iax2_set_debug_jb(), handle_cli_iax2_set_debug_trunk(), handle_cli_iax2_set_mtu(), handle_cli_iax2_show_cache(), handle_cli_iax2_show_callno_limits(), handle_cli_iax2_show_channels(), handle_cli_iax2_show_firmware(), handle_cli_iax2_show_netstats(), handle_cli_iax2_show_peer(), handle_cli_iax2_show_peers(), handle_cli_iax2_show_registry(), handle_cli_iax2_show_stats(), handle_cli_iax2_show_threads(), handle_cli_iax2_show_users(), handle_cli_iax2_test_losspct(), handle_cli_iax2_unregister(), handle_cli_indication_add(), handle_cli_indication_remove(), handle_cli_indication_show(), handle_cli_keys_init(), handle_cli_keys_show(), handle_cli_locks_show(), handle_cli_malloc_trim(), handle_cli_mixmonitor(), handle_cli_mobile_cusd(), handle_cli_mobile_rfcomm(), handle_cli_mobile_search(), handle_cli_mobile_show_devices(), handle_cli_moh_reload(), handle_cli_moh_show_classes(), handle_cli_moh_show_files(), handle_cli_moh_unregister_class(), handle_cli_odbc_show(), handle_cli_ooh323_reload(), handle_cli_ooh323_set_debug(), handle_cli_ooh323_show_config(), handle_cli_ooh323_show_gk(), handle_cli_ooh323_show_peer(), handle_cli_ooh323_show_peers(), handle_cli_ooh323_show_user(), handle_cli_ooh323_show_users(), handle_cli_performance_test(), handle_cli_presencestate_change(), handle_cli_presencestate_list(), handle_cli_queue_test(), handle_cli_realtime_mysql_cache(), handle_cli_realtime_mysql_status(), handle_cli_realtime_pgsql_cache(), handle_cli_realtime_pgsql_status(), handle_cli_recalc(), handle_cli_refresh(), handle_cli_reload(), handle_cli_rtcp_set_debug(), handle_cli_rtcp_set_stats(), handle_cli_rtp_set_debug(), handle_cli_rtp_settings(), handle_cli_sched_bench(), handle_cli_sec_evt_test(), handle_cli_show(), handle_cli_show_config(), handle_cli_show_permissions(), handle_cli_sound_show(), handle_cli_sounds_show(), handle_cli_status(), handle_cli_stun_set_debug(), handle_cli_stun_show_status(), handle_cli_submit(), handle_cli_test_locales(), handle_cli_transcoder_show(), handle_cli_udptl_set_debug(), handle_cli_ulimit(), handle_cli_wait_fullybooted(), handle_commandmatchesarray(), handle_core_reload(), handle_core_set_debug_channel(), handle_core_show_image_formats(), handle_dahdi_show_cadences(), handle_debug(), handle_debug_category(), handle_debug_dialplan(), handle_debug_or_trace(), handle_dump_docs(), handle_dump_frames(), handle_eval_function(), handle_exec(), handle_export_primitives(), handle_feature_show(), handle_gml_show(), handle_help(), handle_kickmanconn(), handle_load(), handle_logger_add_channel(), handle_logger_chanloggroup_filter(), handle_logger_filter_reset(), handle_logger_filter_show(), handle_logger_mute(), handle_logger_reload(), handle_logger_remove_channel(), handle_logger_rotate(), handle_logger_set_level(), handle_logger_show_channels(), handle_logger_show_levels(), handle_manager_reload(), handle_manager_show_event(), handle_manager_show_events(), handle_manager_show_settings(), handle_mandebug(), handle_minivm_list_templates(), handle_minivm_reload(), handle_minivm_show_settings(), handle_minivm_show_stats(), handle_minivm_show_users(), handle_minivm_show_zones(), handle_modlist(), handle_nodebugchan_deprecated(), handle_orig(), handle_pjproject_set_log_level(), handle_pjproject_show_buildopts(), handle_pjproject_show_log_level(), handle_pjproject_show_log_mappings(), handle_pjsip_show_version(), handle_queue_add_member(), handle_queue_change_priority_caller(), handle_queue_pause_member(), handle_queue_reload(), handle_queue_remove_member(), handle_queue_reset(), handle_queue_rule_show(), handle_queue_set_member_penalty(), handle_queue_set_member_ringinuse(), handle_redirect(), handle_refresh(), handle_reload(), handle_remb_set(), handle_restart_gracefully(), handle_restart_now(), handle_restart_when_convenient(), handle_set_chanvar(), handle_set_extenpatternmatchnew(), handle_set_global(), handle_show_application(), handle_show_applications(), handle_show_calendar(), handle_show_calendars(), handle_show_calendars_types(), handle_show_chanvar(), handle_show_dialplan(), handle_show_function(), handle_show_functions(), handle_show_globals(), handle_show_hangup_all(), handle_show_hangup_channel(), handle_show_hint(), handle_show_hints(), handle_show_http(), handle_show_named_acl_cmd(), handle_show_parking_lot_cmd(), handle_show_profile(), handle_show_routes(), handle_show_settings(), handle_show_switches(), handle_show_sysinfo(), handle_show_threads(), handle_show_translation_path(), handle_show_translation_table(), handle_showcalls(), handle_showchan(), handle_showmanager(), handle_showmanagers(), handle_showmancmd(), handle_showmancmds(), handle_showmanconn(), handle_showmaneventq(), handle_showuptime(), handle_skel_show_config(), handle_skel_show_games(), handle_skel_show_levels(), handle_softhangup(), handle_stop_gracefully(), handle_stop_now(), handle_stop_when_convenient(), handle_trace(), handle_unload(), handle_unset_extenpatternmatchnew(), handle_verbose(), handle_version(), handle_voicemail_forward_message(), handle_voicemail_move_message(), handle_voicemail_reload(), handle_voicemail_remove_message(), handle_voicemail_show_aliases(), handle_voicemail_show_mailbox(), handle_voicemail_show_users(), handle_voicemail_show_zones(), has_state_changed(), hashtab_compare_strings(), iax_show_provisioning(), inner_product_single(), interpolate_product_single(), interval_hook_time_cmp(), levdurb(), locals_show(), lsf2a(), LSFinterpolate2a_dec(), LSFinterpolate2a_enc(), lua_extension_cmp(), main(), manager_iax2_show_peers(), MD5Transform(), media_cache_handle_create_item(), media_cache_handle_delete_item(), media_cache_handle_refresh_item(), media_cache_handle_show_all(), media_cache_handle_show_item(), media_cache_prnt_summary(), meetme_cmd_helper(), meetme_kick_cmd(), meetme_lock_cmd(), meetme_mute_cmd(), meetme_show_cmd(), method_logging_info_sort_cmp(), module_vector_cmp(), module_vector_strcasecmp(), moh_filename_strcasecmp(), monitor_matcher(), move_message_from_mailbox(), my_cli_traverse_objects(), my_swap_subchannels(), op_and(), op_colon(), op_compl(), op_cond(), op_div(), op_eq(), op_eqtilde(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_or(), op_plus(), op_rem(), op_tildetilde(), op_times(), P1(), P2(), pjsip_set_history(), pjsip_set_logger(), pjsip_show_history(), print_applicationmap(), print_event_instance(), print_featuregroup(), print_featuregroups(), prometheus_show_metrics(), prometheus_show_status(), ptr_matcher(), queue_show(), r_sign(), realtime_exec(), realtime_ldap_status(), remove_message_from_mailbox(), rescomp(), rtcp_do_debug_ip(), rtp_do_debug_ip(), rtp_transport_wide_cc_packet_statistics_cmp(), s_streamwait3(), say_date_generic(), say_enumeration_full(), say_full(), say_number_full(), sched_time_cmp(), search_directory_sub(), send_dtmf(), show_codec(), show_codecs(), show_license(), show_mailbox_details(), show_mailbox_snapshot(), show_messages_for_mailbox(), show_sound_info_cb(), show_sounds_cb(), show_users_cb(), show_warranty(), sla_show_stations(), sla_show_trunks(), SLEEP_SPINNER(), sorcery_memory_cache_cli_thrash(), sorcery_memory_cache_dump(), sorcery_memory_cache_expire(), sorcery_memory_cache_populate(), sorcery_memory_cache_show(), sorcery_memory_cache_stale(), stasis_app_to_cli(), stasis_show_topic(), stasis_show_topics(), status_debug_verbose(), str_appender(), subsystem_cmp(), swap_subs(), syntFilter(), timing_test(), tps_taskprocessor_tab_complete(), tvfix(), unistim_do_debug(), unistim_reload(), unistim_show_devices(), unistim_show_info(), unistim_sp(), unload_odbc(), wakeup_sub(), xmpp_cli_create_collection(), xmpp_cli_create_leafnode(), xmpp_cli_delete_pubsub_node(), xmpp_cli_list_pubsub_nodes(), xmpp_cli_purge_pubsub_nodes(), xmpp_do_set_debug(), xmpp_show_buddies(), and xmpp_show_clients().

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 662 of file test_linkedlists.c.

◆ b

struct test_val b = { "B" }
static

Definition at line 47 of file test_linkedlists.c.

Referenced by __ast_format_def_register(), __ast_register_translator(), __bt_defcmp(), __bt_defpfx(), __bt_open(), __bt_split(), _ast_hashtab_dup(), _ast_hashtab_insert_immediate_bucket(), _ast_hashtab_resize(), ael_yy_create_buffer(), ael_yy_delete_buffer(), ael_yy_flush_buffer(), ael_yy_init_buffer(), ael_yy_scan_buffer(), ael_yy_scan_bytes(), age_cmp(), analog_swap_subs(), ast_channel_internal_oldest_linkedid(), ast_channel_internal_swap_endpoint_forward(), ast_channel_internal_swap_snapshots(), ast_channel_internal_swap_topics(), ast_channel_internal_swap_uniqueid_and_linkedid(), ast_extension_cmp(), ast_hashtab_compare_ints(), ast_hashtab_compare_shorts(), ast_hashtab_compare_strings(), ast_hashtab_compare_strings_nocase(), ast_hashtab_lookup_internal(), ast_hashtab_remove_object_internal(), ast_hashtab_remove_object_via_lookup_nolock(), ast_hashtab_remove_this_object_nolock(), ast_namedgroups_intersect(), ast_sip_are_media_types_equal(), ast_sip_is_media_type_in(), ast_sockaddr_cmp(), ast_sockaddr_cmp_addr(), AST_TEST_DEFINE(), ast_tvadd(), ast_tvsub(), ast_xml_doc_item_cmp_fn(), ast_yy_create_buffer(), ast_yy_delete_buffer(), ast_yy_flush_buffer(), ast_yy_init_buffer(), ast_yy_scan_buffer(), ast_yy_scan_bytes(), callerid_feed(), callerid_feed_jp(), chk_div(), chk_minus(), chk_plus(), chk_times(), compare_categories(), compare_char(), contact_transport_monitor_matcher(), convshort(), dll_tests(), ext_cmp(), fbuf_append(), ffmpeg_decode(), ffmpeg_encode(), GSM_ADD(), GSM_SUB(), h261_decap(), h261_encap(), h263_decap(), h263_encap(), h263p_decap(), h263p_encap(), h264_decap(), h264_encap(), has_state_changed(), hashtab_compare_strings(), inner_product_single(), interpolate_product_single(), interval_hook_time_cmp(), lsf2a(), lua_extension_cmp(), MD5Transform(), method_logging_info_sort_cmp(), module_vector_cmp(), module_vector_strcasecmp(), moh_filename_strcasecmp(), monitor_matcher(), mpeg4_decap(), mpeg4_decode(), mpeg4_encap(), my_swap_subchannels(), op_and(), op_colon(), op_cond(), op_div(), op_eq(), op_eqtilde(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_or(), op_plus(), op_rem(), op_tildetilde(), op_times(), P2(), packsms7(), powiedz(), ptr_matcher(), r_sign(), rescomp(), rtp_transport_wide_cc_packet_statistics_cmp(), sched_time_cmp(), subsystem_cmp(), swap_subs(), tdd_feed(), unload_odbc(), unpacksms7(), and yy_get_next_buffer().

◆ c

struct test_val c = { "C" }
static

Definition at line 48 of file test_linkedlists.c.

Referenced by __analog_handle_event(), __ao2_callback(), __ao2_callback_data(), __ao2_find(), __ao2_unlink(), __ao2_weakproxy_find(), __ast_pbx_run(), __bt_curdel(), __bt_delete(), __bt_seqadv(), __bt_stkacq(), __has_voicemail(), _ast_hashtab_insert_immediate_bucket(), _ast_hashtab_resize(), acf_vmcount_exec(), action_getvar(), action_sendtext(), action_setvar(), action_timeout(), add_email_attachment(), agi_handle_command(), analog_call(), analog_my_getsigstr(), analog_new_ast_channel(), ao2_container_count(), ao2_iterator_init(), ast_add_extension(), ast_add_extension2_lockopt(), ast_add_extension_nolock(), ast_app_getdata(), ast_app_getdata_full(), ast_app_getdata_terminator(), ast_base64_encode_file(), ast_canmatch_extension(), ast_compile_ael2(), ast_context_add_ignorepat(), ast_context_add_include(), ast_context_add_include2(), ast_context_add_switch(), ast_context_ignorepats_count(), ast_context_includes_count(), ast_context_remove_extension_callerid(), ast_context_remove_ignorepat(), ast_context_remove_include(), ast_context_remove_switch(), ast_context_switches_count(), ast_el_read_char(), ast_escape(), ast_escape_c(), ast_exists_extension(), ast_extension_state(), ast_extension_state_extended(), ast_findlabel_extension(), ast_findlabel_extension2(), ast_get_context_registrar(), ast_get_extension_data(), ast_get_group(), ast_get_hint(), ast_get_namedgroups(), ast_hashtab_hash_string_sax(), ast_hint_extension(), ast_hint_extension_nolock(), ast_hint_presence_state(), ast_manager_hangup_helper(), ast_matchmore_extension(), ast_parse_digest(), ast_pbx_run(), ast_pbx_run_args(), ast_pbx_start(), ast_readstring(), ast_readstring_full(), ast_recvchar(), ast_settimeout(), ast_settimeout_full(), ast_smdi_interface_find(), ast_spawn_extension(), ast_str_get_hint(), ast_str_retrieve_variable(), ast_str_substitute_variables_full2(), AST_TEST_DEFINE(), ast_unescape_c(), ast_waitfor(), ast_waitfor_n(), ast_waitfor_nandfds(), ast_waitfordigit(), ast_waitfordigit_full(), ast_waitstream(), ast_waitstream_exten(), ast_waitstream_fr(), ast_waitstream_fr_w_cb(), ast_waitstream_full(), ast_writefile(), ast_xmldoc_printable(), bt_psplit(), build_bits(), build_channels(), c_prevword(), check_day(), check_dow(), check_month(), check_switch_expr(), chunked_atoh(), cli_complete_notify(), collect_digits(), common_exec(), compile_script(), complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_context(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), complete_mohclass_realtime(), complete_show_dialplan_context(), compress_char(), conf_add(), conf_del(), conf_run(), console_answer(), console_call(), console_hangup(), console_print(), container_destruct(), context_included(), conv65(), conv66(), coreshowchannelmap_add_to_map(), create_addr(), crypto_load_crl_store(), crypto_load_untrusted_cert_store(), crypto_show_cli_store(), dahdi_call(), dahdi_handle_event(), dahdi_read(), dahdi_sendtext(), destroy_cts(), dll_tests(), do_forward(), dtmf_info_incoming_request(), ebl_callback(), enum_callback(), ext_cmp1(), ext_cmp_pattern_pos(), extract_bits(), fileexists_test(), find_context_locked(), find_matching_endif(), find_matching_endwhile(), find_matching_priority(), find_ringing_channel(), func_channels_read(), function_ltrim(), function_rtrim(), function_trim(), generate_filenames_string(), generic_fax_exec(), get_device_state_causing_channels(), get_event(), getnum(), getqzname(), getzname(), handle_call_outgoing(), handle_cli_dialplan_remove_extension(), handle_cli_dialplan_save(), handle_cli_locks_show(), handle_core_set_debug_channel(), handle_dump_frames(), handle_eval_function(), handle_exec(), handle_hangup(), handle_softhangup(), handle_updates(), handle_uri(), headers_to_vars(), htonll(), httpd_process_request(), iax2_answer(), iax2_call(), iax2_digit_begin(), iax2_digit_end(), iax2_hangup(), iax2_indicate(), iax2_predestroy(), iax2_queryoption(), iax2_request(), iax2_sendhtml(), iax2_sendimage(), iax2_sendtext(), iax2_setoption(), iax2_transfer(), iax2_write(), iax_prov_complete_template(), include_alloc(), increase_call_count(), input(), internal_extension_state_extended(), isourconf(), ivr_dispatch(), load_dlopen(), load_dlopen_missing(), lookup_c_ip(), lookup_ci(), lua_find_extension(), main(), manager_mixmonitor(), manager_mute_mixmonitor(), manager_mutestream(), manager_show_dialplan_helper(), manager_stop_mixmonitor(), MD5Transform(), moh_rescan_files(), my_getsigstr(), ntohll(), ochar(), onAlerting(), onCallEstablished(), onProgress(), ooh323_onReceivedSetup(), ooh323c_call_thread(), ooh323c_start_call_thread(), op_cond(), P3(), parse_line(), parseintarg(), pbcwhere(), pbx_exec(), pbx_extension_helper(), pbx_load_users(), pbx_retrieve_variable(), pbx_substitute_variables_helper(), pbx_substitute_variables_helper_full(), pbx_substitute_variables_helper_full_location(), pbx_thread(), populate_addr(), print_file(), process_dahdi(), process_text_line(), read_some(), rebuild_channels(), request_channel(), rfcomm_append_buf(), rfcomm_read(), rfcomm_read_and_append_char(), rfcomm_read_and_expect_char(), rfcomm_read_command(), rfcomm_read_result(), rfcomm_read_until_crlf(), rfcomm_read_until_ok(), rotate_file(), run_agi(), safe_mkdir(), save_conference(), send_waveform_to_fd(), sendfax_exec(), serialize_showchan(), set_ext_pri(), setup_dahdi_int(), shift_pop(), show_debug_helper(), show_dialplan_helper(), smdi_read(), sms_messagetx(), socket_process_helper(), socket_receive_file_to_buff(), softhangup_exec(), speex_get_wb_sz_at(), speex_samples(), split_ec(), srv_callback(), store_tone_zone_ring_cadence(), strbetween(), t30_phase_e_handler(), table_config_for_table_name(), table_configs_free(), tdd_feed(), tdd_generate(), test_2way_function(), test_chan_function(), test_chan_integer(), test_chan_integer_accessor(), test_chan_string(), test_chan_variable(), test_expected_result(), try_hangup(), try_load_key(), try_redirect(), txt_callback(), unistim_sp(), verify_key(), wait_for_answer(), waitstream_control(), waitstream_core(), while(), write_entry_history(), write_history(), xmldoc_setpostbr(), xmpp_client_receive(), and yyunput().

◆ d

struct test_val d = { "D" }
static

Definition at line 49 of file test_linkedlists.c.

Referenced by __ast_play_and_record(), add_fingerprints_if_present(), ast_mwi_state_callback_all(), ast_mwi_state_callback_subscribed(), ast_parse_digest(), ast_play_and_wait(), ast_playtones_start(), ast_readstring_full(), AST_TEST_DEFINE(), ast_tonepair_start(), auth_http_callback(), block4(), build_device(), calc_rxstamp_and_jitter(), change_favorite_icon(), conv65(), conv66(), datastore_destroy_cb(), delete_device(), destroy_session_details(), dll_tests(), find_line_by_number(), find_subchannel_by_name(), finish_bookmark(), g726_encode(), get_folder(), get_folder_ja(), get_unaligned_uint16(), get_unaligned_uint32(), get_unaligned_uint64(), h261_encap(), h263_encap(), h263p_encap(), h264_encap(), handle_call_outgoing(), handle_mwi_state(), hash_test_count(), hash_test_grow(), hash_test_lookup(), hash_test_shrink(), is_key_favorite(), is_key_line(), key_select_extension(), lintog726_framein(), lintog726aal2_framein(), main(), MD5Transform(), mpeg4_encap(), numcpy(), P4(), P7(), parse_bookmark(), parse_naptr(), parse_node(), printdigest(), put_unaligned_uint16(), put_unaligned_uint32(), put_unaligned_uint64(), quantize(), rcv_mac_addr(), readdirqueue(), reload_config(), rxqcheck(), say_and_wait(), session_details_new(), sms_exec(), sms_nextoutgoing(), sms_readfile(), soft_key_visible(), tdd_decode_baudot(), transfer_call_step1(), transfer_cancel_step2(), transtime(), txqcheck(), unistim_alloc_sub(), unistim_answer(), unistim_hangup(), unistim_register(), unistim_request(), and unistim_unalloc_sub().