summaryrefslogtreecommitdiffstats
path: root/tests/nonRegression/bug2263.sci
blob: 0b49e46492d8c3c92279d7aa2e2d2a4a6a70bda8 (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
// <-- Non-regression test for bug 2263 -->
//
// <-- Bugzilla URL -->
// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=2263
//
// <-- Short Description -->
//    Suppose you want to call a arbitrary scilab function "test". But you want the
//    outputs from this function be stored in a matlab-like struct, for example,
//    [out.t1,out.t2,out.t3,out.t4]=test(1)
//    This works fine, but if you have a nested structure (out.a.XXX) than scilab is
//    not able to provide the outputs at the correct places, for example
//    [out.a.t1,out.a.t2,out.a.t3,out.a.t4]=test(1).
//
//
//    The function "test" could be:
//    function [a,b,c,d,e]=teste(in)
//      a=in;
//      b=in+1;
//      c=in+2;
//      d=in+3;
//      e=in+4;
//    endfunction

// Serge Steer - Scilab Project
// Copyright INRIA
// 2 janv 2007

function [a,b,c,d,e]=test()
  a=1;b=2;c=3;d=4;e=5;
endfunction
[out.a.t1,out.a.t2,out.a.t3,out.a.t4]=test();
T=%t;
T=T&and(out==mlist(["st","dims","a"],int32([1,1]),..
		   mlist(["st","dims","t4","t3","t2","t1"],int32([1,1]),4,3,2,1))) ;

clear out
[out.a.t1,t2,out.a.t3,t4]=test();
T=T&and(out==mlist(["st","dims","a"],int32([1,1]),..
		   mlist(["st","dims","t3","t1"],int32([1,1]),3,1)))&t2==2&t4==4;

clear a
[a.t1,a.t2,a.t3,a.t4]=test();
T=T& and(a==mlist(["st","dims","t4","t3","t2","t1"],int32([1,1]),4,3,2,1));

clear a
[t1,a.t2,t3,a.t4]=test();
T=T& and(a==mlist(["st","dims","t4","t2"],int32([1,1]),4,2))&t1==1&t3==3;

[t1,t2,t3,t4]=test();
T=T&and([t1 t2 t3 t4]==[1 2 3 4]);

affich_result(T,2263);