summaryrefslogtreecommitdiff
path: root/comp/cw/code/tokenizer/ads/dll/dlltest.c
diff options
context:
space:
mode:
Diffstat (limited to 'comp/cw/code/tokenizer/ads/dll/dlltest.c')
-rw-r--r--comp/cw/code/tokenizer/ads/dll/dlltest.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/comp/cw/code/tokenizer/ads/dll/dlltest.c b/comp/cw/code/tokenizer/ads/dll/dlltest.c
new file mode 100644
index 0000000..4544d2e
--- /dev/null
+++ b/comp/cw/code/tokenizer/ads/dll/dlltest.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+#include "dll.h"
+
+int main(){
+ dll_t *head = dllalloc();
+ dllsetdata(head, "hello");
+
+ for (int i = 0; i < 3; i++){
+ dll_t *node = dllalloc();
+ dllsetdata(node, "hi");
+ dllsetnext(head, node);
+ }
+
+ for (int i = 0; i < 4; i++)
+ printf("%s\n", (char *)dllgetat(head, i));
+ printf("%s\n", (char *)head->prev->next->data);
+
+ dllfreeall(head);
+}