llvm.org GIT mirror llvm / 0331a89
[Allocator] Simplify unittests by using the default size parameters in more places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205141 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 6 years ago
1 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
3232
3333 // Allocate enough bytes to create three slabs.
3434 TEST(AllocatorTest, ThreeSlabs) {
35 BumpPtrAllocator Alloc(4096, 4096);
35 BumpPtrAllocator Alloc;
3636 Alloc.Allocate(3000, 0);
3737 EXPECT_EQ(1U, Alloc.GetNumSlabs());
3838 Alloc.Allocate(3000, 0);
4444 // Allocate enough bytes to create two slabs, reset the allocator, and do it
4545 // again.
4646 TEST(AllocatorTest, TestReset) {
47 BumpPtrAllocator Alloc(4096, 4096);
47 BumpPtrAllocator Alloc;
4848 Alloc.Allocate(3000, 0);
4949 EXPECT_EQ(1U, Alloc.GetNumSlabs());
5050 Alloc.Allocate(3000, 0);
8080 // Test allocating just over the slab size. This tests a bug where before the
8181 // allocator incorrectly calculated the buffer end pointer.
8282 TEST(AllocatorTest, TestOverflow) {
83 BumpPtrAllocator Alloc(4096, 4096);
83 BumpPtrAllocator Alloc;
8484
8585 // Fill the slab right up until the end pointer.
8686 Alloc.Allocate(4096 - sizeof(MemSlab), 0);
9393
9494 // Test allocating with a size larger than the initial slab size.
9595 TEST(AllocatorTest, TestSmallSlabSize) {
96 BumpPtrAllocator Alloc(128);
96 BumpPtrAllocator Alloc;
9797
98 Alloc.Allocate(200, 0);
98 Alloc.Allocate(8000, 0);
9999 EXPECT_EQ(2U, Alloc.GetNumSlabs());
100100 }
101101