Skip to content

Commit

Permalink
add test for AlignedAllocator
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Dec 13, 2021
1 parent d176b37 commit 4fcc0dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/bloballocators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,15 @@ TEST_CASE("bloballocators.SharedPtr")
iotaCheckView(view);
}
#endif

TEST_CASE("bloballocators.AlignedAllocator")
{
constexpr auto size = 50;

auto aa = llama::bloballoc::AlignedAllocator<int, 1024>{};
auto* p = aa.allocate(size);
CHECK((reinterpret_cast<std::uintptr_t>(p) & std::uintptr_t{0x3FF}) == 0);
aa.deallocate(p, size);
CHECK(aa == llama::bloballoc::AlignedAllocator<int, 1024>{});
CHECK(!(aa != llama::bloballoc::AlignedAllocator<int, 1024>{}));
}

0 comments on commit 4fcc0dd

Please sign in to comment.