From: Paul Bignier Date: Mon, 27 Apr 2015 13:21:35 +0000 (+0200) Subject: Differential_equations tests: fix warnings and wrong quotes X-Git-Tag: 6.0.0-alpha-2~364^2~7 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=ad7a66b21e238a766d201471bc7c1163ef2f1d06 Differential_equations tests: fix warnings and wrong quotes Change-Id: I4affa73b2b65b7955a1b84e2b88632f2f2c5a79c --- diff --git a/scilab/modules/differential_equations/tests/unit_tests/daskr.dia.ref b/scilab/modules/differential_equations/tests/unit_tests/daskr.dia.ref index 91baa72..9b808c6 100644 --- a/scilab/modules/differential_equations/tests/unit_tests/daskr.dia.ref +++ b/scilab/modules/differential_equations/tests/unit_tests/daskr.dia.ref @@ -132,6 +132,8 @@ deff("s=gr2(t,y,yd)","s=y(1)") assert_checkalmostequal(nn(1),81.163512,0.009); // Same problem, with psol and pjac macros // Redefine pjac to use res2 +prot = funcprot(); +funcprot(0); function [wp, iwp, ires] = pjac(neq, t, y, ydot, h, cj, rewt, savr) ires = 0; SQuround = 1.490D-08; @@ -160,15 +162,14 @@ function [wp, iwp, ires] = pjac(neq, t, y, ydot, h, cj, rewt, savr) ydot(i) = ypsave; end endfunction -Warning : redefining function: pjac . Use funcprot(0) to avoid this message - +funcprot(prot); [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,"gr2",info,psol,pjac); 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); assert_checkalmostequal(nn(1),81.163512,0.003); info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1); -// Hot Restart +// 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(3:4,qq);y0d1=yy(4:5,qq); [yy,nn,hotd]=daskr([y01,y0d1],t01,t,atol,rtol,"res2","jac2",ng,"gr2",info,hotd); diff --git a/scilab/modules/differential_equations/tests/unit_tests/daskr.tst b/scilab/modules/differential_equations/tests/unit_tests/daskr.tst index 8b8aefb..d358ca3 100644 --- a/scilab/modules/differential_equations/tests/unit_tests/daskr.tst +++ b/scilab/modules/differential_equations/tests/unit_tests/daskr.tst @@ -144,6 +144,8 @@ assert_checkalmostequal(nn(1),81.163512,0.009); // Same problem, with psol and pjac macros // Redefine pjac to use res2 +prot = funcprot(); +funcprot(0); function [wp, iwp, ires] = pjac(neq, t, y, ydot, h, cj, rewt, savr) ires = 0; SQuround = 1.490D-08; @@ -172,6 +174,7 @@ function [wp, iwp, ires] = pjac(neq, t, y, ydot, h, cj, rewt, savr) ydot(i) = ypsave; end endfunction +funcprot(prot); [yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,"gr2",info,psol,pjac); assert_checkalmostequal(nn(1),81.163512,0.003); deff("s=gr2(t,y,yd)","s=y(1)") @@ -179,7 +182,7 @@ deff("s=gr2(t,y,yd)","s=y(1)") assert_checkalmostequal(nn(1),81.163512,0.003); info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1); -// Hot Restart +// 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(3:4,qq);y0d1=yy(4:5,qq); diff --git a/scilab/modules/differential_equations/tests/unit_tests/intg.dia.ref b/scilab/modules/differential_equations/tests/unit_tests/intg.dia.ref index 08d7a39..66a5387 100644 --- a/scilab/modules/differential_equations/tests/unit_tests/intg.dia.ref +++ b/scilab/modules/differential_equations/tests/unit_tests/intg.dia.ref @@ -4,9 +4,10 @@ // // This file is distributed under the same license as the Scilab package. // ============================================================================= +// // <-- CLI SHELL MODE --> +// // <-- ENGLISH IMPOSED --> -// Run with test_run('differential_equations','intg',['no_check_error_output']) ilib_verbose(0); // Function written in the Scilab language function y = f(x), y = x*sin(30*x)/sqrt(1-((x/(2*%pi))^2)), endfunction @@ -20,53 +21,54 @@ if abs(exact-I) > 1e-9 then bugmes();quit;end // Function written in Fortran (a Fortran compiler is required) // define a Fortran function cd TMPDIR; -F=[' double precision function ffun(x)' - ' double precision x, pi' - ' pi = 3.14159265358979312d+0' - ' ffun = x*sin(30.0d+0*x)/sqrt(1.0d+0-(x/(2.0d+0*pi))**2)' - ' return' - ' end']; -mputl(F, fullfile(TMPDIR, 'ffun.f')); +F=[" double precision function ffun(x)" +" double precision x, pi" +" pi = 3.14159265358979312d+0" +" ffun = x*sin(30.0d+0*x)/sqrt(1.0d+0-(x/(2.0d+0*pi))**2)" +" return" +" end"]; +mputl(F, fullfile(TMPDIR, "ffun.f")); // compile the function -l = ilib_for_link('ffun', 'ffun.f', [], 'f'); +l = ilib_for_link("ffun", "ffun.f", [], "f"); // add the function to the working environment -link(l, 'ffun', 'f'); +link(l, "ffun", "f"); // integrate the function -I = intg(0, 2*%pi, 'ffun'); +I = intg(0, 2*%pi, "ffun"); abs(exact-I); if abs(exact-I) > 1e-9 then bugmes();quit;end // Function written in C (a C compiler is required) // define a C function -C=['#include ' - 'double cfun(double *x)' - '{' - ' double y, pi = 3.14159265358979312;' - ' y = *x/(2.0e0*pi);' - ' return *x*sin(30.0e0**x)/sqrt(1.0e0-y*y);' - '}']; -mputl(C, fullfile(TMPDIR, 'cfun.c')); +C=["#include " +"double cfun(double *x)" +"{" +" double y, pi = 3.14159265358979312;" +" y = *x/(2.0e0*pi);" +" return *x*sin(30.0e0**x)/sqrt(1.0e0-y*y);" +"}"]; +mputl(C, fullfile(TMPDIR, "cfun.c")); // compile the function -l = ilib_for_link('cfun', 'cfun.c', [], 'c'); +l = ilib_for_link("cfun", "cfun.c", [], "c"); // add the function to the working environment -link(l, 'cfun', 'c'); +link(l, "cfun", "c"); // integrate the function -I = intg(0, 2*%pi, 'cfun'); +I = intg(0, 2*%pi, "cfun"); if abs(exact-I) > 1e-9 then bugmes();quit;end // Test third output argument [i, err, ierr] = intg(0, 1, f); if abs(ierr) <> 0 then bugmes();quit;end +prot = funcprot(); +funcprot(0); function y = f(x), y = cos(x); endfunction -Warning : redefining function: f . Use funcprot(0) to avoid this message - +funcprot(prot); [i, err, ierr] = intg(0, %pi, f); Warning: Round-off error detected, the requested tolerance (or default) cannot be achieved. Try using bigger tolerances. if abs(ierr) <> 2 then bugmes();quit;end // IEEE compatibility // Error 264: "Wrong value for argument #i: Must not contain NaN or Inf." -if execstr("I = intg(%inf, 0, f)", 'errcatch') <> 264 then bugmes();quit;end -if execstr("I = intg(-%inf, 0, f)", 'errcatch') <> 264 then bugmes();quit;end -if execstr("I = intg(%nan, 0, f)", 'errcatch') <> 264 then bugmes();quit;end -if execstr("I = intg(0, %inf, f)", 'errcatch') <> 264 then bugmes();quit;end -if execstr("I = intg(0, -%inf, f)", 'errcatch') <> 264 then bugmes();quit;end -if execstr("I = intg(0, %nan, f)", 'errcatch') <> 264 then bugmes();quit;end -if execstr("I = intg(%nan, %nan, f)", 'errcatch') <> 264 then bugmes();quit;end +if execstr("I = intg(%inf, 0, f)", "errcatch") <> 264 then bugmes();quit;end +if execstr("I = intg(-%inf, 0, f)", "errcatch") <> 264 then bugmes();quit;end +if execstr("I = intg(%nan, 0, f)", "errcatch") <> 264 then bugmes();quit;end +if execstr("I = intg(0, %inf, f)", "errcatch") <> 264 then bugmes();quit;end +if execstr("I = intg(0, -%inf, f)", "errcatch") <> 264 then bugmes();quit;end +if execstr("I = intg(0, %nan, f)", "errcatch") <> 264 then bugmes();quit;end +if execstr("I = intg(%nan, %nan, f)", "errcatch") <> 264 then bugmes();quit;end diff --git a/scilab/modules/differential_equations/tests/unit_tests/intg.tst b/scilab/modules/differential_equations/tests/unit_tests/intg.tst index 3960534..f2c8bc8 100644 --- a/scilab/modules/differential_equations/tests/unit_tests/intg.tst +++ b/scilab/modules/differential_equations/tests/unit_tests/intg.tst @@ -4,12 +4,11 @@ // // This file is distributed under the same license as the Scilab package. // ============================================================================= - +// // <-- CLI SHELL MODE --> +// // <-- ENGLISH IMPOSED --> -// Run with test_run('differential_equations','intg',['no_check_error_output']) - ilib_verbose(0); // Function written in the Scilab language function y = f(x), y = x*sin(30*x)/sqrt(1-((x/(2*%pi))^2)), endfunction @@ -25,60 +24,63 @@ if abs(exact-I) > 1e-9 then pause, end // Function written in Fortran (a Fortran compiler is required) // define a Fortran function cd TMPDIR; -F=[' double precision function ffun(x)' - ' double precision x, pi' - ' pi = 3.14159265358979312d+0' - ' ffun = x*sin(30.0d+0*x)/sqrt(1.0d+0-(x/(2.0d+0*pi))**2)' - ' return' - ' end']; -mputl(F, fullfile(TMPDIR, 'ffun.f')); +F=[" double precision function ffun(x)" +" double precision x, pi" +" pi = 3.14159265358979312d+0" +" ffun = x*sin(30.0d+0*x)/sqrt(1.0d+0-(x/(2.0d+0*pi))**2)" +" return" +" end"]; +mputl(F, fullfile(TMPDIR, "ffun.f")); // compile the function -l = ilib_for_link('ffun', 'ffun.f', [], 'f'); +l = ilib_for_link("ffun", "ffun.f", [], "f"); // add the function to the working environment -link(l, 'ffun', 'f'); +link(l, "ffun", "f"); // integrate the function -I = intg(0, 2*%pi, 'ffun'); +I = intg(0, 2*%pi, "ffun"); abs(exact-I); if abs(exact-I) > 1e-9 then pause,end // Function written in C (a C compiler is required) // define a C function -C=['#include ' - 'double cfun(double *x)' - '{' - ' double y, pi = 3.14159265358979312;' - ' y = *x/(2.0e0*pi);' - ' return *x*sin(30.0e0**x)/sqrt(1.0e0-y*y);' - '}']; -mputl(C, fullfile(TMPDIR, 'cfun.c')); +C=["#include " +"double cfun(double *x)" +"{" +" double y, pi = 3.14159265358979312;" +" y = *x/(2.0e0*pi);" +" return *x*sin(30.0e0**x)/sqrt(1.0e0-y*y);" +"}"]; +mputl(C, fullfile(TMPDIR, "cfun.c")); // compile the function -l = ilib_for_link('cfun', 'cfun.c', [], 'c'); +l = ilib_for_link("cfun", "cfun.c", [], "c"); // add the function to the working environment -link(l, 'cfun', 'c'); +link(l, "cfun", "c"); // integrate the function -I = intg(0, 2*%pi, 'cfun'); +I = intg(0, 2*%pi, "cfun"); if abs(exact-I) > 1e-9 then pause,end // Test third output argument [i, err, ierr] = intg(0, 1, f); if abs(ierr) <> 0 then pause,end +prot = funcprot(); +funcprot(0); function y = f(x), y = cos(x); endfunction +funcprot(prot); [i, err, ierr] = intg(0, %pi, f); if abs(ierr) <> 2 then pause,end // IEEE compatibility // Error 264: "Wrong value for argument #i: Must not contain NaN or Inf." -if execstr("I = intg(%inf, 0, f)", 'errcatch') <> 264 then pause,end -if execstr("I = intg(-%inf, 0, f)", 'errcatch') <> 264 then pause,end -if execstr("I = intg(%nan, 0, f)", 'errcatch') <> 264 then pause,end -if execstr("I = intg(0, %inf, f)", 'errcatch') <> 264 then pause,end -if execstr("I = intg(0, -%inf, f)", 'errcatch') <> 264 then pause,end -if execstr("I = intg(0, %nan, f)", 'errcatch') <> 264 then pause,end -if execstr("I = intg(%nan, %nan, f)", 'errcatch') <> 264 then pause,end +if execstr("I = intg(%inf, 0, f)", "errcatch") <> 264 then pause,end +if execstr("I = intg(-%inf, 0, f)", "errcatch") <> 264 then pause,end +if execstr("I = intg(%nan, 0, f)", "errcatch") <> 264 then pause,end +if execstr("I = intg(0, %inf, f)", "errcatch") <> 264 then pause,end +if execstr("I = intg(0, -%inf, f)", "errcatch") <> 264 then pause,end +if execstr("I = intg(0, %nan, f)", "errcatch") <> 264 then pause,end +if execstr("I = intg(%nan, %nan, f)", "errcatch") <> 264 then pause,end