1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /* 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 <libtest/test.hpp>
- using namespace libtest;
- #include <cassert>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <unistd.h>
- #include <libgearman/gearman.h>
- #include <tests/basic.h>
- #include <tests/context.h>
- #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);
- }
|