memgraph/tests/unit/block_allocator.cpp
Marko Budiselic dc3433aa8a Stack Allocator Unit Test
Summary: Stack Allocator Unit Test

Test Plan: manual (unit tests are not passing because malloc and free counters have to be added)

Reviewers: sale

Subscribers: sale, buda

Differential Revision: https://memgraph.phacility.com/D21
2016-12-18 20:32:41 +01:00

25 lines
565 B
C++

#include "gtest/gtest.h"
#include "utils/memory/block_allocator.hpp"
TEST(BlockAllocatorTest, UnusedVsReleaseSize)
{
BlockAllocator<64> block_allocator(10);
void *block = block_allocator.acquire();
block_allocator.release(block);
EXPECT_EQ(block_allocator.unused_size(), 9);
EXPECT_EQ(block_allocator.release_size(), 1);
}
TEST(BlockAllocatorTest, CountMallocAndFreeCalls)
{
// TODO: implementation
EXPECT_EQ(true, false);
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}