Eobj: Add a couple of funcs_set tests and fixed a bug related.

SVN revision: 70402
This commit is contained in:
Tom Hacohen 2012-04-23 08:09:37 +00:00
parent 09dba3e746
commit e066c0041c
2 changed files with 37 additions and 1 deletions

View File

@ -151,6 +151,7 @@ dich_func_set(Eobj_Class *klass, Eobj_Op op, eobj_op_func_type func)
{
ERR("OP %x is too big for the domain '%s', expected value < %x.",
op, op_klass->desc->name, op_klass->desc->ops.count);
return;
}
}
else

View File

@ -103,10 +103,45 @@ START_TEST(eobj_weak_reference)
}
END_TEST
static void
_a_set(Eobj *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
{
fail_if(EINA_TRUE);
}
static void
_op_errors_class_constructor(Eobj_Class *klass)
{
const Eobj_Op_Func_Description func_desc[] = {
EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_LAST), _a_set),
EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_LAST + 1), _a_set),
EOBJ_OP_FUNC(0x0F010111, _a_set),
EOBJ_OP_FUNC_SENTINEL
};
eobj_class_funcs_set(klass, func_desc);
}
START_TEST(eobj_op_errors)
{
eobj_init();
Eobj *obj = eobj_add(SIMPLE_CLASS, NULL);
static const Eobj_Class_Description class_desc = {
"Simple",
EOBJ_CLASS_TYPE_REGULAR,
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
NULL,
0,
NULL,
NULL,
_op_errors_class_constructor,
NULL
};
const Eobj_Class *klass = eobj_class_new(&class_desc, SIMPLE_CLASS, NULL);
fail_if(!klass);
Eobj *obj = eobj_add(klass, NULL);
/* Out of bounds op for a legal class. */
fail_if(eobj_do(obj, 0x00010111));