llvm/llvm/unittests/Support/AllocatorTest.cpp

//===- llvm/unittest/Support/AllocatorTest.cpp - BumpPtrAllocator tests ---===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "llvm/Support/Allocator.h"
#include "gtest/gtest.h"
#include <cstdlib>

usingnamespacellvm;

namespace {

TEST(AllocatorTest, Basics) {}

// Allocate enough bytes to create three slabs.
TEST(AllocatorTest, ThreeSlabs) {}

// Allocate enough bytes to create two slabs, reset the allocator, and do it
// again.
TEST(AllocatorTest, TestReset) {}

// Test some allocations at varying alignments.
TEST(AllocatorTest, TestAlignment) {}

// Test zero-sized allocations.
// In general we don't need to allocate memory for these.
// However Allocate never returns null, so if the first allocation is zero-sized
// we end up creating a slab for it.
TEST(AllocatorTest, TestZero) {}

// Test allocating just over the slab size.  This tests a bug where before the
// allocator incorrectly calculated the buffer end pointer.
TEST(AllocatorTest, TestOverflow) {}

// Test allocating with a size larger than the initial slab size.
TEST(AllocatorTest, TestSmallSlabSize) {}

// Test requesting alignment that goes past the end of the current slab.
TEST(AllocatorTest, TestAlignmentPastSlab) {}

// Test allocating with a decreased growth delay.
TEST(AllocatorTest, TestFasterSlabGrowthDelay) {}

// Test allocating with a increased growth delay.
TEST(AllocatorTest, TestSlowerSlabGrowthDelay) {}

TEST(AllocatorTest, TestIdentifyObject) {}

// 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 {};

size_t MockSlabAllocator::LastSlabSize =;

// Allocate a large-ish block with a really large alignment so that the
// allocator will think that it has space, but after it does the alignment it
// will not.
TEST(AllocatorTest, TestBigAlignment) {}

}  // anonymous namespace