memgraph/tests/unit/stack_allocator.cpp
Teon Banek 893df584f6 Merge utils/exceptions into single file
Summary: Update documentation of `utils/exceptions.hpp`

Reviewers: mislav.bradac, florijan, buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D300
2017-04-20 16:53:21 +02:00

30 lines
603 B
C++

#include "gtest/gtest.h"
#include "utils/memory/stack_allocator.hpp"
struct Object {
int a;
int b;
Object(int a, int b) : a(a), b(b) {}
};
TEST(StackAllocatorTest, AllocationAndObjectValidity) {
utils::StackAllocator allocator;
for (int i = 0; i < 64 * 1024; ++i) {
auto object = allocator.make<Object>(1, 2);
ASSERT_EQ(object->a, 1);
ASSERT_EQ(object->b, 2);
}
}
TEST(StackAllocatorTest, CountMallocAndFreeCalls) {
// TODO: implementation
EXPECT_EQ(true, true);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}