PageRenderTime 29ms CodeModel.GetById 15ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Examples/test-suite/octave/li_std_pair_extra_runme.m

#
Objective C | 69 lines | 50 code | 19 blank | 0 comment | 2 complexity | d4781677b4a7c12e6c3e4db060178f36 MD5 | raw file
 1li_std_pair_extra
 2
 3p = {1,2};
 4p1 = li_std_pair_extra.p_inout(p);
 5assert(all(cell2mat(p1)==[2,1]));
 6p2 = li_std_pair_extra.p_inoutd(p1);
 7assert(all(cell2mat(p2)==[1,2]));
 8
 9d1 = li_std_pair_extra.d_inout(2);
10assert(d1==4);
11
12[i,d2] = li_std_pair_extra.d_inout2(2);
13assert(all([i,d2]==[1,4]));
14
15[i,p] = li_std_pair_extra.p_inout2(p);
16assert(i==1&&all([cell2mat(p)]==[2,1]));
17[p3,p4] = li_std_pair_extra.p_inout3(p1,p1);
18assert(all(cell2mat(p3)==[2,1]));
19assert(all(cell2mat(p4)==[2,1]));
20
21psi = li_std_pair_extra.SIPair("hello",1);
22assert(psi=={"hello",1});
23pci = li_std_pair_extra.CIPair(complex(1,2),1);
24assert(pci.first==complex(1,2)&&pci.second==1);
25
26
27psi = li_std_pair_extra.SIPair("hi",1);
28assert(psi.first=="hi"&&psi.second==1);
29
30psii = li_std_pair_extra.SIIPair(psi,1);
31assert(psii.first.first=="hi");
32assert(psii.first.second==1);
33assert(psii.second==1);
34
35a = li_std_pair_extra.A();
36b = li_std_pair_extra.B();
37
38pab = li_std_pair_extra.ABPair(a,b);
39
40pab.first = a;
41pab.first.val = 2;
42
43assert(pab.first.val == 2);
44
45pci = li_std_pair_extra.CIntPair(1,0);
46assert(pci.first==1&&pci.second==0);
47
48a = li_std_pair_extra.A(5);
49p1 = li_std_pair_extra.pairP1(1,a);
50p2 = li_std_pair_extra.pairP2(a,1);
51p3 = li_std_pair_extra.pairP3(a,a);
52
53assert(a.val == li_std_pair_extra.p_identa(p1){2}.val);
54  
55p = li_std_pair_extra.IntPair(1,10);
56assert(p.first==1&&p.second==10);
57p.first = 1;
58assert(p.first==1);
59
60p = li_std_pair_extra.paircA1(1,a);
61assert(p.first==1);
62assert(swig_this(p.second)==swig_this(a));
63
64p = li_std_pair_extra.paircA2(1,a);
65assert(p.first==1);
66assert(swig_this(p.second)==swig_this(a));
67#pp = li_std_pair_extra.pairiiA(1,p); # conversion pb re const of pairA1/A2
68pp = li_std_pair_extra.pairiiA(1,{1,A()});
69