1 // Copyright (C) 2006-2019 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 #ifndef _RUNTIMETEST_HXX_
21 #define _RUNTIMETEST_HXX_
23 #include "RuntimeSALOME.hxx"
24 #include "TypeCode.hxx"
27 #include <cppunit/extensions/HelperMacros.h>
29 #define CPPUNIT_TEST_SUITE(x)
30 #define CPPUNIT_TEST(x)
31 #define CPPUNIT_TEST_SUITE_END(x)
32 #define CPPUNIT_ASSERT(x) std::cerr << #x << " : " << (x) << std::endl
33 #define CPPUNIT_ASSERT_EQUAL(x,y) std::cerr << "Test " << #x << " == " << #y << " : " << ((x) == (y)) << std::endl;
34 #define CPPUNIT_ASSERT_DOUBLES_EQUAL(x,y,z)
35 #define CPPUNIT_ASSERT_THROW(x,y) \
37 catch (y &e) { cerr << e.what() << endl; }
45 class RuntimeForTest : public YACS::ENGINE::RuntimeSALOME
48 static void setRuntime();
50 virtual ~RuntimeForTest();
51 std::vector< std::pair<std::string,int> > getCatalogOfComputeNodes() const override;
56 : public CppUnit::TestFixture
59 CPPUNIT_TEST_SUITE( RuntimeTest );
60 CPPUNIT_TEST(initRuntimeTypeCode );
61 CPPUNIT_TEST(createPythonNodes );
62 CPPUNIT_TEST(createCORBANodes );
63 CPPUNIT_TEST(createBloc );
64 CPPUNIT_TEST(createRecursiveBlocs );
65 CPPUNIT_TEST(createDataLinks );
66 CPPUNIT_TEST(createPythonNodesWithScript );
67 CPPUNIT_TEST(createCORBANodesWithMethod );
68 CPPUNIT_TEST(createXMLNodes );
69 CPPUNIT_TEST(createBloc2 );
70 CPPUNIT_TEST(createDataLinksPythonPython );
71 CPPUNIT_TEST(createDataLinksPythonCORBA );
72 CPPUNIT_TEST(createDataLinksCORBACORBA );
73 CPPUNIT_TEST(createDataLinksCORBAPython );
74 CPPUNIT_TEST(createDataLinksXML );
75 CPPUNIT_TEST(manualInitInputPort );
76 CPPUNIT_TEST(manualExecuteNoThread );
77 CPPUNIT_TEST(manualGetOutputs );
78 CPPUNIT_TEST(createCppNodes );
79 CPPUNIT_TEST(convertPorts );
80 CPPUNIT_TEST(executeCppNode );
81 CPPUNIT_TEST(createGraphWithCppNodes );
82 CPPUNIT_TEST(classTeardown );
83 CPPUNIT_TEST_SUITE_END();
90 void initRuntimeTypeCode();
91 void createPythonNodes();
92 void createCORBANodes();
94 void createRecursiveBlocs();
95 void createDataLinks();
96 void createPythonNodesWithScript();
97 void createCORBANodesWithMethod();
98 void createXMLNodes();
100 void createDataLinksPythonPython();
101 void createDataLinksPythonCORBA();
102 void createDataLinksCORBACORBA();
103 void createDataLinksCORBAPython();
104 void createDataLinksXML();
105 void manualInitInputPort();
106 void manualExecuteNoThread();
107 void manualGetOutputs();
108 void createCppNodes();
109 void executeCppNode();
110 void createGraphWithCppNodes();
113 void classTeardown();
116 static std::map<std::string, YACS::ENGINE::Node*> _nodeMap;
117 static std::map<std::string, YACS::ENGINE::Bloc*> _blocMap;
118 static std::list<YACS::ENGINE::TypeCodeObjref *> _ltc;
121 static YACS::ENGINE::Runtime *_myRuntime;
123 static YACS::ENGINE::TypeCode *_tc_double;
124 static YACS::ENGINE::TypeCode *_tc_int;
125 static YACS::ENGINE::TypeCode *_tc_string;
126 static YACS::ENGINE::TypeCode *_tc;
127 static YACS::ENGINE::TypeCode *_tc_obj;
128 static YACS::ENGINE::TypeCode *_tc_seqdble;
129 static YACS::ENGINE::TypeCode *_tc_seqstr;
130 static YACS::ENGINE::TypeCode *_tc_seqlong;
131 static YACS::ENGINE::TypeCode *_tc_seqobj;
132 static YACS::ENGINE::TypeCode *_tc_seqseqdble;
133 static YACS::ENGINE::TypeCode *_tc_seqseqobj;
134 static YACS::ENGINE::TypeCode *_tc_C;
135 static YACS::ENGINE::TypeCode *_tc_seqC;
137 static bool endTests;