annotate dowa/dowa_test.c @ 178:94705b5986b3

[ThirdParty] Added WRK and luajit for load testing.
author MrJuneJune <me@mrjunejune.com>
date Thu, 22 Jan 2026 20:10:30 -0800
parents 655ea0b661fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
1 #include <stdio.h>
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
2 #include <stdlib.h>
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
3 #include <string.h>
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
4 #include <assert.h>
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
5 #include "dowa.h"
92
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
6 #include <time.h>
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
7
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
8 int main(void)
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
9 {
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
10 printf("=== Testing NEW dowa API (stb_ds style) ===\n\n");
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
11
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
12 // --- Test Arena Allocator ---
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
13 printf("Testing Arena Allocator...\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
14 Dowa_Arena *p_arena = Dowa_Arena_Create(64);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
15 assert(p_arena && "Arena creation failed");
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
16
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
17 char *p_arena_mem1 = (char *)Dowa_Arena_Allocate(p_arena, 16);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
18 assert(p_arena_mem1 && "Arena allocation #1 failed");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
19 strcpy(p_arena_mem1, "hello arena");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
20 printf(" [Arena Allocate] mem1 = \"%s\"\n", p_arena_mem1);
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
21
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
22 char *p_arena_mem2 = (char *)Dowa_Arena_Allocate(p_arena, 8);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
23 assert(p_arena_mem2 && "Arena allocation #2 failed");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
24 strcpy(p_arena_mem2, "data");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
25 printf(" [Arena Allocate] mem2 = \"%s\"\n", p_arena_mem2);
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
26
72
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
27 Dowa_Arena_Free(p_arena);
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
28 printf(" [Arena] destroyed\n\n");
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
29
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
30 // --- Test Array Operations ---
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
31 printf("Testing Array Operations...\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
32 int32* p_numbers = NULL;
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
33
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
34 Dowa_Array_Push(p_numbers, 10);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
35 Dowa_Array_Push(p_numbers, 20);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
36 Dowa_Array_Push(p_numbers, 30);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
37 Dowa_Array_Push(p_numbers, 40);
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
38
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
39 printf(" Array length: %zu\n", Dowa_Array_Length(p_numbers));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
40 printf(" Array capacity: %zu\n", Dowa_Array_Capacity(p_numbers));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
41 printf(" Array contents:");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
42 for (size_t i = 0; i < Dowa_Array_Length(p_numbers); i++)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
43 printf(" %d", p_numbers[i]);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
44 printf("\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
45
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
46 int32 popped = Dowa_Array_Pop(p_numbers);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
47 printf(" Popped value: %d\n", popped);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
48 printf(" Array length after pop: %zu\n", Dowa_Array_Length(p_numbers));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
49
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
50 Dowa_Array_Clear(p_numbers);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
51 printf(" Array length after clear: %zu\n", Dowa_Array_Length(p_numbers));
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
52
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
53 Dowa_Array_Free(p_numbers);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
54 printf(" Array freed\n\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
55
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
56 // --- Test HashMap Basic Operations (String Keys) ---
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
57 printf("Testing HashMap with String Keys...\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
58 Dowa_KV(char*, char*)* p_map = NULL;
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
59
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
60 Dowa_HashMap_Push(p_map, "name", "John");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
61 Dowa_HashMap_Push(p_map, "city", "New York");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
62 Dowa_HashMap_Push(p_map, "country", "USA");
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
63
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
64 printf(" HashMap count: %zu\n", Dowa_HashMap_Count(p_map));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
65
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
66 void* p_kv = Dowa_HashMap_Get_Ptr(p_map, "name");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
67 if (p_kv)
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
68 {
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
69 Dowa_KV(char*, char*)* p_pair = (Dowa_KV(char*, char*)*)p_kv;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
70 printf(" HashMap['name']: %s\n", p_pair->value);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
71 }
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
72
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
73 p_kv = Dowa_HashMap_Get_Ptr(p_map, "city");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
74 if (p_kv)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
75 {
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
76 Dowa_KV(char*, char*)* p_pair = (Dowa_KV(char*, char*)*)p_kv;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
77 printf(" HashMap['city']: %s\n", p_pair->value);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
78 }
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
79
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
80 boolean has_name = Dowa_HashMap_Has_Key(p_map, "name");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
81 printf(" Has key 'name': %d\n", has_name);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
82
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
83 boolean has_missing = Dowa_HashMap_Has_Key(p_map, "missing");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
84 printf(" Has key 'missing': %d\n", has_missing);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
85
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
86 printf(" Iterating over HashMap:\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
87 size_t map_length = Dowa_Array_Length(p_map);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
88 for (size_t i = 0; i < map_length; i++)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
89 printf(" [%zu] '%s' => '%s'\n", i, p_map[i].key, p_map[i].value);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
90
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
91 Dowa_HashMap_Delete(p_map, "city");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
92 printf(" After deleting 'city', count: %zu\n", Dowa_HashMap_Count(p_map));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
93
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
94 Dowa_HashMap_Clear(p_map);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
95 printf(" After clear, count: %zu\n", Dowa_HashMap_Count(p_map));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
96
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
97 Dowa_HashMap_Free(p_map);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
98 printf(" HashMap freed\n\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
99
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
100 // --- Test HashMap with Int Keys (Binary) ---
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
101 printf("Testing HashMap with Int Keys...\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
102 Dowa_KV(int32, char*)* p_int_map = NULL;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
103
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
104 int32 key1 = 1;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
105 int32 key2 = 2;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
106 int32 key3 = 3;
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
107
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
108 Dowa_HashMap_Push_Binary(p_int_map, &key1, sizeof(int32), "one");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
109 Dowa_HashMap_Push_Binary(p_int_map, &key2, sizeof(int32), "two");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
110 Dowa_HashMap_Push_Binary(p_int_map, &key3, sizeof(int32), "three");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
111
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
112 printf(" Int map count: %zu\n", Dowa_HashMap_Count(p_int_map));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
113
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
114 p_kv = Dowa_HashMap_Get_Ptr_Binary(p_int_map, &key1, sizeof(int32));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
115 if (p_kv)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
116 {
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
117 Dowa_KV(int32, char*)* p_pair = (Dowa_KV(int32, char*)*)p_kv;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
118 printf(" Int map[1]: '%s'\n", p_pair->value);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
119 }
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
120
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
121 p_kv = Dowa_HashMap_Get_Ptr_Binary(p_int_map, &key2, sizeof(int32));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
122 if (p_kv)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
123 {
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
124 Dowa_KV(int32, char*)* p_pair = (Dowa_KV(int32, char*)*)p_kv;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
125 printf(" Int map[2]: '%s'\n", p_pair->value);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
126 }
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
127
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
128 printf(" Iterating over Int HashMap:\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
129 map_length = Dowa_Array_Length(p_int_map);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
130 for (size_t i = 0; i < map_length; i++)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
131 printf(" [%zu] %d => '%s'\n", i, p_int_map[i].key, p_int_map[i].value);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
132
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
133 Dowa_HashMap_Free(p_int_map);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
134 printf(" Int map freed\n\n");
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
135
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
136 // --- Test HashMap with Arena ---
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
137 printf("Testing HashMap with Arena...\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
138 Dowa_Arena *p_map_arena = Dowa_Arena_Create(1024);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
139 Dowa_KV(char*, int32) *p_arena_map = NULL;
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
140
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
141 Dowa_HashMap_Push_Arena(p_arena_map, "x", 100, p_map_arena);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
142 Dowa_HashMap_Push_Arena(p_arena_map, "y", 200, p_map_arena);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
143 Dowa_HashMap_Push_Arena(p_arena_map, "z", 300, p_map_arena);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
144
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
145 printf(" Arena map count: %zu\n", Dowa_HashMap_Count(p_arena_map));
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
146
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
147 p_kv = Dowa_HashMap_Get_Ptr(p_arena_map, "x");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
148 if (p_kv)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
149 {
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
150 Dowa_KV(char*, int32)* p_pair = (Dowa_KV(char*, int32)*)p_kv;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
151 printf(" Arena map['x']: %d\n", p_pair->value);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
152 }
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
153
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
154 p_kv = Dowa_HashMap_Get_Ptr(p_arena_map, "y");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
155 if (p_kv)
22
947b81010aba [Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents: 21
diff changeset
156 {
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
157 Dowa_KV(char*, int32)* p_pair = (Dowa_KV(char*, int32)*)p_kv;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
158 printf(" Arena map['y']: %d\n", p_pair->value);
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
159 }
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
160
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
161 printf(" Iterating over Arena HashMap:\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
162 map_length = Dowa_Array_Length(p_arena_map);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
163 for (size_t i = 0; i < map_length; i++)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
164 printf(" [%zu] '%s' => %d\n", i, p_arena_map[i].key, p_arena_map[i].value);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
165
72
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
166 Dowa_Arena_Free(p_map_arena);
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
167 printf(" Arena destroyed (including map)\n\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
168
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
169 // --- Test Array with Arena ---
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
170 printf("Testing Array with Arena...\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
171 Dowa_Arena *p_array_arena = Dowa_Arena_Create(1024);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
172 int32* p_arena_numbers = NULL;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
173
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
174 Dowa_Array_Push_Arena(p_arena_numbers, 5, p_array_arena);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
175 Dowa_Array_Push_Arena(p_arena_numbers, 10, p_array_arena);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
176 Dowa_Array_Push_Arena(p_arena_numbers, 15, p_array_arena);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
177
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
178 printf(" Arena array length: %zu\n", Dowa_Array_Length(p_arena_numbers));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
179 printf(" Arena array contents:");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
180 for (size_t i = 0; i < Dowa_Array_Length(p_arena_numbers); i++)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
181 printf(" %d", p_arena_numbers[i]);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
182 printf("\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
183
72
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
184 Dowa_Arena_Free(p_array_arena);
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
185 printf(" Arena destroyed (including array)\n\n");
21
09def63429b9 [Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
186
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
187 // --- Test Medium HashMap (Stress Test) ---
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
188 printf("Testing Medium HashMap (Stress Test)...\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
189 Dowa_KV(char*, int32)* p_large_map = NULL;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
190
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
191 char key_buffer[32];
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
192 for (int32 i = 0; i < 100; i++)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
193 {
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
194 sprintf(key_buffer, "key_%d", i);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
195 Dowa_HashMap_Push(p_large_map, key_buffer, i * 10);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
196 }
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
197
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
198 printf(" Medium map count: %zu\n", Dowa_HashMap_Count(p_large_map));
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
199
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
200 sprintf(key_buffer, "key_50");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
201 p_kv = Dowa_HashMap_Get_Ptr(p_large_map, key_buffer);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
202 if (p_kv)
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
203 {
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
204 Dowa_KV(char*, int32)* p_pair = (Dowa_KV(char*, int32)*)p_kv;
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
205 printf(" Medium map['key_50']: %d\n", p_pair->value);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
206 }
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
207
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
208 sprintf(key_buffer, "key_99");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
209 boolean has_99 = Dowa_HashMap_Has_Key(p_large_map, key_buffer);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
210 printf(" Has key 'key_99': %d\n", has_99);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
211
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
212 Dowa_HashMap_Free(p_large_map);
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
213 printf(" Medium map freed\n\n");
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
214
87
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
215 // --- Test Key Storage Integrity ---
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
216 printf("Testing Key Storage Integrity (Regression Test)...\n");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
217 Dowa_KV(char*, char*)* p_integrity_map = NULL;
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
218
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
219 // Simple test first
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
220 Dowa_HashMap_Push(p_integrity_map, "HTTP_Method", "GET");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
221 Dowa_HashMap_Push(p_integrity_map, "Path", "/index.html");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
222
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
223 printf(" Testing simple 2-key map...\n");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
224 void* p_method = Dowa_HashMap_Get_Ptr(p_integrity_map, "HTTP_Method");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
225 void* p_path = Dowa_HashMap_Get_Ptr(p_integrity_map, "Path");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
226
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
227 if (p_method && p_path)
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
228 {
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
229 Dowa_KV(char*, char*)* p_m = (Dowa_KV(char*, char*)*)p_method;
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
230 Dowa_KV(char*, char*)* p_p = (Dowa_KV(char*, char*)*)p_path;
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
231 printf(" Method: key='%s', value='%s'\n", p_m->key, p_m->value);
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
232 printf(" Path: key='%s', value='%s'\n", p_p->key, p_p->value);
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
233 printf(" PASS: Simple test passed\n");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
234 }
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
235 else
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
236 {
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
237 printf(" FAIL: Could not find keys\n");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
238 }
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
239
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
240 Dowa_HashMap_Free(p_integrity_map);
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
241 p_integrity_map = NULL;
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
242
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
243 // Test with arena allocator
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
244 printf(" Testing arena-allocated map...\n");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
245 Dowa_Arena *p_integrity_arena = Dowa_Arena_Create(4096);
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
246 Dowa_HashMap_Push_Arena(p_integrity_map, "HTTP_Method", "POST", p_integrity_arena);
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
247 Dowa_HashMap_Push_Arena(p_integrity_map, "Content-Type", "application/json", p_integrity_arena);
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
248
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
249 p_method = Dowa_HashMap_Get_Ptr(p_integrity_map, "HTTP_Method");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
250 void* p_content_type = Dowa_HashMap_Get_Ptr(p_integrity_map, "Content-Type");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
251
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
252 if (p_method && p_content_type)
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
253 {
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
254 Dowa_KV(char*, char*)* p_m = (Dowa_KV(char*, char*)*)p_method;
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
255 Dowa_KV(char*, char*)* p_ct = (Dowa_KV(char*, char*)*)p_content_type;
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
256 printf(" Method: key='%s', value='%s'\n", p_m->key, p_m->value);
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
257 printf(" Content-Type: key='%s', value='%s'\n", p_ct->key, p_ct->value);
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
258 printf(" PASS: Arena test passed\n");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
259 }
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
260 else
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
261 {
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
262 printf(" FAIL: Could not find keys\n");
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
263 }
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
264
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
265 Dowa_Arena_Free(p_integrity_arena);
d39e8860a361 [Dowa] There was alignment issues rea
June Park <parkjune1995@gmail.com>
parents: 72
diff changeset
266 printf(" Key integrity test complete\n\n");
72
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
267
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
268 printf("=== String Manipulations === \n\n");
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
269
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
270 printf(" Split strings without arena \n\n");
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
271 {
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
272 char *from = "june_park_hell";
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
273 char *token = "_";
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
274 Dowa_Arena *p_arena = NULL;
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
275
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
276 char **arr = Dowa_String_Split(from, token, strlen(from), 1, p_arena);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
277 int32 arr_length = Dowa_Array_Length(arr);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
278 printf("arr_length: %i\n", arr_length);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
279 for (int32 i = 0; i < arr_length; i++)
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
280 printf("%s\n", arr[i]);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
281 Dowa_Array_Free(arr);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
282 if (arr == NULL)
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
283 printf("Free properly\n");
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
284 }
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
285
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
286 printf("\n Split strings with arena \n\n");
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
287 {
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
288 char *from = "june_park_hell_arena";
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
289 char *token = "_";
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
290 Dowa_Arena *p_arena = Dowa_Arena_Create(1024);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
291
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
292 char **arr = Dowa_String_Split(from, token, strlen(from), 1, p_arena);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
293 int32 arr_length = Dowa_Array_Length(arr);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
294 for (int32 i = 0; i < arr_length; i++)
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
295 printf("%s\n", arr[i]);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
296 Dowa_Arena_Free(p_arena);
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
297 }
4532ce6d9eb8 [Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents: 71
diff changeset
298
92
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
299 printf("\n Arena Copy string\n\n");
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
300 {
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
301 char *from = "copy_this";
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
302 Dowa_Arena *p_arena = Dowa_Arena_Create(1024);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
303
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
304 char *value = Dowa_String_Copy_Arena(from, p_arena);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
305 assert(strcmp(value, from) == 0);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
306 assert(value[9] == '\0');
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
307
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
308 Dowa_Arena_Free(p_arena);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
309 }
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
310
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
311
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
312 printf("\n UUID\n\n");
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
313 {
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
314 char *uuid = Dowa_String_UUID((uint32)time(NULL), NULL);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
315 printf("UUID %s\n", uuid);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
316 }
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
317
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
318 printf("=== Math/Random === \n\n");
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
319
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
320 printf("\n RandomNumberGenerator\n\n");
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
321 {
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
322 uint32 seed_number = 32;
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
323 uint32 random_number = Dowa_Math_Random_Uint32(seed_number);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
324 uint32 random_number2 = Dowa_Math_Random_Uint32(random_number);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
325 printf("randon_number 1: %i\n", random_number);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
326 printf("randon_number 2: %i\n", random_number2);
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
327 }
655ea0b661fd [Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
June Park <parkjune1995@gmail.com>
parents: 87
diff changeset
328
71
75de5903355c Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents: 65
diff changeset
329 printf("=== All tests passed! ===\n");
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
330 return 0;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
331 }