Scicos tests: fix scicos.tst to load Scicos libs correctly 02/16702/2
Paul Bignier [Thu, 18 Jun 2015 10:16:34 +0000 (12:16 +0200)]
Change-Id: I5beef1fd3c4c45aeac2225a8bdea48f68afcc9af

scilab/modules/scicos/tests/unit_tests/scicos.dia.ref
scilab/modules/scicos/tests/unit_tests/scicos.tst

index 3f28b25..48d7039 100644 (file)
@@ -4,60 +4,49 @@
 //
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
-load('SCI/modules/scicos/macros/scicos_scicos/lib');
-load('SCI/modules/scicos/macros/scicos_utils/lib');
-if ( ~isdef("modelica_libs") | ..
-     ~isdef("scicos_pal_libs") ) then
-     [modelica_libs, scicos_pal_libs, %scicos_with_grid, %scs_wgrid]=initial_scicos_tables()
- %scs_wgrid  =
-    10.  
-    10.  
-    12.  
- %scicos_with_grid  =
-  F  
- scicos_pal_libs  =
-         column 1 to 7
-!Branching  Events  Misc  Sinks  Threshold  Linear  MatrixOp  !
-         column  8 to 13
-!NonLinear  Sources  Electrical  Hydraulics  PDE  IntegerOp  !
- modelica_libs  =
+if exists("scicos_scicoslib") == 0 then
+    load("SCI/modules/scicos/macros/scicos_scicos/lib");
+end
+if exists("scicos_utilslib") == 0 then
+    load("SCI/modules/scicos/macros/scicos_utils/lib");
+end
+if or(~isdef(["modelica_libs" "scicos_pal_libs"])) then
+    [modelica_libs, scicos_pal_libs, %scicos_with_grid, %scs_wgrid] = initial_scicos_tables()
+end
+%scs_wgrid  = 
+    10.
+    10.
+    12.
+%scicos_with_grid  = 
+  F
+scicos_pal_libs  = 
+         column 1 to 8
+!Branching  Events  Misc  Sinks  Threshold  Linear  MatrixOp  NonLinear  !
+         column 9 to 13
+!Sources  Electrical  Hydraulics  PDE  IntegerOp  !
+modelica_libs  = 
          column 1
 !SCI/modules/scicos_blocks/macros/Electrical  !
          column 2
 !SCI/modules/scicos_blocks/macros/Hydraulics  !
-end
-exec(loadpallibs,-1) 
-exec('SCI/modules/scicos/tests/unit_tests/scicos_tests.sci');
-options=default_options();
+exec(loadpallibs,-1)
+exec("SCI/modules/scicos/tests/unit_tests/scicos_tests.sci");
+options = default_options();
 //build the block set
-blockslib='scs'+['Branching','Events','Misc','Sinks','Threshold','Linear', ...
-         'NonLinear','Sources','Electrical','Hydraulics']+'lib';
-Blocs=[]
- Blocs  =
-     []
+blockslib = "scs" + ["Branching" "Events" "Misc" "Sinks" "Threshold" "Linear" ...
+"NonLinear" "Sources" "Electrical" "Hydraulics"] + "lib";
+Blocs = [];
 for blocklib=blockslib
-  B=string(blocklib);Blocs=[Blocs;B(2:$)];
+    B = string(blocklib);
+    Blocs = [Blocs; B(2:$)];
 end
-Blocs(Blocs=="m_sin")=[];
-nb=size(Blocs,1);
-if checkdefine() then bugmes();quit;end
-if checkinputs() then bugmes();quit;end
-if checkoutputs() then bugmes();quit;end
-if checkorigin() then bugmes();quit;end
-if checkdeput() then bugmes();quit;end
-if checkfiring() then bugmes();quit;end
-if check_define_ports() then bugmes();quit;end
-if check_set_ports() then bugmes();quit;end
+Blocs(Blocs=="m_sin") = [];
+nb = size(Blocs, 1);
+assert_checkfalse(checkdefine());
+assert_checkfalse(checkinputs());
+assert_checkfalse(checkoutputs());
+assert_checkfalse(checkorigin());
+assert_checkfalse(checkdeput());
+assert_checkfalse(checkfiring());
+assert_checkfalse(check_define_ports());
+assert_checkfalse(check_set_ports());
index 572ca6f..92b7288 100644 (file)
@@ -5,34 +5,37 @@
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
 
-load('SCI/modules/scicos/macros/scicos_scicos/lib');
-load('SCI/modules/scicos/macros/scicos_utils/lib');
-if ( ~isdef("modelica_libs") | ..
-     ~isdef("scicos_pal_libs") ) then
-    
-     [modelica_libs, scicos_pal_libs, %scicos_with_grid, %scs_wgrid]=initial_scicos_tables()
+if exists("scicos_scicoslib") == 0 then
+    load("SCI/modules/scicos/macros/scicos_scicos/lib");
 end
-  
-exec(loadpallibs,-1) 
+if exists("scicos_utilslib") == 0 then
+    load("SCI/modules/scicos/macros/scicos_utils/lib");
+end
+if or(~isdef(["modelica_libs" "scicos_pal_libs"])) then
+    [modelica_libs, scicos_pal_libs, %scicos_with_grid, %scs_wgrid] = initial_scicos_tables()
+end
+
+exec(loadpallibs,-1)
 
-exec('SCI/modules/scicos/tests/unit_tests/scicos_tests.sci');
+exec("SCI/modules/scicos/tests/unit_tests/scicos_tests.sci");
 
-options=default_options();
+options = default_options();
 //build the block set
-blockslib='scs'+['Branching','Events','Misc','Sinks','Threshold','Linear', ...
-         'NonLinear','Sources','Electrical','Hydraulics']+'lib';
-Blocs=[]
+blockslib = "scs" + ["Branching" "Events" "Misc" "Sinks" "Threshold" "Linear" ...
+"NonLinear" "Sources" "Electrical" "Hydraulics"] + "lib";
+Blocs = [];
 for blocklib=blockslib
-  B=string(blocklib);Blocs=[Blocs;B(2:$)];
+    B = string(blocklib);
+    Blocs = [Blocs; B(2:$)];
 end
-Blocs(Blocs=="m_sin")=[];
+Blocs(Blocs=="m_sin") = [];
 
-nb=size(Blocs,1);
-if checkdefine() then pause,end
-if checkinputs() then pause,end
-if checkoutputs() then pause,end
-if checkorigin() then pause,end
-if checkdeput() then pause,end
-if checkfiring() then pause,end
-if check_define_ports() then pause,end
-if check_set_ports() then pause,end
+nb = size(Blocs, 1);
+assert_checkfalse(checkdefine());
+assert_checkfalse(checkinputs());
+assert_checkfalse(checkoutputs());
+assert_checkfalse(checkorigin());
+assert_checkfalse(checkdeput());
+assert_checkfalse(checkfiring());
+assert_checkfalse(check_define_ports());
+assert_checkfalse(check_set_ports());