aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/AllocatorTest.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2009-07-23 01:40:54 +0000
committerReid Kleckner <reid@kleckner.net>2009-07-23 01:40:54 +0000
commit921673225cee9a4d5b3ee6372fb15d851e82a238 (patch)
tree91e9aa919566f97de1deffc7d86f3630f3f4ad18 /llvm/unittests/Support/AllocatorTest.cpp
parent57421f3e0f205798259ce9066ba04c62de951bda (diff)
downloadllvm-921673225cee9a4d5b3ee6372fb15d851e82a238.zip
llvm-921673225cee9a4d5b3ee6372fb15d851e82a238.tar.gz
llvm-921673225cee9a4d5b3ee6372fb15d851e82a238.tar.bz2
Reverting r76825 and r76828, since they caused clang runtime errors and some build failure involving memset.
llvm-svn: 76838
Diffstat (limited to 'llvm/unittests/Support/AllocatorTest.cpp')
-rw-r--r--llvm/unittests/Support/AllocatorTest.cpp61
1 files changed, 0 insertions, 61 deletions
diff --git a/llvm/unittests/Support/AllocatorTest.cpp b/llvm/unittests/Support/AllocatorTest.cpp
index 139270b..e69de29 100644
--- a/llvm/unittests/Support/AllocatorTest.cpp
+++ b/llvm/unittests/Support/AllocatorTest.cpp
@@ -1,61 +0,0 @@
-//===- llvm/unittest/Support/AllocatorTest.cpp - BumpPtrAllocator tests ---===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/Allocator.h"
-
-#include "gtest/gtest.h"
-
-using namespace llvm;
-
-namespace {
-
-TEST(AllocatorTest, Basics) {
- BumpPtrAllocator Alloc;
- int *a = (int*)Alloc.Allocate(sizeof(int), 0);
- int *b = (int*)Alloc.Allocate(sizeof(int) * 10, 0);
- int *c = (int*)Alloc.Allocate(sizeof(int), 0);
- *a = 1;
- b[0] = 2;
- b[9] = 2;
- *c = 3;
- EXPECT_EQ(1, *a);
- EXPECT_EQ(2, b[0]);
- EXPECT_EQ(2, b[9]);
- EXPECT_EQ(3, *c);
- EXPECT_EQ(1U, Alloc.GetNumSlabs());
-}
-
-// Allocate enough bytes to create three slabs.
-TEST(AllocatorTest, ThreeSlabs) {
- BumpPtrAllocator Alloc(4096, 4096);
- Alloc.Allocate(3000, 0);
- EXPECT_EQ(1U, Alloc.GetNumSlabs());
- Alloc.Allocate(3000, 0);
- EXPECT_EQ(2U, Alloc.GetNumSlabs());
- Alloc.Allocate(3000, 0);
- EXPECT_EQ(3U, Alloc.GetNumSlabs());
-}
-
-// Allocate enough bytes to create two slabs, reset the allocator, and do it
-// again.
-TEST(AllocatorTest, TestReset) {
- BumpPtrAllocator Alloc(4096, 4096);
- Alloc.Allocate(3000, 0);
- EXPECT_EQ(1U, Alloc.GetNumSlabs());
- Alloc.Allocate(3000, 0);
- EXPECT_EQ(2U, Alloc.GetNumSlabs());
- Alloc.Reset();
- EXPECT_EQ(1U, Alloc.GetNumSlabs());
- Alloc.Allocate(3000, 0);
- EXPECT_EQ(1U, Alloc.GetNumSlabs());
- Alloc.Allocate(3000, 0);
- EXPECT_EQ(2U, Alloc.GetNumSlabs());
-}
-
-} // anonymous namespace