X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fhashkit_functions.cc;h=c8ca52414a9553f39f95ff56a61583f67b7d4beb;hb=04b8554c3724eae57fbd75dc6b3e69dca8b58187;hp=98396df5fa79dc4359fea411bb409b1c4d358589;hpb=50dc8599f105fe915607e6f2d57851fd9acad839;p=awesomized%2Flibmemcached diff --git a/tests/hashkit_functions.cc b/tests/hashkit_functions.cc index 98396df5..c8ca5241 100644 --- a/tests/hashkit_functions.cc +++ b/tests/hashkit_functions.cc @@ -35,16 +35,17 @@ * */ -#include "config.h" +#include +#include -#include -#include -#include -#include +using namespace libtest; -#include +#include +#include +#include +#include -#include +#include #include "hash_results.h" @@ -346,8 +347,7 @@ test_st allocation[]= { static test_return_t hashkit_digest_test(hashkit_st *hashk) { - uint32_t value; - value= hashkit_digest(hashk, "a", sizeof("a")); + test_true(hashkit_digest(hashk, "a", sizeof("a"))); return TEST_SUCCESS; } @@ -578,36 +578,31 @@ collection_st collection[] ={ {0, 0, 0, 0} }; -/* Prototypes for functions we will pass to test framework */ -void *world_create(test_return_t *error); -test_return_t world_destroy(hashkit_st *hashk); - -void *world_create(test_return_t *error) +static void *world_create(libtest::server_startup_st&, test_return_t& error) { hashkit_st *hashk_ptr= hashkit_create(&global_hashk); if (hashk_ptr != &global_hashk) { - *error= TEST_FAILURE; + error= TEST_FAILURE; return NULL; } if (hashkit_is_allocated(hashk_ptr) == true) { - *error= TEST_FAILURE; + error= TEST_FAILURE; return NULL; } - *error= TEST_SUCCESS; - return hashk_ptr; } -test_return_t world_destroy(hashkit_st *hashk) +static bool world_destroy(void *object) { + hashkit_st *hashk= (hashkit_st *)object; // Did we get back what we expected? - assert(hashkit_is_allocated(hashk) == false); + test_true(hashkit_is_allocated(hashk) == false); hashkit_free(&global_hashk); return TEST_SUCCESS; @@ -616,6 +611,6 @@ test_return_t world_destroy(hashkit_st *hashk) void get_world(Framework *world) { world->collections= collection; - world->_create= (test_callback_create_fn*)world_create; - world->_destroy= (test_callback_fn*)world_destroy; + world->_create= world_create; + world->_destroy= world_destroy; }