diff options
Diffstat (limited to 'modules/double/tests')
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_10001.dia.ref | 31 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_10001.tst | 35 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_12657.dia.ref | 38 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_12657.tst | 44 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_1529.dia.ref | 16 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_1529.tst | 21 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_2429.dia.ref | 16 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_2429.tst | 22 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_2616.dia.ref | 48 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_2616.tst | 64 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_3006.dia.ref | 26 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_3006.tst | 30 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_8300.dia.ref | 25 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_8300.tst | 25 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_8745.dia.ref | 42 | ||||
-rwxr-xr-x | modules/double/tests/nonreg_tests/bug_8745.tst | 44 |
16 files changed, 527 insertions, 0 deletions
diff --git a/modules/double/tests/nonreg_tests/bug_10001.dia.ref b/modules/double/tests/nonreg_tests/bug_10001.dia.ref new file mode 100755 index 000000000..78bf4c12d --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_10001.dia.ref @@ -0,0 +1,31 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - INRIA - Serge Steer +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 10001 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10001 +// +// <-- Short Description --> +// %inf:%inf crashes Scilab +assert_checkequal(1:0:1,[]); +assert_checkequal(1:0:2,[]); +assert_checkequal(2:0:1,[]); +assert_checkequal(%inf:0:%inf,[]); +assert_checkequal(-%inf:0:%inf,[]); +assert_checkequal(1:0:%inf,[]); +assert_checkequal(%inf:0:1,[]); +assert_checkequal(%nan:1:3,%nan); +assert_checkequal(1:%nan:3,%nan); +assert_checkequal(1:%nan,%nan); +assert_checkequal(%inf:%inf,%nan); +assert_checkequal(-%inf:1:%inf,%nan); +assert_checkequal(%inf:1,[]); +assert_checkequal(1:-%inf,[]); +assert_checkequal(%inf:-1:1,%nan); diff --git a/modules/double/tests/nonreg_tests/bug_10001.tst b/modules/double/tests/nonreg_tests/bug_10001.tst new file mode 100755 index 000000000..2eb1c5319 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_10001.tst @@ -0,0 +1,35 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - INRIA - Serge Steer +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 10001 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10001 +// +// <-- Short Description --> +// %inf:%inf crashes Scilab +assert_checkequal(1:0:1,[]); +assert_checkequal(1:0:2,[]); +assert_checkequal(2:0:1,[]); +assert_checkequal(%inf:0:%inf,[]); +assert_checkequal(-%inf:0:%inf,[]); +assert_checkequal(1:0:%inf,[]); +assert_checkequal(%inf:0:1,[]); + +assert_checkequal(%nan:1:3,%nan); +assert_checkequal(1:%nan:3,%nan); +assert_checkequal(1:%nan,%nan); + +assert_checkequal(%inf:%inf,%nan); +assert_checkequal(-%inf:1:%inf,%nan); + +assert_checkequal(%inf:1,[]); +assert_checkequal(1:-%inf,[]); +assert_checkequal(%inf:-1:1,%nan); + diff --git a/modules/double/tests/nonreg_tests/bug_12657.dia.ref b/modules/double/tests/nonreg_tests/bug_12657.dia.ref new file mode 100755 index 000000000..e32c9fbf1 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_12657.dia.ref @@ -0,0 +1,38 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 12657 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=12657 +// +// <-- Short Description --> +// Computation of v1.^v2 was not done in place, +// when v1 and v2 are real arrays, v1 >= 0 and v2 integer. +// <-- ENGLISH IMPOSED --> +// Run with test_run('double', 'bug_12657', ['no_check_error_output']) +// Checking that the results for said cases are still ok +assert_checkequal([0.5 2; 100000 4.5578].^2, [0.25 4; 1e10 20.7735408400000025608]); +assert_checkequal([2.5].^[2 5; 10 5], [6.25 97.65625; 9536.7431640625 97.65625]); +assert_checkequal([0.5 2; 100000 4.5578].^[2 5; 5 2], [0.25 32; 1e25 20.7735408400000025608]); +// Check that IEEE compatibility is still assured +assert_checkequal([%inf %nan; %inf %nan].^%inf, [%inf %nan; %inf %nan]); +assert_checkequal([%inf].^[%inf %nan; %nan %inf], [%inf %nan; %nan %inf]); +assert_checkequal([%inf %nan; %nan %inf].^[%inf %nan; %inf %nan], [%inf %nan; %nan %nan]); +// Now, checking that computation is done in place +stacksize(2.5e6); +v = rand(1, 1e6); +v.^2; +// Checking the 1e5 first values of the result +assert_checktrue(and(sqrt(ans(1:1e5)) == v(1:1e5))); +// Getting random integer values +v = floor(10*v); +[2].^v; +// Checking the 1e5 first values of the result +res = ans(1:1e5); +v = v(1:1e5); +assert_checktrue(and(nthroot(res(find(v<>0)), v(find(v<>0))) == 2)); +assert_checktrue(and(isnan(nthroot(res(find(v==0)), v(find(v==0)))))); diff --git a/modules/double/tests/nonreg_tests/bug_12657.tst b/modules/double/tests/nonreg_tests/bug_12657.tst new file mode 100755 index 000000000..d3a9c05b3 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_12657.tst @@ -0,0 +1,44 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 12657 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=12657 +// +// <-- Short Description --> +// Computation of v1.^v2 was not done in place, +// when v1 and v2 are real arrays, v1 >= 0 and v2 integer. + +// <-- ENGLISH IMPOSED --> + +// Run with test_run('double', 'bug_12657', ['no_check_error_output']) + +// Checking that the results for said cases are still ok +assert_checkequal([0.5 2; 100000 4.5578].^2, [0.25 4; 1e10 20.7735408400000025608]); +assert_checkequal([2.5].^[2 5; 10 5], [6.25 97.65625; 9536.7431640625 97.65625]); +assert_checkequal([0.5 2; 100000 4.5578].^[2 5; 5 2], [0.25 32; 1e25 20.7735408400000025608]); + +// Check that IEEE compatibility is still assured +assert_checkequal([%inf %nan; %inf %nan].^%inf, [%inf %nan; %inf %nan]); +assert_checkequal([%inf].^[%inf %nan; %nan %inf], [%inf %nan; %nan %inf]); +assert_checkequal([%inf %nan; %nan %inf].^[%inf %nan; %inf %nan], [%inf %nan; %nan %nan]); + +// Now, checking that computation is done in place +stacksize(2.5e6); +v = rand(1, 1e6); +v.^2; +// Checking the 1e5 first values of the result +assert_checktrue(and(sqrt(ans(1:1e5)) == v(1:1e5))); +// Getting random integer values +v = floor(10*v); +[2].^v; +// Checking the 1e5 first values of the result +res = ans(1:1e5); +v = v(1:1e5); +assert_checktrue(and(nthroot(res(find(v<>0)), v(find(v<>0))) == 2)); +assert_checktrue(and(isnan(nthroot(res(find(v==0)), v(find(v==0)))))); diff --git a/modules/double/tests/nonreg_tests/bug_1529.dia.ref b/modules/double/tests/nonreg_tests/bug_1529.dia.ref new file mode 100755 index 000000000..561e5e567 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_1529.dia.ref @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Vincent COUVERT +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 1529 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=1529 +// +// <-- Short Description --> +// The product 0.0 * %inf provides the incorrect value 0.0, +// but the product %inf * 0.0 provides the correct value %nan. +if ~isnan(0.0*%inf) then bugmes();quit;end +if ~isnan(%inf*0.0) then bugmes();quit;end diff --git a/modules/double/tests/nonreg_tests/bug_1529.tst b/modules/double/tests/nonreg_tests/bug_1529.tst new file mode 100755 index 000000000..1646d114a --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_1529.tst @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Vincent COUVERT +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- NOT FIXED --> +// +// <-- Non-regression test for bug 1529 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=1529 +// +// <-- Short Description --> +// The product 0.0 * %inf provides the incorrect value 0.0, +// but the product %inf * 0.0 provides the correct value %nan. + +if ~isnan(0.0*%inf) then pause,end + +if ~isnan(%inf*0.0) then pause,end diff --git a/modules/double/tests/nonreg_tests/bug_2429.dia.ref b/modules/double/tests/nonreg_tests/bug_2429.dia.ref new file mode 100755 index 000000000..2010653cc --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_2429.dia.ref @@ -0,0 +1,16 @@ +// <-- Non-regression test for bug 2429 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2429 +// +// <-- Short Description --> +// Implicit vector in for loop are allocated +// Copyright INRIA +// Scilab Project - Serge Steer +// Copyright INRIA 2007 +// Date : June 2007 +S=stacksize(); +function test(),for k=1:3d5,end,endfunction +stacksize(2d5) +if execstr('test()','errcatch') <> 0 then bugmes();quit;end +stacksize(S(1)) diff --git a/modules/double/tests/nonreg_tests/bug_2429.tst b/modules/double/tests/nonreg_tests/bug_2429.tst new file mode 100755 index 000000000..1359af80d --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_2429.tst @@ -0,0 +1,22 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Serge STEER <serge.steer@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 2429 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2429 +// +// <-- Short Description --> +// Implicit vector in for loop are allocated + +S=stacksize(); + +function test(),for k=1:3d5,end,endfunction + +stacksize(2d5) +if execstr('test()','errcatch') <> 0 then pause,end +stacksize(S(1)) diff --git a/modules/double/tests/nonreg_tests/bug_2616.dia.ref b/modules/double/tests/nonreg_tests/bug_2616.dia.ref new file mode 100755 index 000000000..18a869523 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_2616.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Serge STEER <serge.steer@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 2616 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2616 +// +// <-- Short Description --> +// "eye variable undefined in this context" wrongly reported when a loop range is +// defined concatenating ranges, inside a function +T=[]; +//simple case uncompiled +s=0;for k=1:3,s=s+1;end +if s<>3 then bugmes();quit;end +s=0;for k=(1:3)+1,s=s+1;end +if s<>3 then bugmes();quit;end +s=0;for k=[(1:3) 1],s=s+1;end +if s<>4 then bugmes();quit;end +function s=foo1(),s=0;for k=1:3,s=s+1;end,endfunction +if foo1()<>3 then bugmes();quit;end +function s=foo2(),s=0;for k=(1:3)+1,s=s+1;end,endfunction +if foo2()<>3 then bugmes();quit;end +function s=foo3(),s=0;for k=[(1:3) 1],s=s+1;end,endfunction +if foo3()<>4 then bugmes();quit;end +//check if implicit vector is created or not +old=stacksize(); +stacksize(180000); +//should evaluate +ierr=execstr('s=0;for k=1:200000,s=s+1;end','errcatch'); +if ierr<>0 then bugmes();quit;end +if s<>200000 then bugmes();quit;end +//should produce a stacksize error +ierr=execstr('s=0;for k=(1:200000)+1,s=s+1;end','errcatch'); +if ierr<>17 then bugmes();quit;end +ierr=execstr('s=0;for k=[(1:200000) 1],s=s+1;end','errcatch'); +if ierr<>17 then bugmes();quit;end +function s=foo4(),s=0;for k=1:200000,s=s+1;end,endfunction +ierr=execstr('s=foo4();','errcatch'); +if ierr<>0 then bugmes();quit;end +if s<>200000 then bugmes();quit;end +function s=foo5(),s=0;for k=1+(1:200000),s=s+1;end,endfunction +ierr=execstr('s=foo5();','errcatch'); +if ierr<>17 then bugmes();quit;end +stacksize(old(1)) diff --git a/modules/double/tests/nonreg_tests/bug_2616.tst b/modules/double/tests/nonreg_tests/bug_2616.tst new file mode 100755 index 000000000..4c87b64d7 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_2616.tst @@ -0,0 +1,64 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Serge STEER <serge.steer@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 2616 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2616 +// +// <-- Short Description --> +// "eye variable undefined in this context" wrongly reported when a loop range is +// defined concatenating ranges, inside a function + +T=[]; + +//simple case uncompiled +s=0;for k=1:3,s=s+1;end +if s<>3 then pause,end + + +s=0;for k=(1:3)+1,s=s+1;end +if s<>3 then pause,end + +s=0;for k=[(1:3) 1],s=s+1;end +if s<>4 then pause,end + +function s=foo1(),s=0;for k=1:3,s=s+1;end,endfunction +if foo1()<>3 then pause,end + +function s=foo2(),s=0;for k=(1:3)+1,s=s+1;end,endfunction +if foo2()<>3 then pause,end + +function s=foo3(),s=0;for k=[(1:3) 1],s=s+1;end,endfunction +if foo3()<>4 then pause,end + +//check if implicit vector is created or not +old=stacksize(); +stacksize(180000); + +//should evaluate +ierr=execstr('s=0;for k=1:200000,s=s+1;end','errcatch'); +if ierr<>0 then pause,end +if s<>200000 then pause,end + +//should produce a stacksize error +ierr=execstr('s=0;for k=(1:200000)+1,s=s+1;end','errcatch'); +if ierr<>17 then pause,end + +ierr=execstr('s=0;for k=[(1:200000) 1],s=s+1;end','errcatch'); +if ierr<>17 then pause,end + +function s=foo4(),s=0;for k=1:200000,s=s+1;end,endfunction +ierr=execstr('s=foo4();','errcatch'); +if ierr<>0 then pause,end +if s<>200000 then pause,end + +function s=foo5(),s=0;for k=1+(1:200000),s=s+1;end,endfunction +ierr=execstr('s=foo5();','errcatch'); +if ierr<>17 then pause,end + +stacksize(old(1)) diff --git a/modules/double/tests/nonreg_tests/bug_3006.dia.ref b/modules/double/tests/nonreg_tests/bug_3006.dia.ref new file mode 100755 index 000000000..19688c7e8 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_3006.dia.ref @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Serge STEER <serge.steer@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 3006 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3006 +// +// <-- Short Description --> +// submatrix assignment impossible when the matrix is indexed with a boolean array of falses +a=[1 2;3 4];a_ref=a; +a(1,[%f %f])=[]; +if or(a<>a_ref) then bugmes();quit;end +a([%f %f],1)=[]; +if or(a<>a_ref) then bugmes();quit;end +a([%f %f],[%f %f])=[]; +if or(a<>a_ref) then bugmes();quit;end +a(1,$:1)=[]; +if or(a<>a_ref) then bugmes();quit;end +a($:1,1)=[]; +if or(a<>a_ref) then bugmes();quit;end +a($:1,$:1)=[]; +if or(a<>a_ref) then bugmes();quit;end diff --git a/modules/double/tests/nonreg_tests/bug_3006.tst b/modules/double/tests/nonreg_tests/bug_3006.tst new file mode 100755 index 000000000..12c7dd127 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_3006.tst @@ -0,0 +1,30 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Serge STEER <serge.steer@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- Non-regression test for bug 3006 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3006 +// +// <-- Short Description --> +// submatrix assignment impossible when the matrix is indexed with a boolean array of falses + +a=[1 2;3 4];a_ref=a; + +a(1,[%f %f])=[]; +if or(a<>a_ref) then pause,end +a([%f %f],1)=[]; +if or(a<>a_ref) then pause,end +a([%f %f],[%f %f])=[]; +if or(a<>a_ref) then pause,end + +a(1,$:1)=[]; +if or(a<>a_ref) then pause,end +a($:1,1)=[]; +if or(a<>a_ref) then pause,end +a($:1,$:1)=[]; +if or(a<>a_ref) then pause,end diff --git a/modules/double/tests/nonreg_tests/bug_8300.dia.ref b/modules/double/tests/nonreg_tests/bug_8300.dia.ref new file mode 100755 index 000000000..49a13002d --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_8300.dia.ref @@ -0,0 +1,25 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 8300 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8300 +// +// <-- Short Description --> +// a(48400, 48400) = 0 crashed scilab +if execstr("b((2^32-1)/3,3) = 10;", "errcatch") == 0 then bugmes();quit;end +clear b; +if execstr("a(48400, 48400) = 0;", "errcatch") == 0 then bugmes();quit;end +X = 10; +if execstr("a(48400, 48400) = X;", "errcatch") == 0 then bugmes();quit;end +clear X; +stacksize('max'); +if execstr("b((2^32-1)/3,3) = 0;", "errcatch") == 0 then bugmes();quit;end +clear b; diff --git a/modules/double/tests/nonreg_tests/bug_8300.tst b/modules/double/tests/nonreg_tests/bug_8300.tst new file mode 100755 index 000000000..e7b386288 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_8300.tst @@ -0,0 +1,25 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 8300 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8300 +// +// <-- Short Description --> +// a(48400, 48400) = 0 crashed scilab +if execstr("b((2^32-1)/3,3) = 10;", "errcatch") == 0 then pause,end +clear b; +if execstr("a(48400, 48400) = 0;", "errcatch") == 0 then pause,end +X = 10; +if execstr("a(48400, 48400) = X;", "errcatch") == 0 then pause,end +clear X; +stacksize('max'); +if execstr("b((2^32-1)/3,3) = 0;", "errcatch") == 0 then pause,end +clear b; diff --git a/modules/double/tests/nonreg_tests/bug_8745.dia.ref b/modules/double/tests/nonreg_tests/bug_8745.dia.ref new file mode 100755 index 000000000..d9f38c0e0 --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_8745.dia.ref @@ -0,0 +1,42 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// +// <-- Non-regression test for bug 8745 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8745 +// +// <-- Short Description --> +// +// Extracting from an empty matrix automatically returns an empty matrix +A=[]; +errmsg=msprintf(_("Invalid index.\n")); +assert_checkerror("A(-1)", errmsg); +assert_checkerror("A(cos)", errmsg); +assert_checkerror("A(""x"")", errmsg); +assert_checkequal(A(1:$), []); +assert_checkequal(A($), []); +assert_checkequal(A(%t), []); +assert_checkerror("A(-1, -1)", errmsg); +assert_checkerror("A(1, -1)", errmsg); +assert_checkerror("A(-1, 1)", errmsg); +assert_checkerror("A(cos, cos)", errmsg); +assert_checkerror("A(cos, 1)", errmsg); +assert_checkerror("A(1, cos)", errmsg); +assert_checkerror("A(""x"", ""x"")", errmsg); +assert_checkerror("A(1, ""x"")", errmsg); +assert_checkerror("A(""x"", 1)", errmsg); +assert_checkequal(A(1:$,1:$), []); +assert_checkequal(A(1:$,1), []); +assert_checkequal(A(1, 1:$), []); +assert_checkequal(A($, $), []); +assert_checkequal(A(1, $), []); +assert_checkequal(A($, 1), []); +assert_checkequal(A(%t, %t), []); +assert_checkequal(A(1, %t), []); +assert_checkequal(A(%t, 1), []); diff --git a/modules/double/tests/nonreg_tests/bug_8745.tst b/modules/double/tests/nonreg_tests/bug_8745.tst new file mode 100755 index 000000000..241eef17a --- /dev/null +++ b/modules/double/tests/nonreg_tests/bug_8745.tst @@ -0,0 +1,44 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// +// <-- Non-regression test for bug 8745 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8745 +// +// <-- Short Description --> +// +// Extracting from an empty matrix automatically returns an empty matrix + +A=[]; +errmsg=msprintf(_("Invalid index.\n")); +assert_checkerror("A(-1)", errmsg); +assert_checkerror("A(cos)", errmsg); +assert_checkerror("A(""x"")", errmsg); +assert_checkequal(A(1:$), []); +assert_checkequal(A($), []); +assert_checkequal(A(%t), []); + +assert_checkerror("A(-1, -1)", errmsg); +assert_checkerror("A(1, -1)", errmsg); +assert_checkerror("A(-1, 1)", errmsg); +assert_checkerror("A(cos, cos)", errmsg); +assert_checkerror("A(cos, 1)", errmsg); +assert_checkerror("A(1, cos)", errmsg); +assert_checkerror("A(""x"", ""x"")", errmsg); +assert_checkerror("A(1, ""x"")", errmsg); +assert_checkerror("A(""x"", 1)", errmsg); +assert_checkequal(A(1:$,1:$), []); +assert_checkequal(A(1:$,1), []); +assert_checkequal(A(1, 1:$), []); +assert_checkequal(A($, $), []); +assert_checkequal(A(1, $), []); +assert_checkequal(A($, 1), []); +assert_checkequal(A(%t, %t), []); +assert_checkequal(A(1, %t), []); +assert_checkequal(A(%t, 1), []); |