cdcd4ba4c7cfff20c9bbd9a5bcd72168d2630b61
2 * Copyright (C) 2006-2009 Brian Aker
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
13 Sample test application.
16 #include <libmemcached/memcached.h>
21 #include <sys/types.h>
29 test_return_t
set_test(memcached_st
*memc
);
30 void *world_create(void);
31 void world_destroy(void *p
);
33 test_return_t
set_test(memcached_st
*memc
)
35 memcached_return_t rc
;
36 const char *key
= "foo";
37 const char *value
= "when we sanitize";
39 rc
= memcached_set(memc
, key
, strlen(key
),
41 (time_t)0, (uint32_t)0);
42 test_truth(rc
== MEMCACHED_SUCCESS
|| rc
== MEMCACHED_BUFFERED
);
48 {"set", 1, set_test
},
52 collection_st collection
[] ={
57 #define SERVERS_TO_CREATE 1
59 void *world_create(void)
61 server_startup_st
*construct
;
63 construct
= (server_startup_st
*)malloc(sizeof(server_startup_st
));
64 memset(construct
, 0, sizeof(server_startup_st
));
65 construct
->count
= SERVERS_TO_CREATE
;
67 server_startup(construct
);
72 void world_destroy(void *p
)
74 server_startup_st
*construct
= (server_startup_st
*)p
;
75 memcached_server_st
*servers
= (memcached_server_st
*)construct
->servers
;
76 memcached_server_list_free(servers
);
78 server_shutdown(construct
);
82 void get_world(world_st
*world
)
84 world
->collections
= collection
;
85 world
->create
= world_create
;
86 world
->destroy
= world_destroy
;