summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYong Bakos <ybakos@humanoriented.com>2016-09-27 13:03:49 -0500
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2016-10-18 12:24:53 +0300
commitf04f2187810fc8dcda92305df76fb54a255c20f9 (patch)
tree50e9b443a9f64aebef389a2c63a6ba2a1d28dba8
parente8ad23266f36521215dcd7cfcc524e0ef67d66dd (diff)
tests: Test wl_array_release
array-test.c did not cover wl_array_release, so add one test that specifically tests this method. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> [Pekka: do not overwrite array.data] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--tests/array-test.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/array-test.c b/tests/array-test.c
index fe53240..fe589f4 100644
--- a/tests/array-test.c
+++ b/tests/array-test.c
@@ -45,6 +45,20 @@ TEST(array_init)
}
}
+TEST(array_release)
+{
+ struct wl_array array;
+ void *ptr;
+
+ wl_array_init(&array);
+ ptr = wl_array_add(&array, 1);
+ assert(ptr != NULL);
+ assert(array.data != NULL);
+
+ wl_array_release(&array);
+ assert(array.data == WL_ARRAY_POISON_PTR);
+}
+
TEST(array_add)
{
struct mydata {