5#include <event2/event.h>
14#include <boost/test/unit_test.hpp>
18#ifdef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
20static std::map<void*, short> tags;
21static std::map<void*, uint16_t> orders;
22static uint16_t tagSequence = 0;
24static void* tag_malloc(
size_t sz) {
25 void* mem = malloc(sz);
28 orders[mem] = tagSequence++;
32static void tag_free(
void* mem) {
34 orders[mem] = tagSequence++;
40 event_set_mem_functions(tag_malloc, realloc, tag_free);
42 void* base_ptr =
nullptr;
45 base_ptr = (
void*)base.get();
50 void* event_ptr =
nullptr;
53 auto event =
obtain_event(base.get(), -1, 0,
nullptr,
nullptr);
55 base_ptr = (
void*)base.get();
56 event_ptr = (
void*)event.get();
64 event_set_mem_functions(malloc, realloc, free);
69 event_set_mem_functions(tag_malloc, realloc, tag_free);
71 void* base_ptr =
nullptr;
72 void* event_ptr =
nullptr;
75 auto event =
obtain_event(base.get(), -1, 0,
nullptr,
nullptr);
77 base_ptr = (
void*)base.get();
78 event_ptr = (
void*)event.get();
86 event_set_mem_functions(malloc, realloc, free);
BOOST_AUTO_TEST_CASE(addrman_simple)
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
raii_event obtain_event(struct event_base *base, evutil_socket_t s, short events, event_callback_fn cb, void *arg)
raii_event_base obtain_event_base()
#define BOOST_CHECK(expr)