mirror of
https://gitee.com/apaki/unicstl.git
synced 2025-05-18 03:51:35 +08:00
将list修改为new的方式创建
This commit is contained in:
parent
98ead745ff
commit
51b761d120
154
demo/demo_list.c
154
demo/demo_list.c
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @file demo_list.c
|
* @file demo_list->c
|
||||||
* @author wenjf (Orig5826@163.com)
|
* @author wenjf (Orig5826@163.com)
|
||||||
* @brief
|
* @brief
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
@ -18,128 +18,128 @@ static void demo_list_num(void)
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
int len = sizeof(data) / sizeof(data[0]);
|
int len = sizeof(data) / sizeof(data[0]);
|
||||||
|
|
||||||
struct _list list;
|
list_t list = list_new();
|
||||||
list_init2(&list, sizeof(int), 64);
|
list_init2(list, sizeof(int), 64);
|
||||||
list.print_obj = print_num;
|
list->print_obj = print_num;
|
||||||
|
|
||||||
printf("\n\n----- list_demo_num -----\n");
|
printf("\n\n----- list_demo_num -----\n");
|
||||||
printf("----- push -----\n");
|
printf("----- push -----\n");
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
list.append(&list, &data[i]);
|
list->append(list, &data[i]);
|
||||||
}
|
}
|
||||||
printf("----- print -----\n");
|
printf("----- print -----\n");
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- pop -----\n");
|
printf("----- pop -----\n");
|
||||||
list.pop(&list, 9, NULL);
|
list->pop(list, 9, NULL);
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
list.pop(&list, 0, NULL);
|
list->pop(list, 0, NULL);
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
list.pop(&list, 4, NULL);
|
list->pop(list, 4, NULL);
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- clear -----\n");
|
printf("----- clear -----\n");
|
||||||
list.clear(&list);
|
list->clear(list);
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- push -----\n");
|
printf("----- push -----\n");
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
list.append(&list, &data[i]);
|
list->append(list, &data[i]);
|
||||||
}
|
}
|
||||||
printf("----- print -----\n");
|
printf("----- print -----\n");
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- get -----\n");
|
printf("----- get -----\n");
|
||||||
index = 0;
|
index = 0;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
index = 4;
|
index = 4;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
index = 9;
|
index = 9;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
|
|
||||||
printf("----- set -----\n");
|
printf("----- set -----\n");
|
||||||
index = 0;
|
index = 0;
|
||||||
temp = 11;
|
temp = 11;
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
index = 4;
|
index = 4;
|
||||||
temp = 22;
|
temp = 22;
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
index = 9;
|
index = 9;
|
||||||
temp = 33;
|
temp = 33;
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
printf("----- print -----\n");
|
printf("----- print -----\n");
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
printf("----- at like python -----\n");
|
printf("----- at like python -----\n");
|
||||||
index = -1;
|
index = -1;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
index = -6;
|
index = -6;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
index = -10;
|
index = -10;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
printf("----- set like python -----\n");
|
printf("----- set like python -----\n");
|
||||||
index = -1;
|
index = -1;
|
||||||
temp = 99;
|
temp = 99;
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
index = -6;
|
index = -6;
|
||||||
temp = 98;
|
temp = 98;
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
index = -10;
|
index = -10;
|
||||||
temp = 97;
|
temp = 97;
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = %2d\n", index, temp);
|
printf("list[%4d] = %2d\n", index, temp);
|
||||||
|
|
||||||
printf("----- print -----\n");
|
printf("----- print -----\n");
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- pop -----\n");
|
printf("----- pop -----\n");
|
||||||
for (i = 0; i < len + 1; i++)
|
for (i = 0; i < len + 1; i++)
|
||||||
{
|
{
|
||||||
list.pop(&list, 0, &temp);
|
list->pop(list, 0, &temp);
|
||||||
|
|
||||||
if (list.empty(&list))
|
if (list->empty(list))
|
||||||
{
|
{
|
||||||
printf("----- empty -----\n");
|
printf("----- empty -----\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list.destory(&list);
|
list_free(&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void demo_list_struct(void)
|
static void demo_list_struct(void)
|
||||||
@ -154,121 +154,121 @@ static void demo_list_struct(void)
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
int len = sizeof(data) / sizeof(data[0]);
|
int len = sizeof(data) / sizeof(data[0]);
|
||||||
|
|
||||||
struct _list list;
|
list_t list = list_new();
|
||||||
list_init2(&list, sizeof(struct _student), 64);
|
list_init2(list, sizeof(struct _student), 64);
|
||||||
list.print_obj = print_struct;
|
list->print_obj = print_struct;
|
||||||
|
|
||||||
printf("\n\n----- list_demo_num -----\n");
|
printf("\n\n----- list_demo_num -----\n");
|
||||||
printf("----- push -----\n");
|
printf("----- push -----\n");
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
list.append(&list, &data[i]);
|
list->append(list, &data[i]);
|
||||||
}
|
}
|
||||||
printf("----- print -----\n");
|
printf("----- print -----\n");
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- pop -----\n");
|
printf("----- pop -----\n");
|
||||||
list.pop(&list, 9, NULL);
|
list->pop(list, 9, NULL);
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
list.pop(&list, 0, NULL);
|
list->pop(list, 0, NULL);
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
list.pop(&list, 4, NULL);
|
list->pop(list, 4, NULL);
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- clear -----\n");
|
printf("----- clear -----\n");
|
||||||
list.clear(&list);
|
list->clear(list);
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- push -----\n");
|
printf("----- push -----\n");
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
list.append(&list, &data[i]);
|
list->append(list, &data[i]);
|
||||||
}
|
}
|
||||||
printf("----- print -----\n");
|
printf("----- print -----\n");
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- at -----\n");
|
printf("----- at -----\n");
|
||||||
index = 0;
|
index = 0;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
index = 4;
|
index = 4;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
index = 9;
|
index = 9;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
|
||||||
printf("----- set -----\n");
|
printf("----- set -----\n");
|
||||||
index = 0;
|
index = 0;
|
||||||
temp.id = 11;
|
temp.id = 11;
|
||||||
sprintf(temp.name, "robot_%02d", temp.id);
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
index = 4;
|
index = 4;
|
||||||
temp.id = 22;
|
temp.id = 22;
|
||||||
sprintf(temp.name, "robot_%02d", temp.id);
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
index = 9;
|
index = 9;
|
||||||
temp.id = 33;
|
temp.id = 33;
|
||||||
sprintf(temp.name, "robot_%02d", temp.id);
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
printf("----- print -----\n");
|
printf("----- print -----\n");
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
printf("----- at like python -----\n");
|
printf("----- at like python -----\n");
|
||||||
index = -1;
|
index = -1;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
index = -6;
|
index = -6;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
index = -10;
|
index = -10;
|
||||||
list.get(&list, index, &temp);
|
list->get(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
printf("----- set like python -----\n");
|
printf("----- set like python -----\n");
|
||||||
index = -1;
|
index = -1;
|
||||||
temp.id = 99;
|
temp.id = 99;
|
||||||
sprintf(temp.name, "robot_%02d", temp.id);
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
index = -6;
|
index = -6;
|
||||||
temp.id = 98;
|
temp.id = 98;
|
||||||
sprintf(temp.name, "robot_%02d", temp.id);
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
index = -10;
|
index = -10;
|
||||||
//temp.id = 97;
|
//temp.id = 97;
|
||||||
@ -277,27 +277,27 @@ static void demo_list_struct(void)
|
|||||||
// struct _student robot = {"robot", 97};
|
// struct _student robot = {"robot", 97};
|
||||||
// temp = robot;
|
// temp = robot;
|
||||||
temp = (struct _student){"robot", 97};
|
temp = (struct _student){"robot", 97};
|
||||||
list.set(&list, index, &temp);
|
list->set(list, index, &temp);
|
||||||
printf("list[%4d] = ", index);
|
printf("list[%4d] = ", index);
|
||||||
list.print_obj(&temp); printf("\n");
|
list->print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
printf("----- print -----\n");
|
printf("----- print -----\n");
|
||||||
list.print(&list);
|
list->print(list);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("----- pop -----\n");
|
printf("----- pop -----\n");
|
||||||
for (i = 0; i < len + 1; i++)
|
for (i = 0; i < len + 1; i++)
|
||||||
{
|
{
|
||||||
list.pop(&list, 0, &temp);
|
list->pop(list, 0, &temp);
|
||||||
|
|
||||||
if (list.empty(&list))
|
if (list->empty(list))
|
||||||
{
|
{
|
||||||
printf("----- empty -----\n");
|
printf("----- empty -----\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list.destory(&list);
|
list_free(&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void demo_list(void)
|
void demo_list(void)
|
||||||
|
153
test/test_list.c
153
test/test_list.c
@ -219,6 +219,159 @@ static void test_list_num(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
static void demo_list_struct(void)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
struct _student data[] = {
|
||||||
|
"zhao", 1001, "qian", 1002, "sun", 1003, "li", 1004,
|
||||||
|
"zhou", 1005, "wu", 1006, "zheng", 1007, "wang", 1008,
|
||||||
|
"feng", 1009, "cheng",1010,
|
||||||
|
};
|
||||||
|
struct _student temp = {0};
|
||||||
|
int index = 0;
|
||||||
|
int len = sizeof(data) / sizeof(data[0]);
|
||||||
|
|
||||||
|
list_t list = NULL;
|
||||||
|
list = list_new();
|
||||||
|
list_init(list, sizeof(struct _student), 64);
|
||||||
|
list->print_obj = print_struct;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
TEST_ASSERT_TRUE(list->append(&list, &data[i]));
|
||||||
|
}
|
||||||
|
TEST_ASSERT_TRUE(list->pop(&list, 9, NULL));
|
||||||
|
list.print(&list);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
list.pop(&list, 0, NULL);
|
||||||
|
list.print(&list);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
list.pop(&list, 4, NULL);
|
||||||
|
list.print(&list);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
printf("----- clear -----\n");
|
||||||
|
list.clear(&list);
|
||||||
|
list.print(&list);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
printf("----- push -----\n");
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
list.append(&list, &data[i]);
|
||||||
|
}
|
||||||
|
printf("----- print -----\n");
|
||||||
|
list.print(&list);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
printf("----- at -----\n");
|
||||||
|
index = 0;
|
||||||
|
list.get(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
index = 4;
|
||||||
|
list.get(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
index = 9;
|
||||||
|
list.get(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
|
||||||
|
printf("----- set -----\n");
|
||||||
|
index = 0;
|
||||||
|
temp.id = 11;
|
||||||
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
|
list.set(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
index = 4;
|
||||||
|
temp.id = 22;
|
||||||
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
|
list.set(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
index = 9;
|
||||||
|
temp.id = 33;
|
||||||
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
|
list.set(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
printf("----- print -----\n");
|
||||||
|
list.print(&list);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
|
printf("----- at like python -----\n");
|
||||||
|
index = -1;
|
||||||
|
list.get(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
index = -6;
|
||||||
|
list.get(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
index = -10;
|
||||||
|
list.get(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
printf("----- set like python -----\n");
|
||||||
|
index = -1;
|
||||||
|
temp.id = 99;
|
||||||
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
|
list.set(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
index = -6;
|
||||||
|
temp.id = 98;
|
||||||
|
sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
|
list.set(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
index = -10;
|
||||||
|
//temp.id = 97;
|
||||||
|
//sprintf(temp.name, "robot_%02d", temp.id);
|
||||||
|
// temp = data[0];
|
||||||
|
// struct _student robot = {"robot", 97};
|
||||||
|
// temp = robot;
|
||||||
|
temp = (struct _student){"robot", 97};
|
||||||
|
list.set(&list, index, &temp);
|
||||||
|
printf("list[%4d] = ", index);
|
||||||
|
list.print_obj(&temp); printf("\n");
|
||||||
|
|
||||||
|
printf("----- print -----\n");
|
||||||
|
list.print(&list);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
printf("----- pop -----\n");
|
||||||
|
for (i = 0; i < len + 1; i++)
|
||||||
|
{
|
||||||
|
list.pop(&list, 0, &temp);
|
||||||
|
|
||||||
|
if (list.empty(&list))
|
||||||
|
{
|
||||||
|
printf("----- empty -----\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list.destory(&list);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #if 0
|
||||||
static void test_list_struct(void)
|
static void test_list_struct(void)
|
||||||
{
|
{
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user