37 #include <gtest/gtest.h>
39 #include <details/legacy/storage.hh>
41 using namespace multisense::legacy;
43 TEST(BufferPool, null_construction)
45 BufferPool pool(BufferPoolConfig{0, 0, 0, 0});
47 ASSERT_EQ(pool.get_buffer(1),
nullptr);
50 TEST(BufferPool, valid_construction)
52 BufferPool pool(BufferPoolConfig{1, 10, 1, 30});
54 const auto small_buffer = pool.get_buffer(2);
55 const auto large_buffer = pool.get_buffer(20);
57 ASSERT_NE(small_buffer,
nullptr);
58 ASSERT_NE(large_buffer,
nullptr);
63 ASSERT_EQ(pool.get_buffer(20),
nullptr);
64 ASSERT_EQ(pool.get_buffer(2),
nullptr);
67 TEST(BufferPool, buffer_to_large)
69 BufferPool pool(BufferPoolConfig{1, 10, 1, 30});
74 ASSERT_EQ(pool.get_buffer(40),
nullptr);