1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2008-2020 EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
22 "COMM/TUI/SCD/YACS: Conversion utilities verification"
28 fichiers = glob.glob("*.comm")
30 # ==============================================================================
31 class Test_Adao(unittest.TestCase):
35 Conversion utilities verification (COM->TUI)
36 ++++++++++++++++++++++++++++++++++++++++++++
40 from adao import adaoBuilder
42 for fichier in fichiers:
43 basename = fichier.rstrip(".comm")
45 with open(basename+"_tui.py") as fid:
46 ref_content = fid.read()
48 print(" Processing \"%s\""%basename)
49 with open(basename+".comm") as fid:
50 comm_content = fid.read()
52 comm_content = comm_content.replace("test001_ADAO_External_variables", "test914_Xternal_3_Variables")
53 comm_content = comm_content.replace("test020_Observation_and_Simulation", "test914_Xternal_4_Variables")
54 comm_content = comm_content.replace("test033_ADAO_Elementary_FunctionTest_Operators", "test914_Xternal_5_Variables")
56 case = adaoBuilder.New()
57 case.load( Content=comm_content, Formater="COM" )
58 texte = case.dump(Formater="TUI")
61 self.assertEqual(texte, ref_content, msg="Differences encoutered in TUI file of COMM conversion")
62 print(" ---> Ok, TUI file of COMM conversion is correct\n")
64 # ==============================================================================
65 if __name__ == '__main__':
66 print("\nAUTODIAGNOSTIC\n==============")
67 sys.stderr = sys.stdout
68 unittest.main(verbosity=2)