summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-03 18:15:57 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-03 18:15:57 -0300
commite79eb53e8d20bdb4838fbb42c9e5b1ee47b7f263 (patch)
tree3b38de336ae0346543b4e5100d83da88720906f1 /src/tests
parent09446ccb90c1f3180e5b2e0a52b3ce2c78c7c140 (diff)
eina: Remove Eina_Promise* parameter in promise callback
Remove not very useful parameter to eina_promise_then callbacks.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/ecore/ecore_test_promise.c26
-rw-r--r--src/tests/ecore/ecore_test_timer.c2
-rw-r--r--src/tests/eio/eio_model_test_file.c8
-rw-r--r--src/tests/eio/eio_model_test_monitor_add.c4
-rw-r--r--src/tests/eio/eio_test_job.c14
-rw-r--r--src/tests/eldbus/eldbus_test_eldbus_model.c12
6 files changed, 26 insertions, 40 deletions
diff --git a/src/tests/ecore/ecore_test_promise.c b/src/tests/ecore/ecore_test_promise.c
index f016580..791e6fc 100644
--- a/src/tests/ecore/ecore_test_promise.c
+++ b/src/tests/ecore/ecore_test_promise.c
@@ -11,7 +11,7 @@ void promised_thread(const void* data EINA_UNUSED, Eina_Promise_Owner* promise,
11 eina_promise_owner_value_set(promise, NULL, NULL); 11 eina_promise_owner_value_set(promise, NULL, NULL);
12} 12}
13 13
14void promise_callback(void* data EINA_UNUSED, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED) 14void promise_callback(void* data EINA_UNUSED, void* value EINA_UNUSED)
15{ 15{
16 ecore_main_loop_quit(); 16 ecore_main_loop_quit();
17} 17}
@@ -36,7 +36,7 @@ void promise_error_thread(const void* data EINA_UNUSED, Eina_Promise_Owner* prom
36 eina_promise_owner_error_set(promise, EINA_ERROR_OUT_OF_MEMORY); 36 eina_promise_owner_error_set(promise, EINA_ERROR_OUT_OF_MEMORY);
37} 37}
38 38
39void promise_error_callback(void* data EINA_UNUSED, Eina_Error error, Eina_Promise* promise EINA_UNUSED) 39void promise_error_callback(void* data EINA_UNUSED, Eina_Error error)
40{ 40{
41 ck_assert(error == EINA_ERROR_OUT_OF_MEMORY); 41 ck_assert(error == EINA_ERROR_OUT_OF_MEMORY);
42 ecore_main_loop_quit(); 42 ecore_main_loop_quit();
@@ -74,7 +74,7 @@ START_TEST(ecore_test_promise_all)
74} 74}
75END_TEST 75END_TEST
76 76
77void promise_callback2(void* data, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED) 77void promise_callback2(void* data, void* value EINA_UNUSED)
78{ 78{
79 if(++(*(int*)data) == 2) 79 if(++(*(int*)data) == 2)
80 ecore_main_loop_quit(); 80 ecore_main_loop_quit();
@@ -186,22 +186,8 @@ START_TEST(ecore_test_promise_then_after_thread_finished_all)
186} 186}
187END_TEST 187END_TEST
188 188
189/* void promised_block_thread(const void* data EINA_UNUSED, Eina_Promise_Owner* promise, Ecore_Thread* thread EINA_UNUSED) */
190/* { */
191/* struct timespec v = {.tv_sec = 1, .tv_nsec = 0}, rem; */
192/* if(nanosleep(&v, &rem) == -1 && errno == EINTR) */
193/* do */
194/* { */
195/* v = rem; */
196/* } */
197/* while(nanosleep(&v, &rem) == -1 && errno == EINTR); */
198
199/* int r = 10; */
200/* eina_promise_owner_value_set(promise, &r, NULL); */
201/* } */
202
203static void 189static void
204_ecore_test_promise_normal_lifetime_cb(void* data EINA_UNUSED, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED) 190_ecore_test_promise_normal_lifetime_cb(void* data EINA_UNUSED, void* value EINA_UNUSED)
205{ 191{
206 ecore_main_loop_quit(); 192 ecore_main_loop_quit();
207} 193}
@@ -254,7 +240,7 @@ START_TEST(ecore_test_promise_normal_lifetime_all)
254END_TEST 240END_TEST
255 241
256static void 242static void
257_ecore_test_promise_immediate_set_lifetime_cb(void* data EINA_UNUSED, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED) 243_ecore_test_promise_immediate_set_lifetime_cb(void* data EINA_UNUSED, void* value EINA_UNUSED)
258{ 244{
259 ecore_main_loop_quit(); 245 ecore_main_loop_quit();
260} 246}
@@ -327,7 +313,7 @@ static void _cancel_callback(const void* data, Eina_Promise_Owner* promise EINA_
327 eina_lock_release(&v->lock); 313 eina_lock_release(&v->lock);
328} 314}
329 315
330static void _cancel_promise_callback(void* data EINA_UNUSED, Eina_Error value, Eina_Promise* promise EINA_UNUSED) 316static void _cancel_promise_callback(void* data EINA_UNUSED, Eina_Error value)
331{ 317{
332 ck_assert(value == EINA_ERROR_PROMISE_CANCEL); 318 ck_assert(value == EINA_ERROR_PROMISE_CANCEL);
333 ecore_main_loop_quit(); 319 ecore_main_loop_quit();
diff --git a/src/tests/ecore/ecore_test_timer.c b/src/tests/ecore/ecore_test_timer.c
index d073d5d..25018bd 100644
--- a/src/tests/ecore/ecore_test_timer.c
+++ b/src/tests/ecore/ecore_test_timer.c
@@ -176,7 +176,7 @@ START_TEST(ecore_test_timers)
176END_TEST 176END_TEST
177 177
178static void 178static void
179_ecore_promise_quit(void *data, void *value, Eina_Promise* promise EINA_UNUSED) 179_ecore_promise_quit(void *data, void *value)
180{ 180{
181 Eina_Bool *bob = data; 181 Eina_Bool *bob = data;
182 double *start = value; 182 double *start = value;
diff --git a/src/tests/eio/eio_model_test_file.c b/src/tests/eio/eio_model_test_file.c
index ec9e6a6..2c0c712 100644
--- a/src/tests/eio/eio_model_test_file.c
+++ b/src/tests/eio/eio_model_test_file.c
@@ -58,7 +58,7 @@ static Eina_Bool
58 } 58 }
59 59
60static void 60static void
61promise_then_count(void *data EINA_UNUSED, void *p, Eina_Promise* promise EINA_UNUSED) 61promise_then_count(void *data EINA_UNUSED, void *p)
62{ 62{
63 int *total = p; 63 int *total = p;
64 ck_assert_ptr_ne(total, NULL); 64 ck_assert_ptr_ne(total, NULL);
@@ -67,7 +67,7 @@ promise_then_count(void *data EINA_UNUSED, void *p, Eina_Promise* promise EINA_U
67} 67}
68 68
69static void 69static void
70promise_then_accessor(void *data EINA_UNUSED, void* p, Eina_Promise* promise EINA_UNUSED) 70promise_then_accessor(void *data EINA_UNUSED, void* p)
71{ 71{
72 Eina_Accessor **accessor = (Eina_Accessor**)p; 72 Eina_Accessor **accessor = (Eina_Accessor**)p;
73 ck_assert_ptr_ne(accessor, NULL); 73 ck_assert_ptr_ne(accessor, NULL);
@@ -84,7 +84,7 @@ promise_then_accessor(void *data EINA_UNUSED, void* p, Eina_Promise* promise EIN
84} 84}
85 85
86static void 86static void
87promise_then_value(void *user EINA_UNUSED, void *p, Eina_Promise* promise EINA_UNUSED) 87promise_then_value(void *user EINA_UNUSED, void *p)
88{ 88{
89 Eina_Value* value = p; 89 Eina_Value* value = p;
90 ck_assert_ptr_ne(value, NULL); 90 ck_assert_ptr_ne(value, NULL);
@@ -98,7 +98,7 @@ promise_then_value(void *user EINA_UNUSED, void *p, Eina_Promise* promise EINA_U
98} 98}
99 99
100static void 100static void
101error_promise_then(void* data EINA_UNUSED, Eina_Error error EINA_UNUSED, Eina_Promise* promise EINA_UNUSED) 101error_promise_then(void* data EINA_UNUSED, Eina_Error error EINA_UNUSED)
102{ 102{
103 ck_abort_msg(0, "Error Promise cb"); 103 ck_abort_msg(0, "Error Promise cb");
104 ecore_main_loop_quit(); 104 ecore_main_loop_quit();
diff --git a/src/tests/eio/eio_model_test_monitor_add.c b/src/tests/eio/eio_model_test_monitor_add.c
index e8bcd11..4a97f0f 100644
--- a/src/tests/eio/eio_model_test_monitor_add.c
+++ b/src/tests/eio/eio_model_test_monitor_add.c
@@ -64,7 +64,7 @@ _children_added_cb(void *data EINA_UNUSED, const Eo_Event* event)
64} 64}
65 65
66static void 66static void
67_create_file(void *data EINA_UNUSED, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED) 67_create_file(void *data EINA_UNUSED, void* value EINA_UNUSED)
68{ 68{
69 int fd; 69 int fd;
70 if((fd = eina_file_mkstemp("prefixXXXXXX.ext", &temp_filename)) > 0) 70 if((fd = eina_file_mkstemp("prefixXXXXXX.ext", &temp_filename)) > 0)
@@ -76,7 +76,7 @@ _create_file(void *data EINA_UNUSED, void* value EINA_UNUSED, Eina_Promise* prom
76 76
77 77
78static void 78static void
79_create_file_error(void *data EINA_UNUSED, Eina_Error value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED) 79_create_file_error(void *data EINA_UNUSED, Eina_Error value EINA_UNUSED)
80{ 80{
81 ck_abort_msg(0, "Error Promise cb called in Create file"); 81 ck_abort_msg(0, "Error Promise cb called in Create file");
82 ecore_main_loop_quit(); 82 ecore_main_loop_quit();
diff --git a/src/tests/eio/eio_test_job.c b/src/tests/eio/eio_test_job.c
index 7c9a007..0a532eb 100644
--- a/src/tests/eio/eio_test_job.c
+++ b/src/tests/eio/eio_test_job.c
@@ -31,7 +31,7 @@ _filter_direct_cb(void *data EINA_UNUSED, const Eo_Event *event)
31} 31}
32 32
33static void 33static void
34_main_direct_cb(void *data, const Eina_File_Direct_Info *info, Eina_Promise* promise EINA_UNUSED) 34_main_direct_cb(void *data, const Eina_File_Direct_Info *info)
35{ 35{
36 int *number_of_listed_files = (int *)data; 36 int *number_of_listed_files = (int *)data;
37 37
@@ -53,7 +53,7 @@ _filter_cb(void *data EINA_UNUSED, const Eo_Event *event)
53} 53}
54 54
55static void 55static void
56_main_cb(void *data, const char *file, Eina_Promise* promise EINA_UNUSED) 56_main_cb(void *data, const char *file)
57{ 57{
58 int *number_of_listed_files = (int *)data; 58 int *number_of_listed_files = (int *)data;
59 59
@@ -62,7 +62,7 @@ _main_cb(void *data, const char *file, Eina_Promise* promise EINA_UNUSED)
62} 62}
63 63
64static void 64static void
65_done_cb(void *data, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED) 65_done_cb(void *data, void* value EINA_UNUSED)
66{ 66{
67 int *number_of_listed_files = (int *)data; 67 int *number_of_listed_files = (int *)data;
68 fail_if((*number_of_listed_files) != test_count); 68 fail_if((*number_of_listed_files) != test_count);
@@ -71,7 +71,7 @@ _done_cb(void *data, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED)
71} 71}
72 72
73static void 73static void
74_error_cb(void *data EINA_UNUSED, Eina_Error error, Eina_Promise* promise EINA_UNUSED) 74_error_cb(void *data EINA_UNUSED, Eina_Error error)
75{ 75{
76 const char *msg = eina_error_msg_get(error); 76 const char *msg = eina_error_msg_get(error);
77 EINA_LOG_ERR("error: %s", msg); 77 EINA_LOG_ERR("error: %s", msg);
@@ -79,7 +79,7 @@ _error_cb(void *data EINA_UNUSED, Eina_Error error, Eina_Promise* promise EINA_U
79} 79}
80 80
81static void 81static void
82_open_done_cb(void *data, void *file_value, Eina_Promise* promise EINA_UNUSED) 82_open_done_cb(void *data, void *file_value)
83{ 83{
84 Eina_Bool *opened = (Eina_Bool *)data; 84 Eina_Bool *opened = (Eina_Bool *)data;
85 *opened = EINA_TRUE; 85 *opened = EINA_TRUE;
@@ -89,7 +89,7 @@ _open_done_cb(void *data, void *file_value, Eina_Promise* promise EINA_UNUSED)
89} 89}
90 90
91static void 91static void
92_stat_done_cb(void *data, void *value, Eina_Promise* promise EINA_UNUSED) 92_stat_done_cb(void *data, void *value)
93{ 93{
94 Eina_Stat const* stat = value; 94 Eina_Stat const* stat = value;
95 Eina_Bool *is_dir = data; 95 Eina_Bool *is_dir = data;
@@ -284,4 +284,4 @@ eio_test_job(TCase *tc)
284 tcase_add_test(tc, eio_job_test_file_direct_stat); 284 tcase_add_test(tc, eio_job_test_file_direct_stat);
285 tcase_add_test(tc, eio_job_test_open); 285 tcase_add_test(tc, eio_job_test_open);
286} 286}
287; 287
diff --git a/src/tests/eldbus/eldbus_test_eldbus_model.c b/src/tests/eldbus/eldbus_test_eldbus_model.c
index 8dd1c07..0b016b6 100644
--- a/src/tests/eldbus/eldbus_test_eldbus_model.c
+++ b/src/tests/eldbus/eldbus_test_eldbus_model.c
@@ -15,14 +15,14 @@
15#include "eldbus_suite.h" 15#include "eldbus_suite.h"
16 16
17static void 17static void
18_promise_then_quit_cb(void *data , void *value, Eina_Promise* promise EINA_UNUSED) 18_promise_then_quit_cb(void *data , void *value)
19{ 19{
20 *(void**)data = value; 20 *(void**)data = value;
21 ecore_main_loop_quit(); 21 ecore_main_loop_quit();
22} 22}
23 23
24static void 24static void
25_promise_then_quit_u_cb(void *data , void *value, Eina_Promise* promise EINA_UNUSED) 25_promise_then_quit_u_cb(void *data , void *value)
26{ 26{
27 unsigned *lhs = data; 27 unsigned *lhs = data;
28 unsigned *rhs = value; 28 unsigned *rhs = value;
@@ -31,7 +31,7 @@ _promise_then_quit_u_cb(void *data , void *value, Eina_Promise* promise EINA_UNU
31} 31}
32 32
33static void 33static void
34_promise_then_cp(void *data , void *value, Eina_Promise* promise EINA_UNUSED) 34_promise_then_cp(void *data , void *value)
35{ 35{
36 eina_value_copy(value, data); 36 eina_value_copy(value, data);
37 ecore_main_loop_quit(); 37 ecore_main_loop_quit();
@@ -39,14 +39,14 @@ _promise_then_cp(void *data , void *value, Eina_Promise* promise EINA_UNUSED)
39 39
40 40
41static void 41static void
42_promise_check_err(void *data EINA_UNUSED, void *value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED) 42_promise_check_err(void *data EINA_UNUSED, void *value EINA_UNUSED)
43{ 43{
44 ck_assert_msg(0, "Promise Expected Error:\n"); 44 ck_assert_msg(0, "Promise Expected Error:\n");
45 ecore_main_loop_quit(); 45 ecore_main_loop_quit();
46} 46}
47 47
48static void 48static void
49_error_then_ok(void* data, Eina_Error error, Eina_Promise* promise EINA_UNUSED) 49_error_then_ok(void* data, Eina_Error error)
50{ 50{
51 Eina_Error const* expected_error = (Eina_Error*)data; 51 Eina_Error const* expected_error = (Eina_Error*)data;
52 if (data != NULL) 52 if (data != NULL)
@@ -58,7 +58,7 @@ _error_then_ok(void* data, Eina_Error error, Eina_Promise* promise EINA_UNUSED)
58} 58}
59 59
60static void 60static void
61_error_then_cb(void* data EINA_UNUSED, Eina_Error error, Eina_Promise* promise EINA_UNUSED) 61_error_then_cb(void* data EINA_UNUSED, Eina_Error error)
62{ 62{
63 ck_assert_msg(0,"Promise ERROR: %s\n", eina_error_msg_get(error)); 63 ck_assert_msg(0,"Promise ERROR: %s\n", eina_error_msg_get(error));
64 ecore_main_loop_quit(); 64 ecore_main_loop_quit();