Path: news.mathworks.com!not-for-mail
From: "per isakson" <poi.nospam@bimDOTkthDOT.se>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Call all methods of an object
Date: Mon, 19 May 2008 18:34:01 +0000 (UTC)
Organization: KTH
Lines: 77
Message-ID: <g0sh6p$2pq$1@fred.mathworks.com>
References: <g0pohu$sji$1@fred.mathworks.com> <g0qfcu$tp$1@fred.mathworks.com>
Reply-To: "per isakson" <poi.nospam@bimDOTkthDOT.se>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1211222041 2874 172.30.248.37 (19 May 2008 18:34:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 19 May 2008 18:34:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1670
Xref: news.mathworks.com comp.soft-sys.matlab:469337


"Steven Lord" <slord@mathworks.com> wrote in message 
<g0qfcu$tp$1@fred.mathworks.com>...
> 
> "per isakson" <poi.nospam@bimDOTkthDOT.se> wrote in 
message 
> news:g0pohu$sji$1@fred.mathworks.com...
> > The tool for Unit Testing that I use, MUNIT (xtargets),
> > doesn't work under R2008a. Now I'm looking for a
> > replacement.
> >
> > In such a tool one need to run all tests in a file, 
which
> > might be implemented as invoking "all" methods of an
> > object. What would be the best way to do that? The 
feature
> > demonstrated by this example looks useful. However, is 
it
> > documented?
> 
> I'd do this using the METHODS function to obtain the list 
of methods, then 
> use FEVAL to evaluate the method or use STR2FUNC to 
create a function handle 
> to the method and invoke that using the regular 
functionHandle() syntax.
> 
> 
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/me
thods.html
> 
> -- 
> Steve Lord
> slord@mathworks.com 
> 

I guess I raised three different questions: 
1. How to know for sure that an operational feature in 
Matlab is NOT documented*?
2. Is the calling syntax: object.(&#8216;method1&#8217;) documented?
3. A vague question on a design detail of a unit test 
framework.

*) documented meaning that The Mathworks promises that the 
feature will work in future versions of Matlab.

Background: I have a large number of test and a broken unit 
testing framework. Three(?) years ago I thought that it was 
safe to use &#8220;evalin(&#8216;caller&#8217;,&#8216;@name&#8217;)&#8221; (wishful thinking?). 

I had something like the following in mind:

for ca = list_of_tests
    obj.setup()
    &#8230; obj.(ca{:})
    obj.teardown()
end

Where list_of_tests is a cell array of strings holding 
names of methods, each of which implements a test. 

Doug, I cannot find the text you refer to. The matter ought 
to be treated in &#8220;MATLAB? 7 Classes and Object-Oriented 
Programming&#8221; on page 7-9 or close. 

Steve, you propose two alternatives to &#8220;object.( 
strName )&#8221;, but avoid the question whether it is 
documented. Thus, I should be wise and use one of your 
alternatives. 

Loren and ImageAnalyst, indeed the signatures of the 
methods must be known beforehand. Thus, the methods, which 
implement test, must honor a given signature.

Thank you for your answeres
Per