summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Cornet <allan.cornet@scilab.org>2007-04-21 05:13:43 +0000
committerAllan Cornet <allan.cornet@scilab.org>2007-04-21 05:13:43 +0000
commitb5488f64abc8db8c106c6370d7963b8ae33f2479 (patch)
tree99473f2921c9827fc2b3218a770b56e1a9f412ec /tests
parent2a4d1b46fcc59186f9aa147e80bec1928f37bc66 (diff)
downloadscilab-b5488f64abc8db8c106c6370d7963b8ae33f2479.zip
scilab-b5488f64abc8db8c106c6370d7963b8ae33f2479.tar.gz
update test
Diffstat (limited to 'tests')
-rw-r--r--tests/basic_tests/call.dia.ref232
-rw-r--r--tests/basic_tests/call.tst123
-rw-r--r--tests/basic_tests/maketests.sci1
-rw-r--r--tests/basic_tests/pause.dia.ref6
4 files changed, 4 insertions, 358 deletions
diff --git a/tests/basic_tests/call.dia.ref b/tests/basic_tests/call.dia.ref
deleted file mode 100644
index 6d7c8c2..0000000
--- a/tests/basic_tests/call.dia.ref
+++ /dev/null
@@ -1,232 +0,0 @@
1
2// Copyright INRIA
3
4// Testing interface of programs put in SCIDIR/routines/default/Ex-fort.f
5
6//
7
8// Test 1
9
10// ======================================================
11
12// Corresponding to the following Fortran code inserted in
13
14// SCIDIR/routines/default/Ex-fort.f.
15
16//
17
18//
19
20// subroutine foobar1(fname)
21
22// character*(*) fname
23
24// logical getrhsvar, createvar, putlhsvar
25
26// include '../../routines/stack.h'
27
28//c
29
30// nbvars=0
31
32// minrhs=5
33
34// maxrhs=5
35
36// minlhs=1
37
38// maxlhs=4
39
40//c
41
42// if(.not.((rhs.ge.minrhs).and.(rhs.le.maxrhs))) then
43
44// call erro('wrong number of rhs arguments')
45
46// return
47
48// endif
49
50// if(.not.((lhs.ge.minlhs).and.(lhs.le.maxlhs))) then
51
52// call erro('wrong number of lhs arguments')
53
54// return
55
56// endif
57
58//c
59
60//c when using fort the first parameter is the function name
61
62// if(.not.getrhsvar(1,'c',m1,n1,l1)) return
63
64// if(.not.getrhsvar(2,'c',m2,n2,l2)) return
65
66// if(.not.getrhsvar(3,'i',m3,n3,l3)) return
67
68// if(.not.getrhsvar(4,'r',m4,n4,l4)) return
69
70// if(.not.getrhsvar(5,'d',m5,n5,l5)) return
71
72//c
73
74// if(.not.createvar(6,'d',m5,n5,l6)) return
75
76// if(.not.createvar(7,'d',m5,n5,l7)) return
77
78//c
79
80// call foubare(cstk(l2:l2+m2*n2),istk(l3),n3*m3,sstk(l4),n4*m4,
81
82// $ stk(l5),m5,n5,stk(l6),stk(l7))
83
84//c
85
86// lhsvar(1)=3
87
88// lhsvar(2)=4
89
90// lhsvar(3)=5
91
92// lhsvar(4)=6
93
94// if(.not.putlhsvar()) return
95
96//c
97
98// end
99
100//
101
102//Routine call in Scilab
103
104x =[1,2,3];y =[1,2,3;4,5,6];z=[10,11;12,13];
105
106[a,b,c,d]=call('foobar1','mul', x, y, z);
107
108// tests
109
110if norm(a-2*x,1) > %eps then bugmes();quit;end
111
112if norm(b-2*y,1) > %eps then bugmes();quit;end
113
114if norm(c-2*z,1) > %eps then bugmes();quit;end
115
116[mc,nc]=size(c);
117
118w=zeros(c);
119
120for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
121
122if norm(d-(2*z.*w),1) > %eps then bugmes();quit;end
123
124
125[a,b,c,d]=call('foobar1','add', x, y, z);
126
127if norm(a-(2+x),1) > %eps then bugmes();quit;end
128
129if norm(b-(2+y),1) > %eps then bugmes();quit;end
130
131if norm(c-(2+z),1) > %eps then bugmes();quit;end
132
133w=zeros(c);
134
135for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
136
137if norm(d-(2+z+w),1) > %eps then bugmes();quit;end
138
139//
140
141//
142
143// Test 2
144
145// ======================================================
146
147// Routine foubare is in SCIDIR/default/Ex-fort.f
148
149// and "foubare" appears in SCIDIR/default/Flist
150
151// This is equivalent to -->link("foobar.o","foubare");
152
153// Routine call from scilab:
154
155
156a =[1,2,3];b =[1,2,3;4,5,6];c =[10,11;12,13];
157
158[ma,na]=size(a);ia=ma*na;
159
160[mb,nb]=size(b);ib=mb*nb;
161
162[mc,nc]=size(c);ic=mc*nc;
163
164md=mc;nd=nc;
165
166[as,bs,cs,ds]=call('foubare','mul',1,'c',a,2,'i',ia,3,'i',b,4,'r',ib,5,'i',...
167 c,6,'d',mc,7,'i',nc,8,'i',...
168 'out',[ma,na],2,'i',[mb,nb],4,'r',[mc,nc],6,'d',...
169 [md,nd],9,'d',[mc,nc],10,'d');
170
171if norm(as-2*a,1) > %eps then bugmes();quit;end
172
173if norm(bs-2*b,1) > %eps then bugmes();quit;end
174
175if norm(cs-2*c,1) > %eps then bugmes();quit;end
176
177[mc,nc]=size(c);
178
179w=zeros(c);
180
181for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
182
183if norm(ds-(2*c.*w),1) > %eps then bugmes();quit;end
184
185
186md=mc;nd=nc;
187
188[as,bs,cs,ds]=call('foubare','add',1,'c',a,2,'i',ia,3,'i',b,4,'r',ib,5,'i',...
189 c,6,'d',mc,7,'i',nc,8,'i',...
190 'out',[ma,na],2,'i',[mb,nb],4,'r',[mc,nc],6,'d',...
191 [md,nd],9,'d',[mc,nc],10,'d');
192
193if norm(as-(2+a),1) > %eps then bugmes();quit;end
194
195if norm(bs-(2+b),1) > %eps then bugmes();quit;end
196
197if norm(cs-(2+c),1) > %eps then bugmes();quit;end
198
199[mc,nc]=size(c);
200
201w=zeros(c);
202
203for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
204
205if norm(ds-(2+c+w),1) > %eps then bugmes();quit;end
206
207
208//other valid call (output parameters 1 3 and 5 are also inputs)
209
210a =[1,2,3];b =[1,2,3;4,5,6];c =[10,11;12,13];md=mc;nd=nc;mul=str2code('mul');
211
212[as,bs,cs,ds]=call('foubare','mul',1,'c',a,2,'i',ia,3,'i',b,4,'r',ib,5,'i',...
213 c,6,'d',mc,7,'i',nc,8,'i',...
214 'out',2,4,6,...
215 [md,nd],9,'d',[mc,nc],10,'d');
216
217if norm(as-2*a,1) > %eps then bugmes();quit;end
218
219if norm(bs-2*b,1) > %eps then bugmes();quit;end
220
221if norm(cs-2*c,1) > %eps then bugmes();quit;end
222
223[mc,nc]=size(c);
224
225w=zeros(c);
226
227for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
228
229if norm(ds-(2*c.*w),1) > %eps then bugmes();quit;end
230
231
232
diff --git a/tests/basic_tests/call.tst b/tests/basic_tests/call.tst
deleted file mode 100644
index e266440..0000000
--- a/tests/basic_tests/call.tst
+++ /dev/null
@@ -1,123 +0,0 @@
1// Copyright INRIA
2// Testing interface of programs put in SCIDIR/routines/default/Ex-fort.f
3//
4// Test 1
5// ======================================================
6// Corresponding to the following Fortran code inserted in
7// SCIDIR/routines/default/Ex-fort.f.
8//
9//
10// subroutine foobar1(fname)
11// character*(*) fname
12// logical getrhsvar, createvar, putlhsvar
13// include '../../routines/stack.h'
14//c
15// nbvars=0
16// minrhs=5
17// maxrhs=5
18// minlhs=1
19// maxlhs=4
20//c
21// if(.not.((rhs.ge.minrhs).and.(rhs.le.maxrhs))) then
22// call erro('wrong number of rhs arguments')
23// return
24// endif
25// if(.not.((lhs.ge.minlhs).and.(lhs.le.maxlhs))) then
26// call erro('wrong number of lhs arguments')
27// return
28// endif
29//c
30//c when using fort the first parameter is the function name
31// if(.not.getrhsvar(1,'c',m1,n1,l1)) return
32// if(.not.getrhsvar(2,'c',m2,n2,l2)) return
33// if(.not.getrhsvar(3,'i',m3,n3,l3)) return
34// if(.not.getrhsvar(4,'r',m4,n4,l4)) return
35// if(.not.getrhsvar(5,'d',m5,n5,l5)) return
36//c
37// if(.not.createvar(6,'d',m5,n5,l6)) return
38// if(.not.createvar(7,'d',m5,n5,l7)) return
39//c
40// call foubare(cstk(l2:l2+m2*n2),istk(l3),n3*m3,sstk(l4),n4*m4,
41// $ stk(l5),m5,n5,stk(l6),stk(l7))
42//c
43// lhsvar(1)=3
44// lhsvar(2)=4
45// lhsvar(3)=5
46// lhsvar(4)=6
47// if(.not.putlhsvar()) return
48//c
49// end
50//
51//Routine call in Scilab
52x =[1,2,3];y =[1,2,3;4,5,6];z=[10,11;12,13];
53[a,b,c,d]=call('foobar1','mul', x, y, z);
54// tests
55if norm(a-2*x,1) > %eps then pause,end
56if norm(b-2*y,1) > %eps then pause,end
57if norm(c-2*z,1) > %eps then pause,end
58[mc,nc]=size(c);
59w=zeros(c);
60for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
61if norm(d-(2*z.*w),1) > %eps then pause,end
62
63[a,b,c,d]=call('foobar1','add', x, y, z);
64if norm(a-(2+x),1) > %eps then pause,end
65if norm(b-(2+y),1) > %eps then pause,end
66if norm(c-(2+z),1) > %eps then pause,end
67w=zeros(c);
68for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
69if norm(d-(2+z+w),1) > %eps then pause,end
70//
71//
72// Test 2
73// ======================================================
74// Routine foubare is in SCIDIR/default/Ex-fort.f
75// and "foubare" appears in SCIDIR/default/Flist
76// This is equivalent to -->link("foobar.o","foubare");
77// Routine call from scilab:
78
79a =[1,2,3];b =[1,2,3;4,5,6];c =[10,11;12,13];
80[ma,na]=size(a);ia=ma*na;
81[mb,nb]=size(b);ib=mb*nb;
82[mc,nc]=size(c);ic=mc*nc;
83md=mc;nd=nc;
84[as,bs,cs,ds]=call('foubare','mul',1,'c',a,2,'i',ia,3,'i',b,4,'r',ib,5,'i',...
85 c,6,'d',mc,7,'i',nc,8,'i',...
86 'out',[ma,na],2,'i',[mb,nb],4,'r',[mc,nc],6,'d',...
87 [md,nd],9,'d',[mc,nc],10,'d');
88if norm(as-2*a,1) > %eps then pause,end
89if norm(bs-2*b,1) > %eps then pause,end
90if norm(cs-2*c,1) > %eps then pause,end
91[mc,nc]=size(c);
92w=zeros(c);
93for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
94if norm(ds-(2*c.*w),1) > %eps then pause,end
95
96md=mc;nd=nc;
97[as,bs,cs,ds]=call('foubare','add',1,'c',a,2,'i',ia,3,'i',b,4,'r',ib,5,'i',...
98 c,6,'d',mc,7,'i',nc,8,'i',...
99 'out',[ma,na],2,'i',[mb,nb],4,'r',[mc,nc],6,'d',...
100 [md,nd],9,'d',[mc,nc],10,'d');
101if norm(as-(2+a),1) > %eps then pause,end
102if norm(bs-(2+b),1) > %eps then pause,end
103if norm(cs-(2+c),1) > %eps then pause,end
104[mc,nc]=size(c);
105w=zeros(c);
106for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
107if norm(ds-(2+c+w),1) > %eps then pause,end
108
109//other valid call (output parameters 1 3 and 5 are also inputs)
110a =[1,2,3];b =[1,2,3;4,5,6];c =[10,11;12,13];md=mc;nd=nc;mul=str2code('mul');
111[as,bs,cs,ds]=call('foubare','mul',1,'c',a,2,'i',ia,3,'i',b,4,'r',ib,5,'i',...
112 c,6,'d',mc,7,'i',nc,8,'i',...
113 'out',2,4,6,...
114 [md,nd],9,'d',[mc,nc],10,'d');
115if norm(as-2*a,1) > %eps then pause,end
116if norm(bs-2*b,1) > %eps then pause,end
117if norm(cs-2*c,1) > %eps then pause,end
118[mc,nc]=size(c);
119w=zeros(c);
120for i=1:mc;for j=1:nc, w(i,j)=i+j;end;end
121if norm(ds-(2*c.*w),1) > %eps then pause,end
122
123
diff --git a/tests/basic_tests/maketests.sci b/tests/basic_tests/maketests.sci
index e0a0e48..3e35eb3 100644
--- a/tests/basic_tests/maketests.sci
+++ b/tests/basic_tests/maketests.sci
@@ -13,7 +13,6 @@ tests = ['arma.tst';
13 'binary_representation.tst'; 13 'binary_representation.tst';
14 'breakpoints.tst'; 14 'breakpoints.tst';
15 'bvode.tst'; 15 'bvode.tst';
16 'call.tst';
17 'calpol.tst'; 16 'calpol.tst';
18 'clause.tst'; 17 'clause.tst';
19 'cmp.tst'; 18 'cmp.tst';
diff --git a/tests/basic_tests/pause.dia.ref b/tests/basic_tests/pause.dia.ref
index 3ed1075..e136b03 100644
--- a/tests/basic_tests/pause.dia.ref
+++ b/tests/basic_tests/pause.dia.ref
@@ -8,6 +8,8 @@ deff('[x]=tata(y)','x=-y,write(%io(2),''enter quit''),pause,x=+20')
8xx=tata(10); 8xx=tata(10);
9enter quit 9enter quit
10 10
11Type 'resume' or 'abort' to return to standard level prompt.
12
11quit; 13quit;
12 14
13if 10+xx<>0 then bugmes();quit;end 15if 10+xx<>0 then bugmes();quit;end
@@ -18,7 +20,7 @@ deff('[x]=tata(y)',['x=-y'
18 'write(6,''enter return'')' 20 'write(6,''enter return'')'
19 'pause' 21 'pause'
20 'x=+20']) 22 'x=+20'])
21Warning :redefining function: tata 23Warning : redefining function : tata
22 24
23 25
24xx=tata(0); 26xx=tata(0);
@@ -29,7 +31,7 @@ return
29if 20-xx<>0 then bugmes();quit;end 31if 20-xx<>0 then bugmes();quit;end
30 32
31deff('[x]=tata(y)','x=-y,write(6,''type x=resume(0)''),pause') 33deff('[x]=tata(y)','x=-y,write(6,''type x=resume(0)''),pause')
32Warning :redefining function: tata 34Warning : redefining function : tata
33 35
34 36
35xx=tata(40); 37xx=tata(40);