storage_test.cc
Go to the documentation of this file.
1 
37 #include <gtest/gtest.h>
38 
40 
41 using namespace multisense::legacy;
42 
43 TEST(BufferPool, null_construction)
44 {
45  BufferPool pool(BufferPoolConfig{0, 0, 0, 0});
46 
47  ASSERT_EQ(pool.get_buffer(1), nullptr);
48 }
49 
50 TEST(BufferPool, valid_construction)
51 {
52  BufferPool pool(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 
67 TEST(BufferPool, buffer_to_large)
68 {
69  BufferPool pool(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 }
multisense::legacy
Definition: calibration.cc:40
multisense::legacy::BufferPool::get_buffer
std::shared_ptr< std::vector< uint8_t > > get_buffer(size_t target_size)
Get a buffer which will contain at least target_size bytes of storage.
Definition: storage.cc:98
multisense::legacy::BufferPool
Object to handle the management and delivery of buffers to used to store incoming data without needin...
Definition: LibMultiSense/include/details/legacy/storage.hh:58
multisense::legacy::BufferPoolConfig
Definition: LibMultiSense/include/details/legacy/storage.hh:46
storage.hh
TEST
TEST(BufferPool, null_construction)
Definition: storage_test.cc:43


multisense_lib
Author(s):
autogenerated on Thu Apr 17 2025 02:49:09