testiterator.c
856 Bytes
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
45
46
47
48
49
50
#include <stdio.h>
#include "trbase.h"
#include "trdata.h"
int
main (int argc, char * argv[])
{
TR_List list = TR_new(TR_List);
TR_Queue queue = TR_new(TR_Queue);
list->free_msgs = 0;
((TR_List)queue)->free_msgs = 0;
TR_listPut(list, "a");
TR_listPut(list, "b");
TR_listPut(list, "c");
TR_iterableForeach(list) {
printf("%s\n", (char *)TR_iterableCurrent(list));
}
TR_listGetFirst(list);
TR_iterableForeach(list) {
printf("%s\n", (char *)TR_iterableCurrent(list));
}
TR_queuePut(queue, "1");
TR_queuePut(queue, "2");
TR_queuePut(queue, "3");
TR_iterableForeach(queue) {
printf("%s\n", (char *)TR_iterableCurrent(queue));
}
TR_queueGet(queue);
TR_iterableForeach(queue) {
printf("%s\n", (char *)TR_iterableCurrent(queue));
}
TR_delete(list);
TR_delete(queue);
TR_cleanup();
return 0;
}
// vim: set ts=4 sw=4: