Differential_equations tests: replace 'pause, end' with 'assert_*' 95/12195/3
Paul BIGNIER [Tue, 30 Jul 2013 13:32:31 +0000 (15:32 +0200)]
For instance, replaced 'if x>2 then pause end' by 'assert_checkalmostequal(x,2)'.

Change-Id: Ieca11bf62a446f6e0f1df3aee64dd50d9a6aadb3

scilab/modules/differential_equations/tests/unit_tests/daskr.dia.ref
scilab/modules/differential_equations/tests/unit_tests/daskr.tst
scilab/modules/differential_equations/tests/unit_tests/dassldasrt.dia.ref
scilab/modules/differential_equations/tests/unit_tests/dassldasrt.tst

index 284a5ef..ae788d3 100644 (file)
@@ -21,27 +21,27 @@ y0=1;t=2:6;t0=1;y0d=3;
 info=list([],0,[],[],[],0,[],1,[],0,1,[],[],1);
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info,'psol1','pjac1');
-if abs(nn(1)-2.47)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info,'psol1','pjac1');
-if abs(nn(1)-2.5)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1);
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info);
-if abs(nn(1)-2.53)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.53,0.001);
 // Same problem, but using macro for the derivative evaluation function 'res1'
 deff('[delta,ires]=res1(t,y,ydot)','ires=0;delta=ydot-((2.*log(y)+8)./t-5).*y')
 deff('[rts]=gr1(t,y,yd)','rts=[((2*log(y)+8)/t-5)*y;log(y)-2.2491]')
 y0=1;t=2:6;t0=1;y0d=3;
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.47)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.5)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.53)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.53,0.001);
 // Same problem, but using macros for the preconditioner evaluation and application functions 'pjac' and 'psol'
 // pjac uses the macro res1 defined above.
 function [wp, iwp, ires] = pjac(neq, t, y, ydot, h, cj, rewt, savr)
@@ -92,13 +92,13 @@ y0=1;t=2:6;t0=1;y0d=3;
 info=list([],0,[],[],[],0,[],1,[],0,1,[],[],1);
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,'gr1',info,psol,pjac);
-if abs(nn(1)-2.47)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,'gr1',info,psol,pjac);
-if abs(nn(1)-2.5)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,'gr1',info,psol,pjac);
-if abs(nn(1)-2.53)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.53,0.001);
 //C
 //C-----------------------------------------------------------------------
 //C Second problem (Van Der Pol oscillator).
@@ -114,7 +114,7 @@ info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1);
 rtol=[1.d-6;1.d-6];atol=[1.d-6;1.d-4];
 t0=0;y0=[2;0];y0d=[0;-2];t=[20:20:200];ng=1;
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,'res2','jac2',ng,'gr2',info);
-if abs(nn(1)-81.163512)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),81.163512,0.001);
 deff('[delta,ires]=res2(t,y,ydot)',...
 'ires=0;y1=y(1),y2=y(2),delta=[ydot-[y2;100*(1-y1*y1)*y2-y1]]')
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,'jac2',ng,'gr2',info);
@@ -125,10 +125,10 @@ deff('s=gr2(t,y,yd)','s=y(1)')
 // Same problem, with psol and pjac example routines
 info=list([],0,[],[],[],0,[],1,[],0,1,[],[],1);
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,'gr2',info,'psol1','pjac1');
-if abs(nn(1)-81.163512)>0.009 then bugmes();quit;end
+assert_checkalmostequal(nn(1),81.163512,0.009);
 deff('s=gr2(t,y,yd)','s=y(1)')
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,gr2,info,'psol1','pjac1');
-if abs(nn(1)-81.163512)>0.009 then bugmes();quit;end
+assert_checkalmostequal(nn(1),81.163512,0.009);
 // Same problem, with psol and pjac macros
 // Redefine pjac to use res2
 function [wp, iwp, ires] = pjac(neq, t, y, ydot, h, cj, rewt, savr)
@@ -162,16 +162,16 @@ endfunction
 Warning : redefining function: pjac                    . Use funcprot(0) to avoid this message
 
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,'gr2',info,psol,pjac);
-if abs(nn(1)-81.163512)>0.003 then bugmes();quit;end
+assert_checkalmostequal(nn(1),81.163512,0.003);
 deff('s=gr2(t,y,yd)','s=y(1)')
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,gr2,info,psol,pjac);
-if abs(nn(1)-81.163512)>0.003 then bugmes();quit;end
+assert_checkalmostequal(nn(1),81.163512,0.003);
 info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1);
 //           Hot Restart
 [yy,nn,hotd]=daskr([y0,y0d],t0,t,atol,rtol,'res2','jac2',ng,'gr2',info);
 t01=nn(1);t=100:20:200;[pp,qq]=size(yy);y01=yy(2:3,qq);y0d1=yy(3:4,qq);
 [yy,nn,hotd]=daskr([y01,y0d1],t01,t,atol,rtol,'res2','jac2',ng,'gr2',info,hotd);
-if abs(nn(1)-162.57763)>0.004 then bugmes();quit;end
+assert_checkalmostequal(nn(1),162.57763,0.004);
 //Test of Dynamic link (Require f77!)
 //         1 making the routines
 res22=[...
index 35c6696..e4a2e3d 100644 (file)
@@ -22,14 +22,14 @@ y0=1;t=2:6;t0=1;y0d=3;
 info=list([],0,[],[],[],0,[],1,[],0,1,[],[],1);
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info,'psol1','pjac1');
-if abs(nn(1)-2.47)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info,'psol1','pjac1');
-if abs(nn(1)-2.5)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1);
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info);
-if abs(nn(1)-2.53)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.53,0.001);
 
 // Same problem, but using macro for the derivative evaluation function 'res1'
 deff('[delta,ires]=res1(t,y,ydot)','ires=0;delta=ydot-((2.*log(y)+8)./t-5).*y')
@@ -38,13 +38,13 @@ deff('[rts]=gr1(t,y,yd)','rts=[((2*log(y)+8)/t-5)*y;log(y)-2.2491]')
 y0=1;t=2:6;t0=1;y0d=3;
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.47)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.5)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.53)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.53,0.001);
 
 // Same problem, but using macros for the preconditioner evaluation and application functions 'pjac' and 'psol'
 // pjac uses the macro res1 defined above.
@@ -97,13 +97,13 @@ y0=1;t=2:6;t0=1;y0d=3;
 info=list([],0,[],[],[],0,[],1,[],0,1,[],[],1);
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,'gr1',info,psol,pjac);
-if abs(nn(1)-2.47)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,'gr1',info,psol,pjac);
-if abs(nn(1)-2.5)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res1,ng,'gr1',info,psol,pjac);
-if abs(nn(1)-2.53)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.53,0.001);
 
 //C
 //C-----------------------------------------------------------------------
@@ -120,7 +120,7 @@ info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1);
 rtol=[1.d-6;1.d-6];atol=[1.d-6;1.d-4];
 t0=0;y0=[2;0];y0d=[0;-2];t=[20:20:200];ng=1;
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,'res2','jac2',ng,'gr2',info);
-if abs(nn(1)-81.163512)>0.001 then pause,end
+assert_checkalmostequal(nn(1),81.163512,0.001);
 
 deff('[delta,ires]=res2(t,y,ydot)',...
 'ires=0;y1=y(1),y2=y(2),delta=[ydot-[y2;100*(1-y1*y1)*y2-y1]]')
@@ -134,10 +134,10 @@ deff('s=gr2(t,y,yd)','s=y(1)')
 
 info=list([],0,[],[],[],0,[],1,[],0,1,[],[],1);
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,'gr2',info,'psol1','pjac1');
-if abs(nn(1)-81.163512)>0.009 then pause,end
+assert_checkalmostequal(nn(1),81.163512,0.009);
 deff('s=gr2(t,y,yd)','s=y(1)')
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,gr2,info,'psol1','pjac1');
-if abs(nn(1)-81.163512)>0.009 then pause,end
+assert_checkalmostequal(nn(1),81.163512,0.009);
 
 // Same problem, with psol and pjac macros
 
@@ -171,10 +171,10 @@ function [wp, iwp, ires] = pjac(neq, t, y, ydot, h, cj, rewt, savr)
     end
 endfunction
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,'gr2',info,psol,pjac);
-if abs(nn(1)-81.163512)>0.003 then pause,end
+assert_checkalmostequal(nn(1),81.163512,0.003);
 deff('s=gr2(t,y,yd)','s=y(1)')
 [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,gr2,info,psol,pjac);
-if abs(nn(1)-81.163512)>0.003 then pause,end
+assert_checkalmostequal(nn(1),81.163512,0.003);
 info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1);
 
 //           Hot Restart
@@ -182,7 +182,7 @@ info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1);
 [yy,nn,hotd]=daskr([y0,y0d],t0,t,atol,rtol,'res2','jac2',ng,'gr2',info);
 t01=nn(1);t=100:20:200;[pp,qq]=size(yy);y01=yy(2:3,qq);y0d1=yy(3:4,qq);
 [yy,nn,hotd]=daskr([y01,y0d1],t01,t,atol,rtol,'res2','jac2',ng,'gr2',info,hotd);
-if abs(nn(1)-162.57763)>0.004 then pause,end
+assert_checkalmostequal(nn(1),162.57763,0.004);
 
 //Test of Dynamic link (Require f77!)
 //         1 making the routines
index 434e566..9336b13 100644 (file)
@@ -1,8 +1,14 @@
-// Copyright INRIA
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
 //DASSL
 // PROBLEM 1..   LINEAR DIFFERENTIAL/ALGEBRAIC SYSTEM
 //
-//X1DOT + 10.0*X1 = 0
+//X1DOT + 10.0*X1 = 0  
 //X1 + X2 = 1
 //X1(0) = 1.0, X2(0) = 0.0
 //
@@ -17,11 +23,11 @@ yy0=dassl([y0,y0d],t0,t,dres1,info);
 yy1=dassl([y0,y0d],t0,t,dres1,djac1,info);
 // fortran routine, without jacobian
 yy2=dassl([y0,y0d],t0,t,'dres1',info);   //=yy0
-if norm(yy2-yy0,1)>1E-5 then bugmes();quit;end
+assert_checkalmostequal(norm(yy2,1),norm(yy0,1),1E-5);
 // fortran routines, with jacobian
 yy3=dassl([y0,y0d],t0,t,'dres1','djac1',info);  //=yy1
-if norm(yy3-yy1,1)>1E-5 then bugmes();quit;end
-yy3bis=dassl([y0,y0d],t0,t,'dres1',djac1,info);
+assert_checkalmostequal(norm(yy3,1),norm(yy1,1),1E-5);
+yy3bis=dassl([y0,y0d],t0,t,'dres1',djac1,info); 
 // call fortran dres1 and scilab's djac1
 yy3ter=dassl([y0,y0d],t0,t,dres1,'djac1',info);
 //
@@ -29,11 +35,11 @@ yy3ter=dassl([y0,y0d],t0,t,dres1,'djac1',info);
 atol=1.d-6;rtol=0;
 yy4=dassl([y0,y0d],t0,t,atol,rtol,dres1,info);
 yy5=dassl([y0,y0d],t0,t,atol,rtol,'dres1',info); //=yy4
-if norm(yy5-yy4,1)>1E-9 then bugmes();quit;end
-yy6=dassl([y0,y0d],t0,t,atol,rtol,dres1,djac1,info);
+assert_checkalmostequal(norm(yy5,1),norm(yy4,1),1E-9);
+yy6=dassl([y0,y0d],t0,t,atol,rtol,dres1,djac1,info); 
 yy7=dassl([y0,y0d],t0,t,atol,rtol,'dres1','djac1',info); //==yy6
-if norm(yy7-yy6,1)>1E-12 then bugmes();quit;end
-//
+assert_checkalmostequal(norm(yy7,1),norm(yy6,1),1E-12);
+//    
 //   Testing E xdot - A x=0
 //   x(0)=x0;   xdot(0)=xd0
 rand('seed',0);
@@ -44,21 +50,21 @@ E=rand(nx,1)*rand(1,nx);A=rand(nx,nx);
 deff('[r,ires]=g(t,x,xdot)','r=E*xdot-A*x;ires=0');
 t=[1,2,3];t0=0;info=list([],0,[],[],[],0,0);
 x=dassl([x0,x0d],t0,t,g,info);x1=x(2:nx+1,:);
-if norm(pp*x1-x1,1)>1.d-5 then bugmes();quit;end
+assert_checkalmostequal(norm(pp*x1,1),norm(x1,1),1.d-5);
 //x(4) goes through 1 at  t=1.5409711;
 t=1.5409711;ww=dassl([x0,x0d],t0,t,g,info);
-if abs(ww(5)-1)>0.001 then bugmes();quit;end
+assert_checkalmostequal(ww(5),1,0.001);
 deff('[rt]=surface(t,y,yd)','rt=y(4)-1');nbsurf=1;
 [yyy,nnn]=dasrt([x0,x0d],t0,t,g,nbsurf,surface,info);
 deff('pd=j(t,y,ydot,cj)','pd=cj*E-A');
 x=dassl([x0,x0d],t0,t,g,j,info);x2=x(2:nx+1,1);
-if norm(x2-ww(2:nx+1,1),1)>0.0001 then bugmes();quit;end
+assert_checkalmostequal(norm(x2,1),norm(ww(2:nx+1,1),1),0.0001);
 [yyy1,nnn]=dasrt([x0,x0d],t0,t,g,j,nbsurf,surface,info);
 //x0d is not known:
 x0d=ones(x0);info(7)=1;
 x=dassl([x0,x0d],t0,t,g,info);
 xn=dassl([x0,x0d],t0,t,g,j,info);
-if norm(x-xn,1)>0.00001 then bugmes();quit;end
+assert_checkalmostequal(norm(x,1),norm(xn,1),0.00001);
 //PROBLEM 2..
 info=list([],0,[],[],[],0,0);
 y0=zeros(25,1);y0(1)=1;
@@ -70,7 +76,7 @@ t0=0;t=[0.01,0.1,1,10,100];
 rtol=0;atol=1.d-6;
 y=dassl([y0,y0d],t0,t,atol,rtol,'dres2',info);
 //                 DASRT
-//
+// 
 //C-----------------------------------------------------------------------
 //C First problem.
 //C The initial value problem is..
@@ -84,26 +90,26 @@ y0=1;t=2:6;t0=1;y0d=3;
 info=list([],0,[],[],[],0,0);
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info);
-if abs(nn(1)-2.47)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info);
-if abs(nn(1)-2.5)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info);
-if abs(nn(1)-2.53)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.53,0.001);
 deff('[delta,ires]=res1(t,y,ydot)','ires=0;delta=ydot-((2*log(y)+8)/t-5)*y')
 deff('[rts]=gr1(t,y,yd)','rts=[((2*log(y)+8)/t-5)*y;log(y)-2.2491]')
 y0=1;t=2:6;t0=1;y0d=3;
 info=list([],0,[],[],[],0,0);
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.47)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.5)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.53)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),2.53,0.001);
 //C
 //C-----------------------------------------------------------------------
 //C Second problem (Van Der Pol oscillator).
@@ -119,7 +125,7 @@ rtol=[1.d-6;1.d-6];atol=[1.d-6;1.d-4];
 t0=0;y0=[2;0];y0d=[0;-2];t=[20:20:200];ng=1;
 info=list([],0,[],[],[],0,0);
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,'res2','jac2',ng,'gr2',info);
-if abs(nn(1)-81.163512)>0.001 then bugmes();quit;end
+assert_checkalmostequal(nn(1),81.163512,0.001);
 deff('[delta,ires]=res2(t,y,ydot)',...
 'ires=0;y1=y(1),y2=y(2),delta=[ydot-[y2;100*(1-y1*y1)*y2-y1]]')
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res2,'jac2',ng,'gr2',info);
@@ -131,7 +137,7 @@ deff('s=gr2(t,y,yd)','s=y(1)')
 [yy,nn,hotd]=dasrt([y0,y0d],t0,t,atol,rtol,'res2','jac2',ng,'gr2',info);
 t01=nn(1);t=100:20:200;[pp,qq]=size(yy);y01=yy(2:3,qq);y0d1=yy(3:4,qq);
 [yy,nn,hotd]=dasrt([y01,y0d1],t01,t,atol,rtol,'res2','jac2',ng,'gr2',info,hotd);
-if abs(nn(1)-162.57763)>0.004 then bugmes();quit;end
+assert_checkalmostequal(nn(1),162.57763,0.004);
 //Test of Dynamic link (Require f77!)
 //         1 making the routines
 res22=[...
@@ -275,7 +281,7 @@ gr22=[...
 !      RETURN                                              !
 !                                                          !
 !      END                                                 !
-//Uncomment lines below: link may be machine dependent if some f77 libs are
+//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');
 //unix_g('cd /tmp;rm -f /tmp/jac22.f');
index c7c6aca..3155b3a 100644 (file)
@@ -25,10 +25,10 @@ yy0=dassl([y0,y0d],t0,t,dres1,info);
 yy1=dassl([y0,y0d],t0,t,dres1,djac1,info);
 // fortran routine, without jacobian
 yy2=dassl([y0,y0d],t0,t,'dres1',info);   //=yy0
-if norm(yy2-yy0,1)>1E-5 then pause,end
+assert_checkalmostequal(norm(yy2,1),norm(yy0,1),1E-5);
 // fortran routines, with jacobian
 yy3=dassl([y0,y0d],t0,t,'dres1','djac1',info);  //=yy1
-if norm(yy3-yy1,1)>1E-5 then pause,end
+assert_checkalmostequal(norm(yy3,1),norm(yy1,1),1E-5);
 yy3bis=dassl([y0,y0d],t0,t,'dres1',djac1,info); 
 // call fortran dres1 and scilab's djac1
 yy3ter=dassl([y0,y0d],t0,t,dres1,'djac1',info);
@@ -37,10 +37,10 @@ yy3ter=dassl([y0,y0d],t0,t,dres1,'djac1',info);
 atol=1.d-6;rtol=0;
 yy4=dassl([y0,y0d],t0,t,atol,rtol,dres1,info);
 yy5=dassl([y0,y0d],t0,t,atol,rtol,'dres1',info); //=yy4
-if norm(yy5-yy4,1)>1E-9 then pause,end
+assert_checkalmostequal(norm(yy5,1),norm(yy4,1),1E-9);
 yy6=dassl([y0,y0d],t0,t,atol,rtol,dres1,djac1,info); 
 yy7=dassl([y0,y0d],t0,t,atol,rtol,'dres1','djac1',info); //==yy6
-if norm(yy7-yy6,1)>1E-12 then pause,end
+assert_checkalmostequal(norm(yy7,1),norm(yy6,1),1E-12);
 //    
 //   Testing E xdot - A x=0
 //   x(0)=x0;   xdot(0)=xd0
@@ -52,21 +52,21 @@ E=rand(nx,1)*rand(1,nx);A=rand(nx,nx);
 deff('[r,ires]=g(t,x,xdot)','r=E*xdot-A*x;ires=0');
 t=[1,2,3];t0=0;info=list([],0,[],[],[],0,0);
 x=dassl([x0,x0d],t0,t,g,info);x1=x(2:nx+1,:);
-if norm(pp*x1-x1,1)>1.d-5 then pause,end
+assert_checkalmostequal(norm(pp*x1,1),norm(x1,1),1.d-5);
 //x(4) goes through 1 at  t=1.5409711;
 t=1.5409711;ww=dassl([x0,x0d],t0,t,g,info);
-if abs(ww(5)-1)>0.001 then pause,end
+assert_checkalmostequal(ww(5),1,0.001);
 deff('[rt]=surface(t,y,yd)','rt=y(4)-1');nbsurf=1;
 [yyy,nnn]=dasrt([x0,x0d],t0,t,g,nbsurf,surface,info);
 deff('pd=j(t,y,ydot,cj)','pd=cj*E-A');
 x=dassl([x0,x0d],t0,t,g,j,info);x2=x(2:nx+1,1);
-if norm(x2-ww(2:nx+1,1),1)>0.0001 then pause,end
+assert_checkalmostequal(norm(x2,1),norm(ww(2:nx+1,1),1),0.0001);
 [yyy1,nnn]=dasrt([x0,x0d],t0,t,g,j,nbsurf,surface,info);
 //x0d is not known:
 x0d=ones(x0);info(7)=1;
 x=dassl([x0,x0d],t0,t,g,info);
 xn=dassl([x0,x0d],t0,t,g,j,info);
-if norm(x-xn,1)>0.00001 then pause,end
+assert_checkalmostequal(norm(x,1),norm(xn,1),0.00001);
 
 
 //PROBLEM 2..
@@ -96,13 +96,13 @@ y0=1;t=2:6;t0=1;y0d=3;
 info=list([],0,[],[],[],0,0);
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info);
-if abs(nn(1)-2.47)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info);
-if abs(nn(1)-2.5)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,'res1',ng,'gr1',info);
-if abs(nn(1)-2.53)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.53,0.001);
 
 deff('[delta,ires]=res1(t,y,ydot)','ires=0;delta=ydot-((2*log(y)+8)/t-5)*y')
 deff('[rts]=gr1(t,y,yd)','rts=[((2*log(y)+8)/t-5)*y;log(y)-2.2491]')
@@ -111,13 +111,13 @@ y0=1;t=2:6;t0=1;y0d=3;
 info=list([],0,[],[],[],0,0);
 atol=1.d-6;rtol=0;ng=2;
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.47)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.47,0.001);
 y0=yy(2,2);y0d=yy(3,2);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.5)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.5,0.001);
 y0=yy(2,1);y0d=yy(3,1);t0=nn(1);t=[3,4,5,6];
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1,info);
-if abs(nn(1)-2.53)>0.001 then pause,end
+assert_checkalmostequal(nn(1),2.53,0.001);
 
 //C
 //C-----------------------------------------------------------------------
@@ -134,7 +134,7 @@ rtol=[1.d-6;1.d-6];atol=[1.d-6;1.d-4];
 t0=0;y0=[2;0];y0d=[0;-2];t=[20:20:200];ng=1;
 info=list([],0,[],[],[],0,0);
 [yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,'res2','jac2',ng,'gr2',info);
-if abs(nn(1)-81.163512)>0.001 then pause,end
+assert_checkalmostequal(nn(1),81.163512,0.001);
 
 deff('[delta,ires]=res2(t,y,ydot)',...
 'ires=0;y1=y(1),y2=y(2),delta=[ydot-[y2;100*(1-y1*y1)*y2-y1]]')
@@ -149,7 +149,7 @@ deff('s=gr2(t,y,yd)','s=y(1)')
 [yy,nn,hotd]=dasrt([y0,y0d],t0,t,atol,rtol,'res2','jac2',ng,'gr2',info);
 t01=nn(1);t=100:20:200;[pp,qq]=size(yy);y01=yy(2:3,qq);y0d1=yy(3:4,qq);
 [yy,nn,hotd]=dasrt([y01,y0d1],t01,t,atol,rtol,'res2','jac2',ng,'gr2',info,hotd);
-if abs(nn(1)-162.57763)>0.004 then pause,end
+assert_checkalmostequal(nn(1),162.57763,0.004);
 
 //Test of Dynamic link (Require f77!)
 //         1 making the routines
@@ -223,5 +223,3 @@ gr22=[...
 //[yy,nn,hotd]=dasrt([y0,y0d],t0,t,atol,rtol,'res22','jac22',ng,'gr22',info);
 //t01=nn(1);t=100:20:200;[pp,qq]=size(yy);y01=yy(2:3,qq);y0d1=yy(3:4,qq);
 //[yy,nn,hotd]=dasrt([y01,y0d1],t01,t,atol,rtol,'res22','jac22',ng,'gr22',info,hotd);
-
-