Mercurial > hg > ltpda
comparison testing/utp_1.1/utps/ao/utp_ao_eq.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_AO_EQ a set of UTPs for the ao/eq method | |
2 % | |
3 % M Hewitson 06-08-08 | |
4 % | |
5 % $Id: utp_ao_eq.m,v 1.11 2011/04/19 18:14:00 ingo Exp $ | |
6 % | |
7 | |
8 % <MethodDescription> | |
9 % | |
10 % The eq() method of the ao class ao1 == ao2 compares each element of an | |
11 % analysis object with the corresponding element of an second analysis object | |
12 % and returns a logical 1 (true) where ao1 and ao2 are equal, | |
13 % or logical 0 (false) where they are not equal. | |
14 % | |
15 % </MethodDescription> | |
16 | |
17 function results = utp_ao_eq(varargin) | |
18 | |
19 % Check the inputs | |
20 if nargin == 0 | |
21 | |
22 % Some keywords | |
23 class = 'ao'; | |
24 mthd = 'eq'; | |
25 | |
26 results = []; | |
27 disp('******************************************************'); | |
28 disp(['**** Running UTPs for ' class '/' mthd]); | |
29 disp('******************************************************'); | |
30 | |
31 % Test AOs | |
32 [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); | |
33 | |
34 % Exception list for the UTPs: | |
35 [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); | |
36 | |
37 % Run the tests | |
38 results = [results utp_01]; % getInfo call | |
39 results = [results utp_02]; % Vector input | |
40 results = [results utp_03]; % Matrix input | |
41 results = [results utp_04]; % List input | |
42 results = [results utp_05]; % Test with mixed input | |
43 results = [results utp_06]; % Test history is working | |
44 results = [results utp_07]; % Test with the exception list 'name' | |
45 results = [results utp_08]; % Test with the exception list 'plotinfo' | |
46 results = [results utp_09]; % Test with the exception list 't0' | |
47 results = [results utp_10]; % Test with the exception list 'x' | |
48 results = [results utp_11]; % Test with the exception list 'y' | |
49 results = [results utp_12]; % Test with the exception list 'xunits' | |
50 results = [results utp_13]; % Test with the exception list 'yunits' | |
51 results = [results utp_14]; % Test with the exception list 'fs' | |
52 results = [results utp_15]; % Test with the exception list 'description' | |
53 results = [results utp_16]; % Test exception list in a plist | |
54 | |
55 disp('Done.'); | |
56 disp('******************************************************'); | |
57 | |
58 elseif nargin == 1 % Check for UTP functions | |
59 if strcmp(varargin{1}, 'isutp') | |
60 results = 1; | |
61 else | |
62 results = 0; | |
63 end | |
64 else | |
65 error('### Incorrect inputs') | |
66 end | |
67 | |
68 %% UTP_01 | |
69 | |
70 % <TestDescription> | |
71 % | |
72 % Tests that the getInfo call works for this method. | |
73 % | |
74 % </TestDescription> | |
75 function result = utp_01 | |
76 | |
77 | |
78 % <SyntaxDescription> | |
79 % | |
80 % Test that the getInfo call works for no sets, all sets, and each set | |
81 % individually. | |
82 % | |
83 % </SyntaxDescription> | |
84 | |
85 try | |
86 % <SyntaxCode> | |
87 % Call for no sets | |
88 io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); | |
89 % Call for all sets | |
90 io(2) = eval([class '.getInfo(''' mthd ''')']); | |
91 % Call for each set | |
92 for kk=1:numel(io(2).sets) | |
93 io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); | |
94 end | |
95 % </SyntaxCode> | |
96 stest = true; | |
97 catch err | |
98 disp(err.message) | |
99 stest = false; | |
100 end | |
101 | |
102 % <AlgoDescription> | |
103 % | |
104 % 1) Check that getInfo call returned an minfo object in all cases. | |
105 % 2) Check that all plists have the correct parameters. | |
106 % | |
107 % </AlgoDescription> | |
108 | |
109 atest = true; | |
110 if stest | |
111 % <AlgoCode> | |
112 % check we have minfo objects | |
113 if isa(io, 'minfo') | |
114 % SET 'None' | |
115 if ~isempty(io(1).sets), atest = false; end | |
116 if ~isempty(io(1).plists), atest = false; end | |
117 % Check number of SETS | |
118 if numel(io(2).sets) ~= 1, atest = false; end | |
119 % Check all Sets | |
120 if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end | |
121 % SET 'Default' | |
122 % Check key | |
123 if ~io(3).plists.isparam('Exceptions'), atest = false; end | |
124 if ~io(3).plists.isparam('Tol'), atest = false; end | |
125 % Check default value | |
126 if ~isequal(io(3).plists.find('Exceptions'), {}), atest = false; end | |
127 if ~isequal(io(3).plists.find('Tol'), eps(1)), atest = false; end | |
128 % Check options | |
129 if ~isequal(io(3).plists.getOptionsForParam('Exceptions'), {{}}), atest = false; end | |
130 if ~isequal(io(3).plists.getOptionsForParam('Tol'), {eps(1)}), atest = false; end | |
131 end | |
132 % </AlgoCode> | |
133 else | |
134 atest = false; | |
135 end | |
136 | |
137 % Return a result structure | |
138 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
139 end % END UTP_01 | |
140 | |
141 %% UTP_02 | |
142 | |
143 % <TestDescription> | |
144 % | |
145 % Tests that the eq method works with a vector of AOs as input. | |
146 % | |
147 % </TestDescription> | |
148 function result = utp_02 | |
149 | |
150 % <SyntaxDescription> | |
151 % | |
152 % Test that the eq method works for a vector of AOs as input. Test the | |
153 % positive and the negative case. | |
154 % | |
155 % </SyntaxDescription> | |
156 | |
157 try | |
158 % <SyntaxCode> | |
159 aa = at1.setName('my name'); | |
160 avec1 = [at4, at3, at2, at1]; | |
161 avec2 = [at4, at3, at2, aa]; | |
162 out1 = eq(avec1, avec1); | |
163 out2 = eq(avec1, avec2); | |
164 % </SyntaxCode> | |
165 stest = true; | |
166 catch err | |
167 disp(err.message) | |
168 stest = false; | |
169 end | |
170 | |
171 % <AlgoDescription> | |
172 % | |
173 % 1) Check the output of the eq function. | |
174 % | |
175 % </AlgoDescription> | |
176 | |
177 atest = true; | |
178 if stest | |
179 % <AlgoCode> | |
180 if out1 ~= 1, atest = false; end | |
181 if out2 ~= 0, atest = false; end | |
182 % </AlgoCode> | |
183 else | |
184 atest = false; | |
185 end | |
186 | |
187 % Return a result structure | |
188 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
189 end % END UTP_02 | |
190 | |
191 %% UTP_03 | |
192 | |
193 % <TestDescription> | |
194 % | |
195 % Tests that the eq method works with a matrix of AOs as input. | |
196 % | |
197 % </TestDescription> | |
198 function result = utp_03 | |
199 | |
200 % <SyntaxDescription> | |
201 % | |
202 % Test that the eq method works for a matrix of AOs as input. Test the | |
203 % positive and the negative case. | |
204 % | |
205 % </SyntaxDescription> | |
206 | |
207 try | |
208 % <SyntaxCode> | |
209 aa = at1.setName('my name'); | |
210 amat1 = [at4, at3, at1, at1, at2, at4]; | |
211 amat2 = [at4, at3, aa; at1, at2, at4]; | |
212 out1 = eq(amat1, amat1); | |
213 out2 = eq(amat1, amat2); | |
214 % </SyntaxCode> | |
215 stest = true; | |
216 catch err | |
217 disp(err.message) | |
218 stest = false; | |
219 end | |
220 | |
221 % <AlgoDescription> | |
222 % | |
223 % 1) Check the output of the eq function. | |
224 % | |
225 % </AlgoDescription> | |
226 | |
227 atest = true; | |
228 if stest | |
229 % <AlgoCode> | |
230 if out1 ~= 1, atest = false; end | |
231 if out2 ~= 0, atest = false; end | |
232 % </AlgoCode> | |
233 else | |
234 atest = false; | |
235 end | |
236 | |
237 % Return a result structure | |
238 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
239 end % END UTP_03 | |
240 | |
241 %% UTP_04 | |
242 | |
243 % <TestDescription> | |
244 % | |
245 % Tests that the eq method works with a list of AOs as input. | |
246 % | |
247 % </TestDescription> | |
248 function result = utp_04 | |
249 | |
250 % <SyntaxDescription> | |
251 % | |
252 % The eq method doesn't works for a list of AOs as input. Nothing to do. | |
253 % | |
254 % </SyntaxDescription> | |
255 | |
256 try | |
257 % <SyntaxCode> | |
258 % </SyntaxCode> | |
259 stest = true; | |
260 catch err | |
261 disp(err.message) | |
262 stest = false; | |
263 end | |
264 | |
265 % <AlgoDescription> | |
266 % | |
267 % </AlgoDescription> | |
268 | |
269 atest = true; | |
270 if stest | |
271 % <AlgoCode> | |
272 % </AlgoCode> | |
273 else | |
274 atest = false; | |
275 end | |
276 | |
277 % Return a result structure | |
278 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
279 end % END UTP_04 | |
280 | |
281 %% UTP_05 | |
282 | |
283 % <TestDescription> | |
284 % | |
285 % Tests that the eq method works with a mix of different shaped AOs as | |
286 % input. | |
287 % | |
288 % </TestDescription> | |
289 function result = utp_05 | |
290 | |
291 % <SyntaxDescription> | |
292 % | |
293 % The eq method doesn't works for a list of AOs as input. Nothing to do. | |
294 % | |
295 % </SyntaxDescription> | |
296 | |
297 try | |
298 % <SyntaxCode> | |
299 % </SyntaxCode> | |
300 stest = true; | |
301 catch err | |
302 disp(err.message) | |
303 stest = false; | |
304 end | |
305 | |
306 % <AlgoDescription> | |
307 % | |
308 % </AlgoDescription> | |
309 | |
310 atest = true; | |
311 if stest | |
312 % <AlgoCode> | |
313 % </AlgoCode> | |
314 else | |
315 atest = false; | |
316 end | |
317 | |
318 % Return a result structure | |
319 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
320 end % END UTP_05 | |
321 | |
322 %% UTP_06 | |
323 | |
324 % <TestDescription> | |
325 % | |
326 % Tests that the eq method properly applies history. | |
327 % | |
328 % </TestDescription> | |
329 function result = utp_06 | |
330 | |
331 % <SyntaxDescription> | |
332 % | |
333 % The eq method doesn't change the AO, thus will no history added. | |
334 % Nothing to do | |
335 % | |
336 % </SyntaxDescription> | |
337 | |
338 try | |
339 % <SyntaxCode> | |
340 % </SyntaxCode> | |
341 stest = true; | |
342 catch err | |
343 disp(err.message) | |
344 stest = false; | |
345 end | |
346 | |
347 % <AlgoDescription> | |
348 % | |
349 % </AlgoDescription> | |
350 | |
351 atest = true; | |
352 if stest | |
353 % <AlgoCode> | |
354 % </AlgoCode> | |
355 else | |
356 atest = false; | |
357 end | |
358 | |
359 % Return a result structure | |
360 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
361 end % END UTP_06 | |
362 | |
363 %% UTP_07 | |
364 | |
365 % <TestDescription> | |
366 % | |
367 % Test the eq method with an exception list. | |
368 % With the LTPDA toolbox 2.0 it is only possible to test the exception list | |
369 % with properties where a public set method exist. | |
370 % | |
371 % </TestDescription> | |
372 function result = utp_07 | |
373 | |
374 % <SyntaxDescription> | |
375 % | |
376 % Test the eq method with the exception 'name'. Use the option 'internal' to | |
377 % suppress the history. It is necessary to add 'created' to the exception | |
378 % list because aa is created at an other time. | |
379 % | |
380 % </SyntaxDescription> | |
381 | |
382 try | |
383 % <SyntaxCode> | |
384 aa = testCallerIsMethod(@setName, at1, 'my name'); | |
385 out1 = eq(aa, at1); | |
386 out2 = eqLocal(aa, at1, 'name'); | |
387 out3 = eqLocal(aa, at1, 'ao/name'); | |
388 out4 = eq(aa.hist, at1.hist); | |
389 % </SyntaxCode> | |
390 stest = true; | |
391 catch err | |
392 disp(err.message) | |
393 stest = false; | |
394 end | |
395 | |
396 % <AlgoDescription> | |
397 % | |
398 % 1) Check the output. | |
399 % | |
400 % </AlgoDescription> | |
401 | |
402 atest = true; | |
403 if stest | |
404 % <AlgoCode> | |
405 if out1 ~= 0, atest = false; end | |
406 if out2 ~= 1, atest = false; end | |
407 if out3 ~= 1, atest = false; end | |
408 if out4 ~= 1, atest = false; end | |
409 % </AlgoCode> | |
410 else | |
411 atest = false; | |
412 end | |
413 | |
414 % Return a result structure | |
415 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
416 end % END UTP_07 | |
417 | |
418 %% UTP_08 | |
419 | |
420 % <TestDescription> | |
421 % | |
422 % Test the eq method with an exception list. | |
423 % With the LTPDA toolbox 2.0 it is only possible to test the exception list | |
424 % with properties where a public set method exist. | |
425 % | |
426 % </TestDescription> | |
427 function result = utp_08 | |
428 | |
429 % <SyntaxDescription> | |
430 % | |
431 % Test the eq method with the exception 'plotinfo'. Use the option 'internal' to | |
432 % suppress the history. It is necessary to add 'created' to the exception | |
433 % list because aa is created at an other time. | |
434 % | |
435 % </SyntaxDescription> | |
436 | |
437 try | |
438 % <SyntaxCode> | |
439 aa = testCallerIsMethod(@setPlotinfo, at1, plist('line', 'k')); | |
440 out1 = eq(aa, at1); | |
441 out2 = eqLocal(aa, at1, 'plotinfo'); | |
442 out3 = eqLocal(aa, at1, 'ao/plotinfo'); | |
443 out4 = eq(aa.hist, at1.hist); | |
444 % </SyntaxCode> | |
445 stest = true; | |
446 catch err | |
447 disp(err.message) | |
448 stest = false; | |
449 end | |
450 | |
451 % <AlgoDescription> | |
452 % | |
453 % 1) Check the output. | |
454 % | |
455 % </AlgoDescription> | |
456 | |
457 atest = true; | |
458 if stest | |
459 % <AlgoCode> | |
460 if out1 ~= 0, atest = false; end | |
461 if out2 ~= 1, atest = false; end | |
462 if out3 ~= 1, atest = false; end | |
463 if out4 ~= 1, atest = false; end | |
464 % </AlgoCode> | |
465 else | |
466 atest = false; | |
467 end | |
468 | |
469 % Return a result structure | |
470 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
471 end % END UTP_08 | |
472 | |
473 %% UTP_09 | |
474 | |
475 % <TestDescription> | |
476 % | |
477 % Test the eq method with an exception list. | |
478 % With the LTPDA toolbox 2.0 it is only possible to test the exception list | |
479 % with properties where a public set method exist. | |
480 % | |
481 % </TestDescription> | |
482 function result = utp_09 | |
483 | |
484 % <SyntaxDescription> | |
485 % | |
486 % Test the eq method with the exception 't0'. Use the option 'internal' to | |
487 % suppress the history. It is necessary to add 'created' to the exception | |
488 % list because aa is created at an other time. | |
489 % | |
490 % </SyntaxDescription> | |
491 | |
492 try | |
493 % <SyntaxCode> | |
494 aa = testCallerIsMethod(@setT0, at1, time(123)); | |
495 out1 = eq(aa, at1); | |
496 out2 = eqLocal(aa, at1, 't0'); | |
497 out3 = eqLocal(aa, at1, 'tsdata/t0'); | |
498 out4 = eq(aa.hist, at1.hist); | |
499 % </SyntaxCode> | |
500 stest = true; | |
501 catch err | |
502 disp(err.message) | |
503 stest = false; | |
504 end | |
505 | |
506 % <AlgoDescription> | |
507 % | |
508 % 1) Check the output. | |
509 % | |
510 % </AlgoDescription> | |
511 | |
512 atest = true; | |
513 if stest | |
514 % <AlgoCode> | |
515 if out1 ~= 0, atest = false; end | |
516 if out2 ~= 1, atest = false; end | |
517 if out3 ~= 1, atest = false; end | |
518 if out4 ~= 1, atest = false; end | |
519 % </AlgoCode> | |
520 else | |
521 atest = false; | |
522 end | |
523 | |
524 % Return a result structure | |
525 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
526 end % END UTP_09 | |
527 | |
528 %% UTP_10 | |
529 | |
530 % <TestDescription> | |
531 % | |
532 % Test the eq method with an exception list. | |
533 % With the LTPDA toolbox 2.0 it is only possible to test the exception list | |
534 % with properties where a public set method exist. | |
535 % | |
536 % </TestDescription> | |
537 function result = utp_10 | |
538 | |
539 % <SyntaxDescription> | |
540 % | |
541 % Test the eq method with the exception 'x'. Use the option 'internal' to | |
542 % suppress the history. It is necessary to add 'created' to the exception | |
543 % list because aa is created at an other time. | |
544 % | |
545 % </SyntaxDescription> | |
546 | |
547 try | |
548 % <SyntaxCode> | |
549 aa = testCallerIsMethod(@setX, at1, randn(300,1)); | |
550 out1 = eq(aa, at1); | |
551 out2 = eqLocal(aa, at1, 'x'); | |
552 out3 = eqLocal(aa, at1, 'tsdata/x'); | |
553 out4 = eq(aa.hist, at1.hist); | |
554 % </SyntaxCode> | |
555 stest = true; | |
556 catch err | |
557 disp(err.message) | |
558 stest = false; | |
559 end | |
560 | |
561 % <AlgoDescription> | |
562 % | |
563 % 1) Check the output. | |
564 % | |
565 % </AlgoDescription> | |
566 | |
567 atest = true; | |
568 if stest | |
569 % <AlgoCode> | |
570 if out1 ~= 0, atest = false; end | |
571 if out2 ~= 1, atest = false; end | |
572 if out3 ~= 1, atest = false; end | |
573 if out4 ~= 1, atest = false; end | |
574 % </AlgoCode> | |
575 else | |
576 atest = false; | |
577 end | |
578 | |
579 % Return a result structure | |
580 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
581 end % END UTP_10 | |
582 | |
583 %% UTP_11 | |
584 | |
585 % <TestDescription> | |
586 % | |
587 % Test the eq method with an exception list. | |
588 % With the LTPDA toolbox 2.0 it is only possible to test the exception list | |
589 % with properties where a public set method exist. | |
590 % | |
591 % </TestDescription> | |
592 function result = utp_11 | |
593 | |
594 % <SyntaxDescription> | |
595 % | |
596 % Test the eq method with the exception 'y'. Use the option 'internal' to | |
597 % suppress the history. It is necessary to add 'created' to the exception | |
598 % list because aa is created at an other time. | |
599 % | |
600 % </SyntaxDescription> | |
601 | |
602 try | |
603 % <SyntaxCode> | |
604 aa = testCallerIsMethod(@setY, at1, randn(300,1)); | |
605 out1 = eq(aa, at1); | |
606 out2 = eqLocal(aa, at1, 'y'); | |
607 out3 = eqLocal(aa, at1, 'tsdata/y'); | |
608 out4 = eq(aa.hist, at1.hist); | |
609 % </SyntaxCode> | |
610 stest = true; | |
611 catch err | |
612 disp(err.message) | |
613 stest = false; | |
614 end | |
615 | |
616 % <AlgoDescription> | |
617 % | |
618 % 1) Check the output. | |
619 % | |
620 % </AlgoDescription> | |
621 | |
622 atest = true; | |
623 if stest | |
624 % <AlgoCode> | |
625 if out1 ~= 0, atest = false; end | |
626 if out2 ~= 1, atest = false; end | |
627 if out3 ~= 1, atest = false; end | |
628 if out4 ~= 1, atest = false; end | |
629 % </AlgoCode> | |
630 else | |
631 atest = false; | |
632 end | |
633 | |
634 % Return a result structure | |
635 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
636 end % END UTP_11 | |
637 | |
638 %% UTP_12 | |
639 | |
640 % <TestDescription> | |
641 % | |
642 % Test the eq method with an exception list. | |
643 % With the LTPDA toolbox 2.0 it is only possible to test the exception list | |
644 % with properties where a public set method exist. | |
645 % | |
646 % </TestDescription> | |
647 function result = utp_12 | |
648 | |
649 % <SyntaxDescription> | |
650 % | |
651 % Test the eq method with the exception 'xunits'. Use the option 'internal' to | |
652 % suppress the history. It is necessary to add 'created' to the exception | |
653 % list because aa is created at an other time. | |
654 % | |
655 % </SyntaxDescription> | |
656 | |
657 try | |
658 % <SyntaxCode> | |
659 aa = testCallerIsMethod(@setXunits, at1, 'Hz s^-2/3'); | |
660 out1 = eq(aa, at1); | |
661 out2 = eqLocal(aa, at1, 'xunits'); | |
662 out3 = eqLocal(aa, at1, 'tsdata/xunits'); | |
663 out4 = eq(aa.hist, at1.hist); | |
664 % </SyntaxCode> | |
665 stest = true; | |
666 catch err | |
667 disp(err.message) | |
668 stest = false; | |
669 end | |
670 | |
671 % <AlgoDescription> | |
672 % | |
673 % 1) Check the output. | |
674 % | |
675 % </AlgoDescription> | |
676 | |
677 atest = true; | |
678 if stest | |
679 % <AlgoCode> | |
680 if out1 ~= 0, atest = false; end | |
681 if out2 ~= 1, atest = false; end | |
682 if out3 ~= 1, atest = false; end | |
683 if out4 ~= 1, atest = false; end | |
684 % </AlgoCode> | |
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_12 | |
692 | |
693 %% UTP_13 | |
694 | |
695 % <TestDescription> | |
696 % | |
697 % Test the eq method with an exception list. | |
698 % With the LTPDA toolbox 2.0 it is only possible to test the exception list | |
699 % with properties where a public set method exist. | |
700 % | |
701 % </TestDescription> | |
702 function result = utp_13 | |
703 | |
704 % <SyntaxDescription> | |
705 % | |
706 % Test the eq method with the exception 'yunits'. Use the option 'internal' to | |
707 % suppress the history. It is necessary to add 'created' to the exception | |
708 % list because aa is created at an other time. | |
709 % | |
710 % </SyntaxDescription> | |
711 | |
712 try | |
713 % <SyntaxCode> | |
714 aa = testCallerIsMethod(@setYunits, at1, 'Hz s^-2/3'); | |
715 out1 = eq(aa, at1); | |
716 out2 = eqLocal(aa, at1, {'yunits', 'hist'}); | |
717 out3 = eqLocal(aa, at1, {'tsdata/yunits', 'hist'}); | |
718 out4 = eq(aa.hist, at1.hist); | |
719 % </SyntaxCode> | |
720 stest = true; | |
721 catch err | |
722 disp(err.message) | |
723 stest = false; | |
724 end | |
725 | |
726 % <AlgoDescription> | |
727 % | |
728 % 1) Check the output. | |
729 % | |
730 % </AlgoDescription> | |
731 | |
732 atest = true; | |
733 if stest | |
734 % <AlgoCode> | |
735 if out1 ~= 0, atest = false; end | |
736 if out2 ~= 1, atest = false; end | |
737 if out3 ~= 1, atest = false; end | |
738 if out4 ~= 1, atest = false; end | |
739 % </AlgoCode> | |
740 else | |
741 atest = false; | |
742 end | |
743 | |
744 % Return a result structure | |
745 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
746 end % END UTP_13 | |
747 | |
748 %% UTP_14 | |
749 | |
750 % <TestDescription> | |
751 % | |
752 % Test the eq method with an exception list. | |
753 % With the LTPDA toolbox 2.0 it is only possible to test the exception list | |
754 % with properties where a public set method exist. | |
755 % | |
756 % </TestDescription> | |
757 function result = utp_14 | |
758 | |
759 % <SyntaxDescription> | |
760 % | |
761 % Test the eq method with the exception 'fs'. Use the option 'internal' to | |
762 % suppress the history. It is necessary to add 'created' to the exception | |
763 % list because aa is created at an other time. | |
764 % | |
765 % </SyntaxDescription> | |
766 | |
767 try | |
768 % <SyntaxCode> | |
769 aa = testCallerIsMethod(@setFs, at2, 123.123); | |
770 out1 = eq(aa, at2); | |
771 out2 = eqLocal(aa, at2, 'fs'); | |
772 out3 = eqLocal(aa, at2, 'fsdata/fs'); | |
773 out4 = eq(aa.hist, at2.hist); | |
774 % </SyntaxCode> | |
775 stest = true; | |
776 catch err | |
777 disp(err.message) | |
778 stest = false; | |
779 end | |
780 | |
781 % <AlgoDescription> | |
782 % | |
783 % 1) Check the output. | |
784 % | |
785 % </AlgoDescription> | |
786 | |
787 atest = true; | |
788 if stest | |
789 % <AlgoCode> | |
790 if out1 ~= 0, atest = false; end | |
791 if out2 ~= 1, atest = false; end | |
792 if out3 ~= 1, atest = false; end | |
793 if out4 ~= 1, atest = false; end | |
794 % </AlgoCode> | |
795 else | |
796 atest = false; | |
797 end | |
798 | |
799 % Return a result structure | |
800 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
801 end % END UTP_14 | |
802 | |
803 %% UTP_15 | |
804 | |
805 % <TestDescription> | |
806 % | |
807 % Test the eq method with an exception list. | |
808 % With the LTPDA toolbox 2.0 it is only possible to test the exception list | |
809 % with properties where a public set method exist. | |
810 % | |
811 % </TestDescription> | |
812 function result = utp_15 | |
813 | |
814 % <SyntaxDescription> | |
815 % | |
816 % Test the eq method with the exception 'description'. Use the option 'internal' to | |
817 % suppress the history. It is necessary to add 'created' to the exception | |
818 % list because aa is created at an other time. | |
819 % | |
820 % </SyntaxDescription> | |
821 | |
822 try | |
823 % <SyntaxCode> | |
824 aa = testCallerIsMethod(@setDescription, at1, 'my description'); | |
825 out1 = eq(aa, at1); | |
826 out2 = eqLocal(aa, at1, 'description'); | |
827 out3 = eqLocal(aa, at1, 'ao/description'); | |
828 out4 = eq(aa.hist, at1.hist); | |
829 % </SyntaxCode> | |
830 stest = true; | |
831 catch err | |
832 disp(err.message) | |
833 stest = false; | |
834 end | |
835 | |
836 % <AlgoDescription> | |
837 % | |
838 % 1) Check the output. | |
839 % | |
840 % </AlgoDescription> | |
841 | |
842 atest = true; | |
843 if stest | |
844 % <AlgoCode> | |
845 if out1 ~= 0, atest = false; end | |
846 if out2 ~= 1, atest = false; end | |
847 if out3 ~= 1, atest = false; end | |
848 if out4 ~= 1, atest = false; end | |
849 % </AlgoCode> | |
850 else | |
851 atest = false; | |
852 end | |
853 | |
854 % Return a result structure | |
855 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
856 end % END UTP_15 | |
857 | |
858 %% UTP_16 | |
859 | |
860 % <TestDescription> | |
861 % | |
862 % Test the eq method with an exception list which is in a plist. | |
863 % | |
864 % </TestDescription> | |
865 function result = utp_16 | |
866 | |
867 % <SyntaxDescription> | |
868 % | |
869 % Test that the eq method uses the exception list in a plist. | |
870 % | |
871 % </SyntaxDescription> | |
872 | |
873 try | |
874 % <SyntaxCode> | |
875 aa = testCallerIsMethod(@setName, at1, 'my name'); | |
876 pl = plist('Exceptions', {'name', 'UUID'}); | |
877 out1 = eq(aa, at1); | |
878 out2 = eq(aa, at1, pl); | |
879 out3 = eq(aa, at1, pl); | |
880 out4 = eq(aa.hist, at1.hist); | |
881 % </SyntaxCode> | |
882 stest = true; | |
883 catch err | |
884 disp(err.message) | |
885 stest = false; | |
886 end | |
887 | |
888 % <AlgoDescription> | |
889 % | |
890 % 1) Check the output. | |
891 % | |
892 % </AlgoDescription> | |
893 | |
894 atest = true; | |
895 if stest | |
896 % <AlgoCode> | |
897 % Check the shape of the output data | |
898 if out1 ~= 0, atest = false; end | |
899 if out2 ~= 1, atest = false; end | |
900 if out3 ~= 1, atest = false; end | |
901 if out4 ~= 1, atest = false; end | |
902 % </AlgoCode> | |
903 else | |
904 atest = false; | |
905 end | |
906 | |
907 % Return a result structure | |
908 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
909 end % END UTP_16 | |
910 | |
911 function res = eqLocal(obj1, obj2, ex) | |
912 e = ple1.find('EXCEPTIONS'); | |
913 ple = plist('EXCEPTIONS', [e cellstr(ex)]); | |
914 | |
915 res = eq(obj1, obj2, ple); | |
916 end | |
917 | |
918 end |