[PATCH wayland v2 4/4] array-test: Include wayland-util.h and simplify init test

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


From: Yong Bakos <ybakos at humanoriented.com>

Include wayland-util.h in addition to wayland-private.h, to be more explicit
about where wl_array is defined.

Remove the useless repeated testing of wl_array_init, because if it fails once
out of thousands of iterations we're all doomed anyway.

Signed-off-by: Yong Bakos <ybakos at humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
v2: Add empty line (pq)

 tests/array-test.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/tests/array-test.c b/tests/array-test.c
index b0de8e6..ed6fbfb 100644
--- a/tests/array-test.c
+++ b/tests/array-test.c
@@ -25,24 +25,18 @@

 #include <stdlib.h>
 #include <assert.h>
+#include "wayland-util.h"
 #include "wayland-private.h"
 #include "test-runner.h"

 TEST(array_init)
 {
-	const int iterations = 4122; /* this is arbitrary */
-	int i;
-
-	/* Init array an arbitray amount of times and verify the
-	 * defaults are sensible. */
+	struct wl_array array;

-	for (i = 0; i < iterations; i++) {
-		struct wl_array array;
-		wl_array_init(&array);
-		assert(array.size == 0);
-		assert(array.alloc == 0);
-		assert(array.data == 0);
-	}
+	wl_array_init(&array);
+	assert(array.size == 0);
+	assert(array.alloc == 0);
+	assert(array.data == 0);
 }

 TEST(array_release)
--
2.7.2



More information about the wayland-devel mailing list