diff options
author | Bryce Harrington <bryce@osg.samsung.com> | 2014-11-19 17:18:35 -0800 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2014-11-28 15:56:45 +0200 |
commit | 22ea306ce2e49807832317dd4ea111f2c5b9f47d (patch) | |
tree | 9e83a9f051ba1b40810cc9d406d719cba3e6819f | |
parent | a76802685aae2b3563aae0ee8ffd84ab0b55c327 (diff) | |
download | weston-22ea306ce2e49807832317dd4ea111f2c5b9f47d.tar.gz |
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>
-rw-r--r-- | tests/presentation-test.c | 2 | ||||
-rw-r--r-- | tests/weston-test-runner.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/presentation-test.c b/tests/presentation-test.c index b99e93da..f97e5b36 100644 --- a/tests/presentation-test.c +++ b/tests/presentation-test.c @@ -31,8 +31,6 @@ #include "weston-test-client-helper.h" #include "presentation_timing-client-protocol.h" -#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) - static inline void * xzalloc(size_t size) { diff --git a/tests/weston-test-runner.h b/tests/weston-test-runner.h index e1db0409..193b76d3 100644 --- a/tests/weston-test-runner.h +++ b/tests/weston-test-runner.h @@ -41,6 +41,8 @@ struct weston_test { int must_fail; } __attribute__ ((aligned (32))); +#define ARRAY_LENGTH(a) ((int) (sizeof (a) / sizeof (a)[0])) + #define TEST_BEGIN(name, arg) \ static void name(arg) @@ -67,7 +69,7 @@ struct weston_test { #define ARG_TEST(name, ret, test_data) \ TEST_COMMON(name, name, ret, test_data, \ sizeof(test_data[0]), \ - sizeof(test_data) / sizeof (test_data[0])) \ + ARRAY_LENGTH(test_data)) \ TEST_BEGIN(name, void *data) \ #define TEST(name) NO_ARG_TEST(name, 0) |