2 Structures for generic tests.
8 #include <libmemcached/memcached.h>
11 typedef struct world_st world_st
;
12 typedef struct collection_st collection_st
;
13 typedef struct test_st test_st
;
16 TEST_SUCCESS
= 0, /* Backwards compatibility */
18 TEST_MEMORY_ALLOCATION_FAILURE
,
20 TEST_MAXIMUM_RETURN
/* Always add new error code before */
25 unsigned int requires_flush
;
26 test_return_t (*function
)(memcached_st
*memc
);
29 struct collection_st
{
31 memcached_return_t (*pre
)(memcached_st
*memc
);
32 memcached_return_t (*post
)(memcached_st
*memc
);
37 collection_st
*collections
;
38 void *(*create
)(void);
39 void (*destroy
)(void *collection_object
);
42 /* How we make all of this work :) */
43 void get_world(world_st
*world
);
45 void create_core(void);
47 #define test_truth(A) \
51 fprintf(stderr, "Assertion failed in %s:%d: %s\n", __FILE__, __LINE__, #A);\
53 return TEST_FAILURE; \
57 #define test_false(A) \
61 fprintf(stderr, "Assertion failed in %s:%d: %s\n", __FILE__, __LINE__, #A);\
63 return TEST_FAILURE; \
67 #define test_strcmp(A,B) \
70 if (strcmp((A), (B))) \
72 fprintf(stderr, "%d", __LINE__); \
74 return TEST_FAILURE; \