Eobj: Added more function override tests.
[profile/ivi/eobj.git] / examples / function_overrides / main.c
1 #include "Eobj.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    eobj_init();
15
16    Eobj *obj = eobj_add(INHERIT2_CLASS, NULL);
17
18    eobj_do(obj, SIMPLE_A_SET(1));
19    Simple_Public_Data *pd = eobj_data_get(obj, SIMPLE_CLASS);
20    fail_if(pd->a != 2);
21
22    eobj_unref(obj);
23
24    obj = eobj_add(INHERIT3_CLASS, NULL);
25
26    eobj_do(obj, SIMPLE_A_SET(1));
27    pd = eobj_data_get(obj, SIMPLE_CLASS);
28    fail_if(pd->a != 3);
29
30    eobj_unref(obj);
31
32    obj = eobj_add(INHERIT2_CLASS, NULL);
33    eobj_do(obj, INHERIT2_PRINT());
34    eobj_unref(obj);
35
36    obj = eobj_add(SIMPLE_CLASS, NULL);
37    fail_if(eobj_do(obj, INHERIT2_PRINT2()));
38    eobj_unref(obj);
39
40    eobj_shutdown();
41    return 0;
42 }
43