7e9d2e162a83793fd0d9ccb09a6f5566070239bf
[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    eo_do(obj, inherit2_print());
34    eo_unref(obj);
35
36    obj = eo_add(SIMPLE_CLASS, NULL);
37    fail_if(eo_do(obj, inherit2_print2()));
38
39    fail_if(eo_do_super(obj, simple_a_print()));
40
41    fail_if(eo_do(obj, simple_class_print()));
42
43    fail_if(!eo_class_do(SIMPLE_CLASS, simple_class_print()));
44    fail_if(!eo_class_do(INHERIT_CLASS, simple_class_print()));
45    fail_if(!eo_class_do(INHERIT2_CLASS, simple_class_print()));
46    fail_if(!eo_class_do(INHERIT3_CLASS, simple_class_print()));
47
48    fail_if(eo_class_do(SIMPLE_CLASS, simple_a_print()));
49
50    eo_do_super(obj, eo_constructor());
51    eo_do_super(obj, eo_destructor());
52
53    eo_unref(obj);
54
55    eo_shutdown();
56    return 0;
57 }
58