octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting DejaGNU tests to Paul's test/assert infrastructure


From: David Bateman
Subject: Re: Converting DejaGNU tests to Paul's test/assert infrastructure
Date: Mon, 24 Oct 2005 16:15:08 +0200
User-agent: Mozilla Thunderbird 0.8 (X11/20040923)

Andy Adler wrote:

On Mon, 24 Oct 2005, David Bateman wrote:
You could make the conversion slightly easier to automate like this:
*warning* untested code.

1;
function [varargout] = f (varargin)
 prinf_to_assert ("nargin: %d, nargout: %d\n", nargin, nargout);
endfunction
[s, t, u, v] = f (1, 2, 3);
assert_prog_output( "nargin: 3, nargout: 4" );

with auxilary functions

function printf_to_assert(varargin)
 global _assert_program_output_;
 _assert_program_output_= sprintf( varargin );

and

function assert_prog_output( str )
 global _assert_program_output_;
 assert( strcmp( _assert_program_output_ , str ));

The conversion is not too hard, its the nested functions that cause the problems. I suppose the two new functions you include here might be in a "shared" section of the test script, but they are still nested functions, and cause the error

error: nested functions not implemented in this context

The fact is this seems like a limitation of octave itself in that

function x = f1(...)
 function y = f2 (...)
 ...
 endfunction
endfunction

isn't implemented, and the test script works by creating an enclosing function, and we therefore can't nested a function within a test. I suppose therefore the really solution is to include nested functions in octave, now that matlab has implemented them and we can do it without causing future compatibility issues...

Regards
D.



--
David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary



reply via email to

[Prev in Thread] Current Thread [Next in Thread]