Eo: Fixed bug with calling multiple ops in some cases.
[profile/ivi/eobj.git] / src / tests / function_overrides / main.c
1 #include "Eo.h"
2 #include "simple.h"
3 #include "inherit.h"
4 #include "inherit2.h"
5 #include "inherit3.h"
6
7 #include "../eunit_tests.h"
8
9 int
10 main(int argc, char *argv[])
11 {
12    (void) argc;
13    (void) argv;
14    eo_init();
15
16    Eo *obj = eo_add(INHERIT2_CLASS, NULL);
17
18    eo_do(obj, simple_a_set(1));
19    Simple_Public_Data *pd = eo_data_get(obj, SIMPLE_CLASS);
20    fail_if(pd->a != 2);
21
22    eo_unref(obj);
23
24    obj = eo_add(INHERIT3_CLASS, NULL);
25
26    eo_do(obj, simple_a_set(1));
27    pd = eo_data_get(obj, SIMPLE_CLASS);
28    fail_if(pd->a != 3);
29
30    eo_unref(obj);
31
32    obj = eo_add(INHERIT2_CLASS, NULL);
33    fail_if(!eo_do(obj, inherit2_print()));
34    fail_if(!eo_do(obj, inherit2_print(), inherit2_print()));
35    eo_unref(obj);
36
37    obj = eo_add(SIMPLE_CLASS, NULL);
38    fail_if(eo_do(obj, inherit2_print2()));
39
40    fail_if(eo_do_super(obj, simple_a_print()));
41
42    fail_if(eo_do(obj, simple_class_print()));
43
44    fail_if(!eo_class_do(SIMPLE_CLASS, simple_class_print()));
45    fail_if(!eo_class_do(INHERIT_CLASS, simple_class_print()));
46    fail_if(!eo_class_do(INHERIT2_CLASS, simple_class_print()));
47    fail_if(!eo_class_do(INHERIT3_CLASS, simple_class_print()));
48
49    fail_if(eo_class_do(SIMPLE_CLASS, simple_a_print()));
50
51    eo_do_super(obj, eo_constructor());
52    eo_do_super(obj, eo_destructor());
53
54    eo_unref(obj);
55
56    eo_shutdown();
57    return 0;
58 }
59