#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "list.h"
#include "utils.h"
Go to the source code of this file.
◆ OUT
Value: do { \
fprintf(stdout, "%s: " fmt, __func__, ## __VA_ARGS__); \
} while (0);
Definition at line 13 of file test-list.c.
◆ init_list()
static void init_list |
( |
struct list_head * |
list | ) |
|
|
static |
Definition at line 17 of file test-list.c.
19 const char *vals[] = {
20 "zero",
"one",
"two",
"three",
"four",
"five",
"six",
21 "seven",
"eight",
"nine",
"ten",
"eleven",
"twelve"
25 OUT(
"list_add_tail: ");
27 struct item *e = malloc(
sizeof(
struct item));
30 fprintf(stdout,
"%s ", vals[i]);
32 fprintf(stdout,
"\n");
static void list_add_tail(struct list_head *_new, struct list_head *head)
static bool list_empty(const struct list_head *head)
◆ main()
Definition at line 112 of file test-list.c.
static void test_while_list_empty()
static void test_basics()
◆ test_basics()
static void test_basics |
( |
| ) |
|
|
static |
Definition at line 36 of file test-list.c.
52 OUT(
"removing 'twelve' and 'zero'\n");
68 OUT(
"moving 'one' to the tail\n");
76 OUT(
"list_for_each_entry: ");
80 fprintf(stdout,
"\n");
82 OUT(
"list_for_each_entry_reverse: ");
86 fprintf(stdout,
"\n");
88 OUT(
"delete all entries\n");
93 OUT(
"list_empty: %s\n",
list_empty(&test_list) ?
"yes" :
"no");
#define list_for_each_entry_reverse(p, h, field)
static void list_move_tail(struct list_head *entry, struct list_head *head)
#define LIST_HEAD_INIT(name)
static bool list_is_first(const struct list_head *list, const struct list_head *head)
#define list_for_each_entry_safe(p, n, h, field)
#define list_for_each_entry(p, h, field)
static void list_del(struct list_head *entry)
static bool list_is_last(const struct list_head *list, const struct list_head *head)
#define list_first_entry(ptr, type, field)
#define list_last_entry(ptr, type, field)
static void init_list(struct list_head *list)
◆ test_while_list_empty()
static void test_while_list_empty |
( |
| ) |
|
|
static |