explicit Builder(osmium::memory::Buffer& buffer, Builder* parent, osmium::memory::item_size_type size) : m_buffer(buffer), m_parent(parent), m_item_offset(buffer.written()) { m_buffer.reserve_space(size); assert(buffer.is_aligned()); if (m_parent) { m_parent->add_size(size); } }
REQUIRE(empty_buffer1); REQUIRE(empty_buffer2); REQUIRE(invalid_buffer1 == invalid_buffer2); REQUIRE(invalid_buffer1 != empty_buffer1); REQUIRE(empty_buffer1 != empty_buffer2); REQUIRE(invalid_buffer1.capacity() == 0); REQUIRE(invalid_buffer1.written() == 0); REQUIRE(invalid_buffer1.committed() == 0); REQUIRE(invalid_buffer1.clear() == 0); REQUIRE(empty_buffer1.capacity() == 1024); REQUIRE(empty_buffer1.written() == 0); REQUIRE(empty_buffer1.committed() == 0); REQUIRE(empty_buffer1.is_aligned()); REQUIRE(empty_buffer1.clear() == 0); REQUIRE(empty_buffer2.capacity() == 2048); REQUIRE(empty_buffer2.written() == 0); REQUIRE(empty_buffer2.committed() == 0); REQUIRE(empty_buffer2.is_aligned()); REQUIRE(empty_buffer2.clear() == 0); } TEST_CASE("Buffer with zero size") { osmium::memory::Buffer buffer{0}; REQUIRE(buffer.capacity() == 64); } TEST_CASE("Buffer with less than minimum size") {