sl@0
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\system\t_multin.cpp
|
sl@0
|
15 |
// Overview:
|
sl@0
|
16 |
// Test multiple inheritance with and without virtual bases.
|
sl@0
|
17 |
// API Information:
|
sl@0
|
18 |
// N/A
|
sl@0
|
19 |
// Details:
|
sl@0
|
20 |
// - Test multiple inheritance with virtual bases. Using a virtual
|
sl@0
|
21 |
// base class, copy one or more strings from the "producer" object
|
sl@0
|
22 |
// to the "consumer" object. Verify that results are as expected.
|
sl@0
|
23 |
// - Test multiple inheritance without virtual bases. Using a non-
|
sl@0
|
24 |
// virtual base class, copy one or more strings from the "producer"
|
sl@0
|
25 |
// object to the "consumer" object. Verify that results are as expected.
|
sl@0
|
26 |
// Platforms/Drives/Compatibility:
|
sl@0
|
27 |
// All.
|
sl@0
|
28 |
// Assumptions/Requirement/Pre-requisites:
|
sl@0
|
29 |
// Failures and causes:
|
sl@0
|
30 |
// Base Port information:
|
sl@0
|
31 |
//
|
sl@0
|
32 |
//
|
sl@0
|
33 |
|
sl@0
|
34 |
#include "t_multin.h"
|
sl@0
|
35 |
|
sl@0
|
36 |
LOCAL_D RTest test(_L("T_MULTIN"));
|
sl@0
|
37 |
|
sl@0
|
38 |
void MConsumer::Consume(const TDesC& aStr1,const TDesC& aStr2)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
#if defined(__TRACE__)
|
sl@0
|
41 |
test.Printf(_L("MConsumer::Consume(s,s)\n"));
|
sl@0
|
42 |
//test.Getch();
|
sl@0
|
43 |
#endif
|
sl@0
|
44 |
TBuf<0x100> b;b.Format(_L("%S%S"),&aStr1,&aStr2);Consume(b);
|
sl@0
|
45 |
}
|
sl@0
|
46 |
|
sl@0
|
47 |
void MConsumer::Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3)
|
sl@0
|
48 |
{
|
sl@0
|
49 |
#if defined(__TRACE__)
|
sl@0
|
50 |
test.Printf(_L("MConsumer::Consume(s,s,s)\n"));
|
sl@0
|
51 |
//test.Getch();
|
sl@0
|
52 |
#endif
|
sl@0
|
53 |
TBuf<0x100> b;b.Format(_L("%S%S%S"),&aStr1,&aStr2,&aStr3);Consume(b);
|
sl@0
|
54 |
}
|
sl@0
|
55 |
|
sl@0
|
56 |
void MConsumer::Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4)
|
sl@0
|
57 |
{
|
sl@0
|
58 |
#if defined(__TRACE__)
|
sl@0
|
59 |
test.Printf(_L("MConsumer::Consume(s,s,s,s)\n"));
|
sl@0
|
60 |
//test.Getch();
|
sl@0
|
61 |
#endif
|
sl@0
|
62 |
TBuf<0x100> b;b.Format(_L("%S%S%S%S"),&aStr1,&aStr2,&aStr3,&aStr4);Consume(b);
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
TPtrC MPipe::Produce()
|
sl@0
|
66 |
{
|
sl@0
|
67 |
#if defined(__TRACE__)
|
sl@0
|
68 |
test.Printf(_L("MPipe::Produce\n"));
|
sl@0
|
69 |
//test.Getch();
|
sl@0
|
70 |
#endif
|
sl@0
|
71 |
return(iBuf);
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
void MPipe::Consume(const TDesC& aStr)
|
sl@0
|
75 |
{
|
sl@0
|
76 |
#if defined(__TRACE__)
|
sl@0
|
77 |
test.Printf(_L("MPipe::Consume(s)\n"));
|
sl@0
|
78 |
//test.Getch();
|
sl@0
|
79 |
#endif
|
sl@0
|
80 |
#if defined(__TRACE__)
|
sl@0
|
81 |
{
|
sl@0
|
82 |
TInt l=*(TInt*)&aStr;
|
sl@0
|
83 |
TInt t=l>>28;
|
sl@0
|
84 |
l&=0xfffffff;
|
sl@0
|
85 |
test.Printf(_L("aStr type=%d,aStr length=%d\n"),t,l);
|
sl@0
|
86 |
//
|
sl@0
|
87 |
TText* p=NULL;
|
sl@0
|
88 |
switch (t)
|
sl@0
|
89 |
{
|
sl@0
|
90 |
case 0:
|
sl@0
|
91 |
p=(TText*)((TInt*)&aStr+1);
|
sl@0
|
92 |
break;
|
sl@0
|
93 |
case 1:
|
sl@0
|
94 |
p=*(TText**)((TInt*)&aStr+1);
|
sl@0
|
95 |
break;
|
sl@0
|
96 |
case 2:
|
sl@0
|
97 |
p=*(TText**)((TInt*)&aStr+2);
|
sl@0
|
98 |
break;
|
sl@0
|
99 |
case 3:
|
sl@0
|
100 |
p=(TText*)((TInt*)&aStr+2);
|
sl@0
|
101 |
break;
|
sl@0
|
102 |
case 4:
|
sl@0
|
103 |
p=(TText*)(*(TInt**)((TInt*)&aStr+2)+1);
|
sl@0
|
104 |
break;
|
sl@0
|
105 |
}
|
sl@0
|
106 |
//
|
sl@0
|
107 |
test.Printf(_L("aStr=\"%.3s...\"\n"),p);
|
sl@0
|
108 |
}
|
sl@0
|
109 |
//test.Getch();
|
sl@0
|
110 |
#endif
|
sl@0
|
111 |
#if defined(__TRACE__)
|
sl@0
|
112 |
{
|
sl@0
|
113 |
TInt l=*(TInt*)&iBuf;
|
sl@0
|
114 |
TInt t=l>>28;
|
sl@0
|
115 |
l&=0xfffffff;
|
sl@0
|
116 |
TInt m=((TInt*)&iBuf)[1];
|
sl@0
|
117 |
test.Printf(_L("iBuf type=%d,iBuf length=%d,iBuf max length=%d\n"),t,l,m);
|
sl@0
|
118 |
//
|
sl@0
|
119 |
TText* p=NULL;
|
sl@0
|
120 |
switch (t)
|
sl@0
|
121 |
{
|
sl@0
|
122 |
case 0:
|
sl@0
|
123 |
p=(TText*)((TInt*)&iBuf+1);
|
sl@0
|
124 |
break;
|
sl@0
|
125 |
case 1:
|
sl@0
|
126 |
p=*(TText**)((TInt*)&iBuf+1);
|
sl@0
|
127 |
break;
|
sl@0
|
128 |
case 2:
|
sl@0
|
129 |
p=*(TText**)((TInt*)&iBuf+2);
|
sl@0
|
130 |
break;
|
sl@0
|
131 |
case 3:
|
sl@0
|
132 |
p=(TText*)((TInt*)&iBuf+2);
|
sl@0
|
133 |
break;
|
sl@0
|
134 |
case 4:
|
sl@0
|
135 |
p=(TText*)(*(TInt**)((TInt*)&iBuf+2)+1);
|
sl@0
|
136 |
break;
|
sl@0
|
137 |
}
|
sl@0
|
138 |
//
|
sl@0
|
139 |
test.Printf(_L("iBuf=\"%.3s...\"\n"),p);
|
sl@0
|
140 |
}
|
sl@0
|
141 |
//test.Getch();
|
sl@0
|
142 |
#endif
|
sl@0
|
143 |
iBuf=aStr;
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
void MPipe::Consume(const TDesC& aStr1,const TDesC& aStr2)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
#if defined(__TRACE__)
|
sl@0
|
149 |
test.Printf(_L("MPipe::Consume(s,s)\n"));
|
sl@0
|
150 |
//test.Getch();
|
sl@0
|
151 |
#endif
|
sl@0
|
152 |
iBuf.Format(_L("%S%S"),&aStr1,&aStr2);
|
sl@0
|
153 |
}
|
sl@0
|
154 |
|
sl@0
|
155 |
void MPipe::Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3)
|
sl@0
|
156 |
{
|
sl@0
|
157 |
#if defined(__TRACE__)
|
sl@0
|
158 |
test.Printf(_L("MPipe::Consume(s,s,s)\n"));
|
sl@0
|
159 |
//test.Getch();
|
sl@0
|
160 |
#endif
|
sl@0
|
161 |
iBuf.Format(_L("%S%S%S"),&aStr1,&aStr2,&aStr3);
|
sl@0
|
162 |
}
|
sl@0
|
163 |
|
sl@0
|
164 |
void MPipe::Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4)
|
sl@0
|
165 |
{
|
sl@0
|
166 |
#if defined(__TRACE__)
|
sl@0
|
167 |
test.Printf(_L("MPipe::Consume(s,s,s,s)\n"));
|
sl@0
|
168 |
//test.Getch();
|
sl@0
|
169 |
#endif
|
sl@0
|
170 |
iBuf.Format(_L("%S%S%S%S"),&aStr1,&aStr2,&aStr3,&aStr4);
|
sl@0
|
171 |
}
|
sl@0
|
172 |
|
sl@0
|
173 |
MProducer* TBase::Producer()
|
sl@0
|
174 |
{
|
sl@0
|
175 |
#if defined(__TRACE__)
|
sl@0
|
176 |
test.Printf(_L("TBase::Producer\n"));
|
sl@0
|
177 |
//test.Getch();
|
sl@0
|
178 |
#endif
|
sl@0
|
179 |
switch(Species())
|
sl@0
|
180 |
{
|
sl@0
|
181 |
case EProducer:
|
sl@0
|
182 |
return((TProducer*)this);
|
sl@0
|
183 |
case EPipe:
|
sl@0
|
184 |
return((TPipe*)this);
|
sl@0
|
185 |
default:
|
sl@0
|
186 |
return(NULL);
|
sl@0
|
187 |
}
|
sl@0
|
188 |
}
|
sl@0
|
189 |
|
sl@0
|
190 |
MConsumer* TBase::Consumer()
|
sl@0
|
191 |
{
|
sl@0
|
192 |
#if defined(__TRACE__)
|
sl@0
|
193 |
test.Printf(_L("TBase::Consumer\n"));
|
sl@0
|
194 |
//test.Getch();
|
sl@0
|
195 |
#endif
|
sl@0
|
196 |
switch(Species())
|
sl@0
|
197 |
{
|
sl@0
|
198 |
case EConsumer:
|
sl@0
|
199 |
return((TConsumer*)this);
|
sl@0
|
200 |
case EPipe:
|
sl@0
|
201 |
return((TPipe*)this);
|
sl@0
|
202 |
default:
|
sl@0
|
203 |
return(NULL);
|
sl@0
|
204 |
}
|
sl@0
|
205 |
}
|
sl@0
|
206 |
|
sl@0
|
207 |
TPtrC TProducer::Produce()
|
sl@0
|
208 |
{
|
sl@0
|
209 |
#if defined(__TRACE__)
|
sl@0
|
210 |
test.Printf(_L("TProducer::Produce\n"));
|
sl@0
|
211 |
//test.Getch();
|
sl@0
|
212 |
#endif
|
sl@0
|
213 |
return(_L("*"));
|
sl@0
|
214 |
}
|
sl@0
|
215 |
|
sl@0
|
216 |
TSpecies TProducer::Species() const
|
sl@0
|
217 |
{
|
sl@0
|
218 |
#if defined(__TRACE__)
|
sl@0
|
219 |
test.Printf(_L("TProducer::Species\n"));
|
sl@0
|
220 |
//test.Getch();
|
sl@0
|
221 |
#endif
|
sl@0
|
222 |
return(EProducer);
|
sl@0
|
223 |
}
|
sl@0
|
224 |
|
sl@0
|
225 |
TSpecies TConsumer::Species() const
|
sl@0
|
226 |
{
|
sl@0
|
227 |
#if defined(__TRACE__)
|
sl@0
|
228 |
test.Printf(_L("TConsumer::Species\n"));
|
sl@0
|
229 |
//test.Getch();
|
sl@0
|
230 |
#endif
|
sl@0
|
231 |
return(EConsumer);
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
void TConsumer::Consume(const TDesC& aStr)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
#if defined(__TRACE__)
|
sl@0
|
237 |
test.Printf(_L("TConsumer::Consume\n"));
|
sl@0
|
238 |
//test.Getch();
|
sl@0
|
239 |
#endif
|
sl@0
|
240 |
test.Printf(_L("Consumed: %S\n"),&aStr);
|
sl@0
|
241 |
}
|
sl@0
|
242 |
|
sl@0
|
243 |
TSpecies TPipe::Species() const
|
sl@0
|
244 |
{
|
sl@0
|
245 |
#if defined(__TRACE__)
|
sl@0
|
246 |
test.Printf(_L("TPipe::Species\n"));
|
sl@0
|
247 |
//test.Getch();
|
sl@0
|
248 |
#endif
|
sl@0
|
249 |
return(EPipe);
|
sl@0
|
250 |
}
|
sl@0
|
251 |
|
sl@0
|
252 |
TSpecies TVirProducer::Species() const
|
sl@0
|
253 |
{
|
sl@0
|
254 |
#if defined(__TRACE__)
|
sl@0
|
255 |
test.Printf(_L("TVirProducer::Species\n"));
|
sl@0
|
256 |
//test.Getch();
|
sl@0
|
257 |
#endif
|
sl@0
|
258 |
return(EVirtual);
|
sl@0
|
259 |
}
|
sl@0
|
260 |
|
sl@0
|
261 |
TPtrC TVirProducer::Produce()
|
sl@0
|
262 |
{
|
sl@0
|
263 |
#if defined(__TRACE__)
|
sl@0
|
264 |
test.Printf(_L("TVirProducer::Produce\n"));
|
sl@0
|
265 |
//test.Getch();
|
sl@0
|
266 |
#endif
|
sl@0
|
267 |
return(_L("*"));
|
sl@0
|
268 |
}
|
sl@0
|
269 |
|
sl@0
|
270 |
TSpecies TVirConsumer::Species() const
|
sl@0
|
271 |
{
|
sl@0
|
272 |
#if defined(__TRACE__)
|
sl@0
|
273 |
test.Printf(_L("TVirConsumer::Species\n"));
|
sl@0
|
274 |
//test.Getch();
|
sl@0
|
275 |
#endif
|
sl@0
|
276 |
return(EVirtual);
|
sl@0
|
277 |
};
|
sl@0
|
278 |
|
sl@0
|
279 |
MConsumer* TVirConsumer::Consumer()
|
sl@0
|
280 |
{
|
sl@0
|
281 |
#if defined(__TRACE__)
|
sl@0
|
282 |
test.Printf(_L("TVirConsumer::Consumer\n"));
|
sl@0
|
283 |
//test.Getch();
|
sl@0
|
284 |
#endif
|
sl@0
|
285 |
return(this);
|
sl@0
|
286 |
}
|
sl@0
|
287 |
|
sl@0
|
288 |
void TVirConsumer::Consume(const TDesC& aStr)
|
sl@0
|
289 |
{
|
sl@0
|
290 |
#if defined(__TRACE__)
|
sl@0
|
291 |
test.Printf(_L("TVirConsumer::Consume\n"));
|
sl@0
|
292 |
//test.Getch();
|
sl@0
|
293 |
#endif
|
sl@0
|
294 |
test.Printf(_L("Consumed: %S\n"),&aStr);
|
sl@0
|
295 |
}
|
sl@0
|
296 |
|
sl@0
|
297 |
TSpecies TVirPipe::Species() const
|
sl@0
|
298 |
{
|
sl@0
|
299 |
#if defined(__TRACE__)
|
sl@0
|
300 |
test.Printf(_L("TVirPipe::Species\n"));
|
sl@0
|
301 |
//test.Getch();
|
sl@0
|
302 |
#endif
|
sl@0
|
303 |
return(EVirtual);
|
sl@0
|
304 |
};
|
sl@0
|
305 |
|
sl@0
|
306 |
MProducer* TVirPipe::Producer()
|
sl@0
|
307 |
{
|
sl@0
|
308 |
#if defined(__TRACE__)
|
sl@0
|
309 |
test.Printf(_L("TVirPipe::Producer\n"));
|
sl@0
|
310 |
//test.Getch();
|
sl@0
|
311 |
#endif
|
sl@0
|
312 |
return(this);
|
sl@0
|
313 |
}
|
sl@0
|
314 |
|
sl@0
|
315 |
MConsumer* TVirPipe::Consumer()
|
sl@0
|
316 |
{
|
sl@0
|
317 |
#if defined(__TRACE__)
|
sl@0
|
318 |
test.Printf(_L("TVirPipe::Consumer\n"));
|
sl@0
|
319 |
//test.Getch();
|
sl@0
|
320 |
#endif
|
sl@0
|
321 |
return(this);
|
sl@0
|
322 |
}
|
sl@0
|
323 |
|
sl@0
|
324 |
TPtrC TVirPipe::Produce()
|
sl@0
|
325 |
{
|
sl@0
|
326 |
#if defined(__TRACE__)
|
sl@0
|
327 |
test.Printf(_L("TVirPipe::Produce\n"));
|
sl@0
|
328 |
//test.Getch();
|
sl@0
|
329 |
#endif
|
sl@0
|
330 |
return(iBuf);
|
sl@0
|
331 |
}
|
sl@0
|
332 |
|
sl@0
|
333 |
void TVirPipe::Consume(const TDesC& aStr)
|
sl@0
|
334 |
{
|
sl@0
|
335 |
#if defined(__TRACE__)
|
sl@0
|
336 |
test.Printf(_L("TVirPipe::Consume(s)\n"));
|
sl@0
|
337 |
//test.Getch();
|
sl@0
|
338 |
#endif
|
sl@0
|
339 |
iBuf=aStr;
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
void TVirPipe::Consume(const TDesC& aStr1,const TDesC& aStr2)
|
sl@0
|
343 |
{
|
sl@0
|
344 |
#if defined(__TRACE__)
|
sl@0
|
345 |
test.Printf(_L("TVirPipe::Consume(s,s)\n"));
|
sl@0
|
346 |
//test.Getch();
|
sl@0
|
347 |
#endif
|
sl@0
|
348 |
iBuf.Format(_L("%S%S"),&aStr1,&aStr2);
|
sl@0
|
349 |
}
|
sl@0
|
350 |
|
sl@0
|
351 |
void TVirPipe::Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3)
|
sl@0
|
352 |
{
|
sl@0
|
353 |
#if defined(__TRACE__)
|
sl@0
|
354 |
test.Printf(_L("TVirPipe::Consume(s,s,s)\n"));
|
sl@0
|
355 |
//test.Getch();
|
sl@0
|
356 |
#endif
|
sl@0
|
357 |
iBuf.Format(_L("%S%S%S"),&aStr1,&aStr2,&aStr3);
|
sl@0
|
358 |
}
|
sl@0
|
359 |
|
sl@0
|
360 |
void TVirPipe::Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4)
|
sl@0
|
361 |
{
|
sl@0
|
362 |
#if defined(__TRACE__)
|
sl@0
|
363 |
test.Printf(_L("TVirPipe::Consume(s,s,s,s)\n"));
|
sl@0
|
364 |
//test.Getch();
|
sl@0
|
365 |
#endif
|
sl@0
|
366 |
iBuf.Format(_L("%S%S%S%S"),&aStr1,&aStr2,&aStr3,&aStr4);
|
sl@0
|
367 |
}
|
sl@0
|
368 |
|
sl@0
|
369 |
LOCAL_C MProducer& Producer(TBase& aBase)
|
sl@0
|
370 |
{
|
sl@0
|
371 |
#if defined(__TRACE__)
|
sl@0
|
372 |
test.Printf(_L("Producer(TBase&)\n"));
|
sl@0
|
373 |
//test.Getch();
|
sl@0
|
374 |
#endif
|
sl@0
|
375 |
MProducer* prod=aBase.Producer();
|
sl@0
|
376 |
test(prod!=NULL);
|
sl@0
|
377 |
return(*prod);
|
sl@0
|
378 |
}
|
sl@0
|
379 |
|
sl@0
|
380 |
LOCAL_C MConsumer& Consumer(TBase& aBase)
|
sl@0
|
381 |
{
|
sl@0
|
382 |
#if defined(__TRACE__)
|
sl@0
|
383 |
test.Printf(_L("Consumer(TBase&)\n"));
|
sl@0
|
384 |
//test.Getch();
|
sl@0
|
385 |
#endif
|
sl@0
|
386 |
MConsumer* cons=aBase.Consumer();
|
sl@0
|
387 |
test(cons!=NULL);
|
sl@0
|
388 |
return(*cons);
|
sl@0
|
389 |
}
|
sl@0
|
390 |
|
sl@0
|
391 |
LOCAL_C void testCopy1(MConsumer& aConsumer,MProducer& aProducer)
|
sl@0
|
392 |
//
|
sl@0
|
393 |
// Copy a string from the producer to the consumer.
|
sl@0
|
394 |
//
|
sl@0
|
395 |
{
|
sl@0
|
396 |
|
sl@0
|
397 |
#if defined(__TRACE__)
|
sl@0
|
398 |
test.Printf(_L("testCopy1()\n"));
|
sl@0
|
399 |
//test.Getch();
|
sl@0
|
400 |
#endif
|
sl@0
|
401 |
aConsumer.Consume(aProducer.Produce());
|
sl@0
|
402 |
}
|
sl@0
|
403 |
|
sl@0
|
404 |
LOCAL_C void testCopy2(MConsumer& aConsumer,MProducer& aProducer)
|
sl@0
|
405 |
//
|
sl@0
|
406 |
// Copy two strings from the producer to the consumer.
|
sl@0
|
407 |
//
|
sl@0
|
408 |
{
|
sl@0
|
409 |
|
sl@0
|
410 |
#if defined(__TRACE__)
|
sl@0
|
411 |
test.Printf(_L("testCopy2()\n"));
|
sl@0
|
412 |
//test.Getch();
|
sl@0
|
413 |
#endif
|
sl@0
|
414 |
TPtrC s1=aProducer.Produce();
|
sl@0
|
415 |
TPtrC s2=aProducer.Produce();
|
sl@0
|
416 |
aConsumer.Consume(s1,s2);
|
sl@0
|
417 |
}
|
sl@0
|
418 |
|
sl@0
|
419 |
LOCAL_C void testCopy3(MConsumer& aConsumer,MProducer& aProducer)
|
sl@0
|
420 |
//
|
sl@0
|
421 |
// Copy three strings from the producer to the consumer.
|
sl@0
|
422 |
//
|
sl@0
|
423 |
{
|
sl@0
|
424 |
|
sl@0
|
425 |
#if defined(__TRACE__)
|
sl@0
|
426 |
test.Printf(_L("testCopy3()\n"));
|
sl@0
|
427 |
//test.Getch();
|
sl@0
|
428 |
#endif
|
sl@0
|
429 |
TPtrC s1=aProducer.Produce();
|
sl@0
|
430 |
TPtrC s2=aProducer.Produce();
|
sl@0
|
431 |
TPtrC s3=aProducer.Produce();
|
sl@0
|
432 |
aConsumer.Consume(s1,s2,s3);
|
sl@0
|
433 |
}
|
sl@0
|
434 |
|
sl@0
|
435 |
LOCAL_C void testCopy4(MConsumer& aConsumer,MProducer& aProducer)
|
sl@0
|
436 |
//
|
sl@0
|
437 |
// Copy four strings from the producer to the consumer.
|
sl@0
|
438 |
//
|
sl@0
|
439 |
{
|
sl@0
|
440 |
|
sl@0
|
441 |
#if defined(__TRACE__)
|
sl@0
|
442 |
test.Printf(_L("testCopy4()\n"));
|
sl@0
|
443 |
//test.Getch();
|
sl@0
|
444 |
#endif
|
sl@0
|
445 |
TPtrC s1=aProducer.Produce();
|
sl@0
|
446 |
TPtrC s2=aProducer.Produce();
|
sl@0
|
447 |
TPtrC s3=aProducer.Produce();
|
sl@0
|
448 |
TPtrC s4=aProducer.Produce();
|
sl@0
|
449 |
aConsumer.Consume(s1,s2,s3,s4);
|
sl@0
|
450 |
}
|
sl@0
|
451 |
|
sl@0
|
452 |
LOCAL_C void testMulti()
|
sl@0
|
453 |
//
|
sl@0
|
454 |
// Test multiple inheritance without virtual bases.
|
sl@0
|
455 |
//
|
sl@0
|
456 |
{
|
sl@0
|
457 |
|
sl@0
|
458 |
#if defined(__TRACE__)
|
sl@0
|
459 |
test.Printf(_L("testMulti()\n"));
|
sl@0
|
460 |
//test.Getch();
|
sl@0
|
461 |
#endif
|
sl@0
|
462 |
test.Next(_L("without virtual base classes"));
|
sl@0
|
463 |
//
|
sl@0
|
464 |
TProducer prod;
|
sl@0
|
465 |
TConsumer cons;
|
sl@0
|
466 |
TPipe pipe;
|
sl@0
|
467 |
testCopy1(Consumer(pipe),Producer(prod));
|
sl@0
|
468 |
testCopy2(Consumer(cons),Producer(pipe));
|
sl@0
|
469 |
//
|
sl@0
|
470 |
testCopy3(Consumer(pipe),Producer(prod));
|
sl@0
|
471 |
testCopy4(Consumer(cons),Producer(pipe));
|
sl@0
|
472 |
//
|
sl@0
|
473 |
testCopy4(Consumer(pipe),Producer(prod));
|
sl@0
|
474 |
testCopy3(Consumer(cons),Producer(pipe));
|
sl@0
|
475 |
//
|
sl@0
|
476 |
testCopy2(Consumer(pipe),Producer(prod));
|
sl@0
|
477 |
testCopy1(Consumer(cons),Producer(pipe));
|
sl@0
|
478 |
}
|
sl@0
|
479 |
|
sl@0
|
480 |
LOCAL_C void testVirt()
|
sl@0
|
481 |
//
|
sl@0
|
482 |
// Test multiple inheritance with virtual bases.
|
sl@0
|
483 |
//
|
sl@0
|
484 |
{
|
sl@0
|
485 |
|
sl@0
|
486 |
#if defined(__TRACE__)
|
sl@0
|
487 |
test.Printf(_L("testVirt()\n"));
|
sl@0
|
488 |
//test.Getch();
|
sl@0
|
489 |
#endif
|
sl@0
|
490 |
test.Next(_L("with virtual base classes"));
|
sl@0
|
491 |
//
|
sl@0
|
492 |
TVirProducer prod;
|
sl@0
|
493 |
TVirConsumer cons;
|
sl@0
|
494 |
TVirPipe pipe;
|
sl@0
|
495 |
testCopy1(Consumer(pipe),Producer(prod));
|
sl@0
|
496 |
testCopy2(Consumer(cons),Producer(pipe));
|
sl@0
|
497 |
//
|
sl@0
|
498 |
testCopy3(Consumer(pipe),Producer(prod));
|
sl@0
|
499 |
testCopy4(Consumer(cons),Producer(pipe));
|
sl@0
|
500 |
//
|
sl@0
|
501 |
testCopy4(Consumer(pipe),Producer(prod));
|
sl@0
|
502 |
testCopy3(Consumer(cons),Producer(pipe));
|
sl@0
|
503 |
//
|
sl@0
|
504 |
testCopy2(Consumer(pipe),Producer(prod));
|
sl@0
|
505 |
testCopy1(Consumer(cons),Producer(pipe));
|
sl@0
|
506 |
}
|
sl@0
|
507 |
|
sl@0
|
508 |
GLDEF_C TInt E32Main()
|
sl@0
|
509 |
//
|
sl@0
|
510 |
// Test the multiple inheritance implementation.
|
sl@0
|
511 |
//
|
sl@0
|
512 |
{
|
sl@0
|
513 |
#if defined(__TRACE__)
|
sl@0
|
514 |
test.Printf(_L("E32Main()\n"));
|
sl@0
|
515 |
//test.Getch();
|
sl@0
|
516 |
#endif
|
sl@0
|
517 |
test.Title();
|
sl@0
|
518 |
//
|
sl@0
|
519 |
test.Start(_L("Multiple Inheritance"));
|
sl@0
|
520 |
testMulti();
|
sl@0
|
521 |
//
|
sl@0
|
522 |
testVirt();
|
sl@0
|
523 |
//
|
sl@0
|
524 |
test.End();
|
sl@0
|
525 |
test.Close();
|
sl@0
|
526 |
return(KErrNone);
|
sl@0
|
527 |
}
|
sl@0
|
528 |
|