Salome HOME
Merge branch V7_3_1_BR
[samples/hello.git] / bin / test_hello.py
1 # Copyright (C) 2007-2014  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, 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 ##
21 # Test functionality of HELLO module
22 ##
23
24 # initialize salome session
25 import salome
26 salome.salome_init()
27
28 # get reference to the HELLO engine
29 import HELLO_ORB
30 hello = salome.lcc.FindOrLoadComponent('FactoryServer', 'HELLO')
31
32 # test HELLO module
33 print "Say hello to John: should be OK"
34 if hello.hello(salome.myStudy, "John") != HELLO_ORB.OP_OK:
35     print "ERROR: wrong operation code is returned"
36 else:
37     print "OK"
38 print "Say hello to John: should answer 'already met'"
39 if hello.hello(salome.myStudy, "John") != HELLO_ORB.OP_ERR_ALREADY_MET:
40     print "ERROR: wrong operation code is returned"
41 else:
42     print "OK"
43 print "Say goodbye to Margaret: should answer 'did not meet yet'"
44 if hello.goodbye(salome.myStudy, "Margaret") != HELLO_ORB.OP_ERR_DID_NOT_MEET:
45     print "ERROR: wrong operation code is returned"
46 else:
47     print "OK"
48 print "Say hello to John: should be OK"
49 if hello.goodbye(salome.myStudy, "John") != HELLO_ORB.OP_OK:
50     print "ERROR: wrong operation code is returned"
51 else:
52     print "OK"
53 print "Say hello to John: should answer 'did not meet yet'"
54 if hello.goodbye(salome.myStudy, "John") != HELLO_ORB.OP_ERR_DID_NOT_MEET:
55     print "ERROR: wrong operation code is returned"
56 else:
57     print "OK"