-// Copyright (C) 2006-2012 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
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <cctype>
#include <cstdlib>
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
#include "YacsTrace.hxx"
using namespace YACS::ENGINE;
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)
{
// --- init runtime
std::cerr << std::endl;
- RuntimeSALOME::setRuntime();
+ RuntimeForTest::setRuntime();
_myRuntime = getRuntime();
// --- init typecodes
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"
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);
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);
((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();
((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();
}
}
-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;