summaryrefslogtreecommitdiff
path: root/src/tests/eolian_js/eolian_js_test_constructor_method_impl.c
blob: adff8f5614ff4b7afaee808e19cdc0294ff3c30f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <Eo.h>
#include <Ecore.h>

#include <stdlib.h>

#include "constructor_method_class.eo.h"

#include <check.h>

struct _Constructor_Method_Class_Data
{
  Eina_Bool fail;
};
typedef struct _Constructor_Method_Class_Data Constructor_Method_Class_Data;

#define MY_CLASS CONSTRUCTOR_METHOD_CLASS_CLASS

EOLIAN static Eo_Base *
_constructor_method_class_eo_base_constructor(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd)
{
  pd->fail = EINA_FALSE;
  return eo_constructor(eo_super(obj, MY_CLASS));
}

EOLIAN static void
_constructor_method_class_constructor1(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one)
{
  fprintf(stderr, "one == %d\n", one);
  fflush(stderr);
  if (one != 5)
    pd->fail = EINA_TRUE;
}

EOLIAN static void
_constructor_method_class_constructor2(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, double two)
{
  fprintf(stderr, "two == %f\n", two);
  fflush(stderr);
  if (two != 10.0)
    pd->fail = EINA_TRUE;
}

EOLIAN static Eo *
_constructor_method_class_eo_base_finalize(Eo *obj, Constructor_Method_Class_Data *pd)
{
  if (pd->fail)
    return NULL;

  return eo_finalize(eo_super(obj, MY_CLASS));
}

EOLIAN static Eina_Bool
_constructor_method_class_fail_get(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd)
{
  return pd->fail;
}

EOLIAN static void
_constructor_method_class_method1(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one)
{
  fprintf(stderr, "method1 one == %d\n", one);
  fflush(stderr);
  if (one != 2)
    pd->fail = EINA_TRUE;
}

EOLIAN static int
_constructor_method_class_method2(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one)
{
  fprintf(stderr, "method2 one == %d\n", one);
  fflush(stderr);
  if (one != 3)
    pd->fail = EINA_TRUE;
  return 5;
}

EOLIAN static void
_constructor_method_class_method3(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one, double two)
{
  fprintf(stderr, "method3 one == %d two == %f\n", one, two);
  fflush(stderr);
  if (one != 3)
    pd->fail = EINA_TRUE;
  if (two != 11.1)
    pd->fail = EINA_TRUE;
}

EOLIAN static int
_constructor_method_class_method4(Eo * obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one, double two)
{
  fprintf(stderr, "method4 one == %d two == %f\n", one, two);
  fflush(stderr);
  if (one != 3)
    pd->fail = EINA_TRUE;
  if (two != 11.1)
    pd->fail = EINA_TRUE;
  return 5;
}

EOLIAN static void
_constructor_method_class_outmethod1(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int *one)
{
  fprintf(stderr, "outmethod1\n");
  fflush(stderr);
  *one = 5;
}

EOLIAN static int
_constructor_method_class_outmethod2(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int *one)
{
  fprintf(stderr, "outmethod2\n");
  fflush(stderr);
  *one = 10;
  return 11;
}

EOLIAN static void
_constructor_method_class_outmethod3(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int *one, double *two)
{
  fprintf(stderr, "outmethod3\n");
  fflush(stderr);
  *one = 11;
  *two = 5.1;
}

EOLIAN static Constructor_Method_Class *
_constructor_method_class_classoutmethod1(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int one, double two)
{
  fprintf(stderr, "classoutmethod1\n");
  fflush(stderr);
  Eo *ret = NULL;
  return eo_add(&ret, MY_CLASS, NULL, constructor_method_class_constructor1(ret, one), constructor_method_class_constructor2(ret, two));
}

EOLIAN static void
_constructor_method_class_classoutmethod2(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int one, double two, Constructor_Method_Class **out_class)
{
  fprintf(stderr, "classoutmethod2\n");
  fflush(stderr);
  *out_class = NULL;
  eo_add(&out_class, MY_CLASS, NULL, constructor_method_class_constructor1(out_class, one), constructor_method_class_constructor2(out_class, two));
}


#include <constructor_method_class.eo.c>