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/simple_allocator.h"
26namespace pw::multibuf::test {
29template <
size_t kDataSizeBytes = 1024,
size_t kMetaSizeBytes = kDataSizeBytes>
40 std::optional<MultiBuf> buffer =
Allocate(data.size());
41 PW_ASSERT(buffer.has_value());
42 std::copy(data.begin(), data.end(), buffer->begin());
43 return *std::move(buffer);
47 std::byte data_area_[kDataSizeBytes];
Definition: synchronized_allocator.h:35
An AllocatorForTest that is automatically initialized on construction.
Definition: testing.h:69
std::optional< MultiBuf > Allocate(size_t size)
Definition: multibuf.h:245
A simple first-fit MultiBufAllocator.
Definition: simple_allocator.h:59
Simple, self-contained pw::multibuf::MultiBufAllocator for test use.
Definition: simple_allocator_for_test.h:30
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:39
static constexpr size_t data_size_bytes()
Size of the data area.
Definition: simple_allocator_for_test.h:33