Salome HOME
merge from branch DEV tag mergeto_trunk_04apr08
[modules/yacs.git] / src / yacsloader / Test / YacsLoaderTest.cxx
1 #include "yacsconfig.h"
2 #include "RuntimeSALOME.hxx"
3 #include "PythonPorts.hxx"
4 #include "CORBAPorts.hxx"
5 #include "YacsLoaderTest.hxx"
6 #include "parsers.hxx"
7 #include "Proc.hxx"
8 #include "Exception.hxx"
9 #include "Executor.hxx"
10 #include "parsers.hxx"
11
12 #include <iostream>
13 #include <fstream>
14
15 //#define _DEVDEBUG_
16 #include "YacsTrace.hxx"
17
18 using namespace YACS::ENGINE;
19 using namespace YACS;
20 using namespace std;
21
22 int driverTest(Proc* &p, const char* schema)
23 {
24   DEBTRACE("+++++++++++++++++++ BEGIN test " << schema);
25   RuntimeSALOME::setRuntime();
26
27   YACSLoader loader;
28   Executor executor;
29   
30   try
31     {
32       p=loader.load(schema);
33       DEBTRACE("Proc *p = " << p);
34       std::ofstream f("toto");
35       p->writeDot(f);
36       f.close();
37       DEBTRACE("+++++++++++++++++++ BEGIN execution " << schema);
38       executor.RunW(p,0);
39       DEBTRACE("+++++++++++++++++++   END execution " << schema);
40       std::ofstream g("titi");
41       p->writeDot(g);
42       g.close();
43       DEBTRACE("+++++++++++++++++++ END test " << schema);
44       return 0;
45     }
46   catch (YACS::Exception& e)
47     {
48       DEBTRACE("YACS exception caught: ");
49       DEBTRACE(e.what());
50       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
51       return 1;
52     }
53   catch (const std::ios_base::failure&)
54     {
55       DEBTRACE("io failure");
56       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
57       return 1;
58     }
59   catch(CORBA::SystemException& ex)
60     {
61       DEBTRACE("Caught a CORBA::SystemException.");
62       CORBA::Any tmp;
63       tmp <<= ex;
64       CORBA::TypeCode_var tc = tmp.type();
65       const char *p = tc->name();
66       if ( *p != '\0' )
67         {
68           DEBTRACE(p);
69         }
70       else
71         {
72           DEBTRACE(tc->id());
73         }
74       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
75       return 1;
76     }
77   catch(omniORB::fatalException& fe)
78     {
79       DEBTRACE("Caught omniORB::fatalException:" );
80       DEBTRACE("  file: " << fe.file());
81       DEBTRACE("  line: " << fe.line());
82       DEBTRACE("  mesg: " << fe.errmsg());
83       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
84       return 1;
85     }
86   catch(...)
87     {
88       DEBTRACE("Caught unknown exception.");
89       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
90       return 1;
91     }
92 }
93
94 void YacsLoaderTest::setUp()
95 {
96 }
97
98 void YacsLoaderTest::tearDown()
99 {
100 }
101
102 void YacsLoaderTest::aschema()
103 {
104   Proc *p = 0;
105   int ret = driverTest(p, "samples/aschema.xml");
106   CPPUNIT_ASSERT(ret == 0);
107   CPPUNIT_ASSERT(p != 0);
108   if (p)
109     {
110       CORBA::Double dval = 0;
111       char *text = "";
112       CPPUNIT_ASSERT(p->nodeMap["c0.c1.n1"]);
113       *((OutputCorbaPort*)p->nodeMap["c0.c1.n1"]->getOutputPort("p1"))->getAny() >>= dval;
114       PyObject *data = ((OutputPyPort*)p->nodeMap["node32"]->getOutputPort("p1"))->get();
115       double val = PyFloat_AsDouble(data);
116       CPPUNIT_ASSERT_DOUBLES_EQUAL(22., dval, 1.E-12);
117       CPPUNIT_ASSERT_DOUBLES_EQUAL(20., val, 1.E-12);
118       delete p;
119     }
120 }
121
122 void YacsLoaderTest::bschema()
123 {
124   Proc *p = 0;
125   int ret = driverTest(p, "samples/bschema.xml");
126   CPPUNIT_ASSERT(ret == 0);
127   DEBTRACE("Proc *p = " << p);
128   CPPUNIT_ASSERT(p != 0);
129   if (p)
130     {
131       CORBA::Double dval = 0;
132       const char *text = "";
133       *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= dval;
134       *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
135       CPPUNIT_ASSERT_DOUBLES_EQUAL(24., dval, 1.E-12);
136       CPPUNIT_ASSERT_EQUAL(string("coucou"), string(text));
137       delete p;
138     }
139 }
140
141 void YacsLoaderTest::cschema()
142 {
143   Proc *p = 0;
144   int ret = driverTest(p, "samples/cschema.xml");
145   CPPUNIT_ASSERT(ret == 0);
146   DEBTRACE("Proc *p = " << p);
147   CPPUNIT_ASSERT(p != 0);
148 #ifdef SALOME_KERNEL
149   if (p)
150     {
151       CORBA::Double dval = 0;
152       const char *text = "";
153       *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
154       CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
155       text = "";
156       *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
157       CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
158       delete p;
159     }
160 #endif
161 }
162
163 void YacsLoaderTest::dschema()
164 {
165   Proc *p = 0;
166   int ret = driverTest(p, "samples/dschema.xml");
167   CPPUNIT_ASSERT(ret == 0);
168   DEBTRACE("Proc *p = " << p);
169   CPPUNIT_ASSERT(p != 0);
170 #ifdef SALOME_KERNEL
171   if (p)
172     {
173       CORBA::Double dval = 0;
174       const char *text = "";
175       *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
176       CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
177       text = "";
178       *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
179       CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
180       text = "";
181       *((OutputCorbaPort*)p->nodeMap["node3"]->getOutputPort("p1"))->getAny() >>= text;
182       CPPUNIT_ASSERT_EQUAL( string("Hello Hello coucou!!"), string(text));
183       delete p;
184     }
185 #endif
186 }
187
188 void YacsLoaderTest::eschema()
189 {
190   Proc *p = 0;
191   int ret = driverTest(p, "samples/eschema.xml");
192   CPPUNIT_ASSERT(ret == 0);
193   DEBTRACE("Proc *p = " << p);
194   CPPUNIT_ASSERT(p != 0);
195   if (p)
196     {
197       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
198       char *text = PyString_AsString(data);
199       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text));
200       delete p;
201     }
202 }
203
204 void YacsLoaderTest::fschema()
205 {
206   Proc *p = 0;
207   int ret = driverTest(p, "samples/fschema.xml");
208   CPPUNIT_ASSERT(ret == 0);
209   DEBTRACE("Proc *p = " << p);
210   CPPUNIT_ASSERT(p != 0);
211   if (p)
212     {
213       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
214       char *text = PyString_AsString(data);;
215       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text) );
216       delete p;
217     }
218 }
219
220 void YacsLoaderTest::oschema()
221 {
222   Proc *p = 0;
223   int ret = driverTest(p, "samples/oschema.xml");
224   CPPUNIT_ASSERT(ret == 1);
225 }
226
227 void YacsLoaderTest::pschema()
228 {
229   Proc *p = 0;
230   int ret = driverTest(p, "samples/pschema.xml");
231   CPPUNIT_ASSERT(ret == 0);
232   DEBTRACE("Proc *p = " << p);
233   CPPUNIT_ASSERT(p != 0);
234   if (p)
235     {
236       {
237         CORBA::Double dval = 0;
238         *((OutputCorbaPort*)p->nodeMap["node61"]->getOutputPort("p1"))->getAny() >>= dval;
239         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
240       }
241       {
242         CORBA::Double dval = 0;
243         *((OutputCorbaPort*)p->nodeMap["node62"]->getOutputPort("p1"))->getAny() >>= dval;
244         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
245       }
246       {
247         CORBA::Double dval = 0;
248         *((OutputCorbaPort*)p->nodeMap["node63"]->getOutputPort("p1"))->getAny() >>= dval;
249         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
250       }
251       delete p;
252     }
253 }
254
255 void YacsLoaderTest::schema()
256 {
257   Proc *p = 0;
258   int ret = driverTest(p, "samples/schema.xml");
259   CPPUNIT_ASSERT(ret == 1);
260 }
261
262 void YacsLoaderTest::schema2()
263 {
264   Proc *p = 0;
265   int ret = driverTest(p, "samples/schema2.xml");
266   CPPUNIT_ASSERT(ret == 0);
267   DEBTRACE("Proc *p = " << p);
268   CPPUNIT_ASSERT(p != 0);
269   if (p)
270     {
271       {
272         CORBA::Double dval = 0;
273         *((OutputCorbaPort*)p->nodeMap["node61"]->getOutputPort("p1"))->getAny() >>= dval;
274         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
275       }
276       {
277         CORBA::Double dval = 0;
278         *((OutputCorbaPort*)p->nodeMap["node62"]->getOutputPort("p1"))->getAny() >>= dval;
279         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
280       }
281       {
282         CORBA::Double dval = 0;
283         *((OutputCorbaPort*)p->nodeMap["node63"]->getOutputPort("p1"))->getAny() >>= dval;
284         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
285       }
286       delete p;
287     }
288 }
289
290 void YacsLoaderTest::forloop1()
291 {
292   Proc *p = 0;
293   int ret = driverTest(p, "samples/forloop1.xml");
294   CPPUNIT_ASSERT(ret == 0);
295   DEBTRACE("Proc *p = " << p);
296   CPPUNIT_ASSERT(p != 0);
297   if (p)
298     {
299       PyObject *data = ((OutputPyPort*)p->nodeMap["b1.node2"]->getOutputPort("p1"))->get();
300       double val = PyFloat_AsDouble(data);;
301       CPPUNIT_ASSERT_DOUBLES_EQUAL(33., val, 1.E-12);
302       delete p;
303     }
304 }
305
306 void YacsLoaderTest::forloop2()
307 {
308   Proc *p = 0;
309   int ret = driverTest(p, "samples/forloop2.xml");
310   CPPUNIT_ASSERT(ret == 0);
311 }
312
313 /////////////////////////////
314
315 void YacsLoaderTest::forloop3()
316 {
317   Proc *p = 0;
318   int ret = driverTest(p, "samples/forloop3.xml");
319   CPPUNIT_ASSERT(ret == 0);
320   DEBTRACE("Proc *p = " << p);
321   CPPUNIT_ASSERT(p != 0);
322   if (p)
323     {
324 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
325 //       char *text = PyString_AsString(data);;
326 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
327       delete p;
328     }
329 }
330
331 void YacsLoaderTest::forloop4()
332 {
333   Proc *p = 0;
334   int ret = driverTest(p, "samples/forloop4.xml");
335   CPPUNIT_ASSERT(ret == 0);
336   DEBTRACE("Proc *p = " << p);
337   CPPUNIT_ASSERT(p != 0);
338   if (p)
339     {
340 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
341 //       char *text = PyString_AsString(data);;
342 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
343       delete p;
344     }
345 }
346
347 void YacsLoaderTest::forloop5()
348 {
349   Proc *p = 0;
350   int ret = driverTest(p, "samples/forloop5.xml");
351   CPPUNIT_ASSERT(ret == 0);
352   DEBTRACE("Proc *p = " << p);
353   CPPUNIT_ASSERT(p != 0);
354   if (p)
355     {
356 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
357 //       char *text = PyString_AsString(data);;
358 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
359       delete p;
360     }
361 }
362
363 void YacsLoaderTest::forloop6()
364 {
365   Proc *p = 0;
366   int ret = driverTest(p, "samples/forloop6.xml");
367   CPPUNIT_ASSERT(ret == 0);
368   DEBTRACE("Proc *p = " << p);
369   CPPUNIT_ASSERT(p != 0);
370   if (p)
371     {
372 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
373 //       char *text = PyString_AsString(data);;
374 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
375       delete p;
376     }
377 }
378
379
380 void YacsLoaderTest::forloop7()
381 {
382   Proc *p = 0;
383   int ret = driverTest(p, "samples/forloop7.xml");
384   CPPUNIT_ASSERT(ret == 0);
385   DEBTRACE("Proc *p = " << p);
386   CPPUNIT_ASSERT(p != 0);
387   if (p)
388     {
389 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
390 //       char *text = PyString_AsString(data);;
391 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
392       delete p;
393     }
394 }
395
396 void YacsLoaderTest::switch1()
397 {
398   Proc *p = 0;
399   int ret = driverTest(p, "samples/switch1.xml");
400   CPPUNIT_ASSERT(ret == 0);
401   DEBTRACE("Proc *p = " << p);
402   CPPUNIT_ASSERT(p != 0);
403   if (p)
404     {
405 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
406 //       char *text = PyString_AsString(data);;
407 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
408       delete p;
409     }
410 }
411
412 void YacsLoaderTest::switch2()
413 {
414   Proc *p = 0;
415   int ret = driverTest(p, "samples/switch2.xml");
416   CPPUNIT_ASSERT(ret == 0);
417   DEBTRACE("Proc *p = " << p);
418   CPPUNIT_ASSERT(p != 0);
419   if (p)
420     {
421 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
422 //       char *text = PyString_AsString(data);;
423 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
424       delete p;
425     }
426 }
427
428 void YacsLoaderTest::switch3()
429 {
430   Proc *p = 0;
431   int ret = driverTest(p, "samples/switch3.xml");
432   CPPUNIT_ASSERT(ret == 0);
433   DEBTRACE("Proc *p = " << p);
434   CPPUNIT_ASSERT(p != 0);
435   if (p)
436     {
437 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
438 //       char *text = PyString_AsString(data);;
439 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
440       delete p;
441     }
442 }
443
444 void YacsLoaderTest::switch4()
445 {
446   Proc *p = 0;
447   int ret = driverTest(p, "samples/switch4.xml");
448   CPPUNIT_ASSERT(ret == 0);
449   DEBTRACE("Proc *p = " << p);
450   CPPUNIT_ASSERT(p != 0);
451   if (p)
452     {
453 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
454 //       char *text = PyString_AsString(data);;
455 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
456       delete p;
457     }
458 }
459
460 void YacsLoaderTest::switch5()
461 {
462   Proc *p = 0;
463   int ret = driverTest(p, "samples/switch5.xml");
464   CPPUNIT_ASSERT(ret == 0);
465   DEBTRACE("Proc *p = " << p);
466   CPPUNIT_ASSERT(p != 0);
467   if (p)
468     {
469 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
470 //       char *text = PyString_AsString(data);;
471 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
472       delete p;
473     }
474 }
475
476 void YacsLoaderTest::switch6()
477 {
478   Proc *p = 0;
479   int ret = driverTest(p, "samples/switch6.xml");
480   CPPUNIT_ASSERT(ret == 0);
481   DEBTRACE("Proc *p = " << p);
482   CPPUNIT_ASSERT(p != 0);
483   if (p)
484     {
485 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
486 //       char *text = PyString_AsString(data);;
487 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
488       delete p;
489     }
490 }
491
492 void YacsLoaderTest::switch7()
493 {
494   Proc *p = 0;
495   int ret = driverTest(p, "samples/switch7.xml");
496   CPPUNIT_ASSERT(ret == 0);
497   DEBTRACE("Proc *p = " << p);
498   CPPUNIT_ASSERT(p != 0);
499   if (p)
500     {
501 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
502 //       char *text = PyString_AsString(data);;
503 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
504       delete p;
505     }
506 }
507
508 void YacsLoaderTest::switch8()
509 {
510   Proc *p = 0;
511   int ret = driverTest(p, "samples/switch8.xml");
512   CPPUNIT_ASSERT(ret == 0);
513   DEBTRACE("Proc *p = " << p);
514   CPPUNIT_ASSERT(p != 0);
515   if (p)
516     {
517 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
518 //       char *text = PyString_AsString(data);;
519 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
520       delete p;
521     }
522 }
523
524 void YacsLoaderTest::switch9()
525 {
526   Proc *p = 0;
527   int ret = driverTest(p, "samples/switch9.xml");
528   CPPUNIT_ASSERT(ret == 0);
529   DEBTRACE("Proc *p = " << p);
530   CPPUNIT_ASSERT(p != 0);
531   if (p)
532     {
533 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
534 //       char *text = PyString_AsString(data);;
535 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
536       delete p;
537     }
538 }
539
540 void YacsLoaderTest::whiles()
541 {
542   Proc *p = 0;
543   int ret = driverTest(p, "samples/while1.xml");
544   CPPUNIT_ASSERT(ret == 0);
545   DEBTRACE("Proc *p = " << p);
546   CPPUNIT_ASSERT(p != 0);
547   if (p)
548     {
549 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
550 //       char *text = PyString_AsString(data);;
551 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
552       delete p;
553     }
554   ret = driverTest(p, "samples/while2.xml");
555   CPPUNIT_ASSERT(ret == 0);
556   ret = driverTest(p, "samples/while3.xml");
557   CPPUNIT_ASSERT(ret == 0);
558 }
559
560 void YacsLoaderTest::forwhile1()
561 {
562   Proc *p = 0;
563   int ret = driverTest(p, "samples/forwhile1.xml");
564   CPPUNIT_ASSERT(ret == 0);
565   DEBTRACE("Proc *p = " << p);
566   CPPUNIT_ASSERT(p != 0);
567   if (p)
568     {
569 //       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
570 //       char *text = PyString_AsString(data);;
571 //       CPPUNIT_ASSERT_EQUAL(string(text), string("coucoucoucoucoucoucoucou"));
572       delete p;
573     }
574 }
575
576 void YacsLoaderTest::blocs()
577 {
578   Proc *p = 0;
579   int ret;
580   ret = driverTest(p, "samples/bloc1.xml");
581   CPPUNIT_ASSERT(ret == 0);
582   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
583   ret = driverTest(p, "samples/bloc2.xml");
584   CPPUNIT_ASSERT(ret == 0);
585   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
586   ret = driverTest(p, "samples/bloc3.xml");
587   CPPUNIT_ASSERT(ret == 0);
588   CPPUNIT_ASSERT(p->getEffectiveState() != YACS::DONE );
589   ret = driverTest(p, "samples/bloc4.xml");
590   CPPUNIT_ASSERT(ret == 0);
591   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
592 }
593
594 void YacsLoaderTest::refcnt()
595 {
596   Proc *p = 0;
597   int ret;
598   PyObject *data;
599   ret = driverTest(p, "samples/refcnt1.xml");
600   CPPUNIT_ASSERT(ret == 0);
601   data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
602   CPPUNIT_ASSERT_EQUAL(13, data->ob_refcnt);
603   ret = driverTest(p, "samples/refcnt2.xml");
604   CPPUNIT_ASSERT(ret == 0);
605   data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
606   CPPUNIT_ASSERT_EQUAL(19, data->ob_refcnt);
607 }
608
609 void YacsLoaderTest::foreachs()
610 {
611   Proc *p = 0;
612   int ret;
613   ret = driverTest(p, "samples/foreach1.xml");
614   CPPUNIT_ASSERT(ret == 0);
615   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
616   ret = driverTest(p, "samples/foreach2.xml");
617   CPPUNIT_ASSERT(ret == 0);
618   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
619   ret = driverTest(p, "samples/foreach3.xml");
620   CPPUNIT_ASSERT(ret == 1);
621   ret = driverTest(p, "samples/foreach4.xml");
622   CPPUNIT_ASSERT(ret == 0);
623   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
624   ret = driverTest(p, "samples/foreach5.xml");
625   CPPUNIT_ASSERT(ret == 0);
626   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
627   ret = driverTest(p, "samples/foreach6.xml");
628   CPPUNIT_ASSERT(ret == 0);
629   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
630 }
631
632 void YacsLoaderTest::sinlines()
633 {
634   Proc *p = 0;
635   int ret;
636   ret = driverTest(p, "samples/sinline1.xml");
637   CPPUNIT_ASSERT(ret == 0);
638   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
639   ret = driverTest(p, "samples/sinline2.xml");
640   CPPUNIT_ASSERT(ret == 0);
641   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
642   ret = driverTest(p, "samples/sinline3.xml");
643   CPPUNIT_ASSERT(ret == 0);
644   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
645   ret = driverTest(p, "samples/sinline4.xml");
646   CPPUNIT_ASSERT(ret == 0);
647   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
648   ret = driverTest(p, "samples/sinline5.xml");
649   CPPUNIT_ASSERT(ret == 0);
650   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
651 }
652
653 void YacsLoaderTest::bools()
654 {
655   Proc *p = 0;
656   int ret;
657   ret = driverTest(p, "samples/bool1.xml");
658   CPPUNIT_ASSERT(ret == 0);
659   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
660 }
661 void YacsLoaderTest::integers()
662 {
663   Proc *p = 0;
664   int ret;
665   ret = driverTest(p, "samples/integer1.xml");
666   CPPUNIT_ASSERT(ret == 0);
667   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
668 }
669 void YacsLoaderTest::doubles()
670 {
671   Proc *p = 0;
672   int ret;
673   ret = driverTest(p, "samples/double1.xml");
674   CPPUNIT_ASSERT(ret == 0);
675   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
676 }
677 void YacsLoaderTest::strings()
678 {
679   Proc *p = 0;
680   int ret;
681   ret = driverTest(p, "samples/string1.xml");
682   CPPUNIT_ASSERT(ret == 0);
683   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
684 }
685 void YacsLoaderTest::objrefs()
686 {
687   Proc *p = 0;
688   int ret;
689   ret = driverTest(p, "samples/objref1.xml");
690   CPPUNIT_ASSERT(ret == 0);
691   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
692 }
693 void YacsLoaderTest::structs()
694 {
695   Proc *p = 0;
696   int ret;
697   ret = driverTest(p, "samples/struct1.xml");
698   CPPUNIT_ASSERT(ret == 0);
699   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
700   delete p;
701
702   ret = driverTest(p, "samples/struct2.xml");
703   CPPUNIT_ASSERT(ret == 0);
704   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
705   delete p;
706 }
707
708 void YacsLoaderTest::cpps()
709 {
710   Proc *p = 0;
711   int ret;
712   ret = driverTest(p, "samples/cpp1.xml");
713   CPPUNIT_ASSERT(ret == 0);
714   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
715   delete p;
716 }
717
718 void YacsLoaderTest::datanodes()
719 {
720   Proc *p = 0;
721   int ret;
722   ret = driverTest(p, "samples/datanode0.xml");
723   CPPUNIT_ASSERT(ret == 0);
724   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
725   delete p;
726 }