test: update tests

This commit is contained in:
2026-05-02 14:31:17 +01:00
parent 15a9147e15
commit b072632499
7 changed files with 54 additions and 28 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ static void test_string_create(CuTest *tc)
CuAssertPtrNotNull(tc, str);
CuAssertIntEquals(tc, 0, fx_string_get_size(str, FX_STRLEN_NORMAL));
CuAssertStrEquals(tc, "", fx_string_ptr(str));
CuAssertStrEquals(tc, "", fx_string_get_cstr(str));
fx_string_unref(str);
@@ -15,7 +15,7 @@ static void test_string_create(CuTest *tc)
CuAssertPtrNotNull(tc, str);
CuAssertIntEquals(tc, 8, fx_string_get_size(str, FX_STRLEN_NORMAL));
CuAssertStrEquals(tc, "AAAAAAAA", fx_string_ptr(str));
CuAssertStrEquals(tc, "AAAAAAAA", fx_string_get_cstr(str));
fx_string_unref(str);
@@ -23,7 +23,7 @@ static void test_string_create(CuTest *tc)
CuAssertPtrNotNull(tc, str);
CuAssertIntEquals(tc, 13, fx_string_get_size(str, FX_STRLEN_NORMAL));
CuAssertStrEquals(tc, "Hello, world!", fx_string_ptr(str));
CuAssertStrEquals(tc, "Hello, world!", fx_string_get_cstr(str));
fx_string_unref(str);
}
+3 -3
View File
@@ -7,21 +7,21 @@ int main(void)
{
printf("-------------\n");
fx_string *str = fx_string_create_from_cstr("Hello, world!\n");
printf("%s\n", fx_string_ptr(str));
printf("%s\n", fx_string_get_cstr(str));
printf("len:%zu, max:%zu\n", fx_string_get_size(str, FX_STRLEN_NORMAL),
fx_string_get_capacity(str));
fx_string_insert_cstr(str, "WOW!", 4);
printf("-------------\n");
printf("%s\n", fx_string_ptr(str));
printf("%s\n", fx_string_get_cstr(str));
printf("len:%zu, max:%zu\n", fx_string_get_size(str, FX_STRLEN_NORMAL),
fx_string_get_capacity(str));
fx_string_replace(str, 4, 4, "+");
printf("-------------\n");
printf("%s\n", fx_string_ptr(str));
printf("%s\n", fx_string_get_cstr(str));
printf("len:%zu, max:%zu\n", fx_string_get_size(str, FX_STRLEN_NORMAL),
fx_string_get_capacity(str));
printf("-------------\n");
+1 -1
View File
@@ -33,7 +33,7 @@ int main(void)
size_t i = 0;
fx_foreach(fx_dict_item *, item, it)
{
printf("item %zu: %s=%d\n", i++, fx_string_ptr(item->key),
printf("item %zu: %s=%d\n", i++, fx_string_get_cstr(item->key),
fx_number_get_int(item->value));
}
+1 -1
View File
@@ -7,7 +7,7 @@ int main(void)
{
printf("здравс\u26A0твуите\n");
fx_string *str = fx_string_create_from_cstr("здравствуите");
const char *s = fx_string_ptr(str);
const char *s = fx_string_get_cstr(str);
printf("%s\n", s);
printf("len: %zu\n", fx_string_get_size(str, FX_STRLEN_NORMAL));
printf("codepoints: %zu\n", fx_string_get_size(str, FX_STRLEN_CODEPOINTS));