29 X("array_list::empty", test_al_empty), \
30 X("array_list::push_less_than_32", test_al_push_less_than_32), \
31 X("array_list::push_more_than_32", test_al_push_more_than_32), \
32 X("array_list::tail_to_trie_boundary", test_al_push_tail_to_trie_boundary), \
33 X("array_list::get_out_of_bounds", test_al_get_out_of_bounds), \
34 X("array_list::update", test_al_update), X("array_list::remove", test_al_remove), \
35 X("array_list::remove_out_of_bounds", test_al_remove_out_of_bounds), \
36 X("array_list::remove_drain_and_push", test_al_remove_drain_and_push), \
37 X("array_list::for_each", test_al_for_each), \
38 X("array_list::for_each_early_exit", test_al_for_each_early_exit), \
39 X("array_list::for_each_empty", test_al_for_each_empty)
42# define AL_TEST_LOG(...) DBG("AL_TEST", __VA_ARGS__)
44# define AL_TEST_LOG(...)
73 for (
size_t i = 0; i < 31; i++) {
86 for (
size_t i = 0; i < 30; i++) {
106 for (
int i = 0; i < 2000; i++) {
132 for (
int i = 0; i < 2000; i++) {
158 for (
int i = 0; i < 32; i++) {
219 for (
int i = 0; i < 40; i++) {
293 for (
int i = 0; i < 100; i++) {
305 for (
int i = 0; i < 99; i++) {
309 int expected = i < 50 ? i : i + 1;
344 for (
int i = 0; i < 40; i++) {
368 for (
int i = 0; i < 2000; i++) {
375 for (
int i = 0; i < 1990; i++) {
380 for (
int i = 0; i < 10; i++) {
388 for (
int i = 0; i < 2000; i++) {
396 for (
int i = 0; i < 10; i++) {
401 for (
int i = 0; i < 2000; i++) {
450 for (
int i = 0; i < 100; i++) {
477 for (
int i = 0; i < 20; i++) {
array_list_maybe_element_t array_list_get(const array_list_t *al, array_list_index_t n)
Negative index is not supported.
srn_error_t * array_list_update(array_list_t *al, array_list_index_t n, array_list_elem_t x)
Update the given index n of the array list al with the new element x.
srn_error_t * array_list_remove(array_list_t *al, array_list_index_t n)
Remove the element at the given index n from the array list al, shifting every later element down one...
array_list_t array_list_empty(const srn_context_t *ctx)
Create an empty array list in the given context ctx.
srn_error_t * array_list_push(array_list_t *al, array_list_elem_t x)
Push the given element x to the end of array_list al.
srn_error_t * array_list_for_each(array_list_t *al, array_list_for_each_f_t f)
Run the give function f for every element in the given array list al.
A bit-partitioned trie with a tail buffer, used as a growable indexed sequence in the runtime.
static void test_al_remove()
static void test_al_get_out_of_bounds()
static void test_al_remove_drain_and_push()
static void test_al_for_each()
static srn_error_t * fe_all_visitor(array_list_t *al, size_t n, void *data)
static void test_al_push_more_than_32()
static size_t g_fe_stop_at
static void test_al_for_each_empty()
static void test_al_push_tail_to_trie_boundary()
static srn_error_t * fe_early_exit_visitor(array_list_t *al, size_t n, void *data)
static void test_al_for_each_early_exit()
static void test_al_remove_out_of_bounds()
static void test_al_update()
static void test_al_empty()
static bool g_fe_order_ok
static void test_al_push_less_than_32()
#define RELEASE_CONTEXT(x)
#define ASSERT_NOT_NULL(x)
#define SHUTDOWN_ENGINE(mm, engine)
#define MAKE_ENGINE(mm, engine)
#define MAKE_CONTEXT(engine, x)
#define ERR(ctx, err, msg)
const srn_context_t * ctx
The context that owns every allocation the array list retains.
A runtime error, a tag classifying the failure and a human-readable message.