/* Gearman server and library * Copyright (C) 2011 Data Differential, http://datadifferential.com/ * All rights reserved. * * Use and distribution licensed under the BSD license. See * the COPYING file in the parent directory for full text. */ #include "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static test_return_t collection_init(void *object) { Context *test= (Context *)object; ASSERT_TRUE(test); ASSERT_TRUE(test->initialize(NULL)); return TEST_SUCCESS; } static test_return_t collection_cleanup(void *object) { Context *test= (Context *)object; ASSERT_TRUE(test); test->reset(); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { return new Context(servers); } static bool world_destroy(void *object) { Context *test= (Context *)object; delete test; return TEST_SUCCESS; } test_st tests[] ={ {"gearman_client_echo()", 0, client_echo_test }, {"gearman_client_echo() fail", 0, client_echo_fail_test }, {"gearman_worker_echo()", 0, worker_echo_test }, {"clean", 0, queue_clean }, {"add", 0, queue_add }, {"worker", 0, queue_worker }, {0, 0, 0} }; collection_st collection[] ={ {"ephemeral queue", collection_init, collection_cleanup, tests}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); }