Eo: add autotools tests. I have plenty of errors with the unit tests on Windows
[profile/ivi/eobj.git] / src / tests / eo_suite / class_simple.c
1 #ifdef HAVE_CONFIG_H
2 # include <config.h>
3 #endif
4
5 #include "Eo.h"
6 #include "class_simple.h"
7
8 #define MY_CLASS SIMPLE_CLASS
9
10 EAPI Eo_Op SIMPLE_BASE_ID = 0;
11
12 static void
13 _a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
14 {
15    Simple_Public_Data *pd = class_data;
16    int a;
17    a = va_arg(*list, int);
18    printf("%s %d\n", eo_class_name_get(MY_CLASS), a);
19    pd->a = a;
20 }
21
22 static void
23 _a_print(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
24 {
25    const Simple_Public_Data *pd = class_data;
26    (void) list;
27    printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a);
28 }
29
30 static void
31 _class_hi_print(const Eo_Class *klass, va_list *list)
32 {
33    (void) list;
34    printf("Hi Print %s\n", eo_class_name_get(klass));
35 }
36
37 static void
38 _class_constructor(Eo_Class *klass)
39 {
40    const Eo_Op_Func_Description func_desc[] = {
41         EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
42         EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _a_print),
43         EO_OP_FUNC_CLASS(SIMPLE_ID(SIMPLE_SUB_ID_CLASS_HI_PRINT), _class_hi_print),
44         EO_OP_FUNC_SENTINEL
45    };
46
47    eo_class_funcs_set(klass, func_desc);
48 }
49
50 static const Eo_Op_Description op_desc[] = {
51      EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "Set property A"),
52      EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_PRINT, "Print property A"),
53      EO_OP_DESCRIPTION_CLASS(SIMPLE_SUB_ID_CLASS_HI_PRINT, "Print Hi"),
54      EO_OP_DESCRIPTION_SENTINEL
55 };
56
57 static const Eo_Class_Description class_desc = {
58      EO_VERSION,
59      "Simple",
60      EO_CLASS_TYPE_REGULAR,
61      EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
62      NULL,
63      sizeof(Simple_Public_Data),
64      _class_constructor,
65      NULL
66 };
67
68 EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL)
69