4 static void setup_static(void (*f
)(struct mem_pool
*), size_t block_alloc
)
6 struct mem_pool pool
= { .block_alloc
= block_alloc
};
8 mem_pool_discard(&pool
, 0);
11 static void t_calloc_100(struct mem_pool
*pool
)
14 char *buffer
= mem_pool_calloc(pool
, 1, size
);
15 for (size_t i
= 0; i
< size
; i
++)
16 check_int(buffer
[i
], ==, 0);
17 if (!check(pool
->mp_block
!= NULL
))
19 check(pool
->mp_block
->next_free
!= NULL
);
20 check(pool
->mp_block
->end
!= NULL
);
23 int cmd_main(int argc UNUSED
, const char **argv UNUSED
)
25 TEST(setup_static(t_calloc_100
, 1024 * 1024),
26 "mem_pool_calloc returns 100 zeroed bytes with big block");
27 TEST(setup_static(t_calloc_100
, 1),
28 "mem_pool_calloc returns 100 zeroed bytes with tiny block");