Salome HOME
Copyright update 2022
[modules/yacs.git] / src / runtime / Test / runtimeTest.hxx
1 // Copyright (C) 2006-2022  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef _RUNTIMETEST_HXX_
21 #define _RUNTIMETEST_HXX_
22
23 #include "RuntimeSALOME.hxx"
24 #include "TypeCode.hxx"
25
26 #ifdef USE_CPPUNIT
27 #include <cppunit/extensions/HelperMacros.h>
28 #else
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) \
36         try { x; } \
37         catch (y &e) { cerr << e.what() << endl; }
38 #endif
39
40 #include <string>
41 #include <map>
42
43 namespace YACS
44 {
45   class RuntimeForTest : public YACS::ENGINE::RuntimeSALOME
46   {
47   public:
48     static void setRuntime();
49     RuntimeForTest();
50     virtual ~RuntimeForTest();
51     std::vector< std::pair<std::string,int> > getCatalogOfComputeNodes() const override;
52   };
53
54   class RuntimeTest
55 #ifdef USE_CPPUNIT
56                      : public CppUnit::TestFixture
57 #endif
58   {
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();
84     
85   public:
86       
87     void setUp();
88     void tearDown();
89       
90     void initRuntimeTypeCode();
91     void createPythonNodes();
92     void createCORBANodes();
93     void createBloc();
94     void createRecursiveBlocs();
95     void createDataLinks();
96     void createPythonNodesWithScript();
97     void createCORBANodesWithMethod();
98     void createXMLNodes();
99     void createBloc2();
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();
111     void convertPorts();
112      
113     void classTeardown();
114     
115   protected:
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;
119     static int _inode;
120     static int _ibloc;
121     static YACS::ENGINE::Runtime *_myRuntime;
122
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;
136     
137     static bool endTests;
138       
139   private:
140
141   };
142
143 }
144
145 #endif