- MockSlabAllocator SlabAlloc;
- BumpPtrAllocator Alloc(4096, 4096, SlabAlloc);
- uintptr_t Ptr = (uintptr_t)Alloc.Allocate(3000, 2048);
- MemSlab *Slab = SlabAlloc.GetLastSlab();
- EXPECT_LE(Ptr + 3000, ((uintptr_t)Slab) + Slab->Size);
+ BumpPtrAllocatorImpl<MockSlabAllocator> Alloc;
+
+ // First allocate a tiny bit to ensure we have to re-align things.
+ (void)Alloc.Allocate(1, 0);
+
+ // Now the big chunk with a big alignment.
+ (void)Alloc.Allocate(3000, 2048);
+
+ // We test that the last slab size is not the default 4096 byte slab, but
+ // rather a custom sized slab that is larger.
+ EXPECT_GT(MockSlabAllocator::GetLastSlabSize(), 4096u);