Mercurial > hg > ltpda
comparison testing/utp_1.1/utps/timespan/utp_timespan_timespan.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 |
comparison
equal
deleted
inserted
replaced
43:bc767aaa99a8 | 44:409a22968d5e |
---|---|
1 % UTP_TIMESPAN_TIMESPAN a set of UTPs for the timespan/timespan method | |
2 % | |
3 % M Hewitson 06-08-08 | |
4 % | |
5 % $Id: utp_timespan_timespan.m,v 1.31 2011/09/29 13:46:19 ingo Exp $ | |
6 % | |
7 | |
8 % <MethodDescription> | |
9 % | |
10 % The timespan method of the timespan class constructs TIMESPAN objects. | |
11 % | |
12 % </MethodDescription> | |
13 | |
14 function results = utp_timespan_timespan(varargin) | |
15 | |
16 % Check the inputs | |
17 if nargin == 0 | |
18 | |
19 % Some keywords | |
20 class = 'timespan'; | |
21 mthd = 'timespan'; | |
22 | |
23 results = []; | |
24 disp('******************************************************'); | |
25 disp(['**** Running UTPs for ' class '/' mthd]); | |
26 disp('******************************************************'); | |
27 | |
28 % Test objects | |
29 [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; | |
30 | |
31 % Exception list for the UTPs: | |
32 [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); | |
33 | |
34 % get preferences | |
35 prefs = getappdata(0, 'LTPDApreferences'); | |
36 oldTimezone = char(prefs.getTimePrefs.getTimeTimezone); | |
37 oldTimeformat = char(prefs.getTimePrefs.getTimestringFormat); | |
38 | |
39 % set timezone to UTC for all tests | |
40 prefs.getTimePrefs.setTimeTimezone('UTC'); | |
41 | |
42 try | |
43 % Run the tests | |
44 results = [results utp_00]; | |
45 results = [results utp_01]; % getInfo call | |
46 results = [results utp_02]; % Vector input | |
47 results = [results utp_03]; % Matrix input | |
48 results = [results utp_04]; % List input | |
49 results = [results utp_05]; % Test with mixed input | |
50 results = [results utp_06]; % Test history is working with empty constructor | |
51 results = [results utp_07]; % Test history is working with copy constructor | |
52 results = [results utp_08]; % Test history is working with MAT file constructor | |
53 results = [results utp_09]; % Test history is working with XML file constructor | |
54 results = [results utp_10]; % Test history is working with struct constructor | |
55 results = [results utp_11]; % Test history is working with plist(filename) constructor | |
56 results = [results utp_12]; % Test history is working with plist(hostname) constructor | |
57 results = [results utp_13]; % Test history is working with plist(startT+endT) constructor | |
58 results = [results utp_15]; % Test history is working with start + end time constructor | |
59 results = [results utp_16]; % Test history is working with conn+Id constructor | |
60 results = [results utp_17]; % Test history is working with start + end time + format constructor | |
61 catch ex | |
62 end | |
63 | |
64 % restore preferences | |
65 prefs.getTimePrefs.setTimeTimezone(oldTimezone); | |
66 prefs.getTimePrefs.setTimestringFormat(oldTimeformat); | |
67 | |
68 disp('Done.'); | |
69 disp('******************************************************'); | |
70 | |
71 elseif nargin == 1 % Check for UTP functions | |
72 if strcmp(varargin{1}, 'isutp') | |
73 results = 1; | |
74 elseif strcmpi(varargin{1}, 'needs repository') | |
75 results = 2; | |
76 else | |
77 results = 0; | |
78 end | |
79 else | |
80 error('### Incorrect inputs') | |
81 end | |
82 | |
83 %% UTP_00 | |
84 | |
85 % <TestDescription> | |
86 % | |
87 % Tests that the timespan constructor does what is supposed to do. | |
88 % | |
89 % </TestDescription> | |
90 function result = utp_00 | |
91 | |
92 stest = false; | |
93 try | |
94 % <SyntaxCode> | |
95 ts(1) = timespan(1, 2); | |
96 ts(end+1) = timespan('00:00:01', '00:00:02'); | |
97 ts(end+1) = timespan(time(1), time(2)); | |
98 ts(end+1) = timespan(plist('startT', 1, 'endT', 2)); | |
99 ts(end+1) = timespan(plist('startT', '00:00:01', 'endT', '00:00:02')); | |
100 ts(end+1) = timespan(plist('startT', time(1), 'endT', time(2))); | |
101 ts(end+1) = timespan(plist('startT', '00:00:01', 'endT', '00:00:02')); | |
102 ts(end+1) = timespan(plist('startT', '01:00:01', 'endT', '01:00:02', 'timezone', 'CET')); | |
103 % </SyntaxCode> | |
104 stest = true; | |
105 end | |
106 | |
107 atest = true; | |
108 try | |
109 % do not run algorithm tests if sintax tests failed | |
110 assert(stest); | |
111 | |
112 % <AlgoCode> | |
113 % check that all the start and end time has been interpreted correctly | |
114 tstart = [ts.startT]; | |
115 assert(all([tstart.utc_epoch_milli] == 1000)); | |
116 tend = [ts.endT]; | |
117 assert(all([tend.utc_epoch_milli] == 2000)); | |
118 % </AlgoCode> | |
119 catch | |
120 atest = false; | |
121 end | |
122 | |
123 % return a result structure | |
124 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
125 end | |
126 | |
127 %% UTP_01 | |
128 | |
129 % <TestDescription> | |
130 % | |
131 % Tests that the getInfo call works for this method. | |
132 % | |
133 % </TestDescription> | |
134 function result = utp_01 | |
135 | |
136 | |
137 % <SyntaxDescription> | |
138 % | |
139 % Test that the getInfo call works for no sets, all sets, and each set | |
140 % individually. | |
141 % | |
142 % </SyntaxDescription> | |
143 | |
144 try | |
145 % <SyntaxCode> | |
146 % Call for no sets | |
147 io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); | |
148 % Call for all sets | |
149 io(2) = eval([class '.getInfo(''' mthd ''')']); | |
150 % Call for each set | |
151 for kk=1:numel(io(2).sets) | |
152 io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); | |
153 end | |
154 % </SyntaxCode> | |
155 stest = true; | |
156 catch err | |
157 disp(err.message) | |
158 stest = false; | |
159 end | |
160 | |
161 % <AlgoDescription> | |
162 % | |
163 % 1) Check that getInfo call returned an minfo object in all cases. | |
164 % 2) Check that all plists have the correct parameters. | |
165 % | |
166 % </AlgoDescription> | |
167 | |
168 atest = true; | |
169 if stest | |
170 | |
171 % <AlgoCode> | |
172 % check we have minfo objects | |
173 if isa(io, 'minfo') | |
174 %%% SET 'None' | |
175 if ~isempty(io(1).sets), atest = false; end | |
176 if ~isempty(io(1).plists), atest = false; end | |
177 %%% Check all Sets | |
178 if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end | |
179 if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end | |
180 if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end | |
181 if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end | |
182 if ~any(strcmpi(io(2).sets, 'From Timespan Definition')), atest = false; end | |
183 if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end | |
184 if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end | |
185 %%%%%%%%%% SET 'Default' | |
186 pn = 3; | |
187 if io(pn).plists.nparams ~= 3, atest = false; end | |
188 % Check key | |
189 if ~io(pn).plists.isparam('name'), atest = false; end | |
190 if ~io(pn).plists.isparam('description'), atest = false; end | |
191 if ~io(pn).plists.isparam('plotinfo'), atest = false; end | |
192 % Check default value | |
193 if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end | |
194 if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end | |
195 if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end | |
196 %%%%%%%%%% SET 'From MAT File' | |
197 pn = 4; | |
198 if io(pn).plists.nparams ~= 4, atest = false; end | |
199 % Check key | |
200 if ~io(pn).plists.isparam('name'), atest = false; end | |
201 if ~io(pn).plists.isparam('description'), atest = false; end | |
202 if ~io(pn).plists.isparam('plotinfo'), atest = false; end | |
203 if ~io(pn).plists.isparam('filename'), atest = false; end | |
204 % Check default value | |
205 if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end | |
206 if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end | |
207 if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end | |
208 if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end | |
209 %%%%%%%%%% SET 'From XML File' | |
210 pn = 5; | |
211 if io(pn).plists.nparams ~= 4, atest = false; end | |
212 % Check key | |
213 if ~io(pn).plists.isparam('name'), atest = false; end | |
214 if ~io(pn).plists.isparam('description'), atest = false; end | |
215 if ~io(pn).plists.isparam('plotinfo'), atest = false; end | |
216 if ~io(pn).plists.isparam('filename'), atest = false; end | |
217 % Check default value | |
218 if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end | |
219 if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end | |
220 if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end | |
221 if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end | |
222 %%%%%%%%%% SET 'From Repository' | |
223 pn = 6; | |
224 if io(pn).plists.nparams ~= 10, atest = false; end | |
225 % Check key | |
226 if ~io(pn).plists.isparam('name'), atest = false; end | |
227 if ~io(pn).plists.isparam('description'), atest = false; end | |
228 if ~io(pn).plists.isparam('plotinfo'), atest = false; end | |
229 if ~io(pn).plists.isparam('hostname'), atest = false; end | |
230 if ~io(pn).plists.isparam('id'), atest = false; end | |
231 if ~io(pn).plists.isparam('cid'), atest = false; end | |
232 if ~io(pn).plists.isparam('database'), atest = false; end | |
233 if ~io(pn).plists.isparam('binary'), atest = false; end | |
234 if ~io(pn).plists.isparam('username'), atest = false; end | |
235 if ~io(pn).plists.isparam('password'), atest = false; end | |
236 % Check default value | |
237 if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end | |
238 if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end | |
239 if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end | |
240 if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end | |
241 if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end | |
242 if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end | |
243 %%%%%%%%%% SET 'From Built-in Model' | |
244 pn = 7; | |
245 if io(pn).plists.nparams ~= 4, atest = false; end | |
246 % Check key | |
247 if ~io(pn).plists.isparam('name'), atest = false; end | |
248 if ~io(pn).plists.isparam('description'), atest = false; end | |
249 if ~io(pn).plists.isparam('plotinfo'), atest = false; end | |
250 if ~io(pn).plists.isparam('built-in'), atest = false; end | |
251 % Check default value | |
252 if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end | |
253 if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end | |
254 if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end | |
255 if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end | |
256 %%%%%%%%%% SET 'From Timespan Definition' | |
257 pn = 8; | |
258 if io(pn).plists.nparams ~= 7, atest = false; end | |
259 % Check key | |
260 if ~io(pn).plists.isparam('name'), atest = false; end | |
261 if ~io(pn).plists.isparam('description'), atest = false; end | |
262 if ~io(pn).plists.isparam('plotinfo'), atest = false; end | |
263 if ~io(pn).plists.isparam('startt'), atest = false; end | |
264 if ~io(pn).plists.isparam('endt'), atest = false; end | |
265 if ~io(pn).plists.isparam('timezone'), atest = false; end | |
266 if ~io(pn).plists.isparam('timeformat'), atest = false; end | |
267 % Check default value | |
268 if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end | |
269 if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end | |
270 if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end | |
271 if ~strcmp(io(pn).plists.find('startt'), ''), atest = false; end | |
272 if ~strcmp(io(pn).plists.find('endt'), ''), atest = false; end | |
273 if ~isequal(io(pn).plists.find('timezone'), 'UTC'), atest = false; end | |
274 if ~isequal(io(pn).plists.find('timeformat'), ''), atest = false; end | |
275 end | |
276 % </AlgoCode> | |
277 else | |
278 atest = false; | |
279 end | |
280 | |
281 % Return a result structure | |
282 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
283 end % END UTP_01 | |
284 | |
285 %% UTP_02 | |
286 | |
287 % <TestDescription> | |
288 % | |
289 % Tests that the timespan method works with a vector of TIMESPAN objects as input. | |
290 % | |
291 % </TestDescription> | |
292 function result = utp_02 | |
293 | |
294 % <SyntaxDescription> | |
295 % | |
296 % Test that the timespan method works with a vector of TIMESPAN objects as input. | |
297 % | |
298 % </SyntaxDescription> | |
299 | |
300 try | |
301 % <SyntaxCode> | |
302 out = timespan(tsv); | |
303 % </SyntaxCode> | |
304 stest = true; | |
305 catch err | |
306 disp(err.message) | |
307 stest = false; | |
308 end | |
309 | |
310 % <AlgoDescription> | |
311 % | |
312 % 1) Check that the shape of the output TIMESPANs is the same as the input shape. | |
313 % 2) Check that each output TIMESPAN is a copy of the input TIMESPAN. | |
314 % 3) Check that the copy have an additional history step. | |
315 % | |
316 % </AlgoDescription> | |
317 | |
318 atest = true; | |
319 if stest | |
320 % <AlgoCode> | |
321 % Check we have the correct shape | |
322 if size(out) ~= size(tsv), atest = false; end | |
323 | |
324 % Check that the output is a copy. | |
325 for ii = 1:numel(out) | |
326 % Check that the output is the same except the history | |
327 if ~eq(tsv(ii), out(ii), ple3), atest = false; end | |
328 % Check the history | |
329 if ~eq(tsv(ii).hist, out(ii).hist.inhists), atest = false; end | |
330 % Change the output to make sure that it is a 'real' copy | |
331 out(ii).setDescription('my desc'); | |
332 if eq(tsv(ii), out(ii), ple3), atest = false; end | |
333 end | |
334 % </AlgoCode> | |
335 else | |
336 atest = false; | |
337 end | |
338 | |
339 % Return a result structure | |
340 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
341 end % END UTP_02 | |
342 | |
343 %% UTP_03 | |
344 | |
345 % <TestDescription> | |
346 % | |
347 % Tests that the timespan method works with a matrix of TIMESPAN objects as input. | |
348 % | |
349 % </TestDescription> | |
350 function result = utp_03 | |
351 | |
352 % <SyntaxDescription> | |
353 % | |
354 % Test that the timespan method works with a matrix of TIMESPAN objects as input. | |
355 % | |
356 % </SyntaxDescription> | |
357 | |
358 try | |
359 % <SyntaxCode> | |
360 out = timespan(tsm); | |
361 % </SyntaxCode> | |
362 stest = true; | |
363 catch err | |
364 disp(err.message) | |
365 stest = false; | |
366 end | |
367 | |
368 % <AlgoDescription> | |
369 % | |
370 % 1) Check that the shape of the output TIMESPANs is the same as the input shape. | |
371 % 2) Check that each output TIMESPAN is a copy of the input TIMESPAN. | |
372 % 3) Check that the copy have an additional history step. | |
373 % | |
374 % </AlgoDescription> | |
375 | |
376 atest = true; | |
377 if stest | |
378 % <AlgoCode> | |
379 % Check we have the correct number of outputs | |
380 if size(out) ~= size(tsm), atest = false; end | |
381 | |
382 % Check that the output is a copy. | |
383 for ii = 1:numel(out) | |
384 % Check that the output is the same except the history | |
385 if ~eq(tsm(ii), out(ii), ple3), atest = false; end | |
386 % Check the history | |
387 if ~eq(tsm(ii).hist, out(ii).hist.inhists), atest = false; end | |
388 % Change the output to make sure that it is a 'real' copy | |
389 out(ii).setDescription('my desc'); | |
390 if eq(tsm(ii), out(ii), ple3), atest = false; end | |
391 end | |
392 % </AlgoCode> | |
393 else | |
394 atest = false; | |
395 end | |
396 | |
397 % Return a result structure | |
398 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
399 end % END UTP_03 | |
400 | |
401 %% UTP_04 | |
402 | |
403 % <TestDescription> | |
404 % | |
405 % Tests that the timespan method works with a list of TIMESPAN objects as input. | |
406 % | |
407 % </TestDescription> | |
408 function result = utp_04 | |
409 | |
410 % <SyntaxDescription> | |
411 % | |
412 % Test that the timespan method works with a list of TIMESPAN objects as input. | |
413 % | |
414 % </SyntaxDescription> | |
415 | |
416 try | |
417 % <SyntaxCode> | |
418 out = timespan(ts5, ts4, ts3); | |
419 % </SyntaxCode> | |
420 stest = true; | |
421 catch err | |
422 disp(err.message) | |
423 stest = false; | |
424 end | |
425 | |
426 % <AlgoDescription> | |
427 % | |
428 % 1) Check that the number of elements in 'out' is the same of the | |
429 % number in the input. | |
430 % 2) Check that each output TIMESPAN is a copy of the input TIMESPAN. | |
431 % 3) Check that the copy have an additional history step. | |
432 % | |
433 % </AlgoDescription> | |
434 | |
435 atest = true; | |
436 tsin = [ts5, ts4, ts3]; | |
437 if stest | |
438 % <AlgoCode> | |
439 % Check we have the correct number of outputs | |
440 if numel(out) ~= 3, atest = false; end | |
441 | |
442 % Check that the output is a copy. | |
443 for ii = 1:numel(out) | |
444 % Check that the output is the same except the history | |
445 if ~eq(tsin(ii), out(ii), ple3), atest = false; end | |
446 % Check the history | |
447 if ~eq(tsin(ii).hist, out(ii).hist.inhists), atest = false; end | |
448 % Change the output to make sure that it is a 'real' copy | |
449 out(ii).setDescription('my desc'); | |
450 if eq(tsin(ii), out(ii), ple3), atest = false; end | |
451 end | |
452 % </AlgoCode> | |
453 else | |
454 atest = false; | |
455 end | |
456 | |
457 % Return a result structure | |
458 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
459 end % END UTP_04 | |
460 | |
461 %% UTP_05 | |
462 | |
463 % <TestDescription> | |
464 % | |
465 % Tests that the timespan method works with a mix of different shaped TIMESPANs as | |
466 % input. | |
467 % | |
468 % </TestDescription> | |
469 function result = utp_05 | |
470 | |
471 % <SyntaxDescription> | |
472 % | |
473 % Test that the timespan method works with a mix of different shaped TIMESPANs as | |
474 % input. | |
475 % | |
476 % </SyntaxDescription> | |
477 | |
478 try | |
479 % <SyntaxCode> | |
480 out = timespan(ts5,tsv,ts2,tsm,ts4); | |
481 % </SyntaxCode> | |
482 stest = true; | |
483 catch err | |
484 disp(err.message) | |
485 stest = false; | |
486 end | |
487 | |
488 % <AlgoDescription> | |
489 % | |
490 % 1) Check that the number of elements in 'out' is the same of the | |
491 % number in the input. | |
492 % 2) Check that each output TIMESPAN is a copy of the input TIMESPAN. | |
493 % 3) Check that the copy have an additional history step. | |
494 % | |
495 % </AlgoDescription> | |
496 | |
497 atest = true; | |
498 tsin = [ts5, reshape(tsv, 1, []), ts2, reshape(tsm, 1, []), ts4]; | |
499 if stest | |
500 % <AlgoCode> | |
501 % Check we have the correct number of outputs | |
502 if numel(out) ~= 3+numel(tsv)+numel(tsm), atest = false; end | |
503 | |
504 % Check that the output is a copy. | |
505 for ii = 1:numel(out) | |
506 % Check that the output is the same except the history | |
507 if ~eq(tsin(ii), out(ii), ple3), atest = false; end | |
508 % Check the history | |
509 if ~eq(tsin(ii).hist, out(ii).hist.inhists), atest = false; end | |
510 % Change the output to make sure that it is a 'real' copy | |
511 out(ii).setDescription('my desc'); | |
512 if eq(tsin(ii), out(ii), ple3), atest = false; end | |
513 end | |
514 % </AlgoCode> | |
515 else | |
516 atest = false; | |
517 end | |
518 | |
519 % Return a result structure | |
520 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
521 end % END UTP_05 | |
522 | |
523 %% UTP_06 | |
524 | |
525 % <TestDescription> | |
526 % | |
527 % Tests that the timespan method properly applies history. | |
528 % | |
529 % </TestDescription> | |
530 function result = utp_06 | |
531 | |
532 % <SyntaxDescription> | |
533 % | |
534 % Test that the result of applying the timespan method can be processed back. | |
535 % | |
536 % </SyntaxDescription> | |
537 | |
538 try | |
539 % <SyntaxCode> | |
540 out = timespan(ts4); | |
541 mout = rebuild(out); | |
542 % </SyntaxCode> | |
543 stest = true; | |
544 catch err | |
545 disp(err.message) | |
546 stest = false; | |
547 end | |
548 | |
549 % <AlgoDescription> | |
550 % | |
551 % 1) Check that the last entry in the history of 'out' corresponds to | |
552 % 'timespan'. | |
553 % 2) Check that the method rebuild produces the same object as 'out'. | |
554 % | |
555 % </AlgoDescription> | |
556 | |
557 atest = true; | |
558 if stest | |
559 % <AlgoCode> | |
560 % Check the last step in the history of 'out' | |
561 if ~strcmp(out.hist.methodInfo.mname, 'timespan'), atest = false; end | |
562 % Check the rebuilt object | |
563 if ~eq(mout, out, ple2), atest = false; end | |
564 % </AlgoCode> | |
565 else | |
566 atest = false; | |
567 end | |
568 | |
569 % Return a result structure | |
570 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
571 end % END UTP_06 | |
572 | |
573 %% UTP_07 | |
574 | |
575 % <TestDescription> | |
576 % | |
577 % Tests that the timespan method properly applies history to the copy constructor. | |
578 % | |
579 % </TestDescription> | |
580 function result = utp_07 | |
581 | |
582 % <SyntaxDescription> | |
583 % | |
584 % Test that the output can be processed back with the 'rebuild' method. | |
585 % Test the constructor with a different number of inputs. | |
586 % | |
587 % </SyntaxDescription> | |
588 | |
589 try | |
590 % <SyntaxCode> | |
591 out1 = timespan(ts5); | |
592 out2 = timespan(ts5, ts4); | |
593 out3 = timespan(ts5, ts4, ts3); | |
594 out1.setName('my name'); | |
595 out2(1).setName('my name'); | |
596 out2(2).setName('my name'); | |
597 out3(1).setName('my name'); | |
598 out3(2).setName('my name'); | |
599 out3(3).setName('my name'); | |
600 mout = rebuild(out1); | |
601 % </SyntaxCode> | |
602 stest = true; | |
603 catch err | |
604 disp(err.message) | |
605 stest = false; | |
606 end | |
607 | |
608 % <AlgoDescription> | |
609 % | |
610 % 1) Check that the last entry in the history of 'out' corresponds to | |
611 % 'timespan'. | |
612 % 2) Check that the original objects are not changed by the setter function | |
613 % 3) Check that the method rebuild produces the same object as 'out'. | |
614 % | |
615 % </AlgoDescription> | |
616 | |
617 atest = true; | |
618 if stest | |
619 % <AlgoCode> | |
620 % Check the last step in the history of 'out' | |
621 % It is the method 'setName' because we set it in above | |
622 if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end | |
623 % Check next to the last step in the history of 'out' | |
624 if ~strcmp(out1.hist.inhists.methodInfo.mname, 'timespan'), atest = false; end | |
625 % Check the originals | |
626 if strcmp(ts5, 'my name'), atest = false; end | |
627 if strcmp(ts4, 'my name'), atest = false; end | |
628 if strcmp(ts3, 'my name'), atest = false; end | |
629 % Check the rebuilt object | |
630 if ~eq(mout, out1, ple2), atest = false; end | |
631 % </AlgoCode> | |
632 else | |
633 atest = false; | |
634 end | |
635 | |
636 % Return a result structure | |
637 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
638 end % END UTP_07 | |
639 | |
640 %% UTP_08 | |
641 | |
642 % <TestDescription> | |
643 % | |
644 % Tests that the timespan method properly applies history to the read | |
645 % MAT-file constructor. | |
646 % | |
647 % </TestDescription> | |
648 function result = utp_08 | |
649 | |
650 % <SyntaxDescription> | |
651 % | |
652 % Test that the output can be processed back with the 'rebuild' method. | |
653 % | |
654 % </SyntaxDescription> | |
655 | |
656 try | |
657 % <SyntaxCode> | |
658 filename = 'test_ts.mat'; | |
659 ts = timespan(ts4); | |
660 save(ts, filename); | |
661 | |
662 out = timespan(filename); | |
663 mout = rebuild(out); | |
664 % </SyntaxCode> | |
665 stest = true; | |
666 catch err | |
667 disp(err.message) | |
668 stest = false; | |
669 end | |
670 | |
671 % <AlgoDescription> | |
672 % | |
673 % 1) Check that the 'rebuild' method produces the same object as 'out'. | |
674 % | |
675 % </AlgoDescription> | |
676 | |
677 atest = true; | |
678 if stest | |
679 % <AlgoCode> | |
680 if ~eq(out, ts, ple1), atest = false; end | |
681 % Check the rebuilt object | |
682 if ~eq(mout, out, ple2), atest = false; end | |
683 % </AlgoCode> | |
684 delete(filename); | |
685 else | |
686 atest = false; | |
687 end | |
688 | |
689 % Return a result structure | |
690 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
691 end % END UTP_08 | |
692 | |
693 | |
694 %% UTP_09 | |
695 | |
696 % <TestDescription> | |
697 % | |
698 % Tests that the timespan method properly applies history to the read | |
699 % XML-file constructor. | |
700 % | |
701 % </TestDescription> | |
702 function result = utp_09 | |
703 | |
704 % <SyntaxDescription> | |
705 % | |
706 % Test that the output can be processed back with the 'rebuild' method. | |
707 % | |
708 % </SyntaxDescription> | |
709 | |
710 try | |
711 % <SyntaxCode> | |
712 filename = 'test_ts.xml'; | |
713 amat = timespan(tsm); | |
714 save(amat, filename); | |
715 | |
716 out = timespan(filename); | |
717 mout = rebuild(out); | |
718 % </SyntaxCode> | |
719 stest = true; | |
720 catch err | |
721 disp(err.message) | |
722 stest = false; | |
723 rethrow(err); | |
724 end | |
725 | |
726 % <AlgoDescription> | |
727 % | |
728 % 1) Check that the 'rebuild' method produces the same object as 'out'. | |
729 % | |
730 % </AlgoDescription> | |
731 | |
732 atest = true; | |
733 if stest | |
734 % <AlgoCode> | |
735 % Check the algorithm | |
736 for kk = 1:numel(out) | |
737 if ~eq(out(kk), amat(kk), ple1), atest = false; end | |
738 end | |
739 | |
740 % Check the rebuilt object | |
741 for kk = 1:numel(out) | |
742 if ~eq(mout(kk), out(kk), ple2), atest = false; end | |
743 end | |
744 % </AlgoCode> | |
745 delete(filename); | |
746 else | |
747 atest = false; | |
748 end | |
749 | |
750 % Return a result structure | |
751 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
752 end % END UTP_09 | |
753 | |
754 %% UTP_10 | |
755 | |
756 % <TestDescription> | |
757 % | |
758 % Tests that the timespan method properly applies history to the struct constructor. | |
759 % | |
760 % </TestDescription> | |
761 function result = utp_10 | |
762 | |
763 % <SyntaxDescription> | |
764 % | |
765 % Test that the output can be processed back with the 'rebuild' method. | |
766 % | |
767 % </SyntaxDescription> | |
768 | |
769 try | |
770 % <SyntaxCode> | |
771 % silence warnings about converting objects to struct | |
772 w = warning('off', 'MATLAB:structOnObject'); | |
773 | |
774 sts5 = struct(ts5); | |
775 sts5.startT = struct(ts5.startT); | |
776 sts5.endT = struct(ts5.endT); | |
777 sts5.hist = struct(ts5.hist); | |
778 | |
779 out1 = timespan(struct(ts5)); | |
780 out2 = timespan(sts5); | |
781 mout1 = rebuild(out1); | |
782 mout2 = rebuild(out2); | |
783 | |
784 % restore warnings | |
785 warning(w); | |
786 % </SyntaxCode> | |
787 stest = true; | |
788 catch err | |
789 disp(err.message) | |
790 stest = false; | |
791 end | |
792 | |
793 % <AlgoDescription> | |
794 % | |
795 % 1) Check that the last entry in the history of 'out' | |
796 % corresponds to 'timespan'. | |
797 % 2) Check that the 'rebuild' method produces the same object as 'out'. | |
798 % | |
799 % </AlgoDescription> | |
800 | |
801 atest = true; | |
802 if stest | |
803 % <AlgoCode> | |
804 % Check that the output is a TIMESPAN object | |
805 if ~isa(out1,'timespan'), atest = false; end | |
806 if ~isa(out2,'timespan'), atest = false; end | |
807 % Check the last step in the history of 'out' | |
808 if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end | |
809 if ~strcmp(out2.hist.methodInfo.mname, 'setName'), atest = false; end | |
810 % Check the rebuilt object | |
811 if ~eq(mout1, out1, ple2), atest = false; end | |
812 if ~eq(mout2, out2, ple2), atest = false; end | |
813 % </AlgoCode> | |
814 else | |
815 atest = false; | |
816 end | |
817 | |
818 % Return a result structure | |
819 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
820 end % END UTP_10 | |
821 | |
822 %% UTP_11 | |
823 | |
824 % <TestDescription> | |
825 % | |
826 % Tests that the timespan method properly applies history to the | |
827 % plist(filename) constructor. | |
828 % | |
829 % </TestDescription> | |
830 function result = utp_11 | |
831 | |
832 % <SyntaxDescription> | |
833 % | |
834 % Test that the output can be processed back to an m-file. | |
835 % | |
836 % </SyntaxDescription> | |
837 | |
838 try | |
839 % <SyntaxCode> | |
840 filename1 = 'test_ts.xml'; | |
841 filename2 = 'test_ts.mat'; | |
842 | |
843 f1 = timespan(ts5); | |
844 f2 = timespan(ts4); | |
845 | |
846 save(f1, filename1); | |
847 save(f2, filename2); | |
848 | |
849 out1 = timespan(plist('filename', filename1)); | |
850 out2 = timespan(plist('filename', filename2)); | |
851 | |
852 mout1 = out1.rebuild; | |
853 mout2 = out2.rebuild; | |
854 | |
855 % </SyntaxCode> | |
856 stest = true; | |
857 catch err | |
858 disp(err.message) | |
859 stest = false; | |
860 end | |
861 | |
862 % <AlgoDescription> | |
863 % | |
864 % 1) Check that the save method doesn't change the input object | |
865 % 2) Check that the last two entries in the history of 'out' corresponds to | |
866 % 'timespan' and 'save' | |
867 % 3) Check that the 'rebuild' method produces the same object as 'out'. | |
868 % | |
869 % </AlgoDescription> | |
870 | |
871 atest = true; | |
872 if stest | |
873 % <AlgoCode> | |
874 % Check the input object | |
875 if ~eq(f1, timespan(ts5), ple1), atest = false; end | |
876 if ~eq(f2, timespan(ts4), ple1) , atest = false; end | |
877 % The load doesn't have two additionally history steps (save + load) | |
878 if ~eq(out1, f1, ple1), atest = false; end | |
879 if ~eq(out2, f2, ple1), atest = false; end | |
880 % Rebuild object and check the result | |
881 if ~eq(mout1, out1, ple2), atest = false; end | |
882 if ~eq(mout2, out2, ple2), atest = false; end | |
883 % </AlgoCode> | |
884 % delete test file | |
885 delete(filename1) | |
886 delete(filename2) | |
887 else | |
888 atest = false; | |
889 end | |
890 | |
891 % Return a result structure | |
892 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
893 end % END UTP_11 | |
894 | |
895 %% UTP_12 | |
896 | |
897 % <TestDescription> | |
898 % | |
899 % Tests that the TIMESPAN method properly applies history to the | |
900 % plist(conn) constructor. | |
901 % | |
902 % </TestDescription> | |
903 function result = utp_12 | |
904 | |
905 % <SyntaxDescription> | |
906 % | |
907 % Test that the output can be processed back with the rebuild method. | |
908 % | |
909 % </SyntaxDescription> | |
910 | |
911 conn = utpGetConnection | |
912 try | |
913 % <SyntaxCode> | |
914 | |
915 sinfo.conn = conn; | |
916 sinfo.experiment_title = 'utp_timespan_timespan_12: submit timespan vector'; | |
917 sinfo.experiment_description = 'utp_timespan_timespan_12: &description'; | |
918 sinfo.analysis_description = '<utp_timespan_timespan_12>'; | |
919 sinfo.quantity = 'none'; | |
920 sinfo.keywords = 'none'; | |
921 sinfo.reference_ids = ''; | |
922 sinfo.additional_comments = 'none'; | |
923 sinfo.additional_authors = 'no one'; | |
924 | |
925 plForAutoTest = plist('no dialog', true, 'use selector', false); | |
926 ids = submit(tsv, sinfo, plForAutoTest); | |
927 | |
928 out = timespan(plist('hostname', utpGetHostname, 'database', utpGetDatabase, 'conn', conn, 'id', ids)); | |
929 % </SyntaxCode> | |
930 utpCloseConnection(conn); | |
931 stest = true; | |
932 catch err | |
933 disp(err.message) | |
934 % Close connection | |
935 utpCloseConnection(conn); | |
936 stest = false; | |
937 end | |
938 | |
939 % <AlgoDescription> | |
940 % | |
941 % 1) Check that the last entry in the history of 'out' corresponds to | |
942 % 'timespan'. | |
943 % 2) Check that the 'rebuild' method produces the same object as 'out'. | |
944 % | |
945 % </AlgoDescription> | |
946 | |
947 atest = true; | |
948 if stest | |
949 % <AlgoCode> | |
950 % Check the last step in the history of 'out' | |
951 for kk = 1:numel(out) | |
952 if ~strcmp(out(kk).hist.methodInfo.mname, 'timespan'), atest = false; end | |
953 end | |
954 % Check data values | |
955 if ~eq(out, tsv, ple3), atest = false; end | |
956 % Rebuild object and check the result | |
957 mout = rebuild(out); | |
958 if ~eq(mout, out, ple3), atest = false; end | |
959 % </AlgoCode> | |
960 else | |
961 atest = false; | |
962 end | |
963 | |
964 % Return a result structure | |
965 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
966 end % END UTP_12 | |
967 | |
968 %% UTP_13 | |
969 | |
970 % <TestDescription> | |
971 % | |
972 % Tests that the TIMESPAN method properly applies history to the | |
973 % plist(type) constructor. | |
974 % | |
975 % </TestDescription> | |
976 function result = utp_13 | |
977 | |
978 % <SyntaxDescription> | |
979 % | |
980 % Test that the output can be processed back with the rebuild method. | |
981 % | |
982 % </SyntaxDescription> | |
983 | |
984 try | |
985 % <SyntaxCode> | |
986 tf = 'HH:MM:SS.FFF'; | |
987 tz = 'GMT-04'; | |
988 pl1 = plist('startT', time(1), 'endT', 2); | |
989 pl2 = plist('startT', '00:01:00.000', 'endT', '00:02:00.000', 'timezone', tz); | |
990 pl3 = plist('startT', '00:00:00.000', 'endT', 2, 'timeformat', tf); | |
991 | |
992 out1 = timespan(pl1); | |
993 out2 = timespan(pl2); | |
994 out3 = timespan(pl3); | |
995 | |
996 mout1 = rebuild(out1); | |
997 mout2 = rebuild(out2); | |
998 mout3 = rebuild(out3); | |
999 % </SyntaxCode> | |
1000 stest = true; | |
1001 catch err | |
1002 disp(err.message) | |
1003 stest = false; | |
1004 % rethrow(err) | |
1005 end | |
1006 | |
1007 % <AlgoDescription> | |
1008 % | |
1009 % 1) Check that the last entry in the history of 'out' corresponds to | |
1010 % 'timespan'. | |
1011 % 2) Check that the 'rebuild' method produces the same object as 'out'. | |
1012 % | |
1013 % </AlgoDescription> | |
1014 | |
1015 atest = true; | |
1016 if stest | |
1017 % <AlgoCode> | |
1018 % Check the last step in the history of 'out' | |
1019 if ~strcmp(out1.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1020 if ~strcmp(out2.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1021 if ~strcmp(out3.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1022 % Check first plist | |
1023 if ~eq(out1.startT, time(1)), atest = false; end | |
1024 if ~eq(out1.endT, time(2)), atest = false; end | |
1025 % Check second plist | |
1026 if ~eq(out2.startT, time(plist('time', '00:01:00', 'timezone', tz))), atest = false; end | |
1027 if ~eq(out2.endT, time(plist('time', '00:02:00', 'timezone', tz))), atest = false; end | |
1028 % Check third plist | |
1029 if ~eq(out3.startT, time(0)), atest = false; end | |
1030 if ~eq(out3.endT, time(2)), atest = false; end | |
1031 % Rebuild object and check the result | |
1032 if ~eq(mout1, out1, ple1), atest = false; end | |
1033 if ~eq(mout2, out2, ple1), atest = false; end | |
1034 if ~eq(mout3, out3, ple1), atest = false; end | |
1035 % </AlgoCode> | |
1036 else | |
1037 atest = false; | |
1038 end | |
1039 | |
1040 % Return a result structure | |
1041 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
1042 end % END UTP_13 | |
1043 | |
1044 | |
1045 %% UTP_15 | |
1046 | |
1047 % <TestDescription> | |
1048 % | |
1049 % Tests that the TIMESPAN method properly applies history to | |
1050 % the start + end time constructor. | |
1051 % | |
1052 % </TestDescription> | |
1053 function result = utp_15 | |
1054 | |
1055 % <SyntaxDescription> | |
1056 % | |
1057 % Test that the output can be processed back with the rebuild method. | |
1058 % | |
1059 % </SyntaxDescription> | |
1060 | |
1061 try | |
1062 % <SyntaxCode> | |
1063 out1 = timespan('14:00:00', '14:00:05'); | |
1064 out2 = timespan('00:00:01', time(4)); | |
1065 out3 = timespan(time(1234), time(2345)); | |
1066 out4 = timespan(time(1.234), '00:00:05'); | |
1067 | |
1068 mout1 = rebuild(out1); | |
1069 mout2 = rebuild(out2); | |
1070 mout3 = rebuild(out3); | |
1071 mout4 = rebuild(out4); | |
1072 % </SyntaxCode> | |
1073 stest = true; | |
1074 catch err | |
1075 disp(err.message) | |
1076 stest = false; | |
1077 end | |
1078 | |
1079 % <AlgoDescription> | |
1080 % | |
1081 % 1) Check that the last entry in the history of 'out' corresponds to | |
1082 % 'timespan'. | |
1083 % 2) Check that the 'rebuild' method produces the same object as 'out'. | |
1084 % | |
1085 % </AlgoDescription> | |
1086 | |
1087 atest = true; | |
1088 if stest | |
1089 % <AlgoCode> | |
1090 % Check the last step in the history of 'out' | |
1091 if ~strcmp(out1.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1092 if ~strcmp(out2.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1093 if ~strcmp(out3.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1094 if ~strcmp(out4.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1095 % Check values | |
1096 if ~eq(out1.startT, time('14:00:00')), atest = false; end | |
1097 if ~eq(out1.endT, time('14:00:05')), atest = false; end | |
1098 if ~eq(out2.startT, time('00:00:01')), atest = false; end | |
1099 if ~eq(out2.endT, time(4)), atest = false; end | |
1100 if ~eq(out3.startT, time(1234)), atest = false; end | |
1101 if ~eq(out3.endT, time(2345)), atest = false; end | |
1102 if ~eq(out4.startT, time(1.234)), atest = false; end | |
1103 if ~eq(out4.endT, time('00:00:05')), atest = false; end | |
1104 % Rebuild object and check the result | |
1105 if ~eq(mout1, out1, ple1), atest = false; end | |
1106 if ~eq(mout2, out2, ple1), atest = false; end | |
1107 if ~eq(mout3, out3, ple1), atest = false; end | |
1108 if ~eq(mout4, out4, ple1), atest = false; end | |
1109 % </AlgoCode> | |
1110 else | |
1111 atest = false; | |
1112 end | |
1113 | |
1114 % Return a result structure | |
1115 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
1116 end % END UTP_15 | |
1117 | |
1118 %% UTP_16 | |
1119 | |
1120 % <TestDescription> | |
1121 % | |
1122 % Tests that the TIMESPAN method properly applies history to the conn+Id constructor. | |
1123 % | |
1124 % </TestDescription> | |
1125 function result = utp_16 | |
1126 | |
1127 % <SyntaxDescription> | |
1128 % | |
1129 % Test that the output can be processed back with the rebuild method. | |
1130 % | |
1131 % </SyntaxDescription> | |
1132 | |
1133 conn = utpGetConnection | |
1134 try | |
1135 % <SyntaxCode> | |
1136 | |
1137 sinfo.conn = conn; | |
1138 sinfo.experiment_title = 'utp_timespan_timespan_16: submit timespan'; | |
1139 sinfo.experiment_description = 'utp_timespan_timespan_16: description'; | |
1140 sinfo.analysis_description = 'utp_timespan_timespan_16'; | |
1141 sinfo.quantity = 'none'; | |
1142 sinfo.keywords = 'none'; | |
1143 sinfo.reference_ids = ''; | |
1144 sinfo.additional_comments = 'none'; | |
1145 sinfo.additional_authors = 'no one'; | |
1146 | |
1147 plForAutoTest = plist('no dialog', true, 'use selector', false); | |
1148 [ids] = submit(ts4, sinfo, plForAutoTest); | |
1149 | |
1150 out = timespan(conn, ids); | |
1151 % </SyntaxCode> | |
1152 utpCloseConnection(conn); | |
1153 stest = true; | |
1154 catch err | |
1155 disp(err.message) | |
1156 % Close connection | |
1157 utpCloseConnection(conn); | |
1158 stest = false; | |
1159 end | |
1160 | |
1161 % <AlgoDescription> | |
1162 % | |
1163 % 1) Check that the last entry in the history of 'out' corresponds to | |
1164 % 'timespan'. | |
1165 % 2) Check that the 'rebuild' method produces the same object as 'out'. | |
1166 % | |
1167 % </AlgoDescription> | |
1168 | |
1169 atest = true; | |
1170 if stest | |
1171 % <AlgoCode> | |
1172 % Check the last step in the history of 'out' | |
1173 if ~strcmp(out.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1174 % Check data values | |
1175 if ~eq(out,ts4, ple3), atest = false; end | |
1176 % Check the history except the additional 'submit' + 'retrieve' steps | |
1177 if ~eq(out.hist.inhists, ts4.hist), atest = false; end | |
1178 % Rebuild object and check the result | |
1179 mout = rebuild(out); | |
1180 if ~eq(mout, out, ple3), atest = false; end | |
1181 % </AlgoCode> | |
1182 else | |
1183 atest = false; | |
1184 end | |
1185 | |
1186 % Return a result structure | |
1187 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
1188 end % END UTP_16 | |
1189 | |
1190 %% UTP_17 | |
1191 | |
1192 % <TestDescription> | |
1193 % | |
1194 % Tests that the TIMESPAN method properly applies history to | |
1195 % the start + end time + format constructor. | |
1196 % | |
1197 % </TestDescription> | |
1198 function result = utp_17 | |
1199 | |
1200 % <SyntaxDescription> | |
1201 % | |
1202 % Test that the output can be processed back with the rebuild method. | |
1203 % | |
1204 % </SyntaxDescription> | |
1205 | |
1206 try | |
1207 % <SyntaxCode> | |
1208 f1 = 'HH:MM:SS'; | |
1209 f2 = 'HH:MM:SS'; | |
1210 f4 = 'HH:MM:SS'; | |
1211 out1 = timespan('14:00:00', '14:00:05', f1); | |
1212 out2 = timespan('00:00:01', time(4), f2); | |
1213 out3 = timespan(time(1.234), time(2.345)); | |
1214 out4 = timespan(time(1.234), '00:00:05', f4); | |
1215 | |
1216 mout1 = rebuild(out1); | |
1217 mout2 = rebuild(out2); | |
1218 mout3 = rebuild(out3); | |
1219 mout4 = rebuild(out4); | |
1220 % </SyntaxCode> | |
1221 stest = true; | |
1222 catch err | |
1223 disp(err.message) | |
1224 stest = false; | |
1225 end | |
1226 | |
1227 % <AlgoDescription> | |
1228 % | |
1229 % 1) Check that the last entry in the history of 'out' corresponds to | |
1230 % 'timespan'. | |
1231 % 2) Check that the 'rebuild' method produces the same object as 'out'. | |
1232 % | |
1233 % </AlgoDescription> | |
1234 | |
1235 atest = true; | |
1236 if stest | |
1237 % <AlgoCode> | |
1238 % Check the last step in the history of 'out' | |
1239 if ~strcmp(out1.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1240 if ~strcmp(out2.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1241 if ~strcmp(out3.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1242 if ~strcmp(out4.hist.methodInfo.mname, 'timespan'), atest = false; end | |
1243 % Check first object | |
1244 if ~eq(out1.startT, time('14:00:00', f1)), atest = false; end | |
1245 if ~eq(out1.endT, time('14:00:05', f1)), atest = false; end | |
1246 % Check second object | |
1247 if ~eq(out2.startT, time('00:00:01', f2)), atest = false; end | |
1248 if ~eq(out2.endT, time(4.000)), atest = false; end | |
1249 % Check third object | |
1250 if ~eq(out3.startT, time(1.234)), atest = false; end | |
1251 if ~eq(out3.endT, time(2.345)), atest = false; end | |
1252 % Check fourth object | |
1253 if ~eq(out4.startT, time(1.234)), atest = false; end | |
1254 if ~eq(out4.endT, time('00:00:05', f4)), atest = false; end | |
1255 % Rebuild object and check the result | |
1256 if ~eq(mout1, out1, ple1), atest = false; end | |
1257 if ~eq(mout2, out2, ple1), atest = false; end | |
1258 if ~eq(mout3, out3, ple1), atest = false; end | |
1259 if ~eq(mout4, out4, ple1), atest = false; end | |
1260 % </AlgoCode> | |
1261 else | |
1262 atest = false; | |
1263 end | |
1264 | |
1265 % Return a result structure | |
1266 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
1267 end % END UTP_17 | |
1268 | |
1269 end |