create get_chunk func to simplify
This commit is contained in:
		
							
								
								
									
										20
									
								
								test/main.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								test/main.c
									
									
									
									
									
								
							@ -37,13 +37,13 @@ int main(int ac, char **av)
 | 
			
		||||
    ptr1 = ft_malloc(10000000);
 | 
			
		||||
    ptr2 = ft_malloc(10000000);
 | 
			
		||||
    ptr3 = ft_malloc(10000000);
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[LARGE], ptr1) == NULL), "alloc first", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[LARGE], ptr2) == NULL), "alloc second", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[LARGE], ptr3) == NULL), "alloc third", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[LARGE], ptr1) == NULL), "alloc first", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[LARGE], ptr2) == NULL), "alloc second", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[LARGE], ptr3) == NULL), "alloc third", "");
 | 
			
		||||
    ft_free(ptr1);
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[LARGE], ptr2) == NULL), "free disorder1", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[LARGE], ptr2) == NULL), "free disorder1", "");
 | 
			
		||||
    ft_free(ptr3);
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[LARGE], ptr2) == NULL), "free disorder2", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[LARGE], ptr2) == NULL), "free disorder2", "");
 | 
			
		||||
    ft_free(ptr2);
 | 
			
		||||
    test(NULL, allocs_tree[LARGE], "free disorder3", "");
 | 
			
		||||
 | 
			
		||||
@ -57,13 +57,13 @@ int main(int ac, char **av)
 | 
			
		||||
    ptr1 = ft_malloc(4);
 | 
			
		||||
    ptr2 = ft_malloc(4);
 | 
			
		||||
    ptr3 = ft_malloc(4);
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[TINY], ptr1) == NULL), "alloc first", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[TINY], ptr2) == NULL), "alloc second", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[TINY], ptr3) == NULL), "alloc third", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[TINY], ptr1) == NULL), "alloc first", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[TINY], ptr2) == NULL), "alloc second", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[TINY], ptr3) == NULL), "alloc third", "");
 | 
			
		||||
    ft_free(ptr1);
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[TINY], ptr2) == NULL), "free disorder1", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[TINY], ptr2) == NULL), "free disorder1", "");
 | 
			
		||||
    ft_free(ptr3);
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk(allocs_tree[TINY], ptr2) == NULL), "free disorder2", "");
 | 
			
		||||
    test(0, (const void*) (uintptr_t) (raw_get_chunk_by_root(allocs_tree[TINY], ptr2) == NULL), "free disorder2", "");
 | 
			
		||||
    ft_free(ptr2);
 | 
			
		||||
    test(NULL, allocs_tree[TINY], "free disorder3", "");
 | 
			
		||||
    show_alloc_mem();
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user