Make i8 char; signed char causes string issues

This commit is contained in:
NukeBird 2025-12-01 21:24:43 +03:00
parent eece39c2ed
commit 6061b383a3
2 changed files with 10 additions and 10 deletions

View file

@ -37,7 +37,7 @@ KOAN(strcpy_basic)
i8* result = axl_strcpy(dst, src); i8* result = axl_strcpy(dst, src);
ASSERT_PTR_EQ(dst, result); ASSERT_PTR_EQ(dst, result);
ASSERT_STR_EQ("test", (const char*)dst); ASSERT_STR_EQ("test", dst);
axl_free(dst); axl_free(dst);
} }
@ -51,7 +51,7 @@ KOAN(strcpy_empty)
i8* result = axl_strcpy(dst, src); i8* result = axl_strcpy(dst, src);
ASSERT_PTR_EQ(dst, result); ASSERT_PTR_EQ(dst, result);
ASSERT_STR_EQ("", (const char*)dst); ASSERT_STR_EQ("", dst);
axl_free(dst); axl_free(dst);
} }
@ -64,7 +64,7 @@ KOAN(strcpy_null_dst)
KOAN(strcpy_null_src) KOAN(strcpy_null_src)
{ {
ASSERT_NULL(axl_strcpy(NULL, (const i8*)"test")); ASSERT_NULL(axl_strcpy(NULL, "test"));
} }
KOAN(strncpy_exact) KOAN(strncpy_exact)
@ -131,7 +131,7 @@ KOAN(strcat_basic)
i8* result = axl_strcat(dst, (i8*)"world"); i8* result = axl_strcat(dst, (i8*)"world");
ASSERT_PTR_EQ(dst, result); ASSERT_PTR_EQ(dst, result);
ASSERT_STR_EQ("hello world", (const char*)dst); ASSERT_STR_EQ("hello world", dst);
axl_free(dst); axl_free(dst);
} }
@ -144,7 +144,7 @@ KOAN(strcat_to_empty)
i8* result = axl_strcat(dst, (i8*)"test"); i8* result = axl_strcat(dst, (i8*)"test");
ASSERT_PTR_EQ(dst, result); ASSERT_PTR_EQ(dst, result);
ASSERT_STR_EQ("test", (const char*)dst); ASSERT_STR_EQ("test", dst);
axl_free(dst); axl_free(dst);
} }
@ -157,7 +157,7 @@ KOAN(strncat_full)
i8* result = axl_strncat(dst, (i8*)"world", 5); i8* result = axl_strncat(dst, (i8*)"world", 5);
ASSERT_PTR_EQ(dst, result); ASSERT_PTR_EQ(dst, result);
ASSERT_STR_EQ("hello world", (const char*)dst); ASSERT_STR_EQ("hello world", dst);
axl_free(dst); axl_free(dst);
} }
@ -170,7 +170,7 @@ KOAN(strncat_partial)
i8* result = axl_strncat(dst, (i8*)"worldwide", 5); i8* result = axl_strncat(dst, (i8*)"worldwide", 5);
ASSERT_PTR_EQ(dst, result); ASSERT_PTR_EQ(dst, result);
ASSERT_STR_EQ("hello world", (const char*)dst); ASSERT_STR_EQ("hello world", dst);
axl_free(dst); axl_free(dst);
} }
@ -183,7 +183,7 @@ KOAN(strncat_always_null_terminates)
i8* result = axl_strncat(dst, (i8*)"123456789", 3); i8* result = axl_strncat(dst, (i8*)"123456789", 3);
ASSERT_PTR_EQ(dst, result); ASSERT_PTR_EQ(dst, result);
ASSERT_STR_EQ("test123", (const char*)dst); ASSERT_STR_EQ("test123", dst);
ASSERT_INT_EQ(0, (int)dst[7]); ASSERT_INT_EQ(0, (int)dst[7]);
axl_free(dst); axl_free(dst);
@ -193,7 +193,7 @@ KOAN(strncat_zero_n)
{ {
i8 dst[10] = "hi"; i8 dst[10] = "hi";
axl_strncat(dst, (const i8*)"world", 0); axl_strncat(dst, (const i8*)"world", 0);
ASSERT_STR_EQ("hi", (char*)dst); ASSERT_STR_EQ("hi", dst);
} }
KOAN(strcmp_equal) KOAN(strcmp_equal)

View file

@ -1,7 +1,7 @@
#ifndef AXL_TYPES_H #ifndef AXL_TYPES_H
#define AXL_TYPES_H #define AXL_TYPES_H
typedef signed char i8; typedef char i8;
typedef unsigned char u8; typedef unsigned char u8;
typedef unsigned char b8; typedef unsigned char b8;
typedef signed short i16; typedef signed short i16;