rewrote Makefile + copyright and license infos
[smdp.git] / test / cstring.c
1 #include <stdio.h>
2
3 #include "../include/cstring.h"
4 #include "../cstring.c"
5
6 int main(int argc, char *argv[]) {
7
8     // testing with char
9     cstring_t *p = cstring_init();
10     printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
11
12     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
13     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
14     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
15     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
16     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
17     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
18     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
19     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
20     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
21     (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
22
23     (p->reset)(p);
24     printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
25
26     char x[2] = {'X', '\0'};
27
28     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
29     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
30     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
31     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
32     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
33     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
34     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
35     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
36     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
37     (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc);
38
39     (p->delete)(p);
40
41     return(0);
42 }
43