44
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % UTP_MIIR_INDEX a set of UTPs for the miir/index method
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % M Hewitson 06-08-08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % $Id: utp_miir_index.m,v 1.4 2009/07/28 17:12:38 ingo Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % <MethodDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % The index method of the miir class index into a MIIR vector or
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % matrix. This properly captures the history.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % </MethodDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 function results = utp_miir_index(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % Check the inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 if nargin == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 % Some keywords
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 class = 'miir';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 mthd = 'index';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 results = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 disp('******************************************************');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 disp(['**** Running UTPs for ' class '/' mthd]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 disp('******************************************************');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 % Test MIIR objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 % Exception list for the UTPs:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % Run the tests
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 results = [results utp_01]; % getInfo call
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 results = [results utp_02]; % Vector input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 results = [results utp_03]; % Matrix input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 results = [results utp_04]; % List input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 results = [results utp_05]; % Test history is working
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 results = [results utp_06]; % Test the modify call works
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 results = [results utp_07]; % Test with plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 results = [results utp_08]; % Test select more objects with an index
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 disp('Done.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 disp('******************************************************');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 elseif nargin == 1 % Check for UTP functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 if strcmp(varargin{1}, 'isutp')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 results = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 results = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 error('### Incorrect inputs')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 %% UTP_01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 % Tests that the getInfo call works for this method.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 function result = utp_01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 % Test that the getInfo call works for no sets, all sets, and each set
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 % individually.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 % Call for no sets
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 % Call for all sets
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 io(2) = eval([class '.getInfo(''' mthd ''')']);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 % Call for each set
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 for kk=1:numel(io(2).sets)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 % 1) Check that getInfo call returned an minfo object in all cases.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 % 2) Check that all plists have the correct parameters.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 % check we have minfo objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 if isa(io, 'minfo')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 %%% SET 'None'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 if ~isempty(io(1).sets), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 if ~isempty(io(1).plists), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 %%% Check all Sets
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 %%%%%%%%%% SET 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 if io(3).plists.nparams ~= 2, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 if ~io(3).plists.isparam('i'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 if ~io(3).plists.isparam('j'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 if ~isEmptyDouble(io(3).plists.find('i')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 if ~isEmptyDouble(io(3).plists.find('j')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 if ~isequal(io(3).plists.getOptionsForParam('i'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 if ~isequal(io(3).plists.getOptionsForParam('j'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 end % END UTP_01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 %% UTP_02
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 % Tests that the index method works with a vector of MIIR objects as
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 % input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 function result = utp_02
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 % Test that the index method works for a vector of MIIR objects as
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 % input. The following indexing should work:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 % I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 objvec = [iir1, iir2, iir3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 out1 = objvec.index(1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 out2 = objvec.index(3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 out3 = objvec.index(1,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 % 1) Check that the index method selects the correct object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 if ~eq(out1, iir1, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 if ~eq(out2, iir3, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 if ~eq(out3, iir2, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 end % END UTP_02
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 %% UTP_03
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 % Tests that the index method works with a matrix of MIIR objects as
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 % input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 function result = utp_03
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 % Test that the index method works for a matrix of MIIR objects as
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 % input. The following indexing should work:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 % I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 % [ 2 4 6 ] [(2,1), (2,2), (2,3)]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 objmat = [iir1, iir2, iir3; ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 iir3, iir1, iir2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 out1 = objmat.index(5);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 out2 = objmat.index(4);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 out3 = objmat.index(1,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 out4 = objmat.index(2,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 out5 = objmat.index(2,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 % 1) Check that the index method selects the correct object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 if ~eq(out1, iir3, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 if ~eq(out2, iir1, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 if ~eq(out3, iir2, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 if ~eq(out4, iir3, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 if ~eq(out5, iir1, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 end % END UTP_03
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 %% UTP_04
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 % Tests that the index method works with a list of MIIR objects as
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 % input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 function result = utp_04
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 % The index method doesn't work for a list of MIIR objects as input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 out = index(iir1,iir2,iir3, 4);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 % 1) Nothing to test.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 end % END UTP_04
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 %% UTP_05
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 % Tests that the index method properly applies history.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 function result = utp_05
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 % Test that the result of index have an additional history step.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 i = 2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 j = 3;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 objmat = [iir1, iir2, iir3; ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 iir3, iir1, iir2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 out = index(objmat, i, j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 % 1) Check that the last entry in the history of 'out' corresponds
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 % to 'index'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 if ~strcmp(out.hist.methodInfo.mname, 'index'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 % Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 pl = out.hist.plistUsed;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 if pl.find('i') ~= i, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 if pl.find('j') ~= j, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 end % END UTP_05
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 %% UTP_06
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 % Tests that the index method works for the modifier command.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 function result = utp_06
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 % Tests that the index method works for the modifier command.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 i = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 j = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 objmat = [iir1, iir2, iir3; ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 iir3, iir1, iir2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 out1 = index(objmat, i, j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359 out2 = objmat.index(i,j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 % 1) Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 % 2) Check that the index method selects the correct object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 % Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 pl = out1.hist.plistUsed;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 if pl.find('i') ~= i, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 if pl.find('j') ~= j, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381 % Check that the index method selects the correct object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 if ~eq(out1, iir1, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 % Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 pl = out2.hist.plistUsed;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 if pl.find('i') ~= i, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 if pl.find('j') ~= j, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 % Check that the index method selects the correct object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 if ~eq(out2, iir1, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 end % END UTP_06
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 %% UTP_07
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402 % Control the method with a plist.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 function result = utp_07
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409 % Test that the index method can be controled with a plist.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 i1 = 6;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 i2 = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 j2 = 3;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418 objmat = [iir1, iir2, iir3; ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 iir3, iir1, iir2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 pl1 = plist('i', i1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421 pl2 = plist('i', i2, 'j', j2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 out1 = index(objmat, pl1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423 out2 = index(objmat, pl2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 % 1) Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434 % 2) Check that the index method selects the correct object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 % Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442 pl = out1.hist.plistUsed;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 if ~isequal(pl.find('i'), i1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 if ~isequal(pl.find('j'), []), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445 % Check that the index method selects the correct object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 if ~eq(out1, iir2, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 % Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448 pl = out2.hist.plistUsed;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449 if ~isequal(pl.find('i'), i2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450 if ~isequal(pl.find('j'), j2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451 % Check that the index method selects the correct object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452 if ~eq(out2, iir3, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
459 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
460 end % END UTP_07
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462 %% UTP_08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466 % Test that the index method selects more objects if I have more indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 function result = utp_08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
473 % Test that the index method selects more objects if I have more indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
474 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
475 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
476
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
477 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
478 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
479 i = [2 6];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
480 objmat = [iir1, iir2, iir3; ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
481 iir3, iir1, iir2];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
482 pl = plist('i', i);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
483 out1 = objmat.index(i);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
484 out2 = objmat.index(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
485 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
486 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
487 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
488 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
489 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
490 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
491
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
492 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
493 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
494 % 1) Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
495 % 2) Check that the index method selects the correct object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
496 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
497 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
498
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
499 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
500 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
501 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
502 % Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
503 pl = out1(1).hist.plistUsed;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
504 if ~isequal(pl.find('i'), i), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
505 if ~isequal(pl.find('j'), []), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
506 % Check that the index method selects the correct object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
507 if ~eq(out1(1), iir3, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
508 if ~eq(out1(2), iir2, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
509 % Check that the history-plist contains the used indices.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
510 pl = out2(2).hist.plistUsed;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
511 if ~isequal(pl.find('i'), i), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
512 if ~isequal(pl.find('j'), []), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
513 % Check that the index method selects the correct object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
514 if ~eq(out2(1), iir3, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
515 if ~eq(out2(2), iir2, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
516 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
517 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
518 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
519 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
520
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
521 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
522 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
523 end % END UTP_08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
524
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
525 end
|