]> SALOME platform Git repositories - tools/sat.git/blob - data/templates/CppComponent/bin/test_hello.py
Salome HOME
add the template command
[tools/sat.git] / data / templates / CppComponent / bin / test_hello.py
1 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
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.
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 ##
21 # Test functionality of :sat:{CPPCMP} module
22 ##
23
24 # initialize salome session
25 import salome
26 salome.salome_init()
27
28 # get reference to the :sat:{CPPCMP} engine
29 import :sat:{CPPCMP}_ORB
30 comp = salome.lcc.FindOrLoadComponent('FactoryServer', ':sat:{CPPCMP}')
31
32 # test :sat:{CPPCMP} module
33 print "Say hello to John: should be OK"
34 if comp.hello(salome.myStudy, "John") != :sat:{CPPCMP}_ORB.OP_OK:
35     print "ERROR: wrong operation code is returned"
36 else:
37     print "OK"
38
39 print "Say hello to John: should answer 'already met'"
40 if comp.hello(salome.myStudy, "John") != :sat:{CPPCMP}_ORB.OP_ERR_ALREADY_MET:
41     print "ERROR: wrong operation code is returned"
42 else:
43     print "OK"
44
45 print "Say goodbye to Margaret: should answer 'did not meet yet'"
46 if comp.goodbye(salome.myStudy, "Margaret") != :sat:{CPPCMP}_ORB.OP_ERR_DID_NOT_MEET:
47     print "ERROR: wrong operation code is returned"
48 else:
49     print "OK"
50
51 print "Say hello to John: should be OK"
52 if comp.goodbye(salome.myStudy, "John") != :sat:{CPPCMP}_ORB.OP_OK:
53     print "ERROR: wrong operation code is returned"
54 else:
55     print "OK"
56
57 print "Say hello to John: should answer 'did not meet yet'"
58 if comp.goodbye(salome.myStudy, "John") != :sat:{CPPCMP}_ORB.OP_ERR_DID_NOT_MEET:
59     print "ERROR: wrong operation code is returned"
60 else:
61     print "OK"