Ejemplo n.º 1
0
#include "setting.h"

struct setting setting = {
    { SLIMCACHE_OPTION(OPTION_INIT) },
    { ADMIN_OPTION(OPTION_INIT)     },
    { SERVER_OPTION(OPTION_INIT)    },
    { WORKER_OPTION(OPTION_INIT)    },
    { PROCESS_OPTION(OPTION_INIT)   },
    { KLOG_OPTION(OPTION_INIT)      },
    { REQUEST_OPTION(OPTION_INIT)   },
    { RESPONSE_OPTION(OPTION_INIT)  },
    { CUCKOO_OPTION(OPTION_INIT)    },
    { TIME_OPTION(OPTION_INIT)      },
    { ARRAY_OPTION(OPTION_INIT)     },
    { BUF_OPTION(OPTION_INIT)       },
    { DBUF_OPTION(OPTION_INIT)      },
    { DEBUG_OPTION(OPTION_INIT)     },
    { SOCKIO_OPTION(OPTION_INIT)    },
    { TCP_OPTION(OPTION_INIT)       },
};

unsigned int nopt = OPTION_CARDINALITY(setting);
Ejemplo n.º 2
0
#include <check.h>
#include <string.h>
#include <stdio.h>

/* define for each suite, local scope due to macro visibility rule */
#define SUITE_NAME "cuckoo"
#define DEBUG_LOG  SUITE_NAME ".log"

void test_insert_basic(uint32_t policy, bool cas);
void test_insert_collision(uint32_t policy, bool cas);
void test_cas(uint32_t policy);
void test_delete_basic(uint32_t policy, bool cas);
void test_expire_basic(uint32_t policy, bool cas);

cuckoo_options_st options = { CUCKOO_OPTION(OPTION_INIT) };
cuckoo_metrics_st metrics = { CUCKOO_METRIC(METRIC_INIT) };

/*
 * utilities
 */
static void
test_setup(uint32_t policy, bool cas)
{
    option_load_default((struct option *)&options, OPTION_CARDINALITY(options));
    options.cuckoo_policy.val.vuint = policy;
    options.cuckoo_item_cas.val.vbool = cas;

    cuckoo_setup(&options, &metrics);
}