summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-06-11 10:00:46 -0400
committerAndrew Opalach <andrew@akon.city> 2025-06-11 10:00:46 -0400
commit93f664a69a3c688d196bdc228d572b45a65e7991 (patch)
tree3ea386156bf3e009cba22ca9112aafcda15bd955 /tests
parentb403770e7eb6e0a5a8ca14a24f91dbf214ffe917 (diff)
downloadlibalabaster-93f664a69a3c688d196bdc228d572b45a65e7991.tar.gz
libalabaster-93f664a69a3c688d196bdc228d572b45a65e7991.tar.bz2
libalabaster-93f664a69a3c688d196bdc228d572b45a65e7991.zip
(w)str: Fix str macros
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'tests')
-rw-r--r--tests/str.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/str.c b/tests/str.c
index de5f576..03284d6 100644
--- a/tests/str.c
+++ b/tests/str.c
@@ -346,6 +346,13 @@ static bool str_test_error_prone_str_c(void)
AL_TEST_TRUE(al_str_eq(&global_string, &al_str_c("yeeee")));
#endif
+ wstr w = al_wstr_c(L"Ayo");
+ wstr wr = al_wstr_cr(L"Ayo");
+ AL_TEST_EQ(w.length, al_wcsnlen(L"Ayo", sizeof(L"Ayo") / sizeof(wchar_t)), u32);
+ AL_TEST_EQ(wr.length, 3, u32);
+ AL_TEST_EQ(w.alloc, 0, u32);
+ AL_TEST_EQ(al_memcmp(w.data, L"Ayo", sizeof(L"Ayo")), 0, s32);
+
// This is expected to cause a compile error.
#if 0
char *d = al_malloc(26);
@@ -369,6 +376,9 @@ static bool str_test_error_prone_str_c(void)
AL_TEST_EQ(wss.length, (u32)wcslen(ws), u32);
al_free(wd);
+
+ str sss = al_str_c(true ? "true" : "never");
+ wstr www = al_wstr_c(true ? L"false" : L"always");
#endif
AL_TEST_END();