From e066c0041c796de5c663023c5854908d589af7c5 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 23 Apr 2012 08:09:37 +0000 Subject: [PATCH] Eobj: Add a couple of funcs_set tests and fixed a bug related. SVN revision: 70402 --- legacy/eobj/lib/eobj.c | 1 + legacy/eobj/tests/eobj_test_general.c | 37 ++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/legacy/eobj/lib/eobj.c b/legacy/eobj/lib/eobj.c index 5aab2267c8..8875bce5ee 100644 --- a/legacy/eobj/lib/eobj.c +++ b/legacy/eobj/lib/eobj.c @@ -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 diff --git a/legacy/eobj/tests/eobj_test_general.c b/legacy/eobj/tests/eobj_test_general.c index 03c30907a3..9d1973a853 100644 --- a/legacy/eobj/tests/eobj_test_general.c +++ b/legacy/eobj/tests/eobj_test_general.c @@ -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));