18#include <initializer_list>
21#include "pw_allocator/synchronized_allocator.h"
22#include "pw_allocator/testing.h"
23#include "pw_assert/assert.h"
24#include "pw_multibuf/config.h"
25#include "pw_multibuf/simple_allocator.h"
27namespace pw::multibuf::test {
30template <
size_t kDataSizeBytes = 1024,
size_t kMetaSizeBytes = kDataSizeBytes>
41 std::optional<MultiBuf> buffer = Allocate(data.size());
42 PW_ASSERT(buffer.has_value());
43 std::copy(data.begin(), data.end(), buffer->begin());
44 return *std::move(buffer);
48 std::byte data_area_[kDataSizeBytes];
Definition: synchronized_allocator.h:35
An AllocatorForTest that is automatically initialized on construction.
Definition: testing.h:69
Definition: multibuf_v1.h:246
A simple first-fit MultiBufAllocator.
Definition: simple_allocator.h:60
Simple, self-contained pw::multibuf::MultiBufAllocator for test use.
Definition: simple_allocator_for_test.h:31
MultiBuf BufWith(std::initializer_list< std::byte > data)
Allocates a MultiBuf and initializes its contents to the provided data.
Definition: simple_allocator_for_test.h:40
static constexpr size_t data_size_bytes()
Size of the data area.
Definition: simple_allocator_for_test.h:34