LibMultiSense
LibMultiSense Documentation
Loading...
Searching...
No Matches
storage_test.cc
Go to the documentation of this file.
1
37#include <gtest/gtest.h>
38
39#include <details/legacy/storage.hh>
40
41using namespace multisense::legacy;
42
43TEST(BufferPool, null_construction)
44{
45 auto pool = std::make_shared<BufferPool>(BufferPoolConfig{0, 0, 0, 0});
46
47 ASSERT_EQ(pool->get_buffer(1), nullptr);
48}
49
50TEST(BufferPool, valid_construction)
51{
52 auto pool = std::make_shared<BufferPool>(BufferPoolConfig{1, 10, 1, 30});
53
54 const auto small_buffer = pool->get_buffer(2);
55 const auto large_buffer = pool->get_buffer(20);
56
57 ASSERT_NE(small_buffer, nullptr);
58 ASSERT_NE(large_buffer, nullptr);
59
60 //
61 // At this point we should be out of buffers
62 //
63 ASSERT_EQ(pool->get_buffer(20), nullptr);
64 ASSERT_EQ(pool->get_buffer(2), nullptr);
65}
66
67TEST(BufferPool, buffer_to_large)
68{
69 auto pool = std::make_shared<BufferPool>(BufferPoolConfig{1, 10, 1, 30});
70
71 //
72 // We should have no buffer of size 40
73 //
74 ASSERT_EQ(pool->get_buffer(40), nullptr);
75}
TEST(BufferPool, null_construction)