47 if (!out_fake || !out_stream || !mem) {
55 fake_stream_t *impl = NULL;
66 fake_stream_destroy(&impl, &stream);
82 fake_stream_t *impl = NULL;
89 (*fake)->mem->free(*fake);
93 fake_stream_destroy(&impl, stream);
98 if (!fake || !fake->
impl) {
102 fake_stream_reset(fake->
impl);
110 if (!fake || !fake->
impl) {
114 fake_stream_set_write_result(fake->
impl, n, status);
121 if (!fake || !fake->
impl) {
125 fake_stream_set_flush_result(fake->
impl, status);
133 if (!fake || !fake->
impl) {
137 fake_stream_fail_write_since(fake->
impl, call_idx, status);
142 if (!fake || !fake->
impl) {
151 if (!fake || !fake->
impl) {
155 return fake_stream_written_len(fake->
impl);
160 if (!fake || !fake->
impl) {
164 return fake_stream_written_data(fake->
impl);
#define LEXLEO_ASSERT(expr)
Public environment type for the stream port.
const stream_fake_counters_t * stream_fake_counters(const stream_fake_t *fake)
Return the current call counters recorded by the fake stream.
void stream_fake_set_flush_result(stream_fake_t *fake, stream_status_t status)
Configure the result returned by flush operations.
void stream_fake_destroy(stream_fake_t **fake, stream_t **stream)
Destroy a fake stream backend and its associated public stream.
void stream_fake_fail_write_since(stream_fake_t *fake, size_t call_idx, stream_status_t status)
Make fake writes fail starting from a given call index.
void stream_fake_set_write_result(stream_fake_t *fake, size_t n, stream_status_t status)
Configure the result returned by the next write operations.
void stream_fake_reset(stream_fake_t *fake)
Reset the fake stream runtime state and counters.
size_t stream_fake_written_len(const stream_fake_t *fake)
Return the number of bytes captured by the fake stream.
const uint8_t * stream_fake_written_data(const stream_fake_t *fake)
Return the captured bytes written through the fake stream.
stream_status_t stream_fake_create(stream_fake_t **out_fake, stream_t **out_stream, const osal_mem_ops_t *mem)
Create a fake stream backend and its associated public stream_t.
Fake stream provider used by stream tests.
Internal include shim for the stream fake provider.
stream_status_t
Public status codes used by the stream port.
void *(* calloc)(size_t nmemb, size_t size)
Runtime environment for the stream port.
const osal_mem_ops_t * mem
Memory operations used by the stream port.
Call counters recorded by the fake stream.
const osal_mem_ops_t * mem
Private handle structure for a stream_t.