diff options
author | Yong Bakos <ybakos@humanoriented.com> | 2016-09-27 13:03:50 -0500 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2016-10-18 12:24:53 +0300 |
commit | a1ab2c03ae7471895f8d24f9186c5ac288545e7f (patch) | |
tree | a270bacbb2b5a81b3d7af05968a4a281cfe6c3c6 | |
parent | f04f2187810fc8dcda92305df76fb54a255c20f9 (diff) |
array-test: Include wayland-util.h and simplify init test
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@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
[Pekka: add the memset]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r-- | tests/array-test.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/array-test.c b/tests/array-test.c index fe589f4..eda610b 100644 --- a/tests/array-test.c +++ b/tests/array-test.c @@ -25,24 +25,22 @@ #include <stdlib.h> #include <assert.h> +#include <string.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; + struct wl_array array; - /* Init array an arbitray amount of times and verify the - * defaults are sensible. */ + /* fill with garbage to emulate uninitialized memory */ + memset(&array, 0x57, sizeof 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) |