diff options
author | Max Kellermann <max@musicpd.org> | 2019-08-03 13:10:49 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-08-03 13:10:49 +0200 |
commit | cde6c46d2fff083166c3aca7fbf07df737c07cdc (patch) | |
tree | 51c5706d03b6ea61fa6dad6566dfa67bc090efda /test/test_byte_reverse.cxx | |
parent | d305f187d5268a040aca6df62849c33b05308963 (diff) |
util/Macros: replace with std::size() (C++17)
Diffstat (limited to 'test/test_byte_reverse.cxx')
-rw-r--r-- | test/test_byte_reverse.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/test/test_byte_reverse.cxx b/test/test_byte_reverse.cxx index 144ebde6c..8535a89df 100644 --- a/test/test_byte_reverse.cxx +++ b/test/test_byte_reverse.cxx @@ -18,7 +18,6 @@ */ #include "util/ByteReverse.hxx" -#include "util/Macros.hxx" #include "util/Compiler.h" #include <gtest/gtest.h> @@ -30,10 +29,10 @@ TEST(ByteReverse, A) { alignas(uint16_t) static const char src[] = "123456"; static const char result[] = "214365"; - alignas(uint16_t)static uint8_t dest[ARRAY_SIZE(src)]; + alignas(uint16_t)static uint8_t dest[std::size(src)]; reverse_bytes(dest, (const uint8_t *)src, - (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 2); + (const uint8_t *)(src + std::size(src) - 1), 2); EXPECT_STREQ(result, (const char *)dest); } @@ -41,10 +40,10 @@ TEST(ByteReverse, B) { static const char src[] = "123456"; static const char result[] = "321654"; - static uint8_t dest[ARRAY_SIZE(src)]; + static uint8_t dest[std::size(src)]; reverse_bytes(dest, (const uint8_t *)src, - (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 3); + (const uint8_t *)(src + std::size(src) - 1), 3); EXPECT_STREQ(result, (const char *)dest); } @@ -52,10 +51,10 @@ TEST(ByteReverse, C) { alignas(uint32_t) static const char src[] = "12345678"; static const char result[] = "43218765"; - alignas(uint32_t) static uint8_t dest[ARRAY_SIZE(src)]; + alignas(uint32_t) static uint8_t dest[std::size(src)]; reverse_bytes(dest, (const uint8_t *)src, - (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 4); + (const uint8_t *)(src + std::size(src) - 1), 4); EXPECT_STREQ(result, (const char *)dest); } @@ -63,9 +62,9 @@ TEST(ByteReverse, D) { static const char src[] = "1234567890"; static const char result[] = "5432109876"; - static uint8_t dest[ARRAY_SIZE(src)]; + static uint8_t dest[std::size(src)]; reverse_bytes(dest, (const uint8_t *)src, - (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 5); + (const uint8_t *)(src + std::size(src) - 1), 5); EXPECT_STREQ(result, (const char *)dest); } |