Skip to content

Commit

Permalink
Add tests for byteScatter()
Browse files Browse the repository at this point in the history
  • Loading branch information
alex65536 committed Aug 10, 2023
1 parent e723c37 commit b5a45e4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/util/bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b5a45e4

Please sign in to comment.