comparison dowa/dowa_test.c @ 92:655ea0b661fd

[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
author June Park <parkjune1995@gmail.com>
date Fri, 02 Jan 2026 17:47:10 -0800
parents d39e8860a361
children
comparison
equal deleted inserted replaced
91:19cccf6e866a 92:655ea0b661fd
1 #include <stdio.h> 1 #include <stdio.h>
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <string.h> 3 #include <string.h>
4 #include <assert.h> 4 #include <assert.h>
5 #define DIRECTORY
6 #include "dowa.h" 5 #include "dowa.h"
6 #include <time.h>
7 7
8 int main(void) 8 int main(void)
9 { 9 {
10 printf("=== Testing NEW dowa API (stb_ds style) ===\n\n"); 10 printf("=== Testing NEW dowa API (stb_ds style) ===\n\n");
11 11
294 for (int32 i = 0; i < arr_length; i++) 294 for (int32 i = 0; i < arr_length; i++)
295 printf("%s\n", arr[i]); 295 printf("%s\n", arr[i]);
296 Dowa_Arena_Free(p_arena); 296 Dowa_Arena_Free(p_arena);
297 } 297 }
298 298
299 printf("\n Arena Copy string\n\n");
300 {
301 char *from = "copy_this";
302 Dowa_Arena *p_arena = Dowa_Arena_Create(1024);
303
304 char *value = Dowa_String_Copy_Arena(from, p_arena);
305 assert(strcmp(value, from) == 0);
306 assert(value[9] == '\0');
307
308 Dowa_Arena_Free(p_arena);
309 }
310
311
312 printf("\n UUID\n\n");
313 {
314 char *uuid = Dowa_String_UUID((uint32)time(NULL), NULL);
315 printf("UUID %s\n", uuid);
316 }
317
318 printf("=== Math/Random === \n\n");
319
320 printf("\n RandomNumberGenerator\n\n");
321 {
322 uint32 seed_number = 32;
323 uint32 random_number = Dowa_Math_Random_Uint32(seed_number);
324 uint32 random_number2 = Dowa_Math_Random_Uint32(random_number);
325 printf("randon_number 1: %i\n", random_number);
326 printf("randon_number 2: %i\n", random_number2);
327 }
328
299 printf("=== All tests passed! ===\n"); 329 printf("=== All tests passed! ===\n");
300 return 0; 330 return 0;
301 } 331 }