X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=unittests%2FSupport%2FAllocatorTest.cpp;h=cb9fa430369b7231dde61507b31dff6da9314a8f;hb=7172b38af7ed5d1c1e2c97fadfb0ae0c19aff816;hp=6c0fca90456e706ed7d2001d65a78845e9be3cb5;hpb=85f1968138839156c4bad3f7d186a7cb4dc4e57f;p=oota-llvm.git diff --git a/unittests/Support/AllocatorTest.cpp b/unittests/Support/AllocatorTest.cpp index 6c0fca90456..cb9fa430369 100644 --- a/unittests/Support/AllocatorTest.cpp +++ b/unittests/Support/AllocatorTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Allocator.h" - #include "gtest/gtest.h" #include @@ -93,6 +92,14 @@ TEST(AllocatorTest, TestOverflow) { EXPECT_EQ(2U, Alloc.GetNumSlabs()); } +// Test allocating with a size larger than the initial slab size. +TEST(AllocatorTest, TestSmallSlabSize) { + BumpPtrAllocator Alloc(128); + + Alloc.Allocate(200, 0); + EXPECT_EQ(2U, Alloc.GetNumSlabs()); +} + // Mock slab allocator that returns slabs aligned on 4096 bytes. There is no // easy portable way to do this, so this is kind of a hack. class MockSlabAllocator : public SlabAllocator {