From b7cefeccf5e179117054ae6793ef5502e2cc4e4f Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Sun, 26 Jul 2026 10:45:29 -0400 Subject: array: Fix insert(count - 1) case Signed-off-by: Andrew Opalach --- tests/array.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests/array.c') diff --git a/tests/array.c b/tests/array.c index 2c7746f..ddcc0d8 100644 --- a/tests/array.c +++ b/tests/array.c @@ -272,7 +272,7 @@ static bool array_test_insert(void) struct test_t x = { .d = 5 }; struct test_t y = { .d = 2 }; - struct test_t z = { .d = 6 }; + struct test_t z = { .d = 5464123 }; al_array_push(objects, (struct test_t){ .d = 7 }); al_array_push(objects, (struct test_t){ .d = 9 }); @@ -298,6 +298,14 @@ static bool array_test_insert(void) al_array_free(objects); + al_array_init(objects); + al_array_push(objects, z); + al_array_insert(objects, 0, x); + AL_TEST_EQ(al_array_at(objects, 0).d, x.d, u32); + AL_TEST_EQ(al_array_at(objects, 1).d, z.d, u32); + + al_array_free(objects); + AL_TEST_END(); } -- cgit v1.2.3-101-g0448