Remove libc allocator
This commit is contained in:
@@ -1,27 +1,10 @@
|
||||
#include "test_allocator.h"
|
||||
#include "libc/mem_libc_allocator.h"
|
||||
#include "mem_allocator.h"
|
||||
#include "mem_arena_allocator.h"
|
||||
#include "tester.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
TestFuncResult test_libc_allocator(void) {
|
||||
Allocator allocator = wapp_mem_libc_allocator();
|
||||
bool result = allocator.obj == NULL && allocator.alloc != NULL &&
|
||||
allocator.alloc_aligned == NULL && allocator.realloc != NULL &&
|
||||
allocator.realloc_aligned == NULL && allocator.free != NULL;
|
||||
void *ptr = wapp_mem_allocator_alloc(&allocator, 20);
|
||||
result = result && (ptr != NULL);
|
||||
|
||||
if (ptr != NULL) {
|
||||
wapp_mem_allocator_free(&allocator, &ptr);
|
||||
result = result && (ptr == NULL);
|
||||
}
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_allocator(void) {
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(4096);
|
||||
bool result = allocator.obj != NULL && allocator.alloc != NULL &&
|
||||
|
@@ -7,7 +7,6 @@
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // __cplusplus
|
||||
|
||||
TestFuncResult test_libc_allocator(void);
|
||||
TestFuncResult test_arena_allocator(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -9,9 +9,8 @@
|
||||
|
||||
|
||||
int main(void) {
|
||||
wapp_tester_run_tests(test_libc_allocator, test_arena_allocator, test_arena_init,
|
||||
test_arena_init_succeeds_when_reserving_very_large_size, test_str8_lit,
|
||||
test_str8_buf, test_str8_get_index_within_bounds, test_str8_get_index_out_of_bounds,
|
||||
wapp_tester_run_tests(test_arena_allocator, test_arena_init, test_arena_init_succeeds_when_reserving_very_large_size,
|
||||
test_str8_lit, test_str8_buf, test_str8_get_index_within_bounds, test_str8_get_index_out_of_bounds,
|
||||
test_str8_set, test_cpath_join_path, test_cpath_dirname, test_cpath_dirup,
|
||||
test_arena_alloc_succeeds_when_within_capacity, test_arena_alloc_fails_when_over_capacity,
|
||||
test_arena_realloc_bigger_size, test_arena_realloc_smaller_size, test_arena_clear,
|
||||
|
Reference in New Issue
Block a user