2025-04-19 11:15:18 -05:00
|
|
|
/*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*
|
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
|
* File: Main.c
|
|
|
|
|
* Description:
|
|
|
|
|
* Executes all tests.
|
|
|
|
|
*
|
|
|
|
|
* Author: Mineplay
|
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
#include <stdio.h>
|
2025-05-07 04:33:25 -05:00
|
|
|
#include <Hallocy/Core/Allocator.h>
|
2025-04-19 15:14:30 -05:00
|
|
|
#include <Fledasty/Core/Queue.h>
|
2025-04-23 05:08:00 -05:00
|
|
|
#include <Fledasty/Core/Stack.h>
|
2025-04-24 10:34:57 -05:00
|
|
|
#include <Fledasty/Core/DynamicArray.h>
|
2025-04-25 14:44:24 -05:00
|
|
|
#include <Fledasty/Core/LinkedList.h>
|
2025-04-26 08:56:56 -05:00
|
|
|
#include <Fledasty/Core/DoublyLinkedList.h>
|
2025-05-01 09:42:11 -05:00
|
|
|
#include <Fledasty/Core/HashTable.h>
|
2025-05-02 08:09:46 -05:00
|
|
|
#include <Fledasty/Strings/UTF8String.h>
|
2025-06-14 17:17:17 -05:00
|
|
|
#include <Fledasty/Algorithms/Hashing.h>
|
2025-05-01 09:42:11 -05:00
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
static inline bool compare_integers(const int first_value, const int second_value) { return first_value == second_value; }
|
|
|
|
|
static inline size_t integer_hash_function(const void *key) { return *(int*)key; }
|
|
|
|
|
|
2025-06-21 05:17:21 -05:00
|
|
|
FLEDASTY_STACK_DEFINE(int, int)
|
|
|
|
|
FLEDASTY_STACK_IMPLEMENT(int, int)
|
2025-06-17 14:46:06 -05:00
|
|
|
|
2025-06-21 05:17:21 -05:00
|
|
|
FLEDASTY_QUEUE_DEFINE(int, int)
|
|
|
|
|
FLEDASTY_QUEUE_IMPLEMENT(int, int)
|
2025-06-17 15:20:05 -05:00
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
FLEDASTY_DYNAMIC_ARRAY_DEFINE(int, int)
|
|
|
|
|
FLEDASTY_DYNAMIC_ARRAY_IMPLEMENT(int, int, compare_integers)
|
2025-04-19 11:15:18 -05:00
|
|
|
|
|
|
|
|
int main() {
|
2025-06-17 15:20:05 -05:00
|
|
|
FledastyQueue_int test_queue = { 0, 0, 0, 0, NULL };
|
2025-04-20 09:08:59 -05:00
|
|
|
for (int i = 0; i < 10; i += 1) {
|
2025-06-17 15:20:05 -05:00
|
|
|
fledasty_queue_int_push(&test_queue, i);
|
2025-04-20 09:08:59 -05:00
|
|
|
}
|
|
|
|
|
|
2025-06-17 15:20:05 -05:00
|
|
|
fledasty_queue_int_shrink_to_fit(&test_queue);
|
2025-05-15 13:03:03 -05:00
|
|
|
printf("Queue schrinked to fit %s\n", (test_queue.capacity == test_queue.size) ? "succeeded" : "failed");
|
2025-06-21 05:17:21 -05:00
|
|
|
fledasty_queue_int_push(&test_queue, 10);
|
2025-06-17 15:20:05 -05:00
|
|
|
printf("Queue peeked: %d\n", fledasty_queue_int_peek(&test_queue));
|
2025-04-21 15:14:06 -05:00
|
|
|
|
2025-04-21 15:30:49 -05:00
|
|
|
for (int i = test_queue.size; i > 0; i -= 1) {
|
2025-06-17 15:20:05 -05:00
|
|
|
printf("Queue popped: %d\n", fledasty_queue_int_pop(&test_queue));
|
2025-04-21 15:30:49 -05:00
|
|
|
}
|
|
|
|
|
|
2025-06-17 15:20:05 -05:00
|
|
|
fledasty_queue_int_clear(&test_queue);
|
|
|
|
|
if (fledasty_queue_int_is_empty(&test_queue)) {
|
2025-04-22 15:23:51 -05:00
|
|
|
printf("Queue is empty\n");
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-17 15:20:05 -05:00
|
|
|
fledasty_queue_int_free(&test_queue);
|
2025-04-19 15:14:30 -05:00
|
|
|
|
2025-06-17 14:46:06 -05:00
|
|
|
FledastyStack_int test_stack = { 0, 0, NULL };
|
2025-04-23 05:33:10 -05:00
|
|
|
for (int i = 0; i < 10; i += 1) {
|
2025-06-17 14:46:06 -05:00
|
|
|
fledasty_stack_int_push(&test_stack, i);
|
2025-04-23 05:33:10 -05:00
|
|
|
}
|
|
|
|
|
|
2025-06-17 14:46:06 -05:00
|
|
|
fledasty_stack_int_shrink_to_fit(&test_stack);
|
2025-05-15 12:28:54 -05:00
|
|
|
printf("Stack schrinked to fit %s\n", (test_stack.capacity == test_stack.size) ? "succeeded" : "failed");
|
2025-06-17 14:46:06 -05:00
|
|
|
printf("Stack peeked: %d\n", fledasty_stack_int_peek(&test_stack));
|
2025-04-23 07:14:45 -05:00
|
|
|
|
2025-04-23 12:05:36 -05:00
|
|
|
for (int i = test_stack.size; i > 0; i -= 1) {
|
2025-06-17 14:46:06 -05:00
|
|
|
printf("Stack popped: %d\n", fledasty_stack_int_pop(&test_stack));
|
2025-04-23 12:05:36 -05:00
|
|
|
}
|
|
|
|
|
|
2025-06-17 14:46:06 -05:00
|
|
|
fledasty_stack_int_clear(&test_stack);
|
|
|
|
|
if (fledasty_stack_int_is_empty(&test_stack)) {
|
2025-04-23 05:11:25 -05:00
|
|
|
printf("Stack is empty\n");
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-17 14:46:06 -05:00
|
|
|
fledasty_stack_int_free(&test_stack);
|
2025-04-23 05:08:00 -05:00
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
FledastyDynamicArray_int test_dynamic_array = { 0, 0, NULL };
|
2025-04-24 12:40:21 -05:00
|
|
|
for (int i = 0; i < 10; i += 1) {
|
2025-06-20 15:22:56 -05:00
|
|
|
fledasty_dynamic_array_int_append(&test_dynamic_array, i);
|
2025-04-24 12:40:21 -05:00
|
|
|
}
|
2025-04-24 10:34:57 -05:00
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
fledasty_dynamic_array_int_shrink_to_fit(&test_dynamic_array);
|
2025-05-23 08:42:34 -05:00
|
|
|
printf("Dynamic array schrinked to fit %s\n", (test_dynamic_array.capacity == test_dynamic_array.size) ? "succeeded" : "failed");
|
|
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
fledasty_dynamic_array_int_insert_at_index(&test_dynamic_array, 1, 18);
|
|
|
|
|
fledasty_dynamic_array_int_insert_before_value(&test_dynamic_array, 1, 35);
|
|
|
|
|
fledasty_dynamic_array_int_insert_after_value(&test_dynamic_array, 35, 90);
|
2025-04-24 18:26:33 -05:00
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
fledasty_dynamic_array_int_remove_value(&test_dynamic_array, 35);
|
|
|
|
|
fledasty_dynamic_array_int_remove_at_index(&test_dynamic_array, test_dynamic_array.size - 2);
|
2025-04-25 05:09:16 -05:00
|
|
|
|
2025-04-24 17:51:53 -05:00
|
|
|
for (int i = 0; i < test_dynamic_array.size; i += 1) {
|
2025-06-20 15:22:56 -05:00
|
|
|
printf("Dynamic array get: %d\n", test_dynamic_array.buffer[i]);
|
2025-04-24 17:51:53 -05:00
|
|
|
}
|
|
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
if (fledasty_dynamic_array_int_has_value(&test_dynamic_array, 90)) {
|
|
|
|
|
printf("Dynamic array contains 90\n");
|
2025-04-25 04:42:15 -05:00
|
|
|
}
|
|
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
fledasty_dynamic_array_int_clear(&test_dynamic_array);
|
|
|
|
|
if (fledasty_dynamic_array_int_is_empty(&test_dynamic_array)) {
|
2025-04-24 18:26:33 -05:00
|
|
|
printf("Dynamic array is empty\n");
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
fledasty_dynamic_array_int_free(&test_dynamic_array);
|
2025-04-25 14:44:24 -05:00
|
|
|
|
|
|
|
|
FledastyLinkedList test_linked_list;
|
|
|
|
|
fledasty_linked_list_initialize(&test_linked_list, (int[]){11, 12, 13, 14, 15}, 5, sizeof(int));
|
|
|
|
|
|
2025-04-25 15:18:44 -05:00
|
|
|
for (int i = 0; i < 10; i += 1) {
|
|
|
|
|
fledasty_linked_list_append(&test_linked_list, &i);
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-20 15:22:56 -05:00
|
|
|
int insert_value = 35;
|
2025-04-25 17:04:33 -05:00
|
|
|
fledasty_linked_list_insert_at_index(&test_linked_list, 1, &insert_value);
|
2025-04-25 17:11:35 -05:00
|
|
|
insert_value = 28;
|
2025-06-20 15:22:56 -05:00
|
|
|
int insert_at_value = 35;
|
2025-04-25 17:11:35 -05:00
|
|
|
fledasty_linked_list_insert_before_value(&test_linked_list, &insert_at_value, &insert_value);
|
2025-04-25 17:15:58 -05:00
|
|
|
insert_value = 90;
|
|
|
|
|
fledasty_linked_list_insert_after_value(&test_linked_list, &insert_at_value, &insert_value);
|
2025-04-25 17:04:33 -05:00
|
|
|
|
2025-04-26 05:33:29 -05:00
|
|
|
fledasty_linked_list_remove_at_index(&test_linked_list, 2);
|
2025-06-20 15:22:56 -05:00
|
|
|
int remove_value = 0;
|
2025-04-26 07:32:29 -05:00
|
|
|
fledasty_linked_list_remove_value(&test_linked_list, &remove_value);
|
2025-04-26 05:33:29 -05:00
|
|
|
|
2025-04-25 15:48:09 -05:00
|
|
|
FledastyLinkedListNode *test_linked_list_node = test_linked_list.start;
|
2025-04-25 16:11:13 -05:00
|
|
|
for (int i = 0; i < test_linked_list.size; i += 1) {
|
2025-04-25 15:48:09 -05:00
|
|
|
printf("Linked list get: %d\n", *(int*)test_linked_list_node->value);
|
|
|
|
|
test_linked_list_node = test_linked_list_node->next;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-26 04:50:00 -05:00
|
|
|
if (fledasty_linked_list_has_value(&test_linked_list, &insert_value)) {
|
|
|
|
|
printf("Linked list contains %d\n", insert_value);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-02 06:13:04 -05:00
|
|
|
fledasty_linked_list_clear(&test_linked_list);
|
2025-04-25 16:11:13 -05:00
|
|
|
if (fledasty_linked_list_is_empty(&test_linked_list)) {
|
|
|
|
|
printf("Linked list is empty\n");
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-25 14:44:24 -05:00
|
|
|
fledasty_linked_list_destroy(&test_linked_list);
|
2025-05-02 06:13:04 -05:00
|
|
|
|
2025-04-26 08:56:56 -05:00
|
|
|
FledastyDoublyLinkedList test_doubly_linked_list;
|
|
|
|
|
fledasty_doubly_linked_list_initialize(&test_doubly_linked_list, (int[]){11, 12, 13, 14, 15}, 5, sizeof(int));
|
2025-04-26 09:20:11 -05:00
|
|
|
for (int i = 0; i < 10; i += 1) {
|
|
|
|
|
fledasty_doubly_linked_list_append(&test_doubly_linked_list, &i);
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-29 16:02:11 -05:00
|
|
|
insert_value = 35;
|
|
|
|
|
fledasty_doubly_linked_list_insert_at_index(&test_doubly_linked_list, test_doubly_linked_list.size - 1, &insert_value);
|
2025-04-29 17:58:53 -05:00
|
|
|
insert_value = 28;
|
|
|
|
|
insert_at_value = 35;
|
|
|
|
|
fledasty_doubly_linked_list_insert_before_value(&test_doubly_linked_list, &insert_at_value, &insert_value);
|
2025-04-30 06:43:58 -05:00
|
|
|
insert_value = 90;
|
|
|
|
|
fledasty_doubly_linked_list_insert_after_value(&test_doubly_linked_list, &insert_at_value, &insert_value);
|
2025-04-29 16:02:11 -05:00
|
|
|
|
2025-05-01 05:26:50 -05:00
|
|
|
fledasty_doubly_linked_list_remove_at_index(&test_doubly_linked_list, 2);
|
2025-05-01 05:36:56 -05:00
|
|
|
remove_value = 0;
|
|
|
|
|
fledasty_doubly_linked_list_remove_value(&test_doubly_linked_list, &remove_value);
|
2025-05-01 05:26:50 -05:00
|
|
|
|
2025-04-26 09:20:11 -05:00
|
|
|
FledastyDoublyLinkedListNode *test_doubly_linked_list_node = test_doubly_linked_list.start;
|
|
|
|
|
for (int i = 0; i < test_doubly_linked_list.size; i += 1) {
|
|
|
|
|
printf("Doubly linked list get: %d\n", *(int*)test_doubly_linked_list_node->value);
|
|
|
|
|
test_doubly_linked_list_node = test_doubly_linked_list_node->next;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-29 16:02:11 -05:00
|
|
|
test_doubly_linked_list_node = test_doubly_linked_list.end;
|
|
|
|
|
for (int i = 0; i < test_doubly_linked_list.size; i += 1) {
|
|
|
|
|
printf("Doubly linked list get backwards: %d\n", *(int*)test_doubly_linked_list_node->value);
|
|
|
|
|
test_doubly_linked_list_node = test_doubly_linked_list_node->previous;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-01 05:26:50 -05:00
|
|
|
if (fledasty_doubly_linked_list_has_value(&test_doubly_linked_list, &insert_value)) {
|
2025-05-01 04:25:49 -05:00
|
|
|
printf("Doubly linked list contains %d\n", insert_value);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-02 06:19:22 -05:00
|
|
|
fledasty_doubly_linked_list_clear(&test_doubly_linked_list);
|
2025-05-01 03:27:08 -05:00
|
|
|
if (fledasty_doubly_linked_list_is_empty(&test_doubly_linked_list)) {
|
2025-05-01 04:25:49 -05:00
|
|
|
printf("Doubly linked list is empty\n");
|
2025-05-01 03:27:08 -05:00
|
|
|
}
|
|
|
|
|
|
2025-04-26 08:56:56 -05:00
|
|
|
fledasty_doubly_list_destroy(&test_doubly_linked_list);
|
2025-05-01 09:42:11 -05:00
|
|
|
|
2025-05-01 10:53:09 -05:00
|
|
|
FledastyHashTable test_hash_table;
|
|
|
|
|
fledasty_hash_table_initialize(&test_hash_table, sizeof(int), sizeof(int), integer_hash_function);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i += 1) {
|
|
|
|
|
int pow_value = i * i;
|
|
|
|
|
fledasty_hash_table_insert(&test_hash_table, &pow_value, &i);
|
|
|
|
|
}
|
2025-05-01 09:42:11 -05:00
|
|
|
|
2025-05-28 03:49:18 -05:00
|
|
|
fledasty_hash_table_shrink_to_fit(&test_hash_table);
|
|
|
|
|
|
2025-05-01 15:37:55 -05:00
|
|
|
int hash_table_value = 5;
|
|
|
|
|
int hash_table_remove = 2;
|
|
|
|
|
fledasty_hash_table_insert(&test_hash_table, &hash_table_remove, &hash_table_value);
|
|
|
|
|
fledasty_hash_table_remove(&test_hash_table, &hash_table_remove);
|
|
|
|
|
|
|
|
|
|
if (fledasty_hash_table_get(&test_hash_table, &hash_table_remove) != NULL) {
|
|
|
|
|
printf("Value not removed from hash table\n");
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-01 14:51:27 -05:00
|
|
|
for (int i = 0; i < 10; i += 1) {
|
|
|
|
|
int pow_value = i * i;
|
|
|
|
|
int *hash_table_value = (int*)fledasty_hash_table_get(&test_hash_table, &pow_value);
|
|
|
|
|
printf("Hash table get: %d\n", *hash_table_value);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-01 16:29:56 -05:00
|
|
|
hash_table_value = 4;
|
|
|
|
|
if (fledasty_hash_table_has_key(&test_hash_table, &hash_table_value)) {
|
|
|
|
|
printf("Hash table contains key %d\n", hash_table_value);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-01 17:16:08 -05:00
|
|
|
fledasty_hash_table_clear(&test_hash_table);
|
2025-05-01 16:20:44 -05:00
|
|
|
if (fledasty_hash_table_is_empty(&test_hash_table)) {
|
|
|
|
|
printf("Hash table is empty\n");
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-01 09:42:11 -05:00
|
|
|
fledasty_hash_table_destroy(&test_hash_table);
|
2025-05-02 08:09:46 -05:00
|
|
|
FledastyUtf8String test_utf8_string;
|
2025-05-04 06:54:17 -05:00
|
|
|
unsigned char *test_string = (unsigned char*)"😀€Testing";
|
2025-06-06 10:50:56 -05:00
|
|
|
fledasty_utf8_string_initialize(&test_utf8_string, test_string, 14);
|
2025-05-04 06:54:17 -05:00
|
|
|
printf("%s\n", test_string);
|
|
|
|
|
printf("%s\n", test_utf8_string.character_string);
|
2025-05-02 08:09:46 -05:00
|
|
|
|
2025-05-11 16:39:01 -05:00
|
|
|
fledasty_utf8_string_append(&test_utf8_string, (unsigned char*)"😀", 4);
|
2025-05-12 03:48:08 -05:00
|
|
|
printf("Append: %s\n", test_utf8_string.character_string);
|
|
|
|
|
fledasty_utf8_string_insert_before_string(&test_utf8_string, (unsigned char*)"😀", 4, (unsigned char*)"Hello", 5);
|
|
|
|
|
printf("Insert Before: %s\n", test_utf8_string.character_string);
|
2025-05-12 04:09:25 -05:00
|
|
|
fledasty_utf8_string_insert_after_string(&test_utf8_string, (unsigned char*)"😀", 4, (unsigned char*)"Bye", 3);
|
|
|
|
|
printf("Insert After: %s\n", test_utf8_string.character_string);
|
2025-06-06 10:50:56 -05:00
|
|
|
fledasty_utf8_string_insert_at_index(&test_utf8_string, test_utf8_string.size, (unsigned char*)"index", 5);
|
2025-05-12 04:23:23 -05:00
|
|
|
printf("Insert at Index: %s\n", test_utf8_string.character_string);
|
2025-05-13 04:04:31 -05:00
|
|
|
fledasty_utf8_string_replace_string(&test_utf8_string, (unsigned char*)"😀", 4, (unsigned char*)"𓃶 ", 5);
|
|
|
|
|
printf("Replace: %s\n", test_utf8_string.character_string);
|
2025-05-15 10:17:00 -05:00
|
|
|
fledasty_utf8_string_pop(&test_utf8_string);
|
|
|
|
|
printf("Pop: %s\n", test_utf8_string.character_string);
|
2025-05-15 10:26:32 -05:00
|
|
|
fledasty_utf8_string_remove(&test_utf8_string, (unsigned char*)"𓃶 ", 5);
|
|
|
|
|
printf("Remove: %s\n", test_utf8_string.character_string);
|
2025-06-06 10:50:56 -05:00
|
|
|
fledasty_utf8_string_remove_range(&test_utf8_string, 0, 6);
|
2025-05-15 10:31:39 -05:00
|
|
|
printf("Remove range: %s\n", test_utf8_string.character_string);
|
2025-05-11 16:39:01 -05:00
|
|
|
|
2025-06-07 06:58:41 -05:00
|
|
|
fledasty_utf8_string_shrink_to_fit(&test_utf8_string);
|
2025-05-12 14:48:39 -05:00
|
|
|
if (fledasty_utf8_string_has_string(&test_utf8_string, (unsigned char*)"😀", 4)) {
|
|
|
|
|
printf("String contains 😀!\n");
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-14 17:17:17 -05:00
|
|
|
uint32_t hash_x32 = fledasty_mur_mur_3_hash_x32(test_utf8_string.character_string, test_utf8_string.size, 0);
|
|
|
|
|
printf("UTF-8 String hash using murmur 32 is: %u\n", hash_x32);
|
|
|
|
|
|
|
|
|
|
FledastyHash128 hash_x64 = fledasty_mur_mur_3_hash_x64_128(test_utf8_string.character_string, test_utf8_string.size, 0);
|
|
|
|
|
printf("UTF-8 String hash using murmur 64 is: low = %lu, high = %lu\n", hash_x64.low, hash_x64.high);
|
|
|
|
|
|
2025-05-07 04:33:25 -05:00
|
|
|
size_t unicode_length = 0;
|
|
|
|
|
uint32_t *unicode = fledasty_utf8_string_decode(&test_utf8_string, &unicode_length);
|
|
|
|
|
FledastyUtf8String encoded_string = fledasty_utf8_string_encode(unicode, unicode_length);
|
|
|
|
|
|
|
|
|
|
printf("%s\n", encoded_string.character_string);
|
|
|
|
|
|
2025-05-11 15:24:45 -05:00
|
|
|
if (fledasty_utf8_string_validate(test_utf8_string.character_string, encoded_string.size)) {
|
|
|
|
|
printf("UTF-8 test string is valid!\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fledasty_utf8_string_validate(encoded_string.character_string, encoded_string.size)) {
|
|
|
|
|
printf("UTF-8 encoded string is valid!\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned char *invalid_utf8 = (unsigned char*)hallocy_malloc(2 * sizeof(unsigned char));
|
|
|
|
|
invalid_utf8[0] = 0xDF;
|
|
|
|
|
invalid_utf8[1] = 0xFF;
|
|
|
|
|
if (!fledasty_utf8_string_validate(invalid_utf8, 2)) {
|
|
|
|
|
printf("UTF-8 invalid string is invalid!\n");
|
|
|
|
|
}
|
2025-05-15 10:20:54 -05:00
|
|
|
|
|
|
|
|
fledasty_utf8_string_clear(&test_utf8_string);
|
2025-05-12 05:56:18 -05:00
|
|
|
if (fledasty_utf8_string_is_empty(&test_utf8_string)) {
|
|
|
|
|
printf("UTF-8 string is empty!\n");
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-11 15:24:45 -05:00
|
|
|
hallocy_free(invalid_utf8);
|
2025-05-07 04:33:25 -05:00
|
|
|
hallocy_free(unicode);
|
|
|
|
|
fledasty_utf8_string_destroy(&encoded_string);
|
|
|
|
|
|
2025-05-02 08:09:46 -05:00
|
|
|
fledasty_utf8_string_destroy(&test_utf8_string);
|
2025-04-19 15:14:30 -05:00
|
|
|
printf("Done\n");
|
2025-04-19 11:15:18 -05:00
|
|
|
return 0;
|
|
|
|
|
}
|