2018-06-12 11:07:12 +00:00
|
|
|
#include "test.h"
|
|
|
|
|
2018-06-13 08:04:51 +00:00
|
|
|
|
2018-06-12 11:07:12 +00:00
|
|
|
int list(void) {
|
2018-07-18 03:53:09 +00:00
|
|
|
List *t_list, *m_list;;
|
2018-06-12 11:07:12 +00:00
|
|
|
safeModeForNode(1);
|
2018-07-18 03:53:09 +00:00
|
|
|
t_list = initList();
|
2018-06-12 11:07:12 +00:00
|
|
|
|
|
|
|
/*for(int i = 0; i < 9; i++){
|
|
|
|
Node *t_node = initNode();
|
|
|
|
int *t_i = (int *)malloc(sizeof(int));
|
|
|
|
*t_i = i;
|
|
|
|
initMallocValue(t_node,"int",(void *)t_i);
|
|
|
|
insertInTail(t_list,t_node);
|
|
|
|
}*/
|
|
|
|
|
|
|
|
/*Node *t_node = initNode();
|
|
|
|
insertInTail(t_list,t_node);
|
|
|
|
initMalllocValue(t_node,(void *)"there");*/
|
|
|
|
|
2018-07-23 04:59:16 +00:00
|
|
|
for (int i = 0; i < 12; i++) {
|
2018-06-12 11:07:12 +00:00
|
|
|
insertInHead(t_list, nodeWithInt(i));
|
|
|
|
insertInTail(t_list, nodeWithInt(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printListInfo(t_list, 0);
|
|
|
|
printList(t_list);
|
2018-07-18 03:53:09 +00:00
|
|
|
|
2018-06-12 11:07:12 +00:00
|
|
|
m_list = m_findByIntForNode(t_list, 5);
|
|
|
|
printList(m_list);
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
releaseAllForNode();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-06-13 08:32:39 +00:00
|
|
|
int _useTreeThroughDown(TNode *p_tnode, unsigned long long height) {
|
|
|
|
printTNode(p_tnode,0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-12 11:07:12 +00:00
|
|
|
int tree(void) {
|
2018-07-18 03:53:09 +00:00
|
|
|
TNode *t_tnode, *cr_tnode, *cl_tnode;
|
|
|
|
Tree *t_tree;
|
|
|
|
TNode *gs_tnode;
|
2018-06-12 11:07:12 +00:00
|
|
|
safeModeForTree(1);
|
2018-07-18 03:53:09 +00:00
|
|
|
t_tree = initTree();
|
|
|
|
t_tnode = tnodeWithInt(1);
|
|
|
|
cr_tnode = tnodeWithInt(3);
|
|
|
|
cl_tnode = tnodeWithInt(2);
|
2018-06-13 08:04:51 +00:00
|
|
|
addChildInRight(t_tnode, cl_tnode);
|
|
|
|
addChildInRight(t_tnode, cr_tnode);
|
|
|
|
addChildInRight(cl_tnode, tnodeWithInt(4));
|
2018-07-18 03:53:09 +00:00
|
|
|
gs_tnode = tnodeWithInt(5);
|
2018-06-13 08:32:39 +00:00
|
|
|
addChildInRight(cl_tnode,gs_tnode);
|
2018-06-13 08:04:51 +00:00
|
|
|
addChildInRight(cr_tnode, tnodeWithInt(6));
|
|
|
|
addChildInRight(cr_tnode, tnodeWithInt(7));
|
2018-06-13 08:32:39 +00:00
|
|
|
addChildInRight(gs_tnode, tnodeWithInt(8));
|
|
|
|
setRoot(t_tree, t_tnode);
|
|
|
|
TreeThroughUp(t_tree, _useTreeThroughDown);
|
|
|
|
//printTNodeWithFamily(t_tnode, 0);
|
2018-06-12 11:07:12 +00:00
|
|
|
releaseAllForTree();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int stack(void) {
|
2018-07-18 03:53:09 +00:00
|
|
|
int i;
|
2018-06-12 11:07:12 +00:00
|
|
|
Stack *t_stack = initStack();
|
2018-07-18 03:53:09 +00:00
|
|
|
for (i = 0; i < 10; i++) {
|
2018-06-12 11:07:12 +00:00
|
|
|
pushStack(t_stack, snodeWithInt(i));
|
|
|
|
}
|
2018-07-18 03:53:09 +00:00
|
|
|
for (i = 0; i < 10; i++) {
|
2018-06-12 11:07:12 +00:00
|
|
|
printf("%d", getValueByIntForSNode(popStack(t_stack)));
|
|
|
|
}
|
|
|
|
releaseStack(t_stack);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-07 04:10:55 +00:00
|
|
|
int main(int argc, char **argv) {
|
2018-08-17 08:58:15 +00:00
|
|
|
SID *p_sid = getS_id(VOID, 2);
|
|
|
|
s_idToASCIIString(p_sid);
|
|
|
|
printf("%s",p_sid->decrypt_str);
|
|
|
|
freeS_id(p_sid);
|
2018-06-12 11:07:12 +00:00
|
|
|
return 0;
|
2018-07-23 04:59:16 +00:00
|
|
|
}
|