comparison m-toolbox/classes/tests/@TestDescription/TestDescription.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % TESTDESCRIPTION This class collects all information about a test.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: TESTDESCRIPTION This class collects all information about
5 % a test.
6 %
7 % SUPER CLASSES: handle
8 %
9 % VERSION: $Id: TestDescription.m,v 1.1 2011/06/20 16:38:35 ingo Exp $
10 %
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 classdef TestDescription < handle
15
16
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 % Property definition %
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20
21 %---------- Public (read/write) Properties ----------
22 properties
23 testName = '';
24 testLocation = '';
25 testDescription = 'Unknown test description';
26 checkResults = {};
27 result = TestDescription.FAILED;
28 end
29
30 properties (Dependent = true)
31 testClass
32 testMethod
33 nchecks
34 end
35
36 properties (Constant=true, Hidden=true)
37 PASSED = 'passed';
38 SKIPPED = 'skipped';
39 FAILED = 'failed';
40 end
41
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 % Setter %
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45
46 methods
47 end
48
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 % Getter %
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52
53 methods
54 function value = get.nchecks(self)
55 value = numel(self.checkResults);
56 end
57 function value = get.testClass(self)
58 value = regexp(self.testLocation, '@\w+', 'match');
59 if isempty(value)
60 value = '';
61 else
62 value = value{1};
63 end
64 end
65 function value = get.testMethod(self)
66 value = regexp(self.testLocation, '\w+.?m?$', 'match');
67 if isempty(value)
68 value = '';
69 else
70 value = value{1};
71 end
72 end
73 end
74
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 % Constructor %
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78
79 methods
80 function self = TestDescription(varargin)
81
82 switch nargin
83 case 1
84 self.description = varargin{1};
85 end
86
87 end
88 end
89
90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91 % Methods (public) %
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93
94 methods
95 function txt = char(obj)
96 txt = sprintf('[%dx%d %s]', size(obj), class(obj));
97 end
98 function addCheckResult(self, val)
99 if any(strcmp(self.checkResults, val))
100 % Don't add the result because we have alreayd added this result
101 % This can happen if the user calls the same check function with
102 % different test data. For example inside a loop.
103 else
104 self.checkResults = [self.checkResults val];
105 end
106 end
107 end
108
109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
110 % Methods (static) %
111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
112
113 methods (Static)
114 end
115
116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117 % Methods (hidden) %
118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119
120 methods (Hidden = true)
121 varargout = addlistener(varargin);
122 varargout = copy(varargin);
123 varargout = delete(varargin);
124 varargout = findobj(varargin);
125 varargout = findprop(varargin);
126 varargout = ne(varargin);
127 varargout = eq(varargin);
128 varargout = ge(varargin);
129 varargout = gt(varargin);
130 varargout = le(varargin);
131 varargout = lt(varargin);
132 varargout = notify(varargin);
133 end
134
135 end
136