1 #ifdef HAVE_CONFIG_H
2 # include <config.h>
3 #endif
4 
5 #include <Ecore.h>
6 #include "ecore_suite.h"
7 
8 static void
_pipe_handler(void * data,void * buf EINA_UNUSED,unsigned int len EINA_UNUSED)9 _pipe_handler(void *data, void *buf EINA_UNUSED, unsigned int len EINA_UNUSED)
10 {
11    Eina_Bool *bob = data;
12 
13    *bob = EINA_TRUE;
14    ecore_main_loop_quit();
15 }
16 
EFL_START_TEST(ecore_test_pipe)17 EFL_START_TEST(ecore_test_pipe)
18 {
19    Ecore_Pipe *pipe;
20    Eina_Bool bob = EINA_FALSE;
21 
22    pipe = ecore_pipe_add(_pipe_handler, &bob);
23    fail_if(!pipe);
24 
25    ecore_pipe_write(pipe, &bob, sizeof(Eina_Bool));
26    ecore_main_loop_begin();
27    ck_assert_int_eq(bob, EINA_TRUE);
28 
29    bob = EINA_FALSE;
30    ecore_pipe_write(pipe, NULL, 0);
31    ecore_main_loop_begin();
32    ck_assert_int_eq(bob, EINA_TRUE);
33 
34    ecore_pipe_del(pipe);
35 }
36 EFL_END_TEST
37 
ecore_test_ecore_pipe(TCase * tc)38 void ecore_test_ecore_pipe(TCase *tc)
39 {
40    tcase_add_test(tc, ecore_test_pipe);
41 }
42