c-ipfs/include/ipfs/node/testit.c_PREVIEW_DO_NOT_USE
2016-12-01 21:27:18 +02:00

37 lines
1.2 KiB
Text

testit.c
int main(int argc, char** argv)
{
printf("XETH TESTS\n");
//Variables of link:
char * name = "Alex";
char * ahash = "QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG";
struct Link mylink;
mylink = Create_Link(name,ahash);
printf("===================================\n" \
"Node Link:\n" \
" -Name: %s\n" \
" -Size: %lu\n" \
"\n Cid Details:\n\n" \
" -Version: %d\n" \
" -Codec: %c\n" \
" -Hash: %s\n" \
" -Hash Length: %lu\n" \
"====================================\n" \
, mylink.name, mylink.size, mylink.Lcid->version,mylink.Lcid->codec,mylink.Lcid->hash,mylink.Lcid->hash_length);
//Link Two for testing purposes
char * name2 = "Simo";
char * ahash2 = "QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnSimo";
struct Link mylink2;
mylink2 = Create_Link(name2,ahash2);
//
struct Node * mynode = N_Create_From_Link(mylink.Lcid, sizeof(mylink.Lcid));
mynode = N_Add_Link(&mynode, mylink2.Lcid, sizeof(mylink2.Lcid));
printf("Result pls: %s\n",mynode->links[0]->hash);
printf("LINKS: %d\n", mynode->link_ammount);
printf("Result pls2: %s\n",mynode->links[1]->hash);
Node_Free(mynode);
Free_Link(mylink);
Free_Link(mylink2);
unsigned char * data;
return 0;
}