summaryrefslogtreecommitdiffstats
path: root/tests/nonRegression/bug2616.sci
blob: 471960d547266edc4f9fefecae88580e00cd2c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// <-- Non-regression test for bug 2616 -->
//
// <-- Bugzilla URL -->
// http://www.scilab.org/cgi-bin/bugzilla_bug_II/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


// Scilab Project - Serge Steer
// Copyright INRIA 2007
// Date : June 2007

BugNumber=2616;
T=[];
//simple case uncompiled 
s=0;for k=1:3,s=s+1;end
T=[T,s<>3];


s=0;for k=(1:3)+1,s=s+1;end
T=[T,s<>3];

s=0;for k=[(1:3) 1],s=s+1;end
T=[T,s<>4];

function s=foo(),s=0;for k=1:3,s=s+1;end,endfunction
T=[T,foo()<>3];

function s=foo(),s=0;for k=(1:3)+1,s=s+1;end,endfunction
T=[T,foo()<>3];

function s=foo(),s=0;for k=[(1:3) 1],s=s+1;end,endfunction
T=[T,foo()<>4];

//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')
T=[T,ierr<>0|s<>200000];

//should produce a stacksize error
ierr=execstr('s=0;for k=(1:200000)+1,s=s+1;end','errcatch')
T=[T,ierr<>17];

ierr=execstr('s=0;for k=[(1:200000) 1],s=s+1;end','errcatch')
T=[T,ierr<>17];

function s=foo(),s=0;for k=1:200000,s=s+1;end,endfunction
ierr=execstr('s=foo();','errcatch');
T=[T,ierr<>0|s<>200000];


function s=foo(),s=0;for k=1+(1:200000),s=s+1;end,endfunction
ierr=execstr('s=foo();','errcatch');
T=[T,ierr<>17];
stacksize(old(1))

affich_result(and(~T),BugNumber) ;