summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_ecore_con.c
diff options
context:
space:
mode:
authorSrivardhan Hebbar <sri.hebbar@samsung.com>2015-02-11 17:23:32 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-11 17:23:35 +0100
commit53172c2d792b5fe18e8fe4769712f38326fbd65b (patch)
tree0da291544740901669bd4a40791370f9a3374a9e /src/tests/ecore/ecore_test_ecore_con.c
parent3b52489368837a46abf0cd4193043081256e03e8 (diff)
ecore_con: add ecore con client functions for testing.
Summary: Added ecore con client functions to the existing cases to cover more functions. Reviewers: cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1958 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to '')
-rw-r--r--src/tests/ecore/ecore_test_ecore_con.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/tests/ecore/ecore_test_ecore_con.c b/src/tests/ecore/ecore_test_ecore_con.c
index 58ea44c70b..b1de6c1fd9 100644
--- a/src/tests/ecore/ecore_test_ecore_con.c
+++ b/src/tests/ecore/ecore_test_ecore_con.c
@@ -8,9 +8,15 @@
8#include <Ecore.h> 8#include <Ecore.h>
9#include <Ecore_Con.h> 9#include <Ecore_Con.h>
10 10
11char sdata[] = "Server_info";
12char cdata[] = "Client_info";
13
11Eina_Bool 14Eina_Bool
12_add(void *data, int type EINA_UNUSED, void *ev) 15_add(void *data, int type EINA_UNUSED, void *ev)
13{ 16{
17 double timeout_val = 10, ret;
18 void *del_data;
19
14 fail_if (type != ECORE_CON_EVENT_CLIENT_ADD && 20 fail_if (type != ECORE_CON_EVENT_CLIENT_ADD &&
15 type != ECORE_CON_EVENT_SERVER_ADD); 21 type != ECORE_CON_EVENT_SERVER_ADD);
16 22
@@ -27,8 +33,13 @@ _add(void *data, int type EINA_UNUSED, void *ev)
27 ecore_con_client_port_get(event->client), 33 ecore_con_client_port_get(event->client),
28 ecore_con_client_connected_get(event->client)); 34 ecore_con_client_connected_get(event->client));
29 35
30 ecore_con_client_timeout_set(event->client, 10); 36 ecore_con_client_timeout_set(event->client, timeout_val);
37 ret = ecore_con_client_timeout_get(event->client);
38 fail_if (ret != timeout_val);
31 39
40 ecore_con_client_data_set(event->client, cdata);
41 del_data = ecore_con_client_data_get(event->client);
42 fail_if (strcmp((char *)del_data, cdata));
32 } 43 }
33 else if (type == ECORE_CON_EVENT_SERVER_ADD) 44 else if (type == ECORE_CON_EVENT_SERVER_ADD)
34 { 45 {
@@ -54,6 +65,8 @@ _add(void *data, int type EINA_UNUSED, void *ev)
54Eina_Bool 65Eina_Bool
55_del(void *data , int type EINA_UNUSED, void *ev) 66_del(void *data , int type EINA_UNUSED, void *ev)
56{ 67{
68 void *del_data;
69
57 fail_if (type != ECORE_CON_EVENT_CLIENT_DEL && 70 fail_if (type != ECORE_CON_EVENT_CLIENT_DEL &&
58 type != ECORE_CON_EVENT_SERVER_DEL); 71 type != ECORE_CON_EVENT_SERVER_DEL);
59 72
@@ -69,7 +82,8 @@ _del(void *data , int type EINA_UNUSED, void *ev)
69 printf("Client was connected for %0.3f seconds.\n", 82 printf("Client was connected for %0.3f seconds.\n",
70 ecore_con_client_uptime_get(event->client)); 83 ecore_con_client_uptime_get(event->client));
71 84
72 ecore_con_client_del(event->client); 85 del_data = ecore_con_client_del(event->client);
86 fail_if (strcmp((char *)del_data, cdata));
73 } 87 }
74 else if (type == ECORE_CON_EVENT_SERVER_DEL) 88 else if (type == ECORE_CON_EVENT_SERVER_DEL)
75 { 89 {
@@ -171,7 +185,6 @@ void _ecore_con_server_client_tests(Ecore_Con_Type compl_type, const char *name)
171 Ecore_Event_Handler *handlers[6]; 185 Ecore_Event_Handler *handlers[6];
172 void *server_data = malloc (1); 186 void *server_data = malloc (1);
173 void *client_data = malloc (1); 187 void *client_data = malloc (1);
174 char sdata[] = "Server_info";
175 double timeout_val = 10, timeout_ret; 188 double timeout_val = 10, timeout_ret;
176 int ret, server_port = 1234; 189 int ret, server_port = 1234;
177 void *del_ret; 190 void *del_ret;
@@ -243,11 +256,13 @@ void _ecore_con_server_client_tests(Ecore_Con_Type compl_type, const char *name)
243 256
244 del_ret = ecore_con_server_del(server); 257 del_ret = ecore_con_server_del(server);
245 fail_if (strcmp((char *)del_ret, sdata)); 258 fail_if (strcmp((char *)del_ret, sdata));
246
247 free (server_data); 259 free (server_data);
260 server_data = NULL;
261
248 del_ret = ecore_con_server_del(client); 262 del_ret = ecore_con_server_del(client);
249 fail_if (del_ret != client_data); 263 fail_if (del_ret != client_data);
250 free (client_data); 264 free (client_data);
265 client_data = NULL;
251 266
252 del_ret = ecore_event_handler_del (handlers[0]); 267 del_ret = ecore_event_handler_del (handlers[0]);
253 fail_if (del_ret != (void *) 1); 268 fail_if (del_ret != (void *) 1);
@@ -320,8 +335,6 @@ START_TEST(ecore_test_ecore_con_dns)
320 335
321 ret = eina_init(); 336 ret = eina_init();
322 fail_if(ret != 1); 337 fail_if(ret != 1);
323 ret = ecore_init();
324 fail_if(ret < 1);
325 ret = ecore_con_init(); 338 ret = ecore_con_init();
326 fail_if(ret != 1); 339 fail_if(ret != 1);
327 340
@@ -342,7 +355,6 @@ START_TEST(ecore_test_ecore_con_dns)
342 355
343 ret = ecore_con_shutdown(); 356 ret = ecore_con_shutdown();
344 fail_if(ret != 0); 357 fail_if(ret != 0);
345 ret = ecore_shutdown();
346 ret = eina_shutdown(); 358 ret = eina_shutdown();
347} 359}
348END_TEST 360END_TEST
@@ -362,7 +374,6 @@ START_TEST(ecore_test_ecore_con_shutdown_bef_init)
362} 374}
363END_TEST 375END_TEST
364 376
365
366void ecore_test_ecore_con(TCase *tc) 377void ecore_test_ecore_con(TCase *tc)
367{ 378{
368 tcase_add_test(tc, ecore_test_ecore_con_init); 379 tcase_add_test(tc, ecore_test_ecore_con_init);