Mercurial > hg > ltpda
comparison testing/utp_1.1/utps/ao/utp_ao_rdivide.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_RDIVIDE a set of UTPs for the ao/rdivide method | |
2 % | |
3 % M Hewitson 06-08-08 | |
4 % | |
5 % $Id: utp_ao_rdivide.m,v 1.8 2010/09/21 17:00:41 ingo Exp $ | |
6 % | |
7 | |
8 % <MethodDescription> | |
9 % | |
10 % The rdivide method of the ao class computes the subtraction of the y | |
11 % data of two inputs. | |
12 % | |
13 % </MethodDescription> | |
14 | |
15 function results = utp_ao_rdivide(varargin) | |
16 | |
17 % Check the inputs | |
18 if nargin == 0 | |
19 | |
20 % Some keywords | |
21 class = 'ao'; | |
22 mthd = 'rdivide'; | |
23 | |
24 results = []; | |
25 disp('******************************************************'); | |
26 disp(['**** Running UTPs for ' class '/' mthd]); | |
27 disp('******************************************************'); | |
28 | |
29 % Run the tests | |
30 results = [results utp_01]; % getInfo call | |
31 results = [results utp_generic_aop_rule1(@rdivide)]; % Rule 1 | |
32 results = [results utp_generic_aop_rule2(@rdivide)]; % Rule 2 | |
33 results = [results utp_generic_aop_rule3(@rdivide)]; % Rule 3 | |
34 results = [results utp_generic_aop_rule4(@rdivide)]; % Rule 4 | |
35 results = [results utp_generic_aop_rule5(@rdivide)]; % Rule 5 | |
36 results = [results utp_generic_aop_rule6(@rdivide)]; % Rule 6 | |
37 results = [results utp_generic_aop_rule7(@rdivide)]; % Rule 7 | |
38 results = [results utp_generic_aop_rule8(@rdivide)]; % Rule 8 | |
39 results = [results utp_generic_aop_rule9(@rdivide)]; % Rule 9 | |
40 results = [results utp_generic_aop_rule10(@rdivide)]; % Rule 10 | |
41 results = [results utp_generic_aop_rule11(@rdivide)]; % Rule 11 | |
42 results = [results utp_generic_aop_negative_tests(@rdivide)]; % Negative tests | |
43 | |
44 disp('Done.'); | |
45 disp('******************************************************'); | |
46 | |
47 elseif nargin == 1 % Check for UTP functions | |
48 if strcmp(varargin{1}, 'isutp') | |
49 results = 1; | |
50 else | |
51 results = 0; | |
52 end | |
53 else | |
54 error('### Incorrect inputs') | |
55 end | |
56 | |
57 %% UTP_01 | |
58 | |
59 % <TestDescription> | |
60 % | |
61 % Tests that the getInfo call works for this method. | |
62 % | |
63 % </TestDescription> | |
64 function result = utp_01 | |
65 | |
66 | |
67 % <SyntaxDescription> | |
68 % | |
69 % Test that the getInfo call works for no sets, all sets, and each set | |
70 % individually. | |
71 % | |
72 % </SyntaxDescription> | |
73 | |
74 try | |
75 % <SyntaxCode> | |
76 % Call for no sets | |
77 io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); | |
78 % Call for all sets | |
79 io(2) = eval([class '.getInfo(''' mthd ''')']); | |
80 % Call for each set | |
81 for kk=1:numel(io(2).sets) | |
82 io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); | |
83 end | |
84 % </SyntaxCode> | |
85 stest = true; | |
86 catch err | |
87 disp(err.message) | |
88 stest = false; | |
89 end | |
90 | |
91 % <AlgoDescription> | |
92 % | |
93 % 1) Check that getInfo call returned an minfo object in all cases. | |
94 % 2) Check that all plists have the correct parameters. | |
95 % | |
96 % </AlgoDescription> | |
97 | |
98 atest = true; | |
99 if stest | |
100 % <AlgoCode> | |
101 % check we have minfo objects | |
102 if isa(io, 'minfo') | |
103 % SET 'None' | |
104 if ~isempty(io(1).sets), atest = false; end | |
105 if ~isempty(io(1).plists), atest = false; end | |
106 % Check all Sets | |
107 if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end | |
108 if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end | |
109 % SET 'Default' | |
110 if io(3).plists.nparams ~= 0, atest = false; end | |
111 % Check key | |
112 % Check default value | |
113 % Check options | |
114 end | |
115 % </AlgoCode> | |
116 else | |
117 atest = false; | |
118 end | |
119 | |
120 % Return a result structure | |
121 result = utp_prepare_result(atest, stest, dbstack, mfilename); | |
122 end % END UTP_01 | |
123 | |
124 | |
125 end |