2018-06-09 08:09:21 +00:00
|
|
|
/* ********************************************************
|
|
|
|
* This file is used to test the header file(list.h).
|
|
|
|
* When the project is finished, this file will be deleted.
|
|
|
|
* This file create by saturneric at 20:04 on Feb 7th.
|
|
|
|
* *******************************************************/
|
|
|
|
|
|
|
|
#include "list.h"
|
2018-06-10 09:21:11 +00:00
|
|
|
#include "list_expand.h"
|
2018-06-09 08:09:21 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv){
|
|
|
|
rand_init();
|
2018-06-11 07:00:08 +00:00
|
|
|
safeMode(1);
|
2018-06-09 08:09:21 +00:00
|
|
|
List *t_list = init_list();
|
|
|
|
|
2018-06-10 09:21:11 +00:00
|
|
|
/*for(int i = 0; i < 9; i++){
|
2018-06-09 08:09:21 +00:00
|
|
|
Node *t_node = init_node();
|
|
|
|
int *t_i = (int *)malloc(sizeof(int));
|
|
|
|
*t_i = i;
|
2018-06-10 09:21:11 +00:00
|
|
|
initMallocValue(t_node,"int",(void *)t_i);
|
2018-06-09 08:09:21 +00:00
|
|
|
insertInTail(t_list,t_node);
|
2018-06-10 09:21:11 +00:00
|
|
|
}*/
|
2018-06-09 08:09:21 +00:00
|
|
|
|
|
|
|
/*Node *t_node = init_node();
|
|
|
|
insertInTail(t_list,t_node);
|
2018-06-10 09:21:11 +00:00
|
|
|
initMalllocValue(t_node,(void *)"there");*/
|
|
|
|
|
|
|
|
for(int i = 0; i < 12; i++){
|
|
|
|
insertInHead(t_list, nodeWithInt(i));
|
2018-06-11 07:00:08 +00:00
|
|
|
insertInTail(t_list, nodeWithInt(i));
|
2018-06-10 09:21:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-11 07:00:08 +00:00
|
|
|
|
2018-06-10 09:21:11 +00:00
|
|
|
printListInfo(t_list,0);
|
|
|
|
printList(t_list);
|
2018-06-11 07:00:08 +00:00
|
|
|
List *m_list;
|
|
|
|
m_list = m_findByInt(t_list, 5);
|
|
|
|
printList(m_list);
|
2018-06-10 09:21:11 +00:00
|
|
|
printf("\n");
|
2018-06-11 07:00:08 +00:00
|
|
|
|
|
|
|
releaseAll();
|
2018-06-09 08:09:21 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|