diff options
| author | 2025-03-31 17:47:38 -0400 | |
|---|---|---|
| committer | 2025-03-31 17:47:38 -0400 | |
| commit | f6a8686b2c209b0e25cd64a587d6e9fb55200ec4 (patch) | |
| tree | 5e681d42484d5433e49f21c21229fe7df29299ab /tests | |
| parent | cf45d71c49a7e7364b315dcc45fe7eac060590df (diff) | |
| download | libalabaster-f6a8686b2c209b0e25cd64a587d6e9fb55200ec4.tar.gz libalabaster-f6a8686b2c209b0e25cd64a587d6e9fb55200ec4.tar.bz2 libalabaster-f6a8686b2c209b0e25cd64a587d6e9fb55200ec4.zip | |
all: Revert and add some style changes
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/array.c | 10 | ||||
| -rw-r--r-- | tests/array_typed.c | 4 | ||||
| -rw-r--r-- | tests/lib.c | 16 | ||||
| -rw-r--r-- | tests/str.c | 4 |
4 files changed, 17 insertions, 17 deletions
diff --git a/tests/array.c b/tests/array.c index 6cc88c6..2c7746f 100644 --- a/tests/array.c +++ b/tests/array.c @@ -89,16 +89,16 @@ static bool array_test_last(void) AL_TEST_END(); } -AL_UNUSED_FUNCTION_PUSH +//#define ENABLE_MAX_ALLOC_SORT +#ifdef ENABLE_MAX_ALLOC_SORT static s32 uint8_compare(const void *a, const void *b) { if (*(u8 *)a < *(u8 *)b) return 1; else if (*(u8 *)b < *(u8 *)a) return -1; return 0; } - -AL_UNUSED_FUNCTION_POP +#endif static bool array_test_push(void) { @@ -109,7 +109,7 @@ static bool array_test_push(void) u8 increment = 0; for (u32 i = 0; i < MAX_ALLOC_32; i++) { - al_array_push(bytes, (increment = (u8)al_add_wrap(increment, 2, UINT8_MAX))); + al_array_push(bytes, (increment = (u8)al_u32_add_wrap((u32)increment, 2, UINT8_MAX))); } AL_TEST_EQ(bytes.count, MAX_ALLOC_32, u32); AL_TEST_EQ(bytes.alloc, MAX_ALLOC_32, u32); @@ -126,7 +126,7 @@ static bool array_test_push(void) AL_TEST_EQ(al_array_at(bytes, 2923789681), 199, u8); } -#if 0 // This is very slow. +#ifdef ENABLE_MAX_ALLOC_SORT // This is very slow. al_array_sort(bytes, u8, uint8_compare); AL_TEST_LTE(al_array_at(bytes, MAX_ALLOC_32 - 1), al_array_at(bytes, MAX_ALLOC_32 - 26000000), u8); AL_TEST_LTE(al_array_at(bytes, MAX_ALLOC_32 - 27000000), al_array_at(bytes, MAX_ALLOC_32 - 52000000), u8); diff --git a/tests/array_typed.c b/tests/array_typed.c index f61634d..5397c5d 100644 --- a/tests/array_typed.c +++ b/tests/array_typed.c @@ -4,14 +4,14 @@ #include "array_typed.h" #include "common.h" -AL_UNUSED_FUNCTION_PUSH +AL_IGNORE_WARNING("-Wunused-function") AL_ARRAY_INLINE_STORAGE_DEFINE(u32, u32, 64) AL_ARRAY_DEFINE(u32, u32) AL_ARRAY_DEFINE(u8, u8) AL_ARRAY_INLINE_STORAGE_DEFINE(test_t, struct test_t, 16) -AL_UNUSED_FUNCTION_POP +AL_IGNORE_WARNING_END static bool array_test_init(void) { diff --git a/tests/lib.c b/tests/lib.c index 48b6c02..51b058f 100644 --- a/tests/lib.c +++ b/tests/lib.c @@ -11,32 +11,32 @@ static bool lib_test_add_wrap(void) // u32 u32 counter32 = UINT32_MAX - 5; - counter32 = al_u32_add_wrap(counter32, 15); + counter32 = al_u32_add_wrap(counter32, 15, UINT32_MAX); AL_TEST_EQ(counter32, 10, u32); counter32 = UINT32_MAX; - counter32 = al_u32_add_wrap(counter32, 1); + counter32 = al_u32_add_wrap(counter32, 1, UINT32_MAX); AL_TEST_EQ(counter32, 1, u32); counter32 = UINT32_MAX - 25; - counter32 = al_u32_add_wrap(counter32, 20); + counter32 = al_u32_add_wrap(counter32, 20, UINT32_MAX); AL_TEST_EQ(counter32, UINT32_MAX - 5, u32); - counter32 = al_u32_add_wrap(counter32, 6); + counter32 = al_u32_add_wrap(counter32, 6, UINT32_MAX); AL_TEST_EQ(counter32, 1, u32); // u16 u16 counter16 = UINT16_MAX - 5; - counter16 = al_u16_add_wrap(counter16, 15); + counter16 = al_u16_add_wrap(counter16, 15, UINT16_MAX); AL_TEST_EQ(counter16, 10, u16); counter16 = UINT16_MAX; - counter16 = al_u16_add_wrap(counter16, 1); + counter16 = al_u16_add_wrap(counter16, 1, UINT16_MAX); AL_TEST_EQ(counter16, 1, u16); counter16 = UINT16_MAX - 25; - counter16 = al_u16_add_wrap(counter16, 20); + counter16 = al_u16_add_wrap(counter16, 20, UINT16_MAX); AL_TEST_EQ(counter16, UINT16_MAX - 5, u16); - counter16 = al_u16_add_wrap(counter16, 6); + counter16 = al_u16_add_wrap(counter16, 6, UINT16_MAX); AL_TEST_EQ(counter16, 1, u16); // inc_wrap diff --git a/tests/str.c b/tests/str.c index 51b0bf1..2f7f686 100644 --- a/tests/str.c +++ b/tests/str.c @@ -92,10 +92,10 @@ static bool str_test_find_rfind(void) AL_TEST_EQ(al_str_find(&string0, '\\'), 7, u32); AL_TEST_EQ(al_str_rfind(&string0, '\\'), 10, u32); - AL_TEST_EQ(al_str_find(&string0, 'P'), al_str_npos, u32); + AL_TEST_EQ(al_str_find(&string0, 'P'), AL_STR_NPOS, u32); AL_TEST_EQ(al_str_find_str(&string0, &al_str_c("wow\\")), 4, u32); - AL_TEST_EQ(al_str_find_str(&string0, &al_str_c("John\\")), al_str_npos, u32); + AL_TEST_EQ(al_str_find_str(&string0, &al_str_c("John\\")), AL_STR_NPOS, u32); AL_TEST_END(); } |