From b5a45e4552ed6dc2cf70b95ef012a479a8ade59d Mon Sep 17 00:00:00 2001 From: Alexander Kernozhitsky Date: Thu, 10 Aug 2023 02:34:15 +0200 Subject: [PATCH] Add tests for byteScatter() --- src/util/bit.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/util/bit.h b/src/util/bit.h index 0453db8..d61918b 100644 --- a/src/util/bit.h +++ b/src/util/bit.h @@ -167,6 +167,16 @@ inline uint64_t depositBits(uint64_t x, uint64_t msk) { } #endif +// Static tests (performed at compile time) + +// Tests for `byteScatter()` +static_assert(byteScatter(0) == 0); +static_assert(byteScatter(0x42) == 0x4242424242424242); +static_assert(byteScatter(0x7f) == 0x7f7f7f7f7f7f7f7f); +static_assert(byteScatter(0x80) == 0x8080808080808080); +static_assert(byteScatter(0xfe) == 0xfefefefefefefefe); +static_assert(byteScatter(0xff) == 0xffffffffffffffff); + } // namespace SoFUtil #endif // SOF_UTIL_BIT_INCLUDED