示例#1
0
文件: tests.c 项目: fohr/librope
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);
}
示例#2
0
文件: rope.c 项目: Daniel-NJ/librope
rope *rope_new() {
  return rope_new2(malloc, realloc, free);
}