| 28 | } |
| 29 | |
| 30 | static void slab_tests() { |
| 31 | struct hc_slab_alloc a; |
| 32 | hc_slab_alloc_init(&a, &hc_malloc_default, 2 * sizeof(int)); |
| 33 | assert(a.slab_size == 2 * sizeof(int)); |
| 34 | |
| 35 | const int *p1 = hc_acquire(&a.malloc, sizeof(int)); |
| 36 | const int *p2 = hc_acquire(&a.malloc, sizeof(int)); |
| 37 | assert(p2 == p1 + 1); |
| 38 | |
| 39 | const int *p3 = hc_acquire(&a.malloc, sizeof(int)); |
| 40 | assert(p3 > p2 + 1); |
| 41 | |
| 42 | const int *p4 = hc_acquire(&a.malloc, 10 * sizeof(int)); |
| 43 | assert(p4 > p3 + 1); |
| 44 | |
| 45 | hc_slab_alloc_deinit(&a); |
| 46 | } |
| 47 | |
| 48 | void malloc2_tests() { |
| 49 | memo_tests(); |
no test coverage detected