[PATCH wayland v2 3/4] tests: Test wl_array_release

Yong Bakos junk at humanoriented.com
Tue Sep 27 18:03:49 UTC 2016


From: Yong Bakos <ybakos at humanoriented.com>

array-test.c did not cover wl_array_release, so add one test that specifically
tests this method.

Signed-off-by: Yong Bakos <ybakos at humanoriented.com>
---
v2: Use wl_array_add instead of calloc (pq)

 tests/array-test.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/array-test.c b/tests/array-test.c
index fe53240..b0de8e6 100644
--- a/tests/array-test.c
+++ b/tests/array-test.c
@@ -45,6 +45,17 @@ TEST(array_init)
 	}
 }

+TEST(array_release)
+{
+	struct wl_array array;
+
+	wl_array_init(&array);
+	array.data = wl_array_add(&array, 1);
+	assert(array.data != NULL);
+	wl_array_release(&array);
+	assert(array.data == WL_ARRAY_POISON_PTR);
+}
+
 TEST(array_add)
 {
 	struct mydata {
--
2.7.2



More information about the wayland-devel mailing list