summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSerge Steer <serge.steer@scilab.org>2007-01-17 16:30:28 +0000
committerSerge Steer <serge.steer@scilab.org>2007-01-17 16:30:28 +0000
commitfce4f27d04664b238b23f8e6b63a47e87e4f106d (patch)
treebe89c7457008e8b7834baf845e533c98b709aa2f /tests
parentc95f28532726f3fe749f8e3012993830f5ebf9a1 (diff)
downloadscilab-fce4f27d04664b238b23f8e6b63a47e87e4f106d.zip
scilab-fce4f27d04664b238b23f8e6b63a47e87e4f106d.tar.gz
bug 2284 fixed
Diffstat (limited to 'tests')
-rw-r--r--tests/nonRegression/bug1469.sci183
-rw-r--r--tests/nonRegression/bug2277.sci20
-rw-r--r--tests/nonRegression/bug2284.sci19
-rw-r--r--tests/nonRegression/list_nonreg.txt5
4 files changed, 225 insertions, 2 deletions
diff --git a/tests/nonRegression/bug1469.sci b/tests/nonRegression/bug1469.sci
new file mode 100644
index 0000000..068188a
--- /dev/null
+++ b/tests/nonRegression/bug1469.sci
@@ -0,0 +1,183 @@
1// Non-regression test file for bug 1469
2// Copyright INRIA
3// Scilab Project - Serge Steer
4// Copyright INRIA 2006
5// Date : 23 novembre 2006
6
7mode(-1)
8//test of line numbering in functions, handling initial comments
9
10function foo,endfunction
11L=macr2lst(foo);
12R1=L(4)(1)=='15'&size(L)==6
13clear foo;
14
15function foo,,endfunction
16L=macr2lst(foo);
17R2=L(4)(1)=='15'&size(L)==6
18clear foo;
19
20function foo(),endfunction
21L=macr2lst(foo);
22R3=L(4)(1)=='15'&size(L)==6
23clear foo;
24
25function foo(),a=1,endfunction
26L=macr2lst(foo);
27R4=L(4)(1)=='6'&size(L)==8
28clear foo;
29
30function foo
31endfunction
32L=macr2lst(foo);
33R5=L(4)(1)=='15'&size(L)==6
34clear foo;
35
36
37function foo,
38endfunction
39L=macr2lst(foo);
40R6=L(4)(1)=='15'&size(L)==6
41clear foo;
42
43
44function foo//ZZZZ
45endfunction
46L=macr2lst(foo);
47R7=L(4)(1)=='31'&L(5)(1)=='15'&size(L)==7
48clear foo;
49
50
51function foo,//ZZZZ
52endfunction
53L=macr2lst(foo);
54R8=L(4)(1)=='31'&L(5)(1)=='15'&size(L)==7
55clear foo;
56
57
58function foo
59//ZZZZ
60endfunction
61L=macr2lst(foo);
62R9=L(4)(1)=='15'&L(5)(1)=='31'&size(L)==8
63clear foo;
64
65
66function foo,//ZZZZ
67 a=1
68endfunction
69L=macr2lst(foo);
70R10=L(4)(1)=='31'&L(5)(1)=='15'&L(6)(1)=='6'&size(L)==10
71clear foo;
72
73
74function loc=foo,[l,w]=where(),loc=l(1),endfunction
75R11= and(foo()==1)
76clear foo;
77
78
79function loc=foo,//ZZZZ
80 [l,w]=where(),loc=l(1)
81endfunction
82R12= and(foo()==2)
83clear foo;
84
85function loc=foo
86//ZZZZ
87 [l,w]=where(),loc=l(1)
88endfunction
89R13= and(foo()==3)
90clear foo;
91
92
93function loc=foo1()
94 [l,w]=where(),loc=l(1)
95 function loc=foo3(loc)
96 [l,w]=where(),loc=[loc,l(1:2)']
97 endfunction
98 [l,w]=where(),loc=[loc,l(1)]
99 loc=foo3(loc)
100endfunction
101R14= and(foo1()==[2,6,2,7])
102clear foo1;
103
104function loc=foo1()//ZZZZZZZ
105 [l,w]=where(),loc=l(1)
106 function loc=foo3(loc)
107 [l,w]=where(),loc=[loc,l(1:2)']
108 endfunction
109 [l,w]=where(),loc=[loc,l(1)]
110 loc=foo3(loc)
111endfunction
112L=macr2lst(foo1);
113R15=and(foo1()==[2,6,2,7])&(L(4)(1)=='31')&(L(5)=='15')
114clear foo1;
115
116
117function loc=foo1()
118 //ZZZZZZZ
119 [l,w]=where(),loc=l(1)
120 function loc=foo3(loc)
121 [l,w]=where(),loc=[loc,l(1:2)']
122 endfunction
123 [l,w]=where(),loc=[loc,l(1)]
124 loc=foo3(loc)
125endfunction
126L=macr2lst(foo1);
127R16=and(foo1()==[3,7,2,8])&(L(4)=='15')&(L(5)(1)=='31')
128clear foo1;
129
130
131//pb execution des macros non compilee
132deff('y=foo(a,b,c)','y=a+b+c','n')
133R17=foo('aaa','bbb','cc')=='aaabbbcc'
134clear foo
135
136deff('y=foo(a,b,c)',['','y=a+b+c'],'n')
137R18=foo('aaa','bbb','cc')=='aaabbbcc'
138
139comp(foo)
140R19=foo('aaa','bbb','cc')=='aaabbbcc'
141clear foo
142
143//function definition nested in a or loop!
144z=0;R20=%t
145for k=1:2
146 function y=foo()
147 y=k
148 endfunction
149 L=macr2lst(foo);
150 R20=R20&(L(4)=='15')&(L(5)(1)=='2');
151 z=z+foo();
152end
153
154R20=R20&z==3
155
156
157
158//test avec getf
159t=['function foo,//ZZZZ'
160' a=1'
161'endfunction'];
162mputl(t,TMPDIR+'/foo.sci');
163getf(TMPDIR+'/foo.sci')
164L=macr2lst(foo); //getf ignores declaration line comments
165R21=L(4)(1)=='15'&L(5)(1)=='6'&size(L)==9
166clear foo;
167
168
169t=['function foo'
170'//ZZZZ'
171' a=1'
172'endfunction'];
173mputl(t,TMPDIR+'/foo.sci');
174getf(TMPDIR+'/foo.sci')
175L=macr2lst(foo); //getf ignores declaration line comments
176R22=L(4)(1)=='15'&L(5)(1)=='31'&L(6)(1)=='15'&size(L)==11
177clear foo;
178
179
180
181
182R=[R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15,R16,R17,R18,R19,R20,R21,R22]
183affich_result(and(R),1469);
diff --git a/tests/nonRegression/bug2277.sci b/tests/nonRegression/bug2277.sci
new file mode 100644
index 0000000..4a692c0
--- /dev/null
+++ b/tests/nonRegression/bug2277.sci
@@ -0,0 +1,20 @@
1// Non-regression test file for bug 2277
2// Copyright INRIA
3// Scilab Project - S. Steer
4// Copyright INRIA
5// Date : 17 Janv 2007
6
7mode(-1);
8clear;
9
10
11ij = [1,3;1,7;3,3;4,4;5,3;6,10;7,1;7,9;8,10;9,6;9,7;9,9;10,10] ;
12v=[1 0 0 4:13]'*%i;
13A=sparse(ij,v,[10 10]);
14[ij2,v2,mn]=spget(A);
15r= and(v2==[1 4:13]'*%i) ;
16ij(2:3,:)=[];
17r=r&and(ij==ij2);
18affich_result(r,2277);
19
20clear;
diff --git a/tests/nonRegression/bug2284.sci b/tests/nonRegression/bug2284.sci
new file mode 100644
index 0000000..e574172
--- /dev/null
+++ b/tests/nonRegression/bug2284.sci
@@ -0,0 +1,19 @@
1// Non-regression test file for bug 2284
2// Copyright INRIA
3// Scilab Project - S. Steer
4// Copyright INRIA
5// Date : 17 Janv 2007
6
7mode(-1);
8clear;
9s1=-9.999999999;
10s2=0.999999999999;
11
12print(TMPDIR+'/bug2284',s1,s2)
13txt=mgetl(TMPDIR+'/bug2284')
14r=and(txt== [" s2 =";" ";" 1. ";" s1 =";" ";" -10. "])
15mdelete(TMPDIR+'/bug2284')
16
17affich_result(r,2284);
18
19clear;
diff --git a/tests/nonRegression/list_nonreg.txt b/tests/nonRegression/list_nonreg.txt
index 6644231..2b452c6 100644
--- a/tests/nonRegression/list_nonreg.txt
+++ b/tests/nonRegression/list_nonreg.txt
@@ -156,5 +156,6 @@
1562162 1562162
1572181 1572181
1582264 1582264
1592268 1592266
1602270 1602277
1612284