]> SALOME platform Git repositories - modules/yacs.git/blob - src/yacsloader/Test/YacsLoaderTest.cxx
Salome HOME
Merge branch 'omu/double_foreach'
[modules/yacs.git] / src / yacsloader / Test / YacsLoaderTest.cxx
1 // Copyright (C) 2006-2015  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "yacsconfig.h"
21 #include "RuntimeSALOME.hxx"
22 #include "PythonPorts.hxx"
23 #include "CORBAPorts.hxx"
24 #include "YacsLoaderTest.hxx"
25 #include "parsers.hxx"
26 #include "Proc.hxx"
27 #include "Exception.hxx"
28 #include "Executor.hxx"
29 #include "parsers.hxx"
30
31 #include <iostream>
32 #include <fstream>
33 #include <stdlib.h>
34 #ifdef WIN32
35 #include <io.h>
36 #define F_OK 0
37 #define access _access
38 #else
39 #include <unistd.h>
40 #endif
41
42 //#define _DEVDEBUG_
43 #include "YacsTrace.hxx"
44
45 using namespace YACS::ENGINE;
46 using namespace YACS;
47 using namespace std;
48
49 int driverTest(Proc* &p, const char* schema)
50 {
51   DEBTRACE("+++++++++++++++++++ BEGIN test " << schema);
52   RuntimeSALOME::setRuntime();
53
54   YACSLoader loader;
55   Executor executor;
56   
57   try
58     {
59       p=loader.load(schema);
60       DEBTRACE("Proc *p = " << p);
61       std::ofstream f("toto");
62       p->writeDot(f);
63       f.close();
64       DEBTRACE("+++++++++++++++++++ BEGIN execution " << schema);
65       executor.RunW(p,0);
66       DEBTRACE("+++++++++++++++++++   END execution " << schema);
67       std::ofstream g("titi");
68       p->writeDot(g);
69       g.close();
70       DEBTRACE("+++++++++++++++++++ END test " << schema);
71       return 0;
72     }
73   catch (YACS::Exception& e)
74     {
75       DEBTRACE("YACS exception caught: ");
76       DEBTRACE(e.what());
77       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
78       return 1;
79     }
80   catch (const std::ios_base::failure&)
81     {
82       DEBTRACE("io failure");
83       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
84       return 1;
85     }
86   catch(CORBA::SystemException& ex)
87     {
88       DEBTRACE("Caught a CORBA::SystemException.");
89       CORBA::Any tmp;
90       tmp <<= ex;
91       CORBA::TypeCode_var tc = tmp.type();
92       const char *p = tc->name();
93       if ( *p != '\0' )
94         {
95           DEBTRACE(p);
96         }
97       else
98         {
99           DEBTRACE(tc->id());
100         }
101       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
102       return 1;
103     }
104   catch(omniORB::fatalException& fe)
105     {
106       DEBTRACE("Caught omniORB::fatalException:" );
107       DEBTRACE("  file: " << fe.file());
108       DEBTRACE("  line: " << fe.line());
109       DEBTRACE("  mesg: " << fe.errmsg());
110       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
111       return 1;
112     }
113   catch(...)
114     {
115       DEBTRACE("Caught unknown exception.");
116       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
117       return 1;
118     }
119 }
120
121 void YacsLoaderTest::setUp()
122 {
123 }
124
125 void YacsLoaderTest::tearDown()
126 {
127 }
128
129 void YacsLoaderTest::aschema()
130 {
131   Proc *p = 0;
132   int ret = driverTest(p, "samples/aschema.xml");
133   CPPUNIT_ASSERT(ret == 0);
134   CPPUNIT_ASSERT(p != 0);
135   if (p)
136     {
137       CORBA::Double dval = 0;
138       char *text = (char*)"";
139       CPPUNIT_ASSERT(p->nodeMap["c0.c1.n1"]);
140       *((OutputCorbaPort*)p->nodeMap["c0.c1.n1"]->getOutputPort("p1"))->getAny() >>= dval;
141       PyObject *data = ((OutputPyPort*)p->nodeMap["node32"]->getOutputPort("p1"))->get();
142       double val = PyFloat_AsDouble(data);
143       CPPUNIT_ASSERT_DOUBLES_EQUAL(22., dval, 1.E-12);
144       CPPUNIT_ASSERT_DOUBLES_EQUAL(20., val, 1.E-12);
145       delete p;
146     }
147 }
148
149 void YacsLoaderTest::bschema()
150 {
151   Proc *p = 0;
152   int ret = driverTest(p, "samples/bschema.xml");
153   CPPUNIT_ASSERT(ret == 0);
154   DEBTRACE("Proc *p = " << p);
155   CPPUNIT_ASSERT(p != 0);
156   if (p)
157     {
158       CORBA::Double dval = 0;
159       const char *text = "";
160       *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= dval;
161       *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
162       CPPUNIT_ASSERT_DOUBLES_EQUAL(24., dval, 1.E-12);
163       CPPUNIT_ASSERT_EQUAL(string("coucou"), string(text));
164       delete p;
165     }
166 }
167
168 void YacsLoaderTest::cschema()
169 {
170   Proc *p = 0;
171   int ret = driverTest(p, "samples/cschema.xml");
172   CPPUNIT_ASSERT(ret == 0);
173   DEBTRACE("Proc *p = " << p);
174   CPPUNIT_ASSERT(p != 0);
175 #ifdef SALOME_KERNEL
176   if (p)
177     {
178       if(getenv("PYHELLO_ROOT_DIR"))
179         {
180           std::string hellodir(getenv("PYHELLO_ROOT_DIR"));
181           hellodir=hellodir+"/share/salome/resources/pyhello";
182           if(access(hellodir.c_str(),F_OK) == 0)
183             {
184               CORBA::Double dval = 0;
185               const char *text = "";
186               *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
187               CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
188               text = "";
189               *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
190               CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
191             }
192         }
193       delete p;
194     }
195 #endif
196 }
197
198 void YacsLoaderTest::dschema()
199 {
200   Proc *p = 0;
201   int ret = driverTest(p, "samples/dschema.xml");
202   CPPUNIT_ASSERT(ret == 0);
203   DEBTRACE("Proc *p = " << p);
204   CPPUNIT_ASSERT(p != 0);
205 #ifdef SALOME_KERNEL
206   if (p)
207     {
208       if(getenv("PYHELLO_ROOT_DIR"))
209         {
210           std::string hellodir(getenv("PYHELLO_ROOT_DIR"));
211           hellodir=hellodir+"/share/salome/resources/pyhello";
212           if(access(hellodir.c_str(),F_OK) == 0)
213             {
214               CORBA::Double dval = 0;
215               const char *text = "";
216               *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
217               CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
218               text = "";
219               *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
220               CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
221               text = "";
222               *((OutputCorbaPort*)p->nodeMap["node3"]->getOutputPort("p1"))->getAny() >>= text;
223               CPPUNIT_ASSERT_EQUAL( string("Hello Hello coucou!!"), string(text));
224             }
225         }
226       delete p;
227     }
228 #endif
229 }
230
231 void YacsLoaderTest::eschema()
232 {
233   Proc *p = 0;
234   int ret = driverTest(p, "samples/eschema.xml");
235   CPPUNIT_ASSERT(ret == 0);
236   DEBTRACE("Proc *p = " << p);
237   CPPUNIT_ASSERT(p != 0);
238   if (p)
239     {
240       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
241       char *text = PyString_AsString(data);
242       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text));
243       delete p;
244     }
245 }
246
247 void YacsLoaderTest::fschema()
248 {
249   Proc *p = 0;
250   int ret = driverTest(p, "samples/fschema.xml");
251   CPPUNIT_ASSERT(ret == 0);
252   DEBTRACE("Proc *p = " << p);
253   CPPUNIT_ASSERT(p != 0);
254   if (p)
255     {
256       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
257       char *text = PyString_AsString(data);;
258       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text) );
259       delete p;
260     }
261 }
262
263 void YacsLoaderTest::oschema()
264 {
265   Proc *p = 0;
266   int ret = driverTest(p, "samples/oschema.xml");
267   CPPUNIT_ASSERT(ret == 1);
268 }
269
270 void YacsLoaderTest::pschema()
271 {
272   Proc *p = 0;
273   int ret = driverTest(p, "samples/pschema.xml");
274   CPPUNIT_ASSERT(ret == 0);
275   DEBTRACE("Proc *p = " << p);
276   CPPUNIT_ASSERT(p != 0);
277   if (p)
278     {
279       {
280         CORBA::Double dval = 0;
281         *((OutputCorbaPort*)p->nodeMap["node61"]->getOutputPort("p1"))->getAny() >>= dval;
282         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
283       }
284       {
285         CORBA::Double dval = 0;
286         *((OutputCorbaPort*)p->nodeMap["node62"]->getOutputPort("p1"))->getAny() >>= dval;
287         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
288       }
289       {
290         CORBA::Double dval = 0;
291         *((OutputCorbaPort*)p->nodeMap["node63"]->getOutputPort("p1"))->getAny() >>= dval;
292         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
293       }
294       delete p;
295     }
296 }
297
298 void YacsLoaderTest::schema()
299 {
300   Proc *p = 0;
301   int ret = driverTest(p, "samples/schema.xml");
302   CPPUNIT_ASSERT(ret == 1);
303 }
304
305 void YacsLoaderTest::schema2()
306 {
307   Proc *p = 0;
308   int ret = driverTest(p, "samples/schema2.xml");
309   CPPUNIT_ASSERT(ret == 0);
310   DEBTRACE("Proc *p = " << p);
311   CPPUNIT_ASSERT(p != 0);
312   if (p)
313     {
314       {
315         CORBA::Double dval = 0;
316         *((OutputCorbaPort*)p->nodeMap["node61"]->getOutputPort("p1"))->getAny() >>= dval;
317         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
318       }
319       {
320         CORBA::Double dval = 0;
321         *((OutputCorbaPort*)p->nodeMap["node62"]->getOutputPort("p1"))->getAny() >>= dval;
322         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
323       }
324       {
325         CORBA::Double dval = 0;
326         *((OutputCorbaPort*)p->nodeMap["node63"]->getOutputPort("p1"))->getAny() >>= dval;
327         CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
328       }
329       try
330         {
331           delete p;
332         }
333       catch (YACS::Exception& e)
334         {
335           DEBTRACE("YACS exception caught: ");
336           DEBTRACE(e.what());
337         }
338       catch (const std::ios_base::failure&)
339         {
340           DEBTRACE("io failure");
341         }
342       catch(CORBA::SystemException& ex)
343         {
344           DEBTRACE("Caught a CORBA::SystemException.");
345           CORBA::Any tmp;
346           tmp <<= ex;
347           CORBA::TypeCode_var tc = tmp.type();
348           const char *p = tc->name();
349           if ( *p != '\0' )
350             {
351               DEBTRACE(p);
352             }
353           else
354             {
355               DEBTRACE(tc->id());
356             }
357         }
358       catch(omniORB::fatalException& fe)
359         {
360           DEBTRACE("Caught omniORB::fatalException:" );
361           DEBTRACE("  file: " << fe.file());
362           DEBTRACE("  line: " << fe.line());
363           DEBTRACE("  mesg: " << fe.errmsg());
364         }
365       catch(...)
366         {
367           DEBTRACE("unknown exception");
368         }
369     }
370 }
371
372 void YacsLoaderTest::forloop1()
373 {
374   Proc *p = 0;
375   int ret = driverTest(p, "samples/forloop1.xml");
376   CPPUNIT_ASSERT(ret == 0);
377   DEBTRACE("Proc *p = " << p);
378   CPPUNIT_ASSERT(p != 0);
379   if (p)
380     {
381       PyObject *data = ((OutputPyPort*)p->nodeMap["b1.node2"]->getOutputPort("p1"))->get();
382       double val = PyFloat_AsDouble(data);;
383       CPPUNIT_ASSERT_DOUBLES_EQUAL(33., val, 1.E-12);
384       delete p;
385     }
386 }
387
388 void YacsLoaderTest::forloop2()
389 {
390   Proc *p = 0;
391   int ret = driverTest(p, "samples/forloop2.xml");
392   CPPUNIT_ASSERT(ret == 0);
393 }
394
395 /////////////////////////////
396
397 void YacsLoaderTest::forloop3()
398 {
399   Proc *p = 0;
400   int ret = driverTest(p, "samples/forloop3.xml");
401   CPPUNIT_ASSERT(ret == 0);
402   DEBTRACE("Proc *p = " << p);
403   CPPUNIT_ASSERT(p != 0);
404   if (p)
405     {
406       delete p;
407     }
408 }
409
410 void YacsLoaderTest::forloop4()
411 {
412   Proc *p = 0;
413   int ret = driverTest(p, "samples/forloop4.xml");
414   CPPUNIT_ASSERT(ret == 0);
415   DEBTRACE("Proc *p = " << p);
416   CPPUNIT_ASSERT(p != 0);
417   if (p)
418     {
419       delete p;
420     }
421 }
422
423 void YacsLoaderTest::forloop5()
424 {
425   Proc *p = 0;
426   int ret = driverTest(p, "samples/forloop5.xml");
427   CPPUNIT_ASSERT(ret == 0);
428   DEBTRACE("Proc *p = " << p);
429   CPPUNIT_ASSERT(p != 0);
430   if (p)
431     {
432       delete p;
433     }
434 }
435
436 void YacsLoaderTest::forloop6()
437 {
438   Proc *p = 0;
439   int ret = driverTest(p, "samples/forloop6.xml");
440   CPPUNIT_ASSERT(ret == 0);
441   DEBTRACE("Proc *p = " << p);
442   CPPUNIT_ASSERT(p != 0);
443   if (p)
444     {
445       delete p;
446     }
447 }
448
449
450 void YacsLoaderTest::forloop7()
451 {
452   Proc *p = 0;
453   int ret = driverTest(p, "samples/forloop7.xml");
454   CPPUNIT_ASSERT(ret == 0);
455   DEBTRACE("Proc *p = " << p);
456   CPPUNIT_ASSERT(p != 0);
457   if (p)
458     {
459       delete p;
460     }
461 }
462
463 void YacsLoaderTest::switch1()
464 {
465   Proc *p = 0;
466   int ret = driverTest(p, "samples/switch1.xml");
467   CPPUNIT_ASSERT(ret == 0);
468   DEBTRACE("Proc *p = " << p);
469   CPPUNIT_ASSERT(p != 0);
470   if (p)
471     {
472       delete p;
473     }
474 }
475
476 void YacsLoaderTest::switch2()
477 {
478   Proc *p = 0;
479   int ret = driverTest(p, "samples/switch2.xml");
480   CPPUNIT_ASSERT(ret == 0);
481   DEBTRACE("Proc *p = " << p);
482   CPPUNIT_ASSERT(p != 0);
483   if (p)
484     {
485       delete p;
486     }
487 }
488
489 void YacsLoaderTest::switch3()
490 {
491   Proc *p = 0;
492   int ret = driverTest(p, "samples/switch3.xml");
493   CPPUNIT_ASSERT(ret == 0);
494   DEBTRACE("Proc *p = " << p);
495   CPPUNIT_ASSERT(p != 0);
496   if (p)
497     {
498       delete p;
499     }
500 }
501
502 void YacsLoaderTest::switch4()
503 {
504   Proc *p = 0;
505   int ret = driverTest(p, "samples/switch4.xml");
506   CPPUNIT_ASSERT(ret == 0);
507   DEBTRACE("Proc *p = " << p);
508   CPPUNIT_ASSERT(p != 0);
509   if (p)
510     {
511       delete p;
512     }
513 }
514
515 void YacsLoaderTest::switch5()
516 {
517   Proc *p = 0;
518   int ret = driverTest(p, "samples/switch5.xml");
519   CPPUNIT_ASSERT(ret == 0);
520   DEBTRACE("Proc *p = " << p);
521   CPPUNIT_ASSERT(p != 0);
522   if (p)
523     {
524       delete p;
525     }
526 }
527
528 void YacsLoaderTest::switch6()
529 {
530   Proc *p = 0;
531   int ret = driverTest(p, "samples/switch6.xml");
532   CPPUNIT_ASSERT(ret == 0);
533   DEBTRACE("Proc *p = " << p);
534   CPPUNIT_ASSERT(p != 0);
535   if (p)
536     {
537       delete p;
538     }
539 }
540
541 void YacsLoaderTest::switch7()
542 {
543   Proc *p = 0;
544   int ret = driverTest(p, "samples/switch7.xml");
545   CPPUNIT_ASSERT(ret == 0);
546   DEBTRACE("Proc *p = " << p);
547   CPPUNIT_ASSERT(p != 0);
548   if (p)
549     {
550       delete p;
551     }
552 }
553
554 void YacsLoaderTest::switch8()
555 {
556   Proc *p = 0;
557   int ret = driverTest(p, "samples/switch8.xml");
558   CPPUNIT_ASSERT(ret == 0);
559   DEBTRACE("Proc *p = " << p);
560   CPPUNIT_ASSERT(p != 0);
561   if (p)
562     {
563       delete p;
564     }
565 }
566
567 void YacsLoaderTest::switch9()
568 {
569   Proc *p = 0;
570   int ret = driverTest(p, "samples/switch9.xml");
571   CPPUNIT_ASSERT(ret == 0);
572   DEBTRACE("Proc *p = " << p);
573   CPPUNIT_ASSERT(p != 0);
574   if (p)
575     {
576       delete p;
577     }
578 }
579
580 void YacsLoaderTest::whiles()
581 {
582   Proc *p = 0;
583   int ret = driverTest(p, "samples/while1.xml");
584   CPPUNIT_ASSERT(ret == 0);
585   DEBTRACE("Proc *p = " << p);
586   CPPUNIT_ASSERT(p != 0);
587   if (p)
588     {
589       delete p;
590     }
591   ret = driverTest(p, "samples/while2.xml");
592   CPPUNIT_ASSERT(ret == 0);
593   ret = driverTest(p, "samples/while3.xml");
594   CPPUNIT_ASSERT(ret == 0);
595 }
596
597 void YacsLoaderTest::forwhile1()
598 {
599   Proc *p = 0;
600   int ret = driverTest(p, "samples/forwhile1.xml");
601   CPPUNIT_ASSERT(ret == 0);
602   DEBTRACE("Proc *p = " << p);
603   CPPUNIT_ASSERT(p != 0);
604   if (p)
605     {
606       delete p;
607     }
608 }
609
610 void YacsLoaderTest::blocs()
611 {
612   Proc *p = 0;
613   int ret;
614   ret = driverTest(p, "samples/bloc1.xml");
615   CPPUNIT_ASSERT(ret == 0);
616   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
617   ret = driverTest(p, "samples/bloc2.xml");
618   CPPUNIT_ASSERT(ret == 0);
619   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
620   ret = driverTest(p, "samples/bloc3.xml");
621   CPPUNIT_ASSERT(ret == 0);
622   CPPUNIT_ASSERT(p->getEffectiveState() != YACS::DONE );
623   ret = driverTest(p, "samples/bloc4.xml");
624   CPPUNIT_ASSERT(ret == 0);
625   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
626 }
627
628 void YacsLoaderTest::refcnt()
629 {
630   Proc *p = 0;
631   int ret;
632   PyObject *data;
633   ret = driverTest(p, "samples/refcnt1.xml");
634   CPPUNIT_ASSERT(ret == 0);
635   data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
636   CPPUNIT_ASSERT(data->ob_refcnt==13);
637   ret = driverTest(p, "samples/refcnt2.xml");
638   CPPUNIT_ASSERT(ret == 0);
639   data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
640   CPPUNIT_ASSERT(data->ob_refcnt==19);
641 }
642
643 void YacsLoaderTest::foreachs()
644 {
645   Proc *p = 0;
646   int ret;
647   ret = driverTest(p, "samples/foreach1.xml");
648   CPPUNIT_ASSERT_MESSAGE("Schema: foreach1.xml", ret == 0);
649   CPPUNIT_ASSERT_MESSAGE("Schema: foreach1.xml", p->getEffectiveState() == YACS::DONE);
650   ret = driverTest(p, "samples/foreach2.xml");
651   CPPUNIT_ASSERT_MESSAGE("Schema: foreach2.xml", ret == 0);
652   CPPUNIT_ASSERT_MESSAGE("Schema: foreach2.xml", p->getEffectiveState() == YACS::DONE );
653   ret = driverTest(p, "samples/foreach3.xml");
654   CPPUNIT_ASSERT_MESSAGE("Schema: foreach3.xml", ret == 1);
655   ret = driverTest(p, "samples/foreach4.xml");
656   CPPUNIT_ASSERT_MESSAGE("Schema: foreach4.xml", ret == 0);
657   CPPUNIT_ASSERT_MESSAGE("Schema: foreach4.xml", p->getEffectiveState() == YACS::DONE );
658   ret = driverTest(p, "samples/foreach5.xml");
659   CPPUNIT_ASSERT_MESSAGE("Schema: foreach5.xml", ret == 0);
660   CPPUNIT_ASSERT_MESSAGE("Schema: foreach5.xml", p->getEffectiveState() == YACS::DONE );
661   ret = driverTest(p, "samples/foreach6.xml");
662   CPPUNIT_ASSERT_MESSAGE("Schema: foreach6.xml", ret == 0);
663   CPPUNIT_ASSERT_MESSAGE("Schema: foreach6.xml", p->getEffectiveState() == YACS::DONE );
664   ret = driverTest(p, "samples/foreach8.xml");
665   CPPUNIT_ASSERT_MESSAGE("Schema: foreach8.xml", ret == 0);
666   CPPUNIT_ASSERT_MESSAGE("Schema: foreach8.xml", p->getEffectiveState() == YACS::DONE );
667   if(getenv("GEOM_ROOT_DIR"))
668     {
669       std::string geomdir(getenv("GEOM_ROOT_DIR"));
670       geomdir=geomdir+"/share/salome/resources/geom";
671       if(access(geomdir.c_str(),F_OK) == 0)
672         {
673           ret = driverTest(p, "samples/foreach7.xml"); //needs GEOM_Superv component
674           CPPUNIT_ASSERT_MESSAGE("Schema: foreach7.xml", ret == 0);
675           CPPUNIT_ASSERT_MESSAGE("Schema: foreach7.xml", p->getEffectiveState() == YACS::DONE );
676         }
677     }
678 }
679
680 void YacsLoaderTest::sinlines()
681 {
682   Proc *p = 0;
683   int ret;
684   ret = driverTest(p, "samples/sinline1.xml");
685   CPPUNIT_ASSERT(ret == 0);
686   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
687   ret = driverTest(p, "samples/sinline2.xml");
688   CPPUNIT_ASSERT(ret == 0);
689   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
690   ret = driverTest(p, "samples/sinline3.xml");
691   CPPUNIT_ASSERT(ret == 0);
692   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
693   ret = driverTest(p, "samples/sinline4.xml");
694   CPPUNIT_ASSERT(ret == 0);
695   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
696   ret = driverTest(p, "samples/sinline5.xml");
697   CPPUNIT_ASSERT(ret == 0);
698   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
699 }
700
701 void YacsLoaderTest::bools()
702 {
703   Proc *p = 0;
704   int ret;
705   ret = driverTest(p, "samples/bool1.xml");
706   CPPUNIT_ASSERT(ret == 0);
707   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
708 }
709 void YacsLoaderTest::integers()
710 {
711   Proc *p = 0;
712   int ret;
713   ret = driverTest(p, "samples/integer1.xml");
714   CPPUNIT_ASSERT(ret == 0);
715   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
716 }
717 void YacsLoaderTest::doubles()
718 {
719   Proc *p = 0;
720   int ret;
721   ret = driverTest(p, "samples/double1.xml");
722   CPPUNIT_ASSERT(ret == 0);
723   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
724 }
725 void YacsLoaderTest::strings()
726 {
727   Proc *p = 0;
728   int ret;
729   ret = driverTest(p, "samples/string1.xml");
730   CPPUNIT_ASSERT(ret == 0);
731   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
732 }
733 void YacsLoaderTest::objrefs()
734 {
735   Proc *p = 0;
736   int ret;
737   ret = driverTest(p, "samples/objref1.xml");
738   CPPUNIT_ASSERT(ret == 0);
739   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
740 }
741 void YacsLoaderTest::structs()
742 {
743   Proc *p = 0;
744   int ret;
745   ret = driverTest(p, "samples/struct1.xml");
746   CPPUNIT_ASSERT(ret == 0);
747   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
748   delete p;
749
750   ret = driverTest(p, "samples/struct2.xml");
751   CPPUNIT_ASSERT(ret == 0);
752   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
753   delete p;
754 }
755
756 void YacsLoaderTest::cpps()
757 {
758   Proc *p = 0;
759   int ret;
760   ret = driverTest(p, "samples/cpp1.xml");
761   CPPUNIT_ASSERT(ret == 0);
762   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
763   delete p;
764 }
765
766 void YacsLoaderTest::datanodes()
767 {
768   Proc *p = 0;
769   int ret;
770   ret = driverTest(p, "samples/datanode0.xml");
771   CPPUNIT_ASSERT(ret == 0);
772   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
773   delete p;
774 }
775
776 void YacsLoaderTest::optimizers()
777 {
778   Proc *p = 0;
779   int ret;
780   ret = driverTest(p, "samples/optimizer1.xml");
781   CPPUNIT_ASSERT(ret == 0);
782   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
783   delete p;
784
785   ret = driverTest(p, "samples/optimizer2.xml");
786   CPPUNIT_ASSERT(ret == 0);
787   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
788   delete p;
789
790   ret = driverTest(p, "samples/optimizer_sync_cpp.xml");
791   CPPUNIT_ASSERT(ret == 0);
792   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
793   delete p;
794
795   ret = driverTest(p, "samples/optimizer_async_cpp.xml");
796   CPPUNIT_ASSERT(ret == 0);
797   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
798   delete p;
799
800   ret = driverTest(p, "samples/optimizer_sync_py.xml");
801   CPPUNIT_ASSERT(ret == 0);
802   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
803   delete p;
804
805   ret = driverTest(p, "samples/optimizer_async_py.xml");
806   CPPUNIT_ASSERT(ret == 0);
807   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
808   delete p;
809 }
810
811 void YacsLoaderTest::pyremotes()
812 {
813   Proc *p = 0;
814   int ret;
815   ret = driverTest(p, "samples/pyremote1.xml");
816   CPPUNIT_ASSERT(ret == 0);
817   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
818   ret = driverTest(p, "samples/pyremote2.xml");
819   CPPUNIT_ASSERT(ret == 0);
820   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
821   ret = driverTest(p, "samples/pyremote3.xml");
822   CPPUNIT_ASSERT(ret == 0);
823   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
824   ret = driverTest(p, "samples/pyremote4.xml");
825   CPPUNIT_ASSERT(ret == 0);
826   CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
827 }