replaced numeric types to those from tlibc

This commit is contained in:
2025-11-10 00:11:41 +05:00
parent a5aff56fb1
commit f889990728
3 changed files with 347 additions and 385 deletions

View File

@@ -9,13 +9,13 @@
#define PROJECT_SOURCE_DIR ".."
#endif
void print_table(const TomlTable *table);
void print_value(const TomlValue *value);
void print_table(const TomlTable* table);
void print_value(const TomlValue* value);
void print_array(const TomlArray *array)
{
printf("[");
for (size_t i = 0; i < array->len; i++) {
for (u64 i = 0; i < array->len; i++) {
if (i > 0) {
printf(", ");
}
@@ -24,7 +24,7 @@ void print_array(const TomlArray *array)
printf("]");
}
void print_value(const TomlValue *value)
void print_value(const TomlValue* value)
{
switch (value->type) {
case TOML_TABLE:
@@ -57,12 +57,12 @@ void print_keyval(const TomlKeyValue *keyval)
print_value(keyval->value);
}
void print_table(const TomlTable *table)
void print_table(const TomlTable* table)
{
TomlTableIter it = toml_table_iter_new((TomlTable *)table);
TomlTableIter it = toml_table_iter_new((TomlTable* )table);
printf("{");
size_t i = 0;
u64 i = 0;
while (toml_table_iter_has_next(&it)) {
TomlKeyValue *keyval = toml_table_iter_get(&it);
@@ -77,10 +77,10 @@ void print_table(const TomlTable *table)
printf("}");
}
int test_run(const char *filename)
i32 test_run(cstr filename)
{
TomlTable *table = NULL;
int rc = 0;
TomlTable* table = NULL;
i32 rc = 0;
table = toml_load_filename(filename);
if (table == NULL)
@@ -94,15 +94,15 @@ cleanup:
if (toml_err()->code != TOML_OK) {
fprintf(stderr, "%s\n", toml_err()->message);
rc = (int)toml_err()->code;
rc = (i32)toml_err()->code;
}
toml_err_clear();
return rc;
}
int main(void)
i32 main(void)
{
static const char *const filenames[] = {
static cstr const filenames[] = {
/* should parse */
PROJECT_SOURCE_DIR "/tests/key-values.toml",
PROJECT_SOURCE_DIR "/tests/complex-structure.toml",
@@ -117,12 +117,12 @@ int main(void)
PROJECT_SOURCE_DIR "/tests/hard_example_unicode.toml"
};
int total_tests = sizeof(filenames) / sizeof(char *);
int num_passed = 0;
int num_failed = 0;
i32 total_tests = sizeof(filenames) / sizeof(char* );
i32 num_passed = 0;
i32 num_failed = 0;
for (int i = 0; i < total_tests; i++) {
int rc = test_run(filenames[i]);
for (i32 i = 0; i < total_tests; i++) {
i32 rc = test_run(filenames[i]);
if (rc == 0) {
printf("test %d success\n", i);
num_passed++;