Fix large allocation tests for mimir::Region
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
This commit is contained in:
@@ -33,14 +33,22 @@ TEST(Region, TooBig)
|
||||
{
|
||||
mimir::init();
|
||||
mimir::Region region;
|
||||
EXPECT_FALSE(region.init(1 << 44ULL)); // Attempt to allocate 16TB of pages
|
||||
EXPECT_FALSE(region.init(1ULL << 50)); // Attempt to reserve too many pages
|
||||
}
|
||||
|
||||
TEST(Region, OutOfMemory)
|
||||
{
|
||||
mimir::init();
|
||||
mimir::Region region;
|
||||
EXPECT_TRUE(region.init(1ULL << 46)); // Attempt to reserve 64TB of pages
|
||||
EXPECT_FALSE(region.resize(1ULL << 45)); // Attempt to commit 32TB of pages (Assuming we don't have 32TB of ram!)
|
||||
}
|
||||
|
||||
TEST(Region, Min1GB)
|
||||
{
|
||||
mimir::init();
|
||||
mimir::Region region;
|
||||
EXPECT_TRUE(region.init(1 << 30ULL)); // Allocate 1GB of pages
|
||||
EXPECT_TRUE(region.init(1ULL << 30)); // Allocate 1GB of pages
|
||||
}
|
||||
|
||||
TEST(Region, Resizing)
|
||||
@@ -55,11 +63,11 @@ TEST(Region, Resizing)
|
||||
EXPECT_TRUE(region.resize(0));
|
||||
EXPECT_EQ(region.getSize(), 0);
|
||||
|
||||
EXPECT_TRUE(region.resize(1 << 4ULL));
|
||||
EXPECT_TRUE(region.resize(1 << 10ULL));
|
||||
EXPECT_TRUE(region.resize(1 << 5ULL));
|
||||
EXPECT_TRUE(region.resize(1 << 0ULL));
|
||||
EXPECT_TRUE(region.resize(1 << 9ULL));
|
||||
EXPECT_TRUE(region.resize(1ULL << 4));
|
||||
EXPECT_TRUE(region.resize(1ULL << 10));
|
||||
EXPECT_TRUE(region.resize(1ULL << 5));
|
||||
EXPECT_TRUE(region.resize(1ULL << 0));
|
||||
EXPECT_TRUE(region.resize(1ULL << 9));
|
||||
}
|
||||
|
||||
TEST(Region, OverSized)
|
||||
@@ -67,10 +75,10 @@ TEST(Region, OverSized)
|
||||
mimir::init();
|
||||
mimir::Region region;
|
||||
|
||||
EXPECT_TRUE(region.resize(1 << 4ULL));
|
||||
EXPECT_TRUE(region.resize(1ULL << 4));
|
||||
size_t prevSize = region.getSize();
|
||||
|
||||
EXPECT_FALSE(region.resize(1 << 20ULL));
|
||||
EXPECT_FALSE(region.resize(1ULL << 20));
|
||||
EXPECT_EQ(region.getSize(), prevSize);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user