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

2016-09-20 Thread Pekka Paalanen
On Fri, 16 Sep 2016 15:37:39 -0700
Yong Bakos  wrote:

> From: Yong Bakos 
> 
> Include wayland-util.h instead of wayland-private.h, because that's where
> wl_array is and nothing in wayland-private.h is required.
> 
> 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 
> ---
>  tests/array-test.c | 20 ++--
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/tests/array-test.c b/tests/array-test.c
> index a5856fd..4aaf041 100644
> --- a/tests/array-test.c
> +++ b/tests/array-test.c
> @@ -25,24 +25,16 @@
>  
>  #include 
>  #include 
> -#include "wayland-private.h"
> +#include "wayland-util.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. */
> -
> - 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);
> - }
> + struct wl_array array;

Add an empty line here.

> + wl_array_init(&array);
> + assert(array.size == 0);
> + assert(array.alloc == 0);
> + assert(array.data == 0);
>  }
>  
>  TEST(array_release)

Yeah, I can't imagine what the original code was trying to test with
the repeating.

Reviewed-by: Pekka Paalanen 


Thanks,
pq


pgpJpXLq27Csi.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


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

2016-09-16 Thread Yong Bakos
From: Yong Bakos 

Include wayland-util.h instead of wayland-private.h, because that's where
wl_array is and nothing in wayland-private.h is required.

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 
---
 tests/array-test.c | 20 ++--
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/tests/array-test.c b/tests/array-test.c
index a5856fd..4aaf041 100644
--- a/tests/array-test.c
+++ b/tests/array-test.c
@@ -25,24 +25,16 @@
 
 #include 
 #include 
-#include "wayland-private.h"
+#include "wayland-util.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. */
-
-   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);
-   }
+   struct wl_array array;
+   wl_array_init(&array);
+   assert(array.size == 0);
+   assert(array.alloc == 0);
+   assert(array.data == 0);
 }
 
 TEST(array_release)
-- 
2.7.2

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel