for (const void *_foreach_end = \
CONST_PTR_OFFSET(*(array)->v, (array)->arr.buffer->used), \
*_foreach_ptr = CONST_PTR_OFFSET(*(array)->v, ARRAY_TYPE_CHECK(array, &elem) + \
- COMPILE_ERROR_IF_TRUE(sizeof(elem) > 16)) \
+ COMPILE_ERROR_IF_TRUE(sizeof(elem) > sizeof(void *))) \
; \
(_foreach_ptr != _foreach_end && \
(memcpy(&elem, _foreach_ptr, sizeof(elem)), TRUE)) \
}
test_end();
}
-static void test_array_foreach_elem_struct(void)
-{
- ARRAY(struct foo) foos;
- struct foo foo;
- unsigned int i;
-
- test_begin("array foreach_elem struct");
- t_array_init(&foos, 32);
- for (i = 0; i < 10; i++) {
- foo.a = foo.b = foo.c = i;
- array_push_back(&foos, &foo);
- }
-
- i = 0;
- array_foreach_elem(&foos, foo) {
- test_assert_idx(foo.a == i, i);
- test_assert_idx(foo.b == i, i);
- test_assert_idx(foo.c == i, i);
- i++;
- }
- test_end();
-}
static void test_array_foreach_elem_string(void)
{
ARRAY(char *) blurbs;
{
test_array_count();
test_array_foreach();
- test_array_foreach_elem_struct();
test_array_foreach_elem_string();
test_array_reverse();
test_array_cmp();