]> SALOME platform Git repositories - modules/yacs.git/blobdiff - src/runtime/Test/runtimeTest.cxx
Salome HOME
updated copyright message
[modules/yacs.git] / src / runtime / Test / runtimeTest.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 605d527..6af3df6
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -48,7 +48,7 @@
 #include <cctype>
 #include <cstdlib>
 
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
 #include "YacsTrace.hxx"
 
 using namespace YACS::ENGINE;
@@ -81,6 +81,32 @@ int RuntimeTest::_ibloc = 0;
 Runtime *RuntimeTest::_myRuntime = 0;
 bool RuntimeTest::endTests = false;
 
+RuntimeForTest::RuntimeForTest()
+: RuntimeSALOME(UsePython+UseCorba+UseXml+UseCpp+UseSalome, 0, nullptr)
+{
+}
+
+RuntimeForTest::~RuntimeForTest()
+{
+}
+
+std::vector< std::pair<std::string,int> >
+RuntimeForTest::getCatalogOfComputeNodes() const
+{
+  std::vector< std::pair<std::string,int> > result(1);
+  std::pair<std::string,int> localhost;
+  localhost.first = "localhost";
+  localhost.second = 8;
+  result[0] = localhost;
+  return result;
+}
+
+void RuntimeForTest::setRuntime()
+{
+  if (! Runtime::_singleton)
+    Runtime::_singleton = new RuntimeForTest;
+}
+
 void RuntimeTest::setUp()
 {
   if (_ltc.size() == 0)
@@ -103,7 +129,7 @@ void RuntimeTest::initRuntimeTypeCode()
 {
   // --- init runtime
   std::cerr << std::endl;
-  RuntimeSALOME::setRuntime();
+  RuntimeForTest::setRuntime();
   _myRuntime = getRuntime();
   
   // --- init typecodes
@@ -365,16 +391,16 @@ void RuntimeTest::createPythonNodesWithScript()
     string s = ss.str();
     ElementaryNode* node = _myRuntime->createScriptNode("",s);
     _nodeMap[s] = node;
-    ((InlineNode*) node)->setScript("print 'node 13'\n"
+    ((InlineNode*) node)->setScript("print('node 13')\n"
                                      "import eo\n"
-                                     "print ob\n"
+                                     "print(ob)\n"
                                      "o=ob._narrow(eo.Obj)\n"
-                                     "print o\n"
-                                     "print o.echoLong(13)\n"
+                                     "print(o)\n"
+                                     "print(o.echoLong(13))\n"
                                      "a=dble+1\n"
                                      "dble=2*a\n"
-                                     "print lng\n"
-                                     "print '++++++++',s,'+++++++++++++'\n"
+                                     "print(lng)\n"
+                                     "print('++++++++',s,'+++++++++++++')\n"
                                      "ob=o\n"
                                      "seqstr=['aaa','bbb']\n"
                                      "seqobj=[o,o,o,o]\n"
@@ -413,12 +439,12 @@ void RuntimeTest::createPythonNodesWithScript()
     string s = ss.str();
     ElementaryNode* node = _myRuntime->createScriptNode("",s);
     _nodeMap[s] = node;
-    ((InlineNode*) node)->setScript("print li\n"
-                                     "print 'lili=',lili\n"
-                                     "print 'lstr=',lstr\n"
-                                     "print 'lobj=',lobj\n"
-                                     "print 'llobj=',llobj\n"
-                                     "print 'objc=',objc\n"
+    ((InlineNode*) node)->setScript("print(li)\n"
+                                     "print('lili=',lili)\n"
+                                     "print('lstr=',lstr)\n"
+                                     "print('lobj=',lobj)\n"
+                                     "print('llobj=',llobj)\n"
+                                     "print('objc=',objc)\n"
                                      "li=2*li\n"
                                      );
     InputPort  *i1  = node->edAddInputPort("li",    _tc_seqdble);
@@ -447,12 +473,12 @@ void RuntimeTest::createPythonNodesWithScript()
     string s = ss.str();
     ElementaryNode* node = _myRuntime->createScriptNode("",s);
     _nodeMap[s] = node;
-    ((InlineNode*) node)->setScript("print li\n"
+    ((InlineNode*) node)->setScript("print(li)\n"
                                      "li=[2*e for e in li]\n"
-                                     "print 'obj=',obj\n"
-                                     "print li\n"
-                                     "print lngvec\n"
-                                     "print dblevec\n"
+                                     "print('obj=',obj)\n"
+                                     "print(li)\n"
+                                     "print(lngvec)\n"
+                                     "print(dblevec)\n"
                                      );
     InputPort  *i1  = node->edAddInputPort("li",      _tc_seqdble);
     InputPort  *i2  = node->edAddInputPort("obj",     _tc_obj);
@@ -1155,7 +1181,6 @@ void RuntimeTest::manualExecuteNoThread()
   ((ElementaryNode*)_nodeMap["Node_10"])->load();
   ((ElementaryNode*)_nodeMap["Node_10"])->execute();
   //  CPPUNIT_ASSERT_DOUBLES_EQUAL(10.51, (ElementaryNode*)_nodeMap["Node_10"])
-
   DEBTRACE(" --- execution Python Node_11" );
   ((ElementaryNode*)_nodeMap["Node_11"])->load();
   ((ElementaryNode*)_nodeMap["Node_11"])->execute();
@@ -1240,6 +1265,7 @@ void RuntimeTest::manualExecuteNoThread()
   ((ElementaryNode*)_nodeMap["Node_15"])->load();
   ((ElementaryNode*)_nodeMap["Node_15"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution XML Node_36" );
   ((ElementaryNode*)_nodeMap["Node_36"])->load();
   ((ElementaryNode*)_nodeMap["Node_36"])->execute();
@@ -1469,7 +1495,7 @@ void RuntimeTest::convertPorts()
     }
 }
 
-void myTestRun(int nIn, int nOut, Any **In, Any **Out) throw (YACS::Exception)
+void myTestRun(int nIn, int nOut, Any **In, Any **Out)
 {
   double x, y;
   cerr << "myTestRun nIn = " << nIn << endl;