[differential_equations] fix tests 17/21317/3
Adeline CARNIS [Thu, 13 Feb 2020 14:48:35 +0000 (15:48 +0100)]
Change-Id: I267fd48950bb302306ae6cb927ae684c25a8f3ad

scilab/modules/differential_equations/tests/nonreg_tests/bug_15523.tst
scilab/modules/differential_equations/tests/unit_tests/dassldasrt.dia.ref
scilab/modules/differential_equations/tests/unit_tests/ode.tst

index 3a78481..35c213a 100644 (file)
@@ -1,12 +1,31 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2018 - St├ęphane MOTTELET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+
+// <-- Non-regression test for bug 15523 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=15523
+//
+// <-- Short Description -->
+//    %ODEOPTIONS(1)=2 didn't work with solvers 'rk' and 'rkf'
+// =============================================================================
+
 function ydot=f(t, y)
     ydot=y^2-y*sin(t)+cos(t)
 endfunction
 %ODEOPTIONS=[2,0,0,%inf,0,2,500,12,5,0,-1,-1];
 rtol=1e-5;
 atol=1e-7;
-yrkf=ode('rkf',0,0,%pi,rtol,atol,f);
-yrk=ode('rk',0,0,%pi,rtol,atol,f);
+yrkf=ode("rkf",0,0,%pi,rtol,atol,f);
+yrk=ode("rk",0,0,%pi,rtol,atol,f);
 assert_checktrue(size(yrkf,2)>1);
 assert_checktrue(size(yrk,2)>1);
-assert_checkalmostequal(yrk(2,:),sin(yrk(1,:)),1e-4,1e-4,'element')
-assert_checkalmostequal(yrkf(2,:),sin(yrkf(1,:)),1e-4,1e-4,'element')
+assert_checkalmostequal(yrk(2,:),sin(yrk(1,:)),1e-4,1e-4,"element")
+assert_checkalmostequal(yrkf(2,:),sin(yrkf(1,:)),1e-4,1e-4,"element")
index 0ccf6c0..39d1384 100644 (file)
@@ -162,45 +162,26 @@ res22=[...
 '      RETURN';
 '      END';]
  res22  = 
-!      SUBROUTINE RES22(T,Y,YDOT,DELTA,IRES,RPAR,IPAR)    !
-!                                                         !
-!      IMPLICIT DOUBLE PRECISION (A-H,O-Z)                !
-!                                                         !
-!      INTEGER NEQ                                        !
-!                                                         !
-!      DIMENSION Y(*), YDOT(*), DELTA(*)                  !
-!                                                         !
-!      NEQ=2                                              !
-!                                                         !
-!      CALL F2(NEQ,T,Y,DELTA)                             !
-!                                                         !
-!      DO 10 I = 1,NEQ                                    !
-!                                                         !
-!         DELTA(I) = YDOT(I) - DELTA(I)                   !
-!                                                         !
-! 10   CONTINUE                                           !
-!                                                         !
-!      RETURN                                             !
-!                                                         !
-!      END                                                !
-!                                                         !
-!      SUBROUTINE F2 (NEQ, T, Y, YDOT)                    !
-!                                                         !
-!      IMPLICIT DOUBLE PRECISION (A-H,O-Z)                !
-!                                                         !
-!      INTEGER NEQ                                        !
-!                                                         !
-!      DOUBLE PRECISION T, Y, YDOT                        !
-!                                                         !
-!      DIMENSION Y(*), YDOT(*)                            !
-!                                                         !
-!      YDOT(1) = Y(2)                                     !
-!                                                         !
-!      YDOT(2) = 100.0D0*(1.0D0 - Y(1)*Y(1))*Y(2) - Y(1)  !
-!                                                         !
-!      RETURN                                             !
-!                                                         !
-!      END                                                !
+  "      SUBROUTINE RES22(T,Y,YDOT,DELTA,IRES,RPAR,IPAR)"  
+  "      IMPLICIT DOUBLE PRECISION (A-H,O-Z)"              
+  "      INTEGER NEQ"                                      
+  "      DIMENSION Y(*), YDOT(*), DELTA(*)"                
+  "      NEQ=2"                                            
+  "      CALL F2(NEQ,T,Y,DELTA)"                           
+  "      DO 10 I = 1,NEQ"                                  
+  "         DELTA(I) = YDOT(I) - DELTA(I)"                 
+  " 10   CONTINUE"                                         
+  "      RETURN"                                           
+  "      END"                                              
+  "      SUBROUTINE F2 (NEQ, T, Y, YDOT)"                  
+  "      IMPLICIT DOUBLE PRECISION (A-H,O-Z)"              
+  "      INTEGER NEQ"                                      
+  "      DOUBLE PRECISION T, Y, YDOT"                      
+  "      DIMENSION Y(*), YDOT(*)"                          
+  "      YDOT(1) = Y(2)"                                   
+  "      YDOT(2) = 100.0D0*(1.0D0 - Y(1)*Y(1))*Y(2) - Y(1)"
+  "      RETURN"                                           
+  "      END"                                              
 jac22=[...
 '      SUBROUTINE JAC22 (T, Y, ydot, PD, CJ, RPAR, IPAR)';
 ' ';
@@ -220,39 +201,23 @@ jac22=[...
 '      RETURN';
 '      END';]
  jac22  = 
-!      SUBROUTINE JAC22 (T, Y, ydot, PD, CJ, RPAR, IPAR)  !
-!                                                         !
-!                                                         !
-!                                                         !
-!      IMPLICIT DOUBLE PRECISION (A-H,O-Z)                !
-!                                                         !
-!      INTEGER  NROWPD                                    !
-!                                                         !
-!      DOUBLE PRECISION T, Y, PD                          !
-!                                                         !
-!      PARAMETER (NROWPD=2)                               !
-!                                                         !
-!      DIMENSION Y(2), PD(NROWPD,2)                       !
-!                                                         !
-!      PD(1,1) = 0.0D0                                    !
-!                                                         !
-!      PD(1,2) = 1.0D0                                    !
-!                                                         !
-!      PD(2,1) = -200.0D0*Y(1)*Y(2) - 1.0D0               !
-!                                                         !
-!      PD(2,2) = 100.0D0*(1.0D0 - Y(1)*Y(1))              !
-!                                                         !
-!      PD(1,1) = CJ - PD(1,1)                             !
-!                                                         !
-!      PD(1,2) =    - PD(1,2)                             !
-!                                                         !
-!      PD(2,1) =    - PD(2,1)                             !
-!                                                         !
-!      PD(2,2) = CJ - PD(2,2)                             !
-!                                                         !
-!      RETURN                                             !
-!                                                         !
-!      END                                                !
+  "      SUBROUTINE JAC22 (T, Y, ydot, PD, CJ, RPAR, IPAR)"
+  " "                                                      
+  "      IMPLICIT DOUBLE PRECISION (A-H,O-Z)"              
+  "      INTEGER  NROWPD"                                  
+  "      DOUBLE PRECISION T, Y, PD"                        
+  "      PARAMETER (NROWPD=2)"                             
+  "      DIMENSION Y(2), PD(NROWPD,2)"                     
+  "      PD(1,1) = 0.0D0"                                  
+  "      PD(1,2) = 1.0D0"                                  
+  "      PD(2,1) = -200.0D0*Y(1)*Y(2) - 1.0D0"             
+  "      PD(2,2) = 100.0D0*(1.0D0 - Y(1)*Y(1))"            
+  "      PD(1,1) = CJ - PD(1,1)"                           
+  "      PD(1,2) =    - PD(1,2)"                           
+  "      PD(2,1) =    - PD(2,1)"                           
+  "      PD(2,2) = CJ - PD(2,2)"                           
+  "      RETURN"                                           
+  "      END"                                              
 gr22=[...
 '      SUBROUTINE GR22 (NEQ, T, Y, NG, GROOT, RPAR, IPAR)';
 '      IMPLICIT DOUBLE PRECISION (A-H,O-Z)';
@@ -263,21 +228,14 @@ gr22=[...
 '      RETURN';
 '      END';]
  gr22  = 
-!      SUBROUTINE GR22 (NEQ, T, Y, NG, GROOT, RPAR, IPAR)  !
-!                                                          !
-!      IMPLICIT DOUBLE PRECISION (A-H,O-Z)                 !
-!                                                          !
-!      INTEGER NEQ, NG                                     !
-!                                                          !
-!      DOUBLE PRECISION T, Y, GROOT                        !
-!                                                          !
-!      DIMENSION Y(*), GROOT(*)                            !
-!                                                          !
-!      GROOT(1) = Y(1)                                     !
-!                                                          !
-!      RETURN                                              !
-!                                                          !
-!      END                                                 !
+  "      SUBROUTINE GR22 (NEQ, T, Y, NG, GROOT, RPAR, IPAR)"
+  "      IMPLICIT DOUBLE PRECISION (A-H,O-Z)"               
+  "      INTEGER NEQ, NG"                                   
+  "      DOUBLE PRECISION T, Y, GROOT"                      
+  "      DIMENSION Y(*), GROOT(*)"                          
+  "      GROOT(1) = Y(1)"                                   
+  "      RETURN"                                            
+  "      END"                                               
 //Uncomment lines below: link may be machine dependent if some f77 libs are 
 //needed for linking
 //unix_g('cd /tmp;rm -f /tmp/res22.f');unix_g('cd /tmp;rm -f /tmp/gr22.f');
index d04bb62..6c5772b 100644 (file)
@@ -29,8 +29,8 @@ clear t;
 // to check that error in rhs is reported without crashing Scilab
 function ydot=f(t,y),ydot=z,endfunction
 y0=0;t0=0;t=0:0.1:%pi;
-message = [msprintf(_("Undefined variable: %s"),"z");
-           "ode: An error occurred in ''lsoda'' subroutine."]
+message = [msprintf(_("Undefined variable: %s\n"),"z");
+           msprintf(_("%s: An error occurred in ''%s'' subroutine.\n"), "ode", "lsoda")];
 assert_checkerror("y=ode(y0,t0,t,f)",message);