eo2: add tests for call stack grow and shrink

This commit is contained in:
Jérémy Zurcher 2013-12-30 15:24:44 +01:00 committed by Tom Hacohen
parent ae536bdd84
commit d497459f93
3 changed files with 33 additions and 0 deletions

View File

@ -45,6 +45,22 @@ _class_hi_print(Eo_Class *klass, void *data EINA_UNUSED)
return EINA_TRUE;
}
EO2_VOID_FUNC_BODYV(simple_recursive, EO2_FUNC_CALL(n), int n);
static void
_recursive(Eo *obj, void *class_data EINA_UNUSED, int n)
{
static int count = 0;
if (count < n)
{
count++;
eo2_do(obj, simple_recursive(n));
}
else
count = 0;
}
static void
_dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, Eo_Dbg_Info *root)
{
@ -64,6 +80,7 @@ static Eo2_Op_Description op_descs[] = {
EO2_OP_FUNC(simple_a_get, _a_get, "Get property a"),
EO2_OP_FUNC(simple_a_print, _a_print, "Print property a"),
EO2_OP_CLASS_FUNC(simple_class_hi_print, _class_hi_print, "Print property a"),
EO2_OP_FUNC(simple_recursive, _recursive, "Recursive function"),
EO2_OP_SENTINEL
};

View File

@ -10,6 +10,7 @@ EAPI void simple_a_set(int a);
EAPI int simple_a_get(void);
EAPI Eina_Bool simple_a_print(void);
EAPI Eina_Bool simple_class_hi_print(void);
EAPI void simple_recursive(int n);
extern const Eo_Event_Description _EV_A_CHANGED;
#define EV_A_CHANGED (&(_EV_A_CHANGED))

View File

@ -24,6 +24,20 @@ START_TEST(eo_simple)
}
END_TEST
START_TEST(eo_stack)
{
eo_init();
Eo *obj = eo2_add(SIMPLE_CLASS, NULL);
fail_if(!obj);
eo2_do(obj, simple_recursive(123));
eo_unref(obj);
eo_shutdown();
}
END_TEST
static int _eo_signals_cb_curent = 0;
static int _eo_signals_cb_flag = 0;
@ -835,6 +849,7 @@ END_TEST
void eo_test_general(TCase *tc)
{
tcase_add_test(tc, eo_simple);
tcase_add_test(tc, eo_stack);
tcase_add_test(tc, eo_signals);
tcase_add_test(tc, eo_data_fetch);
tcase_add_test(tc, eo_isa_tests);