From 93f664a69a3c688d196bdc228d572b45a65e7991 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 11 Jun 2025 10:00:46 -0400 Subject: (w)str: Fix str macros Signed-off-by: Andrew Opalach --- tests/str.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') 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(); -- cgit v1.2.3-101-g0448