X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=test%2Fcstring.c;h=217566393b39638345ecbd20fe5f7cc3e6760188;hb=f92a7609f7b4a6c72a892b16d371528213eca283;hp=a1d2b2c681447111fa1d416e8f06629dea2efbdd;hpb=71843db5886f60d3959d966a5e062a516c24798e;p=smdp.git diff --git a/test/cstring.c b/test/cstring.c index a1d2b2c..2175663 100644 --- a/test/cstring.c +++ b/test/cstring.c @@ -1,43 +1,43 @@ #include #include "../include/cstring.h" +#include "../cstring.c" int main(int argc, char *argv[]) { // testing with char cstring_t *p = cstring_init(); - printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - - (p->delete)(p); - - // testing with char array - p = cstring_init(); - printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); + printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + + (p->reset)(p); + printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); char x[2] = {'X', '\0'}; - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); (p->delete)(p); + + return(0); }