tests: Move ARRAY_LENGTH to a shared header for reuse

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
dev
Bryce Harrington 10 years ago committed by Pekka Paalanen
parent a76802685a
commit 22ea306ce2
  1. 2
      tests/presentation-test.c
  2. 4
      tests/weston-test-runner.h

@ -31,8 +31,6 @@
#include "weston-test-client-helper.h" #include "weston-test-client-helper.h"
#include "presentation_timing-client-protocol.h" #include "presentation_timing-client-protocol.h"
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
static inline void * static inline void *
xzalloc(size_t size) xzalloc(size_t size)
{ {

@ -41,6 +41,8 @@ struct weston_test {
int must_fail; int must_fail;
} __attribute__ ((aligned (32))); } __attribute__ ((aligned (32)));
#define ARRAY_LENGTH(a) ((int) (sizeof (a) / sizeof (a)[0]))
#define TEST_BEGIN(name, arg) \ #define TEST_BEGIN(name, arg) \
static void name(arg) static void name(arg)
@ -67,7 +69,7 @@ struct weston_test {
#define ARG_TEST(name, ret, test_data) \ #define ARG_TEST(name, ret, test_data) \
TEST_COMMON(name, name, ret, test_data, \ TEST_COMMON(name, name, ret, test_data, \
sizeof(test_data[0]), \ sizeof(test_data[0]), \
sizeof(test_data) / sizeof (test_data[0])) \ ARRAY_LENGTH(test_data)) \
TEST_BEGIN(name, void *data) \ TEST_BEGIN(name, void *data) \
#define TEST(name) NO_ARG_TEST(name, 0) #define TEST(name) NO_ARG_TEST(name, 0)

Loading…
Cancel
Save