If you're hacky enough, you can now call into auto-generated interfaces from
[wvapps.git] / xplcidl / ctest.c
blobb9fc546cd63a44948a90400f6890cd1619fe7f6f
1 #include <assert.h>
2 #include <stdio.h>
3 #include "ctest.h"
4 #include "testalloc.h"
6 #define RUN(s, stuff) do { \
7 expected = #s; \
8 (*obj)->s stuff; \
9 } while (0)
11 #define RUNCHECK(s, stuff) do { \
12 expected = #s; \
13 assert((int)(*obj)->s stuff == 1); \
14 } while (0)
17 int main()
19 printf("C++ object in C:\n");
21 IObject *o = (IObject *)1;
22 int i = 1;
23 bool b = 1;
24 const char *str = (const char *)1;
26 ITest *obj = get_cppobj();
28 RUN(voidfunc, (obj));
30 RUNCHECK(objret, (obj));
31 RUNCHECK(intret, (obj));
32 RUNCHECK(boolret, (obj));
33 RUNCHECK(strret, (obj));
35 RUN(objparm, (obj, o, &o, &o));
36 RUN(intparm, (obj, i, &i, &i));
37 RUN(intparm_simple, (obj, i));
38 RUN(boolparm, (obj, b, &b, &b));
39 RUN(strparm, (obj, str, &str, &str));
41 free_cppobj(obj);
44 return 0;