Allocation and free test for static */
| 43 | |
| 44 | /* Allocation and free test for static */ |
| 45 | static void test_mp_static_alloc_free(void) |
| 46 | { |
| 47 | void *block1, *block2, *block3; |
| 48 | |
| 49 | /* Allocate blocks */ |
| 50 | block1 = rt_mp_alloc(&mp_static, 0); |
| 51 | uassert_not_null(block1); |
| 52 | |
| 53 | block2 = rt_mp_alloc(&mp_static, 0); |
| 54 | uassert_not_null(block2); |
| 55 | |
| 56 | block3 = rt_mp_alloc(&mp_static, 0); |
| 57 | uassert_not_null(block3); |
| 58 | |
| 59 | /* Check free count */ |
| 60 | uassert_true(mp_static.block_free_count == MEMPOOL_BLOCK_COUNT - 3); |
| 61 | |
| 62 | /* Free blocks */ |
| 63 | rt_mp_free(block1); |
| 64 | rt_mp_free(block2); |
| 65 | rt_mp_free(block3); |
| 66 | |
| 67 | /* Check free count */ |
| 68 | uassert_true(mp_static.block_free_count == MEMPOOL_BLOCK_COUNT); |
| 69 | } |
| 70 | |
| 71 | /* Allocation and free test for dynamic */ |
| 72 | static void test_mp_dynamic_alloc_free(void) |
nothing calls this directly
no test coverage detected