76 assert_ptr_not_equal(rbuffer, NULL);
83 assert_ptr_equal(rbuffer, NULL);
86 assert_ptr_not_equal(rbuffer, NULL);
89 assert_ptr_equal(rbuffer->
read_pos, NULL);
90 assert_ptr_equal(rbuffer->
write_pos, NULL);
93 assert_ptr_equal(rbuffer, NULL);
114 assert_ptr_equal(rbuffer.
read_pos, NULL);
115 assert_ptr_equal(rbuffer.
write_pos, NULL);
272 assert_ptr_equal(rbuffer->
read_pos, NULL);
273 assert_ptr_equal(rbuffer->
write_pos, NULL);
352 const char*
data =
"0123456789";
372 const char*
data =
"0123456789";
389 const char*
data =
"0123456789";
416 char buffer[10] =
"";
429 const char*
data =
"0123456789";
430 char buffer[10] =
"";
445 const char*
data =
"0123456789";
446 char buffer[10] =
"";
455 assert_int_equal(strncmp(buffer,
data, 5), 0);
460 assert_int_equal(strncmp(buffer,
data + 5, 5), 0);
471 const char*
data =
"0123456789";
472 char buffer[30] =
"";
482 assert_int_equal(strncmp(buffer,
data, 10), 0);
483 assert_int_equal(strncmp(buffer + 10,
data, 10), 0);
493 assert_int_equal(strncmp(buffer,
data, 10), 0);
500 const char*
data =
"0123456789";
501 char buffer[10] =
"";
514 assert_int_equal(strncmp(buffer,
data, 10), 0);
Ambiorix ring buffer API header file.
size_t amxc_rbuffer_size(const amxc_rbuffer_t *const rb)
Get the size of the data stored in the ring buffer.
int amxc_rbuffer_shrink(amxc_rbuffer_t *const rb, const size_t size)
Shrinks the ring buffer.
void amxc_rbuffer_clean(amxc_rbuffer_t *const rb)
Frees the buffer and sets all pointers of the ring buffer structure to NULL.
ssize_t amxc_rbuffer_write(amxc_rbuffer_t *const rb, const char *const buf, const size_t count)
Writes a number of bytes to the ring buffer.
int amxc_rbuffer_new(amxc_rbuffer_t **rb, const size_t size)
Allocates a ring buffer.
int amxc_rbuffer_grow(amxc_rbuffer_t *const rb, const size_t size)
Grows the ring buffer.
AMXC_INLINE size_t amxc_rbuffer_capacity(const amxc_rbuffer_t *const rb)
Get the capacity of the ring buffer.
void amxc_rbuffer_delete(amxc_rbuffer_t **rb)
Frees the previously allocated ring buffer.
AMXC_INLINE bool amxc_rbuffer_is_empty(const amxc_rbuffer_t *const rb)
Checks that the ring buffer is empty.
int amxc_rbuffer_init(amxc_rbuffer_t *const rb, const size_t size)
Initializes a ring buffer.
ssize_t amxc_rbuffer_read(amxc_rbuffer_t *const rb, char *const buf, size_t count)
Reads a number of bytes from the ring buffer.
The ring buffer structure.
void amxc_rbuffer_grow_write_before_read_check(UNUSED void **state)
void amxc_rbuffer_is_empty_null_check(UNUSED void **state)
void amxc_rbuffer_new_delete_null_check(UNUSED void **state)
void amxc_rbuffer_capacity_check(UNUSED void **state)
void amxc_rbuffer_new_delete_check(UNUSED void **state)
void amxc_rbuffer_is_empty_check(UNUSED void **state)
void amxc_rbuffer_init_clean_check(UNUSED void **state)
void amxc_rbuffer_size_check(UNUSED void **state)
void amxc_rbuffer_shrink_write_before_read_data_loss_check(UNUSED void **state)
void amxc_rbuffer_shrink_read_before_write_data_loss_check(UNUSED void **state)
void amxc_rbuffer_read_null_check(UNUSED void **state)
void amxc_rbuffer_shrink_read_before_write_check(UNUSED void **state)
void amxc_rbuffer_read_short_check(UNUSED void **state)
void amxc_rbuffer_read_wrap_check(UNUSED void **state)
void amxc_rbuffer_shrink_full(UNUSED void **state)
void amxc_rbuffer_grow_check(UNUSED void **state)
void amxc_rbuffer_capacity_null_check(UNUSED void **state)
void amxc_rbuffer_read_check(UNUSED void **state)
void amxc_rbuffer_grow_shrink_null_check(UNUSED void **state)
void amxc_rbuffer_shrink_write_before_read_check(UNUSED void **state)
void amxc_rbuffer_write_buffer_empty_check(UNUSED void **state)
void amxc_rbuffer_init_clean_null_check(UNUSED void **state)
void amxc_rbuffer_grow_read_before_write_check(UNUSED void **state)
void amxc_rbuffer_write_buffer_need_to_grow_check(UNUSED void **state)
void amxc_rbuffer_read_buffer_empty_check(UNUSED void **state)
void amxc_rbuffer_size_null_check(UNUSED void **state)
void amxc_rbuffer_read_zero_bytes_check(UNUSED void **state)
void amxc_rbuffer_write_buffer_wrap_buffer_check(UNUSED void **state)
void amxc_rbuffer_write_null_check(UNUSED void **state)
void amxc_rbuffer_shrink_check(UNUSED void **state)