Mercurial > hg > ltpda
comparison testing/utp_1.1/generic_utps/utp_12.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 % <TestDescription> | |
2 % | |
3 % Check that the errors are cleared for this method. | |
4 % | |
5 % </TestDescription> | |
6 function result = utp_12(method, obj1, ple1, varargin) | |
7 | |
8 % <SyntaxDescription> | |
9 % | |
10 % Call the method with a list of output variables and with a single output | |
11 % variable. Additionaly check that the rebuild method works on the output. | |
12 % | |
13 % </SyntaxDescription> | |
14 | |
15 if ~isempty(varargin) | |
16 pli = varargin{1}; | |
17 else | |
18 pli = []; | |
19 end | |
20 | |
21 try | |
22 % <SyntaxCode> | |
23 if isa(obj1.data, 'data2D') | |
24 obj1 = obj1.setDx(obj1.x); | |
25 end | |
26 obj1 = obj1.setDy(obj1.y); | |
27 if isempty(pli) | |
28 o1 = feval(method, obj1); | |
29 else | |
30 o1 = feval(method, obj1, pli); | |
31 end | |
32 % </SyntaxCode> | |
33 stest = true; | |
34 catch err | |
35 disp(err.message) | |
36 stest = false; | |
37 end | |
38 | |
39 % <AlgoDescription> | |
40 % | |
41 % 1) Check that the output has no error fields | |
42 % | |
43 % </AlgoDescription> | |
44 | |
45 atest = true; | |
46 if stest | |
47 % check which axis the method was applied to, if any | |
48 ax = o1.hist.plistUsed.find('axis'); | |
49 % <AlgoCode> | |
50 if any('X'==upper(ax)) && ~isempty(o1.dx), atest = false; end | |
51 if any('Y'==upper(ax)) && ~isempty(o1.dy), atest = false; end | |
52 % </AlgoCode> | |
53 else | |
54 atest = false; | |
55 end | |
56 | |
57 % Return a result structure | |
58 dd = dbstack; | |
59 mfilename = dd(2).file(1:end-2); | |
60 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
61 end % END UTP_12 |