-
Notifications
You must be signed in to change notification settings - Fork 0
/
testsimple.cpp
116 lines (98 loc) · 2.94 KB
/
testsimple.cpp
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
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include "SimpleIndicationWrapper.h"
#include "SimpleRequestProxy.h"
#include "GeneratedTypes.h"
int v1a = 2323;
int v2a = 2;
int v2b = 4;
S2 s2 = {7, 8, 9};
S1 s1 = {3, 6};
uint32_t v5a = 0x00000000;
uint64_t v5b = 0xDEADBEEFFECAFECA;
uint32_t v5c = 0x00000001;
uint32_t v6a = 0xBBBBBBBB;
uint64_t v6b = 0x000000EFFECAFECA;
uint32_t v6c = 0xCCCCCCCC;
uint32_t v7a = 0xDADADADA;
E1 v7b = E1_E1Choice2;
S3 s3 = { a: v7a, e1: v7b };
class SimpleIndication : public SimpleIndicationWrapper
{
public:
uint32_t cnt;
void incr_cnt(){
if (++cnt == 7)
exit(0);
}
virtual void heard1(uint32_t a) {
fprintf(stderr, "heard1(%d)\n", a);
assert(a == v1a);
incr_cnt();
}
virtual void heard2(uint32_t a, uint32_t b) {
fprintf(stderr, "heard2(%d %d)\n", a, b);
assert(a == v2a);
assert(b == v2b);
incr_cnt();
}
virtual void heard3(S1 s){
fprintf(stderr, "heard3(S1{a:%d,b:%d})\n", s.a, s.b);
assert(s.a == s1.a);
assert(s.b == s1.b);
incr_cnt();
}
virtual void heard4(S2 s){
fprintf(stderr, "heard4(S2{a:%d,b:%d,c:%d})\n", s.a,s.b,s.c);
assert(s.a == s2.a);
assert(s.b == s2.b);
assert(s.c == s2.c);
incr_cnt();
}
virtual void heard5(uint32_t a, uint64_t b, uint32_t c) {
fprintf(stderr, "heard5(%08x, %016llx, %08x)\n", a, (long long)b, c);
assert(a == v5a);
assert(b == v5b);
assert(c == v5c);
incr_cnt();
}
virtual void heard6(uint32_t a, uint64_t b, uint32_t c) {
fprintf(stderr, "heard6(%08x, %016llx, %08x)\n", a, (long long)b, c);
assert(a == v6a);
assert(b == v6b);
assert(c == v6c);
incr_cnt();
}
virtual void heard7(uint32_t a, E1 b) {
fprintf(stderr, "heard7(%08x, %08x)\n", a, b);
assert(a == v7a);
assert(b == v7b);
incr_cnt();
}
SimpleIndication(unsigned int id) : SimpleIndicationWrapper(id), cnt(0){}
};
int main(int argc, const char **argv)
{
SimpleIndication *indication = new SimpleIndication(IfcNames_SimpleIndication);
SimpleRequestProxy *device = new SimpleRequestProxy(IfcNames_SimpleRequest);
portalExec_start();
fprintf(stderr, "Hello, aren't you happy it's sunny?\n");
fprintf(stderr, "Main::calling say1(%d)\n", v1a);
device->say1(v1a);
fprintf(stderr, "Main::calling say2(%d, %d)\n", v2a,v2b);
device->say2(v2a,v2b);
fprintf(stderr, "Main::calling say3(S1{a:%d,b:%d})\n", s1.a,s1.b);
device->say3(s1);
fprintf(stderr, "Main::calling say4(S2{a:%d,b:%d,c:%d})\n", s2.a,s2.b,s2.c);
device->say4(s2);
fprintf(stderr, "Main::calling say5(%08x, %016llx, %08x)\n", v5a, (long long)v5b, v5c);
device->say5(v5a, v5b, v5c);
fprintf(stderr, "Main::calling say6(%08x, %016llx, %08x)\n", v6a, (long long)v6b, v6c);
device->say6(v6a, v6b, v6c);
fprintf(stderr, "Main::calling say7(%08x, %08x)\n", s3.a, s3.e1);
device->say7(s3);
fprintf(stderr, "Main::about to go to sleep\n");
while(true){sleep(2);}
}