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