from
mlunit_2008a
by Christopher
A MATLAB unit test framework supporting new classdef files (r2008a)
|
| DynamicTestSuite |
classdef DynamicTestSuite < TestSuite
% DYNAMICTESTSUITE A class for dynamically creating temporary test suites.
%
% This class is part of the mlunit_2008a testing framework.
%
% Essentially, this class is a test suite which stores its list of classes
% in a property, rather than hardcoding it in the suite() method. This
% class is used by the test runners to group test cases into a single
% top-level suite.
%
% Public functions:
% DynamicTestSuite() constructs an empty suite.
%
% DynamicTestSuite(tc) constructs a suite containing the tests named in
% tc, which must be a cell array of strings of names of test case or
% test suite classes.
%
% add(obj, c) adds a single test to the suite. The parameter c is the
% name of a test case or test suite class.
%
properties
children
end
methods
% "public" functions
function self = DynamicTestSuite(tc)
if nargin < 1, tc = {}; end
self.children = tc;
end
function self = add(self, c)
last = length(self.children);
self.children{last + 1} = c;
end
% "private" functions
function s = getDescription(self)
s = 'All Tests';
end
function ste = suite(self)
ste = self.children;
end
end
end
|
|
Contact us at files@mathworks.com