Updating test framework for startup/shutdown of memcached.
[awesomized/libmemcached] / libtest / framework.cc
1 /* uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/
2 *
3 * Use and distribution licensed under the BSD license. See
4 * the COPYING file in the parent directory for full text.
5 */
6
7 #include <libtest/common.h>
8
9 test_return_t Framework::destroy(void* arg)
10 {
11 if (_destroy)
12 {
13 return _destroy(arg);
14 }
15
16 return TEST_SUCCESS;
17 }
18
19 test_return_t Framework::Item::flush(void* arg, test_st* run)
20 {
21 if (run->requires_flush and _flush)
22 {
23 return _flush(arg);
24 }
25
26 return TEST_SUCCESS;
27 }
28
29 test_return_t Framework::on_error(const test_return_t rc, void* arg)
30 {
31 if (_on_error and test_failed(_on_error(rc, arg)))
32 {
33 return TEST_FAILURE;
34 }
35
36 return TEST_SUCCESS;
37 }
38
39 test_return_t Framework::startup(void* arg)
40 {
41 if (collection_startup)
42 {
43 return collection_startup(arg);
44 }
45
46 return TEST_SUCCESS;
47 }
48
49 test_return_t Framework::Item::startup(void* arg)
50 {
51 if (_startup)
52 {
53 return _startup(arg);
54 }
55
56 return TEST_SUCCESS;
57 }
58
59 void* Framework::create(test_return_t* arg)
60 {
61 if (_create)
62 {
63 return _create(arg);
64 }
65
66 return NULL;
67 }
68