1 // Copyright (C) 2006-2023 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "yacsconfig.h"
21 #include "RuntimeSALOME.hxx"
22 #include "PythonPorts.hxx"
23 #include "CORBAPorts.hxx"
24 #include "YacsLoaderTest.hxx"
25 #include "parsers.hxx"
27 #include "Exception.hxx"
28 #include "Executor.hxx"
29 #include "parsers.hxx"
37 #define access _access
43 #include "YacsTrace.hxx"
45 using namespace YACS::ENGINE;
49 int driverTest(Proc* &p, const char* schema)
51 DEBTRACE("+++++++++++++++++++ BEGIN test " << schema);
52 RuntimeSALOME::setRuntime();
58 p=loader.load(schema);
60 std::cerr << __FILE__ << std::endl;
61 DEBTRACE("Proc *p = " << p);
62 std::ofstream f("toto");
65 DEBTRACE("+++++++++++++++++++ BEGIN execution " << schema);
66 std::cerr << __FILE__ << std::endl;
68 std::cerr << __FILE__ << std::endl;
70 DEBTRACE("+++++++++++++++++++ END execution " << schema);
71 std::ofstream g("titi");
74 DEBTRACE("+++++++++++++++++++ END test " << schema);
77 catch (YACS::Exception& e)
79 DEBTRACE("YACS exception caught: ");
80 std::cerr << __FILE__ << std::endl;
82 std::cerr << __FILE__ << std::endl;
84 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
87 catch (const std::ios_base::failure&)
89 std::cerr << __FILE__ << std::endl;
91 DEBTRACE("io failure");
92 std::cerr << __FILE__ << std::endl;
94 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
97 catch(CORBA::SystemException& ex)
99 DEBTRACE("Caught a CORBA::SystemException.");
102 CORBA::TypeCode_var tc = tmp.type();
103 const char *p = tc->name();
106 std::cerr << __FILE__ << std::endl;
112 std::cerr << __FILE__ << std::endl;
115 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
118 catch(omniORB::fatalException& fe)
120 DEBTRACE("Caught omniORB::fatalException:" );
121 DEBTRACE(" file: " << fe.file());
122 DEBTRACE(" line: " << fe.line());
123 DEBTRACE(" mesg: " << fe.errmsg());
124 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
129 DEBTRACE("Caught unknown exception.");
130 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
135 void YacsLoaderTest::setUp()
139 void YacsLoaderTest::tearDown()
143 void YacsLoaderTest::aschema()
146 int ret = driverTest(p, "samples/aschema.xml");
147 CPPUNIT_ASSERT(ret == 0);
148 CPPUNIT_ASSERT(p != 0);
151 CORBA::Double dval = 0;
152 char *text = (char*)"";
153 CPPUNIT_ASSERT(p->nodeMap["c0.c1.n1"]);
154 *((OutputCorbaPort*)p->nodeMap["c0.c1.n1"]->getOutputPort("p1"))->getAny() >>= dval;
155 PyObject *data = ((OutputPyPort*)p->nodeMap["node32"]->getOutputPort("p1"))->get();
156 double val = PyFloat_AsDouble(data);
157 CPPUNIT_ASSERT_DOUBLES_EQUAL(22., dval, 1.E-12);
158 CPPUNIT_ASSERT_DOUBLES_EQUAL(20., val, 1.E-12);
163 void YacsLoaderTest::bschema()
166 int ret = driverTest(p, "samples/bschema.xml");
167 CPPUNIT_ASSERT(ret == 0);
168 DEBTRACE("Proc *p = " << p);
169 CPPUNIT_ASSERT(p != 0);
172 CORBA::Double dval = 0;
173 const char *text = "";
174 *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= dval;
175 *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
176 CPPUNIT_ASSERT_DOUBLES_EQUAL(24., dval, 1.E-12);
177 CPPUNIT_ASSERT_EQUAL(string("coucou"), string(text));
182 void YacsLoaderTest::cschema()
185 int ret = driverTest(p, "samples/cschema.xml");
186 CPPUNIT_ASSERT(ret == 0);
187 DEBTRACE("Proc *p = " << p);
188 CPPUNIT_ASSERT(p != 0);
192 if(getenv("PYHELLO_ROOT_DIR"))
194 std::string hellodir(getenv("PYHELLO_ROOT_DIR"));
195 hellodir=hellodir+"/share/salome/resources/pyhello";
196 if(access(hellodir.c_str(),F_OK) == 0)
198 CORBA::Double dval = 0;
199 const char *text = "";
200 *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
201 CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
203 *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
204 CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
212 void YacsLoaderTest::dschema()
215 int ret = driverTest(p, "samples/dschema.xml");
216 CPPUNIT_ASSERT(ret == 0);
217 DEBTRACE("Proc *p = " << p);
218 CPPUNIT_ASSERT(p != 0);
222 if(getenv("PYHELLO_ROOT_DIR"))
224 std::string hellodir(getenv("PYHELLO_ROOT_DIR"));
225 hellodir=hellodir+"/share/salome/resources/pyhello";
226 if(access(hellodir.c_str(),F_OK) == 0)
228 CORBA::Double dval = 0;
229 const char *text = "";
230 *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
231 CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
233 *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
234 CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
236 *((OutputCorbaPort*)p->nodeMap["node3"]->getOutputPort("p1"))->getAny() >>= text;
237 CPPUNIT_ASSERT_EQUAL( string("Hello Hello coucou!!"), string(text));
245 void YacsLoaderTest::eschema()
248 int ret = driverTest(p, "samples/eschema.xml");
249 CPPUNIT_ASSERT(ret == 0);
250 DEBTRACE("Proc *p = " << p);
251 CPPUNIT_ASSERT(p != 0);
254 PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
255 const char *text = PyUnicode_AsUTF8(data);
256 CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text));
261 void YacsLoaderTest::fschema()
264 int ret = driverTest(p, "samples/fschema.xml");
265 CPPUNIT_ASSERT(ret == 0);
266 DEBTRACE("Proc *p = " << p);
267 CPPUNIT_ASSERT(p != 0);
270 PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
271 const char *text = PyUnicode_AsUTF8(data);
272 CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text) );
277 void YacsLoaderTest::oschema()
280 int ret = driverTest(p, "samples/oschema.xml");
281 CPPUNIT_ASSERT(ret == 1);
284 void YacsLoaderTest::pschema()
287 int ret = driverTest(p, "samples/pschema.xml");
288 CPPUNIT_ASSERT(ret == 0);
289 DEBTRACE("Proc *p = " << p);
290 CPPUNIT_ASSERT(p != 0);
294 CORBA::Double dval = 0;
295 *((OutputCorbaPort*)p->nodeMap["node61"]->getOutputPort("p1"))->getAny() >>= dval;
296 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
299 CORBA::Double dval = 0;
300 *((OutputCorbaPort*)p->nodeMap["node62"]->getOutputPort("p1"))->getAny() >>= dval;
301 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
304 CORBA::Double dval = 0;
305 *((OutputCorbaPort*)p->nodeMap["node63"]->getOutputPort("p1"))->getAny() >>= dval;
306 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
312 void YacsLoaderTest::schema()
315 int ret = driverTest(p, "samples/schema.xml");
316 CPPUNIT_ASSERT(ret == 1);
319 void YacsLoaderTest::schema2()
322 int ret = driverTest(p, "samples/schema2.xml");
323 CPPUNIT_ASSERT(ret == 0);
324 DEBTRACE("Proc *p = " << p);
325 CPPUNIT_ASSERT(p != 0);
329 CORBA::Double dval = 0;
330 *((OutputCorbaPort*)p->nodeMap["node61"]->getOutputPort("p1"))->getAny() >>= dval;
331 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
334 CORBA::Double dval = 0;
335 *((OutputCorbaPort*)p->nodeMap["node62"]->getOutputPort("p1"))->getAny() >>= dval;
336 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
339 CORBA::Double dval = 0;
340 *((OutputCorbaPort*)p->nodeMap["node63"]->getOutputPort("p1"))->getAny() >>= dval;
341 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
347 catch (YACS::Exception& e)
349 DEBTRACE("YACS exception caught: ");
352 catch (const std::ios_base::failure&)
354 DEBTRACE("io failure");
356 catch(CORBA::SystemException& ex)
358 DEBTRACE("Caught a CORBA::SystemException.");
361 CORBA::TypeCode_var tc = tmp.type();
362 const char *p = tc->name();
372 catch(omniORB::fatalException& fe)
374 DEBTRACE("Caught omniORB::fatalException:" );
375 DEBTRACE(" file: " << fe.file());
376 DEBTRACE(" line: " << fe.line());
377 DEBTRACE(" mesg: " << fe.errmsg());
381 DEBTRACE("unknown exception");
386 void YacsLoaderTest::forloop1()
389 int ret = driverTest(p, "samples/forloop1.xml");
390 CPPUNIT_ASSERT(ret == 0);
391 DEBTRACE("Proc *p = " << p);
392 CPPUNIT_ASSERT(p != 0);
395 PyObject *data = ((OutputPyPort*)p->nodeMap["b1.node2"]->getOutputPort("p1"))->get();
396 double val = PyFloat_AsDouble(data);;
397 CPPUNIT_ASSERT_DOUBLES_EQUAL(33., val, 1.E-12);
402 void YacsLoaderTest::forloop2()
405 int ret = driverTest(p, "samples/forloop2.xml");
406 CPPUNIT_ASSERT(ret == 0);
409 /////////////////////////////
411 void YacsLoaderTest::forloop3()
414 int ret = driverTest(p, "samples/forloop3.xml");
415 CPPUNIT_ASSERT(ret == 0);
416 DEBTRACE("Proc *p = " << p);
417 CPPUNIT_ASSERT(p != 0);
424 void YacsLoaderTest::forloop4()
427 int ret = driverTest(p, "samples/forloop4.xml");
428 CPPUNIT_ASSERT(ret == 0);
429 DEBTRACE("Proc *p = " << p);
430 CPPUNIT_ASSERT(p != 0);
437 void YacsLoaderTest::forloop5()
440 int ret = driverTest(p, "samples/forloop5.xml");
441 CPPUNIT_ASSERT(ret == 0);
442 DEBTRACE("Proc *p = " << p);
443 CPPUNIT_ASSERT(p != 0);
450 void YacsLoaderTest::forloop6()
453 int ret = driverTest(p, "samples/forloop6.xml");
454 CPPUNIT_ASSERT(ret == 0);
455 DEBTRACE("Proc *p = " << p);
456 CPPUNIT_ASSERT(p != 0);
464 void YacsLoaderTest::forloop7()
467 int ret = driverTest(p, "samples/forloop7.xml");
468 CPPUNIT_ASSERT(ret == 0);
469 DEBTRACE("Proc *p = " << p);
470 CPPUNIT_ASSERT(p != 0);
477 void YacsLoaderTest::switch1()
480 int ret = driverTest(p, "samples/switch1.xml");
481 CPPUNIT_ASSERT(ret == 0);
482 DEBTRACE("Proc *p = " << p);
483 CPPUNIT_ASSERT(p != 0);
490 void YacsLoaderTest::switch2()
493 int ret = driverTest(p, "samples/switch2.xml");
494 CPPUNIT_ASSERT(ret == 0);
495 DEBTRACE("Proc *p = " << p);
496 CPPUNIT_ASSERT(p != 0);
503 void YacsLoaderTest::switch3()
506 int ret = driverTest(p, "samples/switch3.xml");
507 CPPUNIT_ASSERT(ret == 0);
508 DEBTRACE("Proc *p = " << p);
509 CPPUNIT_ASSERT(p != 0);
516 void YacsLoaderTest::switch4()
519 int ret = driverTest(p, "samples/switch4.xml");
520 CPPUNIT_ASSERT(ret == 0);
521 DEBTRACE("Proc *p = " << p);
522 CPPUNIT_ASSERT(p != 0);
529 void YacsLoaderTest::switch5()
532 int ret = driverTest(p, "samples/switch5.xml");
533 CPPUNIT_ASSERT(ret == 0);
534 DEBTRACE("Proc *p = " << p);
535 CPPUNIT_ASSERT(p != 0);
542 void YacsLoaderTest::switch6()
545 int ret = driverTest(p, "samples/switch6.xml");
546 CPPUNIT_ASSERT(ret == 0);
547 DEBTRACE("Proc *p = " << p);
548 CPPUNIT_ASSERT(p != 0);
555 void YacsLoaderTest::switch7()
558 int ret = driverTest(p, "samples/switch7.xml");
559 CPPUNIT_ASSERT(ret == 0);
560 DEBTRACE("Proc *p = " << p);
561 CPPUNIT_ASSERT(p != 0);
568 void YacsLoaderTest::switch8()
571 int ret = driverTest(p, "samples/switch8.xml");
572 CPPUNIT_ASSERT(ret == 0);
573 DEBTRACE("Proc *p = " << p);
574 CPPUNIT_ASSERT(p != 0);
581 void YacsLoaderTest::switch9()
584 int ret = driverTest(p, "samples/switch9.xml");
585 CPPUNIT_ASSERT(ret == 0);
586 DEBTRACE("Proc *p = " << p);
587 CPPUNIT_ASSERT(p != 0);
594 void YacsLoaderTest::whiles()
597 int ret = driverTest(p, "samples/while1.xml");
598 CPPUNIT_ASSERT(ret == 0);
599 DEBTRACE("Proc *p = " << p);
600 CPPUNIT_ASSERT(p != 0);
605 ret = driverTest(p, "samples/while2.xml");
606 CPPUNIT_ASSERT(ret == 0);
607 ret = driverTest(p, "samples/while3.xml");
608 CPPUNIT_ASSERT(ret == 0);
611 void YacsLoaderTest::forwhile1()
614 int ret = driverTest(p, "samples/forwhile1.xml");
615 CPPUNIT_ASSERT(ret == 0);
616 DEBTRACE("Proc *p = " << p);
617 CPPUNIT_ASSERT(p != 0);
624 void YacsLoaderTest::blocs()
628 ret = driverTest(p, "samples/bloc1.xml");
629 CPPUNIT_ASSERT(ret == 0);
630 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
631 ret = driverTest(p, "samples/bloc2.xml");
632 CPPUNIT_ASSERT(ret == 0);
633 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
634 ret = driverTest(p, "samples/bloc3.xml");
635 CPPUNIT_ASSERT(ret == 0);
636 CPPUNIT_ASSERT(p->getEffectiveState() != YACS::DONE );
637 ret = driverTest(p, "samples/bloc4.xml");
638 CPPUNIT_ASSERT(ret == 0);
639 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
642 void YacsLoaderTest::refcnt()
647 ret = driverTest(p, "samples/refcnt1.xml");
648 CPPUNIT_ASSERT(ret == 0);
649 data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
650 CPPUNIT_ASSERT(data->ob_refcnt==13);
651 ret = driverTest(p, "samples/refcnt2.xml");
652 CPPUNIT_ASSERT(ret == 0);
653 data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
654 CPPUNIT_ASSERT(data->ob_refcnt==19);
657 void YacsLoaderTest::foreachs()
661 ret = driverTest(p, "samples/foreach1.xml");
662 CPPUNIT_ASSERT_MESSAGE("Schema: foreach1.xml", ret == 0);
663 CPPUNIT_ASSERT_MESSAGE("Schema: foreach1.xml", p->getEffectiveState() == YACS::DONE);
665 ret = driverTest(p, "samples/foreach2.xml");
666 CPPUNIT_ASSERT_MESSAGE("Schema: foreach2.xml", ret == 0);
667 CPPUNIT_ASSERT_MESSAGE("Schema: foreach2.xml", p->getEffectiveState() == YACS::DONE );
669 ret = driverTest(p, "samples/foreach3.xml");
670 CPPUNIT_ASSERT_MESSAGE("Schema: foreach3.xml", ret == 1);
672 ret = driverTest(p, "samples/foreach4.xml");
673 CPPUNIT_ASSERT_MESSAGE("Schema: foreach4.xml", ret == 0);
674 CPPUNIT_ASSERT_MESSAGE("Schema: foreach4.xml", p->getEffectiveState() == YACS::DONE );
676 ret = driverTest(p, "samples/foreach5.xml");
677 CPPUNIT_ASSERT_MESSAGE("Schema: foreach5.xml", ret == 0);
678 CPPUNIT_ASSERT_MESSAGE("Schema: foreach5.xml", p->getEffectiveState() == YACS::DONE );
680 ret = driverTest(p, "samples/foreach6.xml");
681 CPPUNIT_ASSERT_MESSAGE("Schema: foreach6.xml", ret == 0);
682 CPPUNIT_ASSERT_MESSAGE("Schema: foreach6.xml", p->getEffectiveState() == YACS::DONE );
684 ret = driverTest(p, "samples/foreach8.xml");
685 CPPUNIT_ASSERT_MESSAGE("Schema: foreach8.xml", ret == 0);
686 CPPUNIT_ASSERT_MESSAGE("Schema: foreach8.xml", p->getEffectiveState() == YACS::DONE );
688 ret = driverTest(p, "samples/foreach_init2fin.xml");
689 CPPUNIT_ASSERT_MESSAGE("Schema: foreach_init2fin.xml", ret == 0);
690 CPPUNIT_ASSERT_MESSAGE("Schema: foreach_init2fin.xml", p->getEffectiveState() == YACS::DONE );
692 ret = driverTest(p, "samples/foreach_init2work.xml");
693 CPPUNIT_ASSERT_MESSAGE("Schema: foreach_init2work.xml", ret == 0);
694 CPPUNIT_ASSERT_MESSAGE("Schema: foreach_init2work.xml", p->getEffectiveState() == YACS::DONE );
695 CPPUNIT_ASSERT_EQUAL(p->getOutputPort("PostProc.r")->getAsString(), std::string("108"));
697 if(getenv("GEOM_ROOT_DIR"))
699 std::string geomdir(getenv("GEOM_ROOT_DIR"));
700 geomdir=geomdir+"/share/salome/resources/geom";
701 if(access(geomdir.c_str(),F_OK) == 0)
703 ret = driverTest(p, "samples/foreach7.xml"); //needs GEOM_Superv component
704 CPPUNIT_ASSERT_MESSAGE("Schema: foreach7.xml", ret == 0);
705 CPPUNIT_ASSERT_MESSAGE("Schema: foreach7.xml", p->getEffectiveState() == YACS::DONE );
711 void YacsLoaderTest::sinlines()
715 ret = driverTest(p, "samples/sinline1.xml");
716 CPPUNIT_ASSERT(ret == 0);
717 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
718 ret = driverTest(p, "samples/sinline2.xml");
719 CPPUNIT_ASSERT(ret == 0);
720 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
721 ret = driverTest(p, "samples/sinline3.xml");
722 CPPUNIT_ASSERT(ret == 0);
723 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
724 ret = driverTest(p, "samples/sinline4.xml");
725 CPPUNIT_ASSERT(ret == 0);
726 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
727 ret = driverTest(p, "samples/sinline5.xml");
728 CPPUNIT_ASSERT(ret == 0);
729 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
732 void YacsLoaderTest::bools()
736 ret = driverTest(p, "samples/bool1.xml");
737 CPPUNIT_ASSERT(ret == 0);
738 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
740 void YacsLoaderTest::integers()
744 ret = driverTest(p, "samples/integer1.xml");
745 CPPUNIT_ASSERT(ret == 0);
746 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
748 void YacsLoaderTest::doubles()
752 ret = driverTest(p, "samples/double1.xml");
753 CPPUNIT_ASSERT(ret == 0);
754 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
756 void YacsLoaderTest::strings()
760 ret = driverTest(p, "samples/string1.xml");
761 CPPUNIT_ASSERT(ret == 0);
762 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
764 void YacsLoaderTest::objrefs()
768 ret = driverTest(p, "samples/objref1.xml");
769 CPPUNIT_ASSERT(ret == 0);
770 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
772 void YacsLoaderTest::structs()
776 ret = driverTest(p, "samples/struct1.xml");
777 CPPUNIT_ASSERT(ret == 0);
778 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
781 ret = driverTest(p, "samples/struct2.xml");
782 CPPUNIT_ASSERT(ret == 0);
783 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
787 void YacsLoaderTest::cpps()
791 ret = driverTest(p, "samples/cpp1.xml");
792 CPPUNIT_ASSERT(ret == 0);
793 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
797 void YacsLoaderTest::datanodes()
801 ret = driverTest(p, "samples/datanode0.xml");
802 CPPUNIT_ASSERT(ret == 0);
803 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
807 void YacsLoaderTest::optimizers()
811 ret = driverTest(p, "samples/optimizer1.xml");
812 CPPUNIT_ASSERT(ret == 0);
813 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
816 ret = driverTest(p, "samples/optimizer2.xml");
817 CPPUNIT_ASSERT(ret == 0);
818 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
821 ret = driverTest(p, "samples/optimizer_sync_cpp.xml");
822 CPPUNIT_ASSERT(ret == 0);
823 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
826 ret = driverTest(p, "samples/optimizer_async_cpp.xml");
827 CPPUNIT_ASSERT(ret == 0);
828 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
831 ret = driverTest(p, "samples/optimizer_sync_py.xml");
832 CPPUNIT_ASSERT(ret == 0);
833 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
836 ret = driverTest(p, "samples/optimizer_async_py.xml");
837 CPPUNIT_ASSERT(ret == 0);
838 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
841 ret = driverTest(p, "samples/optimizer_retro.xml");
842 CPPUNIT_ASSERT(ret == 0);
843 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
846 ret = driverTest(p, "samples/double_optimizer_py.xml");
847 CPPUNIT_ASSERT(ret == 0);
848 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
851 ret = driverTest(p, "samples/optimizer_pyobj.xml");
852 CPPUNIT_ASSERT(ret == 0);
853 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
858 void YacsLoaderTest::pyremotes()
862 ret = driverTest(p, "samples/pyremote1.xml");
863 CPPUNIT_ASSERT(ret == 0);
864 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
865 ret = driverTest(p, "samples/pyremote2.xml");
866 CPPUNIT_ASSERT(ret == 0);
867 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
868 ret = driverTest(p, "samples/pyremote3.xml");
869 CPPUNIT_ASSERT(ret == 0);
870 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
871 ret = driverTest(p, "samples/pyremote4.xml");
872 CPPUNIT_ASSERT(ret == 0);
873 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
876 void YacsLoaderTest::nonepyobj()
880 ret = driverTest(p, "samples/nonepyobj.xml");
881 CPPUNIT_ASSERT(ret == 0);
882 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
883 CPPUNIT_ASSERT_EQUAL(p->getOutputPort("n2.r")->getAsString(), std::string("True"));