aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_byte_reverse.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-15 22:04:17 +0200
committerMax Kellermann <max@duempel.org>2013-10-15 22:47:39 +0200
commit509f8dab8946cfc311def89f62352c0881e73348 (patch)
tree913fbb714704bcffc0ca6b8f44cdfb293ec9ee24 /test/test_byte_reverse.c
parent77429b6dd35e23efac92630bab35d935b9496345 (diff)
downloadmpd-509f8dab8946cfc311def89f62352c0881e73348.tar.gz
mpd-509f8dab8946cfc311def89f62352c0881e73348.tar.xz
mpd-509f8dab8946cfc311def89f62352c0881e73348.zip
Util/Macros: replacement for GLib's G_N_ELEMENTS()
Diffstat (limited to 'test/test_byte_reverse.c')
-rw-r--r--test/test_byte_reverse.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/test_byte_reverse.c b/test/test_byte_reverse.c
index 08a107622..1ab787772 100644
--- a/test/test_byte_reverse.c
+++ b/test/test_byte_reverse.c
@@ -18,6 +18,7 @@
*/
#include "util/byte_reverse.h"
+#include "util/Macros.hxx"
#include <glib.h>
@@ -26,10 +27,10 @@ test_byte_reverse_2(void)
{
static const char src[] = "123456";
static const char result[] = "214365";
- static uint8_t dest[G_N_ELEMENTS(src)];
+ static uint8_t dest[ARRAY_SIZE(src)];
reverse_bytes(dest, (const uint8_t *)src,
- (const uint8_t *)(src + G_N_ELEMENTS(src) - 1), 2);
+ (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 2);
g_assert_cmpstr((const char *)dest, ==, result);
}
@@ -38,10 +39,10 @@ test_byte_reverse_3(void)
{
static const char src[] = "123456";
static const char result[] = "321654";
- static uint8_t dest[G_N_ELEMENTS(src)];
+ static uint8_t dest[ARRAY_SIZE(src)];
reverse_bytes(dest, (const uint8_t *)src,
- (const uint8_t *)(src + G_N_ELEMENTS(src) - 1), 3);
+ (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 3);
g_assert_cmpstr((const char *)dest, ==, result);
}
@@ -50,10 +51,10 @@ test_byte_reverse_4(void)
{
static const char src[] = "12345678";
static const char result[] = "43218765";
- static uint8_t dest[G_N_ELEMENTS(src)];
+ static uint8_t dest[ARRAY_SIZE(src)];
reverse_bytes(dest, (const uint8_t *)src,
- (const uint8_t *)(src + G_N_ELEMENTS(src) - 1), 4);
+ (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 4);
g_assert_cmpstr((const char *)dest, ==, result);
}
@@ -62,10 +63,10 @@ test_byte_reverse_5(void)
{
static const char src[] = "1234567890";
static const char result[] = "5432109876";
- static uint8_t dest[G_N_ELEMENTS(src)];
+ static uint8_t dest[ARRAY_SIZE(src)];
reverse_bytes(dest, (const uint8_t *)src,
- (const uint8_t *)(src + G_N_ELEMENTS(src) - 1), 5);
+ (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 5);
g_assert_cmpstr((const char *)dest, ==, result);
}