HEAD: merged from taskmaster branch.
[wvapps.git] / xplcidl / cpptest.cc
blob8372a64a3160c1cbbc12451376b64b8a4bcf96e9
1 #include "cpptest.h"
2 #include "testalloc.h"
3 #include "IObject.hpp" // just to make sure it compiles
4 #include <assert.h>
5 #include <stdio.h>
7 #define RUN(s, stuff) do { \
8 expected = #s; \
9 obj->s stuff; \
10 } while (0)
12 #define RUNCHECK(s, stuff) do { \
13 expected = #s; \
14 assert((int)(obj->s stuff) == 1); \
15 } while (0)
18 int main()
20 printf("C++ object in C++:\n");
22 ITest *obj = get_cppobj();
23 RUN(voidfunc, ());
25 RUNCHECK(objret, ());
26 RUNCHECK(intret, ());
27 RUNCHECK(boolret, ());
28 RUNCHECK(strret, ());
30 IObject *o = (IObject *)1;
31 int i = 1;
32 bool b = 1;
33 const char *str = (const char *)1;
35 RUN(objparm, (*o, o, o));
36 RUN(intparm, (i, i, i));
37 RUN(intparm_simple, (i));
38 RUN(boolparm, (b, b, b));
39 RUN(strparm, (str, str, str));
41 free_cppobj(obj);
44 return 0;