nodesystem/src/main.c

38 lines
1.1 KiB
C

#include<stdio.h>
#include "node.h"
int main(int argc, char** argv){
NOD_Node* node = NOD_CreateNode("test node");
NOD_Node* testchild = NOD_CreateNode("I'm just a child");
NOD_Node* otherchild = NOD_CreateNode("Another child");
NOD_Node* justtotest = NOD_CreateNode("This one is a test");
NOD_NodeAddChild(node, testchild);
NOD_NodeAddChild(node, otherchild);
NOD_NodeAddChild(node, justtotest);
NOD_NodeAddChild(node, justtotest);
NOD_NodeAddChild(node, justtotest);
NOD_NodeAddChild(node, node);
NOD_NodeAddChild(testchild, node);
printf("\nThe name of the node is \"%s\"\n", node->name);
for(int i = 0; i < node->childc; i++){
printf("Childnode: \"%s\"\n", node->childv[i]->name);
}
printf("\nThe name of the node is \"%s\"\n", node->name);
for(int i = 0; i < node->childc; i++){
printf("Childnode: \"%s\"\n", node->childv[i]->name);
}
printf("\nThe amount of children is %d, the real size is %d\n",
node->childc,
(int)sizeof(testchild)
);
NOD_DestroyNode(node);
NOD_DestroyNode(testchild);
return 0;
}