2017-07-06 23:47:28 +08:00
|
|
|
#include <gtest/gtest.h>
|
2016-12-19 02:21:29 +08:00
|
|
|
|
2017-07-06 23:47:28 +08:00
|
|
|
#include "memory/block_allocator.hpp"
|
2016-12-19 02:21:29 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
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);
|
2016-12-19 02:21:29 +08:00
|
|
|
}
|
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
TEST(BlockAllocatorTest, CountMallocAndFreeCalls) {
|
|
|
|
// TODO: implementation
|
|
|
|
EXPECT_EQ(true, true);
|
2016-12-19 02:21:29 +08:00
|
|
|
}
|
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
int main(int argc, char **argv) {
|
|
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
|
|
return RUN_ALL_TESTS();
|
2016-12-19 02:21:29 +08:00
|
|
|
}
|