static void test_custom_allocator() { // Its really hard to test that malloc is never called, but I can make sure // custom frees match custom allocs. rope *r = rope_new2(_alloc, realloc, _free); for (int i = 0; i < 100; i++) { rope_insert(r, random() % (rope_char_count(r) + 1), (uint8_t *)"Whoa super happy fun times!\n"); } rope_free(r); test(alloced_regions == 0); }
rope *rope_new() { return rope_new2(malloc, realloc, free); }