Merge Trond.
[m6w6/libmemcached] / tests / udp.c
1 /* LibMemcached
2 * Copyright (C) 2006-2009 Brian Aker
3 * All rights reserved.
4 *
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
7 *
8 * Summary:
9 *
10 */
11
12 /*
13 Sample test application.
14 */
15 #include <assert.h>
16 #include <libmemcached/memcached.h>
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <sys/time.h>
21 #include <sys/types.h>
22 #include <sys/stat.h>
23 #include <unistd.h>
24 #include <time.h>
25 #include "test.h"
26 #include "server.h"
27
28 /* Prototypes */
29 test_return_t set_test(memcached_st *memc);
30
31 test_return_t set_test(memcached_st *memc)
32 {
33 memcached_return_t rc;
34 const char *key= "foo";
35 const char *value= "when we sanitize";
36
37 rc= memcached_set(memc, key, strlen(key),
38 value, strlen(value),
39 (time_t)0, (uint32_t)0);
40 test_truth(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
41
42 return TEST_SUCCESS;
43 }
44
45 test_st tests[] ={
46 {"set", 1, (test_callback_fn)set_test },
47 {0, 0, 0}
48 };
49
50 collection_st collection[] ={
51 {"udp", 0, 0, tests},
52 {0, 0, 0, 0}
53 };
54
55 #define SERVERS_TO_CREATE 1
56
57 #include "libmemcached_world.h"
58
59 void get_world(world_st *world)
60 {
61 world->collections= collection;
62 world->collection_startup= (test_callback_fn)world_collection_startup;
63 world->flush= (test_callback_fn)world_flush;
64 world->pre_run= (test_callback_fn)world_pre_run;
65 world->create= (test_callback_create_fn)world_create;
66 world->post_run= (test_callback_fn)world_post_run;
67 world->on_error= (test_callback_error_fn)world_on_error;
68 world->destroy= (test_callback_fn)world_destroy;
69 world->runner= &defualt_libmemcached_runner;
70 }