1 // Copyright (C) 2006-2024 CEA, EDF
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");
75 DEBTRACE("+++++++++++++++++++ END test " << schema);
78 catch (YACS::Exception& e)
80 DEBTRACE("YACS exception caught: ");
81 std::cerr << __FILE__ << std::endl;
83 std::cerr << __FILE__ << std::endl;
85 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
88 catch (const std::ios_base::failure&)
90 std::cerr << __FILE__ << std::endl;
92 DEBTRACE("io failure");
93 std::cerr << __FILE__ << std::endl;
95 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
98 catch(CORBA::SystemException& ex)
100 DEBTRACE("Caught a CORBA::SystemException.");
103 CORBA::TypeCode_var tc = tmp.type();
104 const char *p = tc->name();
107 std::cerr << __FILE__ << std::endl;
113 std::cerr << __FILE__ << std::endl;
116 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
119 catch(omniORB::fatalException& fe)
121 DEBTRACE("Caught omniORB::fatalException:" );
122 DEBTRACE(" file: " << fe.file());
123 DEBTRACE(" line: " << fe.line());
124 DEBTRACE(" mesg: " << fe.errmsg());
125 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
130 DEBTRACE("Caught unknown exception.");
131 DEBTRACE("+++++++++++++++++++ END test in error " << schema);
136 void YacsLoaderTest::setUp()
140 void YacsLoaderTest::tearDown()
144 void YacsLoaderTest::aschema()
147 int ret = driverTest(p, "samples/aschema.xml");
148 CPPUNIT_ASSERT(ret == 0);
149 CPPUNIT_ASSERT(p != 0);
152 CORBA::Double dval = 0;
153 char *text = (char*)"";
154 CPPUNIT_ASSERT(p->nodeMap["c0.c1.n1"]);
155 *((OutputCorbaPort*)p->nodeMap["c0.c1.n1"]->getOutputPort("p1"))->getAny() >>= dval;
156 PyObject *data = ((OutputPyPort*)p->nodeMap["node32"]->getOutputPort("p1"))->get();
157 double val = PyFloat_AsDouble(data);
158 CPPUNIT_ASSERT_DOUBLES_EQUAL(22., dval, 1.E-12);
159 CPPUNIT_ASSERT_DOUBLES_EQUAL(20., val, 1.E-12);
164 void YacsLoaderTest::bschema()
167 int ret = driverTest(p, "samples/bschema.xml");
168 CPPUNIT_ASSERT(ret == 0);
169 DEBTRACE("Proc *p = " << p);
170 CPPUNIT_ASSERT(p != 0);
173 CORBA::Double dval = 0;
174 const char *text = "";
175 *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= dval;
176 *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
177 CPPUNIT_ASSERT_DOUBLES_EQUAL(24., dval, 1.E-12);
178 CPPUNIT_ASSERT_EQUAL(string("coucou"), string(text));
183 void YacsLoaderTest::cschema()
186 int ret = driverTest(p, "samples/cschema.xml");
187 CPPUNIT_ASSERT(ret == 0);
188 DEBTRACE("Proc *p = " << p);
189 CPPUNIT_ASSERT(p != 0);
193 if(getenv("PYHELLO_ROOT_DIR"))
195 std::string hellodir(getenv("PYHELLO_ROOT_DIR"));
196 hellodir=hellodir+"/share/salome/resources/pyhello";
197 if(access(hellodir.c_str(),F_OK) == 0)
199 CORBA::Double dval = 0;
200 const char *text = "";
201 *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
202 CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
204 *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
205 CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
214 void YacsLoaderTest::dschema()
217 int ret = driverTest(p, "samples/dschema.xml");
218 CPPUNIT_ASSERT(ret == 0);
219 DEBTRACE("Proc *p = " << p);
220 CPPUNIT_ASSERT(p != 0);
224 if(getenv("PYHELLO_ROOT_DIR"))
226 std::string hellodir(getenv("PYHELLO_ROOT_DIR"));
227 hellodir=hellodir+"/share/salome/resources/pyhello";
228 if(access(hellodir.c_str(),F_OK) == 0)
230 CORBA::Double dval = 0;
231 const char *text = "";
232 *((OutputCorbaPort*)p->nodeMap["node1"]->getOutputPort("p1"))->getAny() >>= text;
233 CPPUNIT_ASSERT_EQUAL(string("Hello coucou!"), string(text) );
235 *((OutputCorbaPort*)p->nodeMap["node2"]->getOutputPort("p1"))->getAny() >>= text;
236 CPPUNIT_ASSERT_EQUAL(string("Hello Hello coucou!!"), string(text) );
238 *((OutputCorbaPort*)p->nodeMap["node3"]->getOutputPort("p1"))->getAny() >>= text;
239 CPPUNIT_ASSERT_EQUAL( string("Hello Hello coucou!!"), string(text));
248 void YacsLoaderTest::eschema()
251 int ret = driverTest(p, "samples/eschema.xml");
252 CPPUNIT_ASSERT(ret == 0);
253 DEBTRACE("Proc *p = " << p);
254 CPPUNIT_ASSERT(p != 0);
257 PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
258 const char *text = PyUnicode_AsUTF8(data);
259 CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text));
264 void YacsLoaderTest::fschema()
267 int ret = driverTest(p, "samples/fschema.xml");
268 CPPUNIT_ASSERT(ret == 0);
269 DEBTRACE("Proc *p = " << p);
270 CPPUNIT_ASSERT(p != 0);
273 PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
274 const char *text = PyUnicode_AsUTF8(data);
275 CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text) );
280 void YacsLoaderTest::oschema()
283 int ret = driverTest(p, "samples/oschema.xml");
284 CPPUNIT_ASSERT(ret == 1);
287 void YacsLoaderTest::pschema()
290 int ret = driverTest(p, "samples/pschema.xml");
291 CPPUNIT_ASSERT(ret == 0);
292 DEBTRACE("Proc *p = " << p);
293 CPPUNIT_ASSERT(p != 0);
297 CORBA::Double dval = 0;
298 *((OutputCorbaPort*)p->nodeMap["node61"]->getOutputPort("p1"))->getAny() >>= dval;
299 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
302 CORBA::Double dval = 0;
303 *((OutputCorbaPort*)p->nodeMap["node62"]->getOutputPort("p1"))->getAny() >>= dval;
304 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
307 CORBA::Double dval = 0;
308 *((OutputCorbaPort*)p->nodeMap["node63"]->getOutputPort("p1"))->getAny() >>= dval;
309 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
315 void YacsLoaderTest::schema()
318 int ret = driverTest(p, "samples/schema.xml");
319 CPPUNIT_ASSERT(ret == 1);
322 void YacsLoaderTest::schema2()
325 int ret = driverTest(p, "samples/schema2.xml");
326 CPPUNIT_ASSERT(ret == 0);
327 DEBTRACE("Proc *p = " << p);
328 CPPUNIT_ASSERT(p != 0);
332 CORBA::Double dval = 0;
333 *((OutputCorbaPort*)p->nodeMap["node61"]->getOutputPort("p1"))->getAny() >>= dval;
334 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
337 CORBA::Double dval = 0;
338 *((OutputCorbaPort*)p->nodeMap["node62"]->getOutputPort("p1"))->getAny() >>= dval;
339 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
342 CORBA::Double dval = 0;
343 *((OutputCorbaPort*)p->nodeMap["node63"]->getOutputPort("p1"))->getAny() >>= dval;
344 CPPUNIT_ASSERT_DOUBLES_EQUAL(25., dval, 1.E-12);
350 catch (YACS::Exception& e)
352 DEBTRACE("YACS exception caught: ");
355 catch (const std::ios_base::failure&)
357 DEBTRACE("io failure");
359 catch(CORBA::SystemException& ex)
361 DEBTRACE("Caught a CORBA::SystemException.");
364 CORBA::TypeCode_var tc = tmp.type();
365 const char *p = tc->name();
375 catch(omniORB::fatalException& fe)
377 DEBTRACE("Caught omniORB::fatalException:" );
378 DEBTRACE(" file: " << fe.file());
379 DEBTRACE(" line: " << fe.line());
380 DEBTRACE(" mesg: " << fe.errmsg());
384 DEBTRACE("unknown exception");
389 void YacsLoaderTest::forloop1()
392 int ret = driverTest(p, "samples/forloop1.xml");
393 CPPUNIT_ASSERT(ret == 0);
394 DEBTRACE("Proc *p = " << p);
395 CPPUNIT_ASSERT(p != 0);
398 PyObject *data = ((OutputPyPort*)p->nodeMap["b1.node2"]->getOutputPort("p1"))->get();
399 double val = PyFloat_AsDouble(data);;
400 CPPUNIT_ASSERT_DOUBLES_EQUAL(33., val, 1.E-12);
405 void YacsLoaderTest::forloop2()
408 int ret = driverTest(p, "samples/forloop2.xml");
409 CPPUNIT_ASSERT(ret == 0);
412 /////////////////////////////
414 void YacsLoaderTest::forloop3()
417 int ret = driverTest(p, "samples/forloop3.xml");
418 CPPUNIT_ASSERT(ret == 0);
419 DEBTRACE("Proc *p = " << p);
420 CPPUNIT_ASSERT(p != 0);
427 void YacsLoaderTest::forloop4()
430 int ret = driverTest(p, "samples/forloop4.xml");
431 CPPUNIT_ASSERT(ret == 0);
432 DEBTRACE("Proc *p = " << p);
433 CPPUNIT_ASSERT(p != 0);
440 void YacsLoaderTest::forloop5()
443 int ret = driverTest(p, "samples/forloop5.xml");
444 CPPUNIT_ASSERT(ret == 0);
445 DEBTRACE("Proc *p = " << p);
446 CPPUNIT_ASSERT(p != 0);
453 void YacsLoaderTest::forloop6()
456 int ret = driverTest(p, "samples/forloop6.xml");
457 CPPUNIT_ASSERT(ret == 0);
458 DEBTRACE("Proc *p = " << p);
459 CPPUNIT_ASSERT(p != 0);
467 void YacsLoaderTest::forloop7()
470 int ret = driverTest(p, "samples/forloop7.xml");
471 CPPUNIT_ASSERT(ret == 0);
472 DEBTRACE("Proc *p = " << p);
473 CPPUNIT_ASSERT(p != 0);
480 void YacsLoaderTest::switch1()
483 int ret = driverTest(p, "samples/switch1.xml");
484 CPPUNIT_ASSERT(ret == 0);
485 DEBTRACE("Proc *p = " << p);
486 CPPUNIT_ASSERT(p != 0);
493 void YacsLoaderTest::switch2()
496 int ret = driverTest(p, "samples/switch2.xml");
497 CPPUNIT_ASSERT(ret == 0);
498 DEBTRACE("Proc *p = " << p);
499 CPPUNIT_ASSERT(p != 0);
506 void YacsLoaderTest::switch3()
509 int ret = driverTest(p, "samples/switch3.xml");
510 CPPUNIT_ASSERT(ret == 0);
511 DEBTRACE("Proc *p = " << p);
512 CPPUNIT_ASSERT(p != 0);
519 void YacsLoaderTest::switch4()
522 int ret = driverTest(p, "samples/switch4.xml");
523 CPPUNIT_ASSERT(ret == 0);
524 DEBTRACE("Proc *p = " << p);
525 CPPUNIT_ASSERT(p != 0);
532 void YacsLoaderTest::switch5()
535 int ret = driverTest(p, "samples/switch5.xml");
536 CPPUNIT_ASSERT(ret == 0);
537 DEBTRACE("Proc *p = " << p);
538 CPPUNIT_ASSERT(p != 0);
545 void YacsLoaderTest::switch6()
548 int ret = driverTest(p, "samples/switch6.xml");
549 CPPUNIT_ASSERT(ret == 0);
550 DEBTRACE("Proc *p = " << p);
551 CPPUNIT_ASSERT(p != 0);
558 void YacsLoaderTest::switch7()
561 int ret = driverTest(p, "samples/switch7.xml");
562 CPPUNIT_ASSERT(ret == 0);
563 DEBTRACE("Proc *p = " << p);
564 CPPUNIT_ASSERT(p != 0);
571 void YacsLoaderTest::switch8()
574 int ret = driverTest(p, "samples/switch8.xml");
575 CPPUNIT_ASSERT(ret == 0);
576 DEBTRACE("Proc *p = " << p);
577 CPPUNIT_ASSERT(p != 0);
584 void YacsLoaderTest::switch9()
587 int ret = driverTest(p, "samples/switch9.xml");
588 CPPUNIT_ASSERT(ret == 0);
589 DEBTRACE("Proc *p = " << p);
590 CPPUNIT_ASSERT(p != 0);
597 void YacsLoaderTest::whiles()
600 int ret = driverTest(p, "samples/while1.xml");
601 CPPUNIT_ASSERT(ret == 0);
602 DEBTRACE("Proc *p = " << p);
603 CPPUNIT_ASSERT(p != 0);
608 ret = driverTest(p, "samples/while2.xml");
609 CPPUNIT_ASSERT(ret == 0);
610 ret = driverTest(p, "samples/while3.xml");
611 CPPUNIT_ASSERT(ret == 0);
614 void YacsLoaderTest::forwhile1()
617 int ret = driverTest(p, "samples/forwhile1.xml");
618 CPPUNIT_ASSERT(ret == 0);
619 DEBTRACE("Proc *p = " << p);
620 CPPUNIT_ASSERT(p != 0);
627 void YacsLoaderTest::blocs()
631 ret = driverTest(p, "samples/bloc1.xml");
632 CPPUNIT_ASSERT(ret == 0);
633 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
634 ret = driverTest(p, "samples/bloc2.xml");
635 CPPUNIT_ASSERT(ret == 0);
636 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
637 ret = driverTest(p, "samples/bloc3.xml");
638 CPPUNIT_ASSERT(ret == 0);
639 CPPUNIT_ASSERT(p->getEffectiveState() != YACS::DONE );
640 ret = driverTest(p, "samples/bloc4.xml");
641 CPPUNIT_ASSERT(ret == 0);
642 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
645 void YacsLoaderTest::refcnt()
650 ret = driverTest(p, "samples/refcnt1.xml");
651 CPPUNIT_ASSERT(ret == 0);
652 data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
653 CPPUNIT_ASSERT(data->ob_refcnt==13);
654 ret = driverTest(p, "samples/refcnt2.xml");
655 CPPUNIT_ASSERT(ret == 0);
656 data = ((OutputPyPort*)p->nodeMap["b1.b.node1"]->getOutputPort("p1"))->get();
657 CPPUNIT_ASSERT(data->ob_refcnt == 13);
660 void YacsLoaderTest::foreachs()
664 ret = driverTest(p, "samples/foreach1.xml");
665 CPPUNIT_ASSERT_MESSAGE("Schema: foreach1.xml", ret == 0);
666 CPPUNIT_ASSERT_MESSAGE("Schema: foreach1.xml", p->getEffectiveState() == YACS::DONE);
668 ret = driverTest(p, "samples/foreach2.xml");
669 CPPUNIT_ASSERT_MESSAGE("Schema: foreach2.xml", ret == 0);
670 CPPUNIT_ASSERT_MESSAGE("Schema: foreach2.xml", p->getEffectiveState() == YACS::DONE );
672 ret = driverTest(p, "samples/foreach3.xml");
674 CPPUNIT_ASSERT_MESSAGE("Schema: foreach3.xml", ret == 1);
676 ret = driverTest(p, "samples/foreach4.xml");
677 CPPUNIT_ASSERT_MESSAGE("Schema: foreach4.xml", ret == 0);
678 CPPUNIT_ASSERT_MESSAGE("Schema: foreach4.xml", p->getEffectiveState() == YACS::DONE );
680 ret = driverTest(p, "samples/foreach5.xml");
681 CPPUNIT_ASSERT_MESSAGE("Schema: foreach5.xml", ret == 0);
682 CPPUNIT_ASSERT_MESSAGE("Schema: foreach5.xml", p->getEffectiveState() == YACS::DONE );
684 ret = driverTest(p, "samples/foreach6.xml");
685 CPPUNIT_ASSERT_MESSAGE("Schema: foreach6.xml", ret == 0);
686 CPPUNIT_ASSERT_MESSAGE("Schema: foreach6.xml", p->getEffectiveState() == YACS::DONE );
688 ret = driverTest(p, "samples/foreach8.xml");
689 CPPUNIT_ASSERT_MESSAGE("Schema: foreach8.xml", ret == 0);
690 CPPUNIT_ASSERT_MESSAGE("Schema: foreach8.xml", p->getEffectiveState() == YACS::DONE );
693 ret = driverTest(p, "samples/foreach_init2fin.xml");
694 CPPUNIT_ASSERT_MESSAGE("Schema: foreach_init2fin.xml", ret == 0);
695 CPPUNIT_ASSERT_MESSAGE("Schema: foreach_init2fin.xml", p->getEffectiveState() == YACS::DONE );
697 ret = driverTest(p, "samples/foreach_init2work.xml");
698 CPPUNIT_ASSERT_MESSAGE("Schema: foreach_init2work.xml", ret == 0);
699 CPPUNIT_ASSERT_MESSAGE("Schema: foreach_init2work.xml", p->getEffectiveState() == YACS::DONE );
700 CPPUNIT_ASSERT_EQUAL(p->getOutputPort("PostProc.r")->getAsString(), std::string("108"));
702 if(getenv("GEOM_ROOT_DIR"))
704 std::string geomdir(getenv("GEOM_ROOT_DIR"));
705 geomdir=geomdir+"/share/salome/resources/geom";
706 if(access(geomdir.c_str(),F_OK) == 0)
708 ret = driverTest(p, "samples/foreach7.xml"); //needs GEOM_Superv component
709 CPPUNIT_ASSERT_MESSAGE("Schema: foreach7.xml", ret == 0);
710 CPPUNIT_ASSERT_MESSAGE("Schema: foreach7.xml", p->getEffectiveState() == YACS::DONE );
716 void YacsLoaderTest::sinlines()
720 ret = driverTest(p, "samples/sinline1.xml");
721 CPPUNIT_ASSERT(ret == 0);
722 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
723 ret = driverTest(p, "samples/sinline2.xml");
724 CPPUNIT_ASSERT(ret == 0);
725 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
726 ret = driverTest(p, "samples/sinline3.xml");
727 CPPUNIT_ASSERT(ret == 0);
728 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
729 ret = driverTest(p, "samples/sinline4.xml");
730 CPPUNIT_ASSERT(ret == 0);
731 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
732 ret = driverTest(p, "samples/sinline5.xml");
733 CPPUNIT_ASSERT(ret == 0);
734 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
737 void YacsLoaderTest::bools()
741 ret = driverTest(p, "samples/bool1.xml");
742 CPPUNIT_ASSERT(ret == 0);
743 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
745 void YacsLoaderTest::integers()
749 ret = driverTest(p, "samples/integer1.xml");
750 CPPUNIT_ASSERT(ret == 0);
751 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
753 void YacsLoaderTest::doubles()
757 ret = driverTest(p, "samples/double1.xml");
758 CPPUNIT_ASSERT(ret == 0);
759 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
761 void YacsLoaderTest::strings()
765 ret = driverTest(p, "samples/string1.xml");
766 CPPUNIT_ASSERT(ret == 0);
767 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
769 void YacsLoaderTest::objrefs()
773 ret = driverTest(p, "samples/objref1.xml");
774 CPPUNIT_ASSERT(ret == 0);
775 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
777 void YacsLoaderTest::structs()
781 ret = driverTest(p, "samples/struct1.xml");
782 CPPUNIT_ASSERT(ret == 0);
783 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
786 ret = driverTest(p, "samples/struct2.xml");
787 CPPUNIT_ASSERT(ret == 0);
788 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
792 void YacsLoaderTest::cpps()
796 ret = driverTest(p, "samples/cpp1.xml");
797 CPPUNIT_ASSERT(ret == 0);
798 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
802 void YacsLoaderTest::datanodes()
806 ret = driverTest(p, "samples/datanode0.xml");
807 CPPUNIT_ASSERT(ret == 0);
808 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
812 void YacsLoaderTest::optimizers()
816 ret = driverTest(p, "samples/optimizer1.xml");
817 CPPUNIT_ASSERT(ret == 0);
818 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
821 ret = driverTest(p, "samples/optimizer2.xml");
822 CPPUNIT_ASSERT(ret == 0);
823 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
826 ret = driverTest(p, "samples/optimizer_sync_cpp.xml");
827 CPPUNIT_ASSERT(ret == 0);
828 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
831 ret = driverTest(p, "samples/optimizer_async_cpp.xml");
832 CPPUNIT_ASSERT(ret == 0);
833 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
836 ret = driverTest(p, "samples/optimizer_sync_py.xml");
837 CPPUNIT_ASSERT(ret == 0);
838 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
841 ret = driverTest(p, "samples/optimizer_async_py.xml");
842 CPPUNIT_ASSERT(ret == 0);
843 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
846 ret = driverTest(p, "samples/optimizer_retro.xml");
847 CPPUNIT_ASSERT(ret == 0);
848 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
851 ret = driverTest(p, "samples/double_optimizer_py.xml");
852 CPPUNIT_ASSERT(ret == 0);
853 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
856 ret = driverTest(p, "samples/optimizer_pyobj.xml");
857 CPPUNIT_ASSERT(ret == 0);
858 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
863 void YacsLoaderTest::pyremotes()
867 ret = driverTest(p, "samples/pyremote1.xml");
868 CPPUNIT_ASSERT(ret == 0);
869 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
870 ret = driverTest(p, "samples/pyremote2.xml");
871 CPPUNIT_ASSERT(ret == 0);
872 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
873 ret = driverTest(p, "samples/pyremote3.xml");
874 CPPUNIT_ASSERT(ret == 0);
875 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
876 ret = driverTest(p, "samples/pyremote4.xml");
877 CPPUNIT_ASSERT(ret == 0);
878 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
881 void YacsLoaderTest::nonepyobj()
885 ret = driverTest(p, "samples/nonepyobj.xml");
886 CPPUNIT_ASSERT(ret == 0);
887 CPPUNIT_ASSERT(p->getEffectiveState() == YACS::DONE );
888 CPPUNIT_ASSERT_EQUAL(p->getOutputPort("n2.r")->getAsString(), std::string("True"));