Update pandora
[m6w6/libmemcached] / tests / test.h
1 /*
2 Structures for generic tests.
3 */
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #include <libmemcached/memcached.h>
9 #include <stdio.h>
10
11 typedef struct world_st world_st;
12 typedef struct collection_st collection_st;
13 typedef struct test_st test_st;
14
15 typedef enum {
16 TEST_SUCCESS= 0, /* Backwards compatibility */
17 TEST_FAILURE,
18 TEST_MEMORY_ALLOCATION_FAILURE,
19 TEST_MAXIMUM_RETURN /* Always add new error code before */
20 } test_return;
21
22 struct test_st {
23 const char *name;
24 unsigned int requires_flush;
25 test_return (*function)(memcached_st *memc);
26 };
27
28 struct collection_st {
29 const char *name;
30 memcached_return (*pre)(memcached_st *memc);
31 memcached_return (*post)(memcached_st *memc);
32 test_st *tests;
33 };
34
35 struct world_st {
36 collection_st *collections;
37 void *(*create)(void);
38 void (*destroy)(void *collection_object);
39 };
40
41 /* How we make all of this work :) */
42 void get_world(world_st *world);
43
44 #ifdef __cplusplus
45 }
46 #endif