-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_str.c
45 lines (37 loc) · 1.17 KB
/
test_str.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <pylists4c.h>
int main()
{
LIST* pList = NULL;
char* string = NULL;
pList = list("1, 2, 3");
string = listStr(pList);
printf("%s\n", string);
listFreeStr(&string);
listClear(&pList);
printf("Allocated memory: %lu\n\n", listGetAllocatedMemory());
pList = list("\"abc\", \"def\", \"ghi\"");
string = listStr(pList);
printf("%s\n", string);
listFreeStr(&string);
listClear(&pList);
printf("Allocated memory: %lu\n\n", listGetAllocatedMemory());
pList = list("123, 456.789, 'abc', \"def\", ['r', 3, 'd', 5]");
string = listStr(pList);
printf("%s\n", string);
listFreeStr(&string);
listClear(&pList);
printf("Allocated memory: %lu\n\n", listGetAllocatedMemory());
pList = list("[1, 2], [3, 4], [5, 6]");
string = listStr(pList);
printf("%s\n", string);
listFreeStr(&string);
listClear(&pList);
printf("Allocated memory: %lu\n\n", listGetAllocatedMemory());
pList = list("\"a'b\", 'c\\d'");
string = listStr(pList);
printf("%s\n", string);
listFreeStr(&string);
listClear(&pList);
printf("Allocated memory: %lu\n\n", listGetAllocatedMemory());
return 0;
}