diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/mixin/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/tests/mixin/inherit.c | 38 | ||||
-rw-r--r-- | src/tests/mixin/inherit.h | 11 | ||||
-rw-r--r-- | src/tests/mixin/main.c | 7 | ||||
-rw-r--r-- | src/tests/mixin/mixin4.c | 24 | ||||
-rw-r--r-- | src/tests/mixin/mixin4.h | 9 |
6 files changed, 91 insertions, 0 deletions
diff --git a/src/tests/mixin/CMakeLists.txt b/src/tests/mixin/CMakeLists.txt index 557cbd3..557a3e6 100644 --- a/src/tests/mixin/CMakeLists.txt +++ b/src/tests/mixin/CMakeLists.txt @@ -1,9 +1,11 @@ LIST(APPEND MIXIN_CC_SOURCES main.c simple.c + inherit.c mixin.c mixin2.c mixin3.c + mixin4.c ) include_directories( diff --git a/src/tests/mixin/inherit.c b/src/tests/mixin/inherit.c new file mode 100644 index 0000000..53c8826 --- /dev/null +++ b/src/tests/mixin/inherit.c @@ -0,0 +1,38 @@ +#include "Eo.h" +#include "inherit.h" + +#include "config.h" + +#define MY_CLASS INHERIT_CLASS + +static void +_a_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list) +{ + int *name = va_arg(*list, int *); + eo_do_super(obj, simple_a_get(name)); + printf("%s\n", __func__); +} + +static void +_class_constructor(Eo_Class *klass) +{ + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), + EO_OP_FUNC_SENTINEL + }; + + eo_class_funcs_set(klass, func_desc); +} + +static const Eo_Class_Description class_desc = { + EO_VERSION, + "Inherit", + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + _class_constructor, + NULL +}; + +EO_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, MIXIN4_CLASS, NULL); diff --git a/src/tests/mixin/inherit.h b/src/tests/mixin/inherit.h new file mode 100644 index 0000000..b6d78fb --- /dev/null +++ b/src/tests/mixin/inherit.h @@ -0,0 +1,11 @@ +#ifndef INHERIT_H +#define INHERIT_H + +#include "Eo.h" +#include "simple.h" +#include "mixin4.h" + +#define INHERIT_CLASS inherit_class_get() +const Eo_Class *inherit_class_get(void); + +#endif diff --git a/src/tests/mixin/main.c b/src/tests/mixin/main.c index b7109a1..c69754d 100644 --- a/src/tests/mixin/main.c +++ b/src/tests/mixin/main.c @@ -1,5 +1,6 @@ #include "Eo.h" #include "simple.h" +#include "inherit.h" #include "mixin.h" #include "mixin2.h" #include "mixin3.h" @@ -30,6 +31,12 @@ main(int argc, char *argv[]) fail_if(pd3->count != 9); eo_unref(obj); + + obj = eo_add(INHERIT_CLASS, NULL); + eo_do(obj, simple_a_set(5), simple_a_get(&a)); + fail_if(a != 5); + + eo_unref(obj); eo_shutdown(); return 0; } diff --git a/src/tests/mixin/mixin4.c b/src/tests/mixin/mixin4.c new file mode 100644 index 0000000..17944bc --- /dev/null +++ b/src/tests/mixin/mixin4.c @@ -0,0 +1,24 @@ +#include "Eo.h" +#include "mixin.h" +#include "mixin4.h" +#include "simple.h" + +#include "config.h" + +#include "../eunit_tests.h" + +#define MY_CLASS MIXIN4_CLASS + +static const Eo_Class_Description class_desc = { + EO_VERSION, + "Mixin4", + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL +}; + +EO_DEFINE_CLASS(mixin4_class_get, &class_desc, NULL, NULL); + diff --git a/src/tests/mixin/mixin4.h b/src/tests/mixin/mixin4.h new file mode 100644 index 0000000..e924332 --- /dev/null +++ b/src/tests/mixin/mixin4.h @@ -0,0 +1,9 @@ +#ifndef MIXIN4_H +#define MIXIN4_H + +#include "Eo.h" + +#define MIXIN4_CLASS mixin4_class_get() +const Eo_Class *mixin4_class_get(void); + +#endif |