2 Sample test application.
5 #include <libmemcached/memcached.h>
10 #include <sys/types.h>
18 test_return_t
set_test(memcached_st
*memc
);
19 void *world_create(void);
20 void world_destroy(void *p
);
22 test_return_t
set_test(memcached_st
*memc
)
25 const char *key
= "foo";
26 const char *value
= "when we sanitize";
28 rc
= memcached_set(memc
, key
, strlen(key
),
30 (time_t)0, (uint32_t)0);
31 assert(rc
== MEMCACHED_SUCCESS
|| rc
== MEMCACHED_BUFFERED
);
37 {"set", 1, set_test
},
41 collection_st collection
[] ={
46 #define SERVERS_TO_CREATE 1
48 void *world_create(void)
50 server_startup_st
*construct
;
52 construct
= (server_startup_st
*)malloc(sizeof(server_startup_st
));
53 memset(construct
, 0, sizeof(server_startup_st
));
54 construct
->count
= SERVERS_TO_CREATE
;
56 server_startup(construct
);
61 void world_destroy(void *p
)
63 server_startup_st
*construct
= (server_startup_st
*)p
;
64 memcached_server_st
*servers
= (memcached_server_st
*)construct
->servers
;
65 memcached_server_list_free(servers
);
67 server_shutdown(construct
);
71 void get_world(world_st
*world
)
73 world
->collections
= collection
;
74 world
->create
= world_create
;
75 world
->destroy
= world_destroy
;