summaryrefslogtreecommitdiff
path: root/test/test_add_elem.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_add_elem.c')
-rw-r--r--test/test_add_elem.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/test_add_elem.c b/test/test_add_elem.c
index 5244880..7a789d1 100644
--- a/test/test_add_elem.c
+++ b/test/test_add_elem.c
@@ -66,10 +66,10 @@ int main()
nb_u8 id;
nb_u8arr name;
- netbyte_store nb;
+ netbyte_store *nb=malloc(sizeof(netbyte_store));
printf("Start test\n");
- nb_init( &nb );
+ nb_init( nb );
printf("Your name : "); fflush( stdin );
n = fgets( str, STR_SIZE, stdin );
@@ -82,21 +82,23 @@ int main()
printf("er create u8arr: %d\n",er);
- er = nb_add_u8( &nb, &id );
+ er = nb_add_u8( nb, &id );
if (er)
printf("er add u8: %d\n",er);
- er = nb_add_u8arr( &nb, &name );
+ er = nb_add_u8arr( nb, &name );
if (er)
printf("er add u8arr: %d\n",er);
- pr_store( &nb );
- res = nb_create( &nb );
+ pr_store( nb );
+ res = nb_create( nb );
f = fopen("test_many.nb","a");
- fwrite( res, 1, nb.size , f );
+ fwrite( res, 1, nb->size , f );
fclose( f );
+ free(res);
+ nb_free(nb);
printf("End test\n");
return 0;