| 2 | #include "malloc2.h" |
| 3 | |
| 4 | static void memo_tests() { |
| 5 | struct hc_memo_alloc a; |
| 6 | hc_memo_alloc_init(&a, &hc_malloc_default); |
| 7 | |
| 8 | int *ip1 = hc_acquire(&a.malloc, sizeof(int)); |
| 9 | |
| 10 | long *lp = hc_acquire(&a.malloc, sizeof(long)); |
| 11 | assert((int *)lp != ip1); |
| 12 | *lp = 42; |
| 13 | |
| 14 | hc_release(&a.malloc, ip1); |
| 15 | int *ip2 = hc_acquire(&a.malloc, sizeof(int)); |
| 16 | assert(ip2 == ip1); |
| 17 | *ip2 = 42; |
| 18 | |
| 19 | int *ip3 = hc_acquire(&a.malloc, sizeof(int)); |
| 20 | assert(ip3 != ip1); |
| 21 | *ip3 = 42; |
| 22 | |
| 23 | hc_release(&a.malloc, lp); |
| 24 | hc_release(&a.malloc, ip2); |
| 25 | hc_release(&a.malloc, ip3); |
| 26 | |
| 27 | hc_memo_alloc_deinit(&a); |
| 28 | } |
| 29 | |
| 30 | static void slab_tests() { |
| 31 | struct hc_slab_alloc a; |
no test coverage detected