summaryrefslogtreecommitdiff
path: root/tests/array.c
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2026-07-26 10:45:29 -0400
committerAndrew Opalach <andrew@akon.city> 2026-07-26 10:45:29 -0400
commitb7cefeccf5e179117054ae6793ef5502e2cc4e4f (patch)
tree1e8d7aab9a880e4c9489ca10d345cd84d8fd3b44 /tests/array.c
parentc633226d2b615f46ef38cc99603775dccdf96ecd (diff)
downloadlibalabaster-b7cefeccf5e179117054ae6793ef5502e2cc4e4f.tar.gz
libalabaster-b7cefeccf5e179117054ae6793ef5502e2cc4e4f.tar.bz2
libalabaster-b7cefeccf5e179117054ae6793ef5502e2cc4e4f.zip
array: Fix insert(count - 1) case
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'tests/array.c')
-rw-r--r--tests/array.c10
1 files changed, 9 insertions, 1 deletions
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();
}