LibMultiSense
LibMultiSense Documentation
storage_test.cc
Go to the documentation of this file.
1 
37 #include <gtest/gtest.h>
38 
39 #include <details/legacy/storage.hh>
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 }
TEST
TEST(BufferPool, null_construction)
Definition: storage_test.cc:43