annotate testing/utp_1.1/utps/pzmodel/utp_pzmodel_tomfir.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
44
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
1 % UTP_PZMODEL_TOMFIR a set of UTPs for the pzmodel/tomfir method
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
2 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
3 % M Hewitson 06-08-08
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
4 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
5 % $Id: utp_pzmodel_tomfir.m,v 1.3 2009/07/23 18:56:38 ingo Exp $
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
6 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
7
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
8 % <MethodDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
9 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
10 % The tomfir method of the pzmodel class approximates a pole/zero model with an
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
11 % FIR filter.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
12 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
13 % </MethodDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
14
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
15 function results = utp_pzmodel_tomfir(varargin)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
16
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
17 % Check the inputs
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
18 if nargin == 0
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
19
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
20 % Some keywords
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
21 class = 'pzmodel';
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
22 mthd = 'tomfir';
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
23
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
24 results = [];
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
25 disp('******************************************************');
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
26 disp(['**** Running UTPs for ' class '/' mthd]);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
27 disp('******************************************************');
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
28
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
29 % Test PZMODELs
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
30 [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
31
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
32 % Exception list for the UTPs:
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
33 [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples();
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
34
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
35 % Run the tests
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
36 results = [results utp_01]; % getInfo call
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
37 results = [results utp_02]; % Vector input
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
38 results = [results utp_03]; % Matrix input
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
39 results = [results utp_04]; % List input
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
40 results = [results utp_05]; % Test with mixed input
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
41 results = [results utp_06]; % Test history is working
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
42 results = [results utp_07]; % Test the modify call works
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
43 results = [results utp_08]; % Test with additional plist with the key 'axis'
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
44 results = [results utp_09]; % Test output of the data
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
45
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
46 disp('Done.');
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
47 disp('******************************************************');
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
48
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
49 elseif nargin == 1 % Check for UTP functions
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
50 if strcmp(varargin{1}, 'isutp')
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
51 results = 1;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
52 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
53 results = 0;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
54 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
55 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
56 error('### Incorrect inputs')
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
57 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
58
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
59 %% UTP_01
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
60
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
61 % <TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
62 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
63 % Tests that the getInfo call works for this method.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
64 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
65 % </TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
66 function result = utp_01
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
67
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
68
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
69 % <SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
70 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
71 % Test that the getInfo call works for no sets, all sets, and each set
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
72 % individually.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
73 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
74 % </SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
75
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
76 try
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
77 % <SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
78 % Call for no sets
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
79 io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
80 % Call for all sets
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
81 io(2) = eval([class '.getInfo(''' mthd ''')']);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
82 % Call for each set
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
83 for kk=1:numel(io(2).sets)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
84 io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
85 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
86 % </SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
87 stest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
88 catch err
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
89 disp(err.message)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
90 stest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
91 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
92
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
93 % <AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
94 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
95 % 1) Check that getInfo call returned an minfo object in all cases.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
96 % 2) Check that all plists have the correct parameters.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
97 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
98 % </AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
99
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
100 atest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
101 if stest
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
102 % <AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
103 % check we have minfo objects
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
104 if isa(io, 'minfo')
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
105 %%% SET 'None'
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
106 if ~isempty(io(1).sets), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
107 if ~isempty(io(1).plists), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
108 %%% Check all Sets
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
109 if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
110 if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
111 %%%%%%%%%% SET 'Default'
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
112 if io(3).plists.nparams ~= 5, atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
113 % Check key
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
114 if ~io(3).plists.isparam('fs'), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
115 if ~io(3).plists.isparam('f1'), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
116 if ~io(3).plists.isparam('f2'), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
117 if ~io(3).plists.isparam('nf'), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
118 if ~io(3).plists.isparam('scale'), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
119 % Check default value
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
120 if ~isequal(io(3).plists.find('fs'), 10), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
121 if ~isequal(io(3).plists.find('f1'), 0), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
122 if ~isequal(io(3).plists.find('f2'), 5), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
123 if ~isequal(io(3).plists.find('nf'), 1000), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
124 if ~isequal(io(3).plists.find('scale'), 'lin'), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
125 % Check options
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
126 if ~isequal(io(3).plists.getOptionsForParam('fs'), {10}), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
127 if ~isequal(io(3).plists.getOptionsForParam('f1'), {0}), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
128 if ~isequal(io(3).plists.getOptionsForParam('f2'), {5}), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
129 if ~isequal(io(3).plists.getOptionsForParam('nf'), {1000}), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
130 if ~isequal(io(3).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
131 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
132 % </AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
133 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
134 atest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
135 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
136
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
137 % Return a result structure
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
138 result = utp_prepare_result(atest, stest, dbstack, mfilename);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
139 end % END UTP_01
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
140
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
141 %% UTP_02
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
142
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
143 % <TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
144 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
145 % Tests that the tomfir method works with a vector of PZMODEL objects as input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
146 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
147 % </TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
148 function result = utp_02
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
149
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
150 % <SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
151 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
152 % Test that the tomfir method works for a vector of PZMODEL objects as input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
153 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
154 % </SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
155
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
156 try
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
157 % <SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
158 out = tomfir(pzv);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
159 % </SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
160 stest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
161 catch err
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
162 disp(err.message)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
163 stest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
164 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
165
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
166 % <AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
167 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
168 % 1) Check that the number of elements in 'out' is the same as in 'pzv'
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
169 % 2) Check that each output PZMODEL object contains the correct data.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
170 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
171 % </AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
172
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
173 atest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
174 if stest
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
175 % <AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
176 % Check we have the correct number of outputs
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
177 if ~isequal(size(out), size(pzv)), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
178 % Check each output against the single steps
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
179 for kk=1:numel(out)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
180 r = resp(pzv(kk), pzmodel.getInfo('tomfir').plists);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
181 r.setFs(10);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
182 if ~eq(mfir(r), out(kk), ple3), atest = false; break; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
183 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
184 % </AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
185 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
186 atest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
187 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
188
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
189 % Return a result structure
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
190 result = utp_prepare_result(atest, stest, dbstack, mfilename);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
191 end % END UTP_02
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
192
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
193 %% UTP_03
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
194
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
195 % <TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
196 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
197 % Tests that the tomfir method works with a matrix of PZMODEL objects as input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
198 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
199 % </TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
200 function result = utp_03
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
201
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
202 % <SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
203 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
204 % Test that the tomfir method works for a matrix of PZMODEL objects as input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
205 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
206 % </SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
207
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
208 try
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
209 % <SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
210 out = tomfir(pzm);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
211 % </SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
212 stest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
213 catch err
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
214 disp(err.message)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
215 stest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
216 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
217
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
218 % <AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
219 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
220 % 1) Check that the number of elements in 'out' is the same as in 'pzm'
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
221 % 2) Check that each output PZMODEL object contains the correct data.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
222 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
223 % </AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
224
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
225 atest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
226 if stest
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
227 % <AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
228 % Check we have the correct number of outputs
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
229 if ~isequal(size(out), size(pzm)), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
230 % Check each output against the single steps
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
231 for kk=1:numel(out)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
232 r = resp(pzm(kk), pzmodel.getInfo('tomfir').plists);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
233 r.setFs(10);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
234 if ~eq(mfir(r), out(kk), ple3), atest = false; break; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
235 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
236 % </AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
237 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
238 atest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
239 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
240
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
241 % Return a result structure
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
242 result = utp_prepare_result(atest, stest, dbstack, mfilename);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
243 end % END UTP_03
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
244
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
245 %% UTP_04
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
246
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
247 % <TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
248 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
249 % Tests that the tomfir method works with a list of PZMODEL objects as input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
250 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
251 % </TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
252 function result = utp_04
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
253
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
254 % <SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
255 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
256 % Test that the tomfir method works for a list of PZMODEL objects as input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
257 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
258 % </SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
259
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
260 try
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
261 % <SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
262 out = tomfir(pz1,pz2,pz3);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
263 % </SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
264 stest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
265 catch err
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
266 disp(err.message)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
267 stest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
268 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
269
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
270 % <AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
271 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
272 % 1) Check that the number of elements in 'out' is the same as in
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
273 % input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
274 % 2) Check that each output PZMODEL object contains the correct data.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
275 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
276 % </AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
277
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
278 atest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
279 pzin = [pz1,pz2,pz3];
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
280 if stest
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
281 % <AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
282 % Check we have the correct number of outputs
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
283 if numel(out) ~= 3, atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
284 % Check each output against the single steps
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
285 for kk=1:numel(out)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
286 r = resp(pzin(kk), pzmodel.getInfo('tomfir').plists);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
287 r.setFs(10);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
288 if ~eq(mfir(r), out(kk), ple3), atest = false; break; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
289 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
290 % </AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
291 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
292 atest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
293 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
294
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
295 % Return a result structure
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
296 result = utp_prepare_result(atest, stest, dbstack, mfilename);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
297 end % END UTP_04
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
298
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
299 %% UTP_05
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
300
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
301 % <TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
302 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
303 % Tests that the tomfir method works with a mix of different shaped PZMODEL objects as
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
304 % input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
305 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
306 % </TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
307 function result = utp_05
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
308
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
309 % <SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
310 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
311 % Test that the tomfir method works with an input of matrices and vectors
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
312 % and single PZMODEL objects.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
313 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
314 % </SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
315
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
316 try
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
317 % <SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
318 out = tomfir(pz1,pzv,pz2,pzm,pz3);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
319 % </SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
320 stest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
321 catch err
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
322 disp(err.message)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
323 stest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
324 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
325
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
326 % <AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
327 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
328 % 1) Check that the number of elements in 'out' is the same as in
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
329 % input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
330 % 2) Check that each output PZMODEL object contains the correct data.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
331 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
332 % </AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
333
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
334 atest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
335 pzin = [pz1,reshape(pzv,1,[]),pz2,reshape(pzm,1,[]),pz3];
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
336 if stest
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
337 % <AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
338 % Check we have the correct number of outputs
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
339 if numel(out) ~= (numel(pzin)), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
340 % Check each output against the single steps
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
341 for kk=1:numel(out)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
342 r = resp(pzin(kk), pzmodel.getInfo('tomfir').plists);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
343 r.setFs(10);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
344 if ~eq(mfir(r), out(kk), ple3), atest = false; break; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
345 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
346 % </AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
347 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
348 atest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
349 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
350
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
351 % Return a result structure
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
352 result = utp_prepare_result(atest, stest, dbstack, mfilename);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
353 end % END UTP_05
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
354
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
355 %% UTP_06
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
356
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
357 % <TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
358 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
359 % Tests that the tomfir method properly applies history.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
360 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
361 % </TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
362 function result = utp_06
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
363
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
364 % <SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
365 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
366 % Test that the result of applying the tomfir method can be processed back.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
367 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
368 % </SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
369
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
370 try
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
371 % <SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
372 out = tomfir(pz5);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
373 mout = rebuild(out);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
374 % </SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
375 stest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
376 catch err
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
377 disp(err.message)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
378 stest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
379 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
380
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
381 % <AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
382 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
383 % 1) Check that the last entry in the history of 'out' corresponds to
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
384 % 'tomfir'.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
385 % 2) Check that re-built object is the same object as the input.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
386 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
387 % </AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
388
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
389 atest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
390 if stest
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
391 % <AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
392 % Check the last step in the history of 'out'
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
393 if ~strcmp(out.hist.methodInfo.mname, 'tomfir'), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
394 % Run 'test.m' and check the result
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
395 if ~eq(mout, out, ple2), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
396 % </AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
397 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
398 atest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
399 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
400
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
401 % Return a result structure
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
402 result = utp_prepare_result(atest, stest, dbstack, mfilename);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
403 end % END UTP_06
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
404
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
405 %% UTP_07
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
406
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
407 % <TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
408 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
409 % Tests that the tomfir method can modify the input PZMODEL object.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
410 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
411 % </TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
412 function result = utp_07
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
413
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
414 % <SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
415 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
416 % Test that the tomfir method can not modify the input PZMODEL object .
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
417 % The method must throw an error for the modifier call.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
418 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
419 % </SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
420
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
421 % <SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
422 try
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
423 ain.tomfir();
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
424 stest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
425 catch err
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
426 stest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
427 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
428 % </SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
429
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
430 % <AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
431 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
432 % 1) Nothing to check.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
433 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
434 % </AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
435
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
436 atest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
437 if stest
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
438 % <AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
439 % </AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
440 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
441 atest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
442 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
443
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
444 % Return a result structure
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
445 result = utp_prepare_result(atest, stest, dbstack, mfilename);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
446 end % END UTP_07
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
447
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
448 %% UTP_08
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
449
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
450 % <TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
451 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
452 % Control the method with a plist.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
453 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
454 % </TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
455 function result = utp_08
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
456
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
457 % <SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
458 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
459 % Test that the tomfir method use the different values in a plist.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
460 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
461 % </SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
462
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
463 try
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
464 % <SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
465 fs = 5;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
466 f2 = fs/2;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
467 pl = plist('fs', fs, 'f1', 0, 'f2', f2, 'nf', 100);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
468 out = tomfir(pz5, pl);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
469 mout = rebuild(out);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
470 % </SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
471 stest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
472 catch err
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
473 disp(err.message)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
474 stest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
475 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
476
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
477 % <AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
478 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
479 % 1) Check the output
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
480 % 2) Check the re-built object
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
481 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
482 % </AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
483
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
484 atest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
485 if stest
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
486 % <AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
487 % Check the output
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
488 if ~isa(out, 'mfir'), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
489 if out.fs ~= fs, atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
490 % Check the rebuilt object
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
491 if ~eq(mout, out, ple2), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
492 % </AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
493 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
494 atest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
495 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
496
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
497 % Return a result structure
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
498 result = utp_prepare_result(atest, stest, dbstack, mfilename);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
499 end % END UTP_08
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
500
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
501 %% UTP_09
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
502
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
503 % <TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
504 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
505 % Check that the tomfir method pass back the output objects to a list of
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
506 % output variables or to a single variable.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
507 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
508 % </TestDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
509 function result = utp_09
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
510
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
511 % <SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
512 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
513 % Call the method with a list of output variables and with a single output
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
514 % variable. Additionaly check that the rebuild method works on the output.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
515 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
516 % </SyntaxDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
517
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
518 try
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
519 % <SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
520 [o1, o2] = tomfir(pz5, pz4);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
521 o3 = tomfir(pz5, pz4);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
522 mout1 = rebuild(o1);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
523 mout2 = rebuild(o2);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
524 mout3 = rebuild(o3);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
525 % </SyntaxCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
526 stest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
527 catch err
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
528 disp(err.message)
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
529 stest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
530 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
531
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
532 % <AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
533 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
534 % 1) Check that the output contains the right number of objects
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
535 % 2) Check that the 'rebuild' method produces the same object as 'out'.
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
536 %
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
537 % </AlgoDescription>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
538
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
539 atest = true;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
540 if stest
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
541 % <AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
542 % Check the number of outputs
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
543 if numel(o1) ~=1, atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
544 if numel(o2) ~=1, atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
545 if numel(o3) ~=2, atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
546 % Check the rebuilding of the object
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
547 if ~eq(o1, mout1, ple2), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
548 if ~eq(o2, mout2, ple2), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
549 if ~eq(o3, mout3, ple2), atest = false; end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
550 % </AlgoCode>
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
551 else
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
552 atest = false;
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
553 end
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
554
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
555 % Return a result structure
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
556 result = utp_prepare_result(atest, stest, dbstack, mfilename);
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
557 end % END UTP_09
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
558
409a22968d5e Add unit tests
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
559 end