Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/unit-tests/u-mem-pool.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / unit-tests / u-mem-pool.c` 25 lines ยท 611 bytes Raw Blame History 1 #include "unit-test.h" 2 #include "mem-pool.h" 3 4 static void test_many_pool_allocations(size_t block_alloc) 5 { 6 struct mem_pool pool = { .block_alloc = block_alloc }; 7 size_t size = 100; 8 char *buffer = mem_pool_calloc(&pool, 1, size); 9 for (size_t i = 0; i < size; i++) 10 cl_assert_equal_i(0, buffer[i]); 11 cl_assert(pool.mp_block != NULL); 12 cl_assert(pool.mp_block->next_free != NULL); 13 cl_assert(pool.mp_block->end != NULL); 14 mem_pool_discard(&pool, 0); 15 } 16 17 void test_mem_pool__big_block(void) 18 { 19 test_many_pool_allocations(1024 * 1024); 20 } 21 22 void test_mem_pool__tiny_block(void) 23 { 24 test_many_pool_allocations(1); 25 }